Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8954a83c authored by Henri Chataing's avatar Henri Chataing Committed by Gerrit Code Review
Browse files

Merge changes I422445af,I9c995127 into main

* changes:
  uwb/aidl/default: Use write_all instead of write in sendUciMessage
  uwb/aidl/default: Log incoming and outgoing packet bytes
parents 49800ab8 cd3a3402
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ impl IUwbChipAsyncServer for UwbChip {
                // Read the payload bytes.
                read_exact(reader.get_mut(), &mut buffer[UWB_HEADER_SIZE..]).unwrap();

                log::debug!(" <-- {:?}", buffer);
                client_callbacks.onUciMessage(&buffer).unwrap();
            }
        });
@@ -295,10 +296,13 @@ impl IUwbChipAsyncServer for UwbChip {
        log::debug!("sendUciMessage");

        if let State::Opened { ref mut serial, .. } = &mut *self.state.lock().await {
            serial
                .write(data)
                .map(|written| written as i32)
                .map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into())
            log::debug!(" --> {:?}", data);
            let result = serial
                .write_all(data)
                .map(|_| data.len() as i32)
                .map_err(|_| binder::StatusCode::UNKNOWN_ERROR.into());
            log::debug!(" status: {:?}", result);
            result
        } else {
            Err(binder::ExceptionCode::ILLEGAL_STATE.into())
        }