monitor: Add support for decoding EATT

This decodes packets received over EATT PSM.
This commit is contained in:
Luiz Augusto von Dentz 2019-05-17 14:13:23 +03:00
parent cc441474e7
commit 209e2568c6

View File

@ -2573,6 +2573,36 @@ static void att_handle_value_conf(const struct l2cap_frame *frame)
{
}
static void att_multiple_vl_rsp(const struct l2cap_frame *frame)
{
struct l2cap_frame *f = (void *) frame;
while (frame->size) {
uint16_t handle;
uint16_t len;
if (!l2cap_frame_get_le16(f, &handle))
return;
print_field("Handle: 0x%4.4x", handle);
if (!l2cap_frame_get_le16(f, &len))
return;
print_field("Length: 0x%4.4x", len);
print_hex_field(" Data", f->data,
len < f->size ? len : f->size);
if (len > f->size) {
print_text(COLOR_ERROR, "invalid size");
return;
}
l2cap_frame_pull(f, f, len);
}
}
static void att_write_command(const struct l2cap_frame *frame)
{
print_field("Handle: 0x%4.4x", get_le16(frame->data));
@ -2645,6 +2675,12 @@ static const struct att_opcode_data att_opcode_table[] = {
att_handle_value_ind, 2, false },
{ 0x1e, "Handle Value Confirmation",
att_handle_value_conf, 0, true },
{ 0x20, "Read Multiple Request Variable Length",
att_read_multiple_req, 4, false },
{ 0x21, "Read Multiple Response Variable Length",
att_multiple_vl_rsp, 4, false },
{ 0x23, "Handle Multiple Value Notification",
att_multiple_vl_rsp, 4, false },
{ 0x52, "Write Command",
att_write_command, 2, false },
{ 0xd2, "Signed Write Command", att_signed_write_command, 14, false },
@ -3287,6 +3323,9 @@ void l2cap_frame(uint16_t index, bool in, uint16_t handle, uint16_t cid,
case 0x001f:
att_packet(index, in, handle, cid, data, size);
break;
case 0x0027:
att_packet(index, in, handle, cid, data + 2, size - 2);
break;
case 0x0017:
case 0x001B:
avctp_packet(&frame);