diff options
author | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-05-23 15:53:23 -0700 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2022-05-26 13:57:50 -0700 |
commit | ba32b25a61eb75277cedc1fea7ed5d35fd1e726e (patch) | |
tree | 35eb6802bc79b0da8830571effa10122e6117c69 /monitor/l2cap.h | |
parent | 13bdb9f3bee1763143ec5af4db3bb4e213261fe7 (diff) | |
download | bluez-ba32b25a61eb75277cedc1fea7ed5d35fd1e726e.tar.gz |
monitor/att: Add decoding support for ASE Sink/Source
This adds decoding support for ASE Sink/Source attributes:
> ACL Data RX: Handle 42 flags 0x02 dlen 9
Channel: 65 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Read Request (0x0a) len 2
Handle: 0x002a Type: Sink ASE (0x2bc4)
< ACL Data TX: Handle 42 flags 0x00 dlen 9
Channel: 64 len 5 sdu 3 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Read Response (0x0b) len 2
Value: 0300
ASE ID: 1
State: Idle (0x00)
< ACL Data TX: Handle 42 flags 0x00 dlen 55
Channel: 64 len 51 sdu 49 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 48
Length: 0x0023
Handle: 0x0024 Type: Sink ASE (0x2bc4)
Data: 01010000000a00204e00409c00204e00409c0006000000000a02010302020103042800
ASE ID: 1
State: Codec Configured (0x01)
Framing: Unframed PDUs supported (0x00)
PHY: 0x00
RTN: 0
Max Transport Latency: 10
Presentation Delay Min: 20000 us
Presentation Delay Max: 40000 us
Preferred Presentation Delay Min: 20000 us
Preferred Presentation Delay Max: 40000 us
Codec: LC3 (0x06)
Codec Specific Configuration #0: len 0x02 type 0x01
Codec Specific Configuration: 03
Codec Specific Configuration #1: len 0x02 type 0x02
Codec Specific Configuration: 01
Codec Specific Configuration #2: len 0x03 type 0x04
Codec Specific Configuration: 2800
< ACL Data TX: Handle 42 flags 0x00 dlen 37
Channel: 64 len 33 sdu 31 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 30
Length: 0x0011
Handle: 0x0024 Type: Sink ASE (0x2bc4)
Data: 0102000010270000022800020a00409c00
ASE ID: 1
State: QoS Configured (0x02)
CIG ID: 0x00
CIS ID: 0x00
SDU Interval: 10000 usec
Framing: Unframed (0x00)
PHY: 0x02
LE 2M PHY (0x02)
Max SDU: 40
RTN: 2
Max Transport Latency: 10
Presentation Delay: 40000 us
< ACL Data TX: Handle 42 flags 0x00 dlen 33
Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 26
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data: 03030000060304030202000000
ASE ID: 3
State: Enabling (0x03)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 39
Channel: 64 len 35 sdu 33 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 32
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data: 03040000060304030202000000
ASE ID: 3
State: Streaming (0x04)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
< ACL Data TX: Handle 42 flags 0x00 dlen 33
Channel: 64 len 29 sdu 27 [PSM 39 mode Enhanced Credit (0x81)] {chan 0}
ATT: Handle Multiple Value Notification (0x23) len 26
Length: 0x000d
Handle: 0x002a Type: Source ASE (0x2bc5)
Data: 03050000060304030202000000
ASE ID: 3
State: Disabling (0x05)
CIG ID: 0x00
CIS ID: 0x00
Metadata #0: len 0x03 type 0x04
Metadata: 0302
Metadata #1: len 0x02 type 0x00
Diffstat (limited to 'monitor/l2cap.h')
-rw-r--r-- | monitor/l2cap.h | 163 |
1 files changed, 163 insertions, 0 deletions
diff --git a/monitor/l2cap.h b/monitor/l2cap.h index c33d4c57f..00a8ffbbd 100644 --- a/monitor/l2cap.h +++ b/monitor/l2cap.h @@ -78,6 +78,21 @@ static inline bool l2cap_frame_get_u8(struct l2cap_frame *frame, uint8_t *value) return true; } +static inline bool l2cap_frame_print_u8(struct l2cap_frame *frame, + const char *label) +{ + uint8_t u8; + + if (!l2cap_frame_get_u8(frame, &u8)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%2.2x", label, u8); + + return true; +} + static inline bool l2cap_frame_get_be16(struct l2cap_frame *frame, uint16_t *value) { @@ -92,6 +107,21 @@ static inline bool l2cap_frame_get_be16(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_be16(struct l2cap_frame *frame, + const char *label) +{ + uint16_t u16; + + if (!l2cap_frame_get_be16(frame, &u16)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%4.4x", label, u16); + + return true; +} + static inline bool l2cap_frame_get_le16(struct l2cap_frame *frame, uint16_t *value) { @@ -106,6 +136,79 @@ static inline bool l2cap_frame_get_le16(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_le16(struct l2cap_frame *frame, + const char *label) +{ + uint16_t u16; + + if (!l2cap_frame_get_le16(frame, &u16)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%4.4x", label, u16); + + return true; +} + +static inline bool l2cap_frame_get_be24(struct l2cap_frame *frame, + uint32_t *value) +{ + if (frame->size < sizeof(uint24_t)) + return false; + + if (value) + *value = get_be24(frame->data); + + l2cap_frame_pull(frame, frame, sizeof(uint24_t)); + + return true; +} + +static inline bool l2cap_frame_print_be24(struct l2cap_frame *frame, + const char *label) +{ + uint32_t u24; + + if (!l2cap_frame_get_be24(frame, &u24)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%6.6x", label, u24); + + return true; +} + +static inline bool l2cap_frame_get_le24(struct l2cap_frame *frame, + uint32_t *value) +{ + if (frame->size < sizeof(uint24_t)) + return false; + + if (value) + *value = get_le24(frame->data); + + l2cap_frame_pull(frame, frame, sizeof(uint24_t)); + + return true; +} + +static inline bool l2cap_frame_print_le24(struct l2cap_frame *frame, + const char *label) +{ + uint32_t u24; + + if (!l2cap_frame_get_le24(frame, &u24)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%6.6x", label, u24); + + return true; +} + static inline bool l2cap_frame_get_be32(struct l2cap_frame *frame, uint32_t *value) { @@ -120,6 +223,21 @@ static inline bool l2cap_frame_get_be32(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_be32(struct l2cap_frame *frame, + const char *label) +{ + uint32_t u32; + + if (!l2cap_frame_get_be32(frame, &u32)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%8.8x", label, u32); + + return true; +} + static inline bool l2cap_frame_get_le32(struct l2cap_frame *frame, uint32_t *value) { @@ -134,6 +252,21 @@ static inline bool l2cap_frame_get_le32(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_le32(struct l2cap_frame *frame, + const char *label) +{ + uint32_t u32; + + if (!l2cap_frame_get_le32(frame, &u32)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%8.8x", label, u32); + + return true; +} + static inline bool l2cap_frame_get_be64(struct l2cap_frame *frame, uint64_t *value) { @@ -148,6 +281,21 @@ static inline bool l2cap_frame_get_be64(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_be64(struct l2cap_frame *frame, + const char *label) +{ + uint64_t u64; + + if (!l2cap_frame_get_be64(frame, &u64)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%zx", label, u64); + + return true; +} + static inline bool l2cap_frame_get_le64(struct l2cap_frame *frame, uint64_t *value) { @@ -162,6 +310,21 @@ static inline bool l2cap_frame_get_le64(struct l2cap_frame *frame, return true; } +static inline bool l2cap_frame_print_le64(struct l2cap_frame *frame, + const char *label) +{ + uint64_t u64; + + if (!l2cap_frame_get_le64(frame, &u64)) { + print_text(COLOR_ERROR, "%s: invalid size", label); + return false; + } + + print_field("%s: 0x%zx", label, u64); + + return true; +} + static inline bool l2cap_frame_get_be128(struct l2cap_frame *frame, uint64_t *lvalue, uint64_t *rvalue) { |