Skip to content

Commit

Permalink
fix debug print in log
Browse files Browse the repository at this point in the history
  • Loading branch information
lulf committed May 9, 2024
1 parent aee57bf commit f502f64
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions host/src/adapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -562,7 +562,7 @@ where
pub fn gatt_server<'reference, 'values, const MAX: usize>(
&'reference self,
table: &'reference AttributeTable<'values, M, MAX>,
) -> GattServer<'reference, 'values, 'd, M, T, MAX> {
) -> GattServer<'reference, 'values, 'd, M, T, CONNS, MAX> {
use crate::attribute_server::AttributeServer;
GattServer {
server: AttributeServer::new(table),
Expand Down Expand Up @@ -864,7 +864,7 @@ impl<'d, M: RawMutex, T: Controller, const CONNS: usize> HciController<'d, M, T,
let mut grant = match self.connections.poll_request_to_send(handle, 1, None) {
Poll::Ready(res) => res?,
Poll::Pending => {
warn!("[link][handle = {}]: not enough credits", handle);
warn!("[link][handle = {:?}]: not enough credits", handle);
return Err(Error::Busy.into());
}
};
Expand Down Expand Up @@ -913,7 +913,7 @@ impl<'d, M: RawMutex, T: Controller, const CONNS: usize> HciController<'d, M, T,
p_buf: &mut [u8],
) -> Result<(), AdapterError<T::Error>> {
trace!(
"[l2cap][conn = {}] sending control signal (req = {}) signal: {:?}",
"[l2cap][conn = {:?}] sending control signal (req = {}) signal: {:?}",
handle,
identifier,
signal
Expand Down
6 changes: 3 additions & 3 deletions host/src/channel_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ impl<
pub(crate) async fn signal(&self, conn: ConnHandle, data: &[u8]) -> Result<(), Error> {
let (header, data) = L2capSignalHeader::from_hci_bytes(data)?;
trace!(
"[l2cap][conn = {}] received signal (req {}) code {:?}",
"[l2cap][conn = {:?}] received signal (req {}) code {:?}",
conn,
header.identifier,
header.code
Expand Down Expand Up @@ -361,13 +361,13 @@ impl<
}
L2capSignalCode::DisconnectionReq => {
let req = DisconnectionReq::from_hci_bytes_complete(data)?;
trace!("[l2cap][conn = {}, cid = {}] disconnect request", conn, req.dcid);
trace!("[l2cap][conn = {:?}, cid = {}] disconnect request", conn, req.dcid);
self.disconnect(req.dcid)?;
Ok(())
}
L2capSignalCode::DisconnectionRes => {
let res = DisconnectionRes::from_hci_bytes_complete(data)?;
trace!("[l2cap][conn = {}, cid = {}] disconnect response", conn, res.scid);
trace!("[l2cap][conn = {:?}, cid = {}] disconnect response", conn, res.scid);
self.handle_disconnect_response(&res)
}
_ => Err(Error::NotSupported),
Expand Down
6 changes: 3 additions & 3 deletions host/src/connection_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<M: RawMutex, const CONNS: usize> ConnectionManager<M, CONNS> {
_ => {}
}
}
trace!("[link][confirm_sent] connection {} not found", handle);
trace!("[link][confirm_sent] connection {:?} not found", handle);
Err(Error::NotFound)
})
}
Expand Down Expand Up @@ -230,7 +230,7 @@ impl<M: RawMutex, const CONNS: usize> ConnectionManager<M, CONNS> {
_ => {}
}
}
trace!("[link][pool_request_to_send] connection {} not found", handle);
trace!("[link][pool_request_to_send] connection {:?} not found", handle);
Poll::Ready(Err(Error::NotFound))
})
}
Expand Down Expand Up @@ -349,7 +349,7 @@ impl<'d, M: RawMutex, const CHANNELS: usize> Drop for PacketGrant<'d, M, CHANNEL
}
}
// make it an assert?
trace!("[link] connection {} not found", self.handle);
trace!("[link] connection {:?} not found", self.handle);
})
}
}
Expand Down
9 changes: 5 additions & 4 deletions host/src/gatt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,18 @@ use crate::packet_pool::{AllocId, DynamicPacketPool};
use crate::pdu::Pdu;
use crate::{AdapterError, Error};

pub struct GattServer<'reference, 'values, 'resources, M: RawMutex, T: Controller, const MAX: usize> {
pub struct GattServer<'reference, 'values, 'resources, M: RawMutex, T: Controller, const CONNS: usize, const MAX: usize>
{
pub(crate) server: AttributeServer<'reference, 'values, M, MAX>,
pub(crate) rx: DynamicReceiver<'reference, (ConnHandle, Pdu<'resources>)>,
pub(crate) tx: HciController<'reference, T>,
pub(crate) tx: HciController<'reference, M, T, CONNS>,
pub(crate) pool_id: AllocId,
pub(crate) pool: &'resources dyn DynamicPacketPool<'resources>,
pub(crate) connections: &'reference dyn DynamicConnectionManager,
}

impl<'reference, 'values, 'resources, M: RawMutex, T: Controller, const MAX: usize>
GattServer<'reference, 'values, 'resources, M, T, MAX>
impl<'reference, 'values, 'resources, M: RawMutex, T: Controller, const CONNS: usize, const MAX: usize>
GattServer<'reference, 'values, 'resources, M, T, CONNS, MAX>
{
pub async fn next(&self) -> Result<GattEvent<'reference, 'values>, AdapterError<T::Error>> {
loop {
Expand Down
2 changes: 1 addition & 1 deletion host/src/types/l2cap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ unsafe impl FixedSizeValue for L2capSignalHeader {
}

#[cfg(not(feature = "defmt"))]
pub trait L2capSignal: WriteHci + FixedSizeValue {
pub trait L2capSignal: WriteHci + FixedSizeValue + core::fmt::Debug {
fn channel() -> u16 {
L2CAP_CID_LE_U_SIGNAL
}
Expand Down

0 comments on commit f502f64

Please sign in to comment.