mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Log if h4 type is unknown
This commit is contained in:
@@ -5,7 +5,7 @@
|
|||||||
use std::pin::Pin;
|
use std::pin::Pin;
|
||||||
|
|
||||||
use futures::Stream;
|
use futures::Stream;
|
||||||
use log::{debug, warn};
|
use log::warn;
|
||||||
|
|
||||||
use crate::{Idevice, IdeviceError, IdeviceService, obf};
|
use crate::{Idevice, IdeviceError, IdeviceService, obf};
|
||||||
|
|
||||||
@@ -148,13 +148,6 @@ impl BtPacketLoggerClient {
|
|||||||
let kind = BtPacketKind::from_byte(frame[off]);
|
let kind = BtPacketKind::from_byte(frame[off]);
|
||||||
let payload = &frame[off + 1..];
|
let payload = &frame[off + 1..];
|
||||||
|
|
||||||
// soft advisory check
|
|
||||||
let advisory = hdr.length as usize;
|
|
||||||
let actual = 1 + payload.len();
|
|
||||||
if advisory != actual {
|
|
||||||
debug!("BTPacketLogger advisory length {} != actual {}", advisory, actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
// make H4 buffer
|
// make H4 buffer
|
||||||
let mut h4 = Vec::with_capacity(1 + payload.len());
|
let mut h4 = Vec::with_capacity(1 + payload.len());
|
||||||
if let Some(t) = kind.h4_type() {
|
if let Some(t) = kind.h4_type() {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
use idevice::bt_packet_logger::BtPacketKind;
|
use idevice::bt_packet_logger::BtPacketKind;
|
||||||
|
use log::warn;
|
||||||
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
use tokio::io::{AsyncWrite, AsyncWriteExt};
|
||||||
|
|
||||||
// Classic PCAP (big-endian) global header for DLT_BLUETOOTH_HCI_H4_WITH_PHDR (201)
|
// Classic PCAP (big-endian) global header for DLT_BLUETOOTH_HCI_H4_WITH_PHDR (201)
|
||||||
@@ -40,6 +41,7 @@ pub async fn write_pcap_record<W: AsyncWrite + Unpin>(
|
|||||||
) -> std::io::Result<()> {
|
) -> std::io::Result<()> {
|
||||||
// Prepend 4-byte direction flag to the packet body
|
// Prepend 4-byte direction flag to the packet body
|
||||||
let Some(dir) = dir_flag(kind) else {
|
let Some(dir) = dir_flag(kind) else {
|
||||||
|
warn!("Unknown H4 packet type: {kind:?}");
|
||||||
return Ok(());
|
return Ok(());
|
||||||
};
|
};
|
||||||
let cap_len = 4u32 + h4_payload.len() as u32;
|
let cap_len = 4u32 + h4_payload.len() as u32;
|
||||||
|
|||||||
Reference in New Issue
Block a user