All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH ] monitor: Add AVCTP support to btmon
@ 2014-07-28 14:24 Vikrampal Yadav
  2014-07-31 13:07 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: Vikrampal Yadav @ 2014-07-28 14:24 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: luiz.dentz, vikram.pal, vikrampal

Support for decoding AVCTP packets added in Bluetooth monitor.
---
 Makefile.tools  |  1 +
 monitor/avctp.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor/avctp.h | 25 +++++++++++++++++++
 monitor/l2cap.c |  6 +++++
 monitor/l2cap.h |  1 +
 5 files changed, 108 insertions(+)
 create mode 100644 monitor/avctp.c
 create mode 100644 monitor/avctp.h

diff --git a/Makefile.tools b/Makefile.tools
index dc9dde9..9226386 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/ll.h monitor/ll.c \
 				monitor/l2cap.h monitor/l2cap.c \
 				monitor/sdp.h monitor/sdp.c \
+				monitor/avctp.h monitor/avctp.c \
 				monitor/uuid.h monitor/uuid.c \
 				monitor/hwdb.h monitor/hwdb.c \
 				monitor/keys.h monitor/keys.c \
diff --git a/monitor/avctp.c b/monitor/avctp.c
new file mode 100644
index 0000000..37084c2
--- /dev/null
+++ b/monitor/avctp.c
@@ -0,0 +1,75 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011-2014  Intel Corporation
+ *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include <bluetooth/bluetooth.h>
+
+#include "src/shared/util.h"
+#include "bt.h"
+#include "packet.h"
+#include "display.h"
+#include "l2cap.h"
+#include "uuid.h"
+#include "keys.h"
+#include "sdp.h"
+#include "avctp.h"
+
+void avctp_packet(const struct l2cap_frame *frame)
+{
+        uint8_t hdr;
+        uint16_t pid;
+        const char *pdu_color;
+
+        if (frame->size < 3) {
+                print_text(COLOR_ERROR, "frame too short");
+                packet_hexdump(frame->data, frame->size);
+                return;
+        }
+
+        hdr = *((uint8_t *) frame->data);
+
+        pid = get_be16(frame->data + 1);
+
+        if (frame->in)
+                pdu_color = COLOR_MAGENTA;
+        else
+                pdu_color = COLOR_BLUE;
+
+        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
+                        " %s: %s: Packet_type 0x%02x Transaction label %d "
+                        "PID 0x%04x",
+                        frame->psm == 23 ? "Control" : "Browsing",
+                        hdr & 0x02 ? "Response" : "Command",
+                        hdr & 0x0c, hdr >> 4, pid);
+
+	packet_hexdump(frame->data + 3, frame->size - 3);
+}
diff --git a/monitor/avctp.h b/monitor/avctp.h
new file mode 100644
index 0000000..2613f14
--- /dev/null
+++ b/monitor/avctp.h
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011-2014  Intel Corporation
+ *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+void avctp_packet(const struct l2cap_frame *frame);
diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index 993aa8b..b286787 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -41,6 +41,7 @@
 #include "uuid.h"
 #include "keys.h"
 #include "sdp.h"
+#include "avctp.h"
 
 #define MAX_CHAN 64
 
@@ -2620,6 +2621,7 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 	default:
 		l2cap_frame_init(&frame, index, in, handle, cid, data, size);
 		psm = get_psm(&frame);
+		frame.psm = psm;
 		mode = get_mode(&frame);
 		chan = get_chan(&frame);
 
@@ -2634,6 +2636,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 		case 0x001f:
 			att_packet(index, in, handle, cid, data, size);
 			break;
+		case 0x0017:
+		case 0x001B:
+			avctp_packet(&frame);
+			break;
 		default:
 			packet_hexdump(data, size);
 			break;
diff --git a/monitor/l2cap.h b/monitor/l2cap.h
index 0d18478..851b5c4 100644
--- a/monitor/l2cap.h
+++ b/monitor/l2cap.h
@@ -32,6 +32,7 @@ struct l2cap_frame {
 	uint16_t cid;
 	const void *data;
 	uint16_t size;
+	uint16_t psm;
 };
 
 static inline void l2cap_frame_init(struct l2cap_frame *frame,
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH ] monitor: Add AVCTP support to btmon
  2014-07-28 14:24 [PATCH ] monitor: Add AVCTP support to btmon Vikrampal Yadav
@ 2014-07-31 13:07 ` Luiz Augusto von Dentz
  0 siblings, 0 replies; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2014-07-31 13:07 UTC (permalink / raw)
  To: Vikrampal Yadav; +Cc: linux-bluetooth, Vikram

Hi Vikram,

On Mon, Jul 28, 2014 at 5:24 PM, Vikrampal Yadav <vikram.pal@samsung.com> wrote:
> Support for decoding AVCTP packets added in Bluetooth monitor.
> ---
>  Makefile.tools  |  1 +
>  monitor/avctp.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor/avctp.h | 25 +++++++++++++++++++
>  monitor/l2cap.c |  6 +++++
>  monitor/l2cap.h |  1 +
>  5 files changed, 108 insertions(+)
>  create mode 100644 monitor/avctp.c
>  create mode 100644 monitor/avctp.h
>
> diff --git a/Makefile.tools b/Makefile.tools
> index dc9dde9..9226386 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
>                                 monitor/ll.h monitor/ll.c \
>                                 monitor/l2cap.h monitor/l2cap.c \
>                                 monitor/sdp.h monitor/sdp.c \
> +                               monitor/avctp.h monitor/avctp.c \
>                                 monitor/uuid.h monitor/uuid.c \
>                                 monitor/hwdb.h monitor/hwdb.c \
>                                 monitor/keys.h monitor/keys.c \
> diff --git a/monitor/avctp.c b/monitor/avctp.c
> new file mode 100644
> index 0000000..37084c2
> --- /dev/null
> +++ b/monitor/avctp.c
> @@ -0,0 +1,75 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2011-2014  Intel Corporation
> + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <inttypes.h>
> +
> +#include <bluetooth/bluetooth.h>
> +
> +#include "src/shared/util.h"
> +#include "bt.h"
> +#include "packet.h"
> +#include "display.h"
> +#include "l2cap.h"
> +#include "uuid.h"
> +#include "keys.h"
> +#include "sdp.h"
> +#include "avctp.h"
> +
> +void avctp_packet(const struct l2cap_frame *frame)
> +{
> +        uint8_t hdr;
> +        uint16_t pid;
> +        const char *pdu_color;
> +
> +        if (frame->size < 3) {
> +                print_text(COLOR_ERROR, "frame too short");
> +                packet_hexdump(frame->data, frame->size);
> +                return;
> +        }
> +
> +        hdr = *((uint8_t *) frame->data);
> +
> +        pid = get_be16(frame->data + 1);
> +
> +        if (frame->in)
> +                pdu_color = COLOR_MAGENTA;
> +        else
> +                pdu_color = COLOR_BLUE;
> +
> +        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
> +                        " %s: %s: Packet_type 0x%02x Transaction label %d "
> +                        "PID 0x%04x",
> +                        frame->psm == 23 ? "Control" : "Browsing",
> +                        hdr & 0x02 ? "Response" : "Command",
> +                        hdr & 0x0c, hdr >> 4, pid);
> +
> +       packet_hexdump(frame->data + 3, frame->size - 3);
> +}
> diff --git a/monitor/avctp.h b/monitor/avctp.h
> new file mode 100644
> index 0000000..2613f14
> --- /dev/null
> +++ b/monitor/avctp.h
> @@ -0,0 +1,25 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2011-2014  Intel Corporation
> + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +void avctp_packet(const struct l2cap_frame *frame);
> diff --git a/monitor/l2cap.c b/monitor/l2cap.c
> index 993aa8b..b286787 100644
> --- a/monitor/l2cap.c
> +++ b/monitor/l2cap.c
> @@ -41,6 +41,7 @@
>  #include "uuid.h"
>  #include "keys.h"
>  #include "sdp.h"
> +#include "avctp.h"
>
>  #define MAX_CHAN 64
>
> @@ -2620,6 +2621,7 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
>         default:
>                 l2cap_frame_init(&frame, index, in, handle, cid, data, size);
>                 psm = get_psm(&frame);
> +               frame.psm = psm;
>                 mode = get_mode(&frame);
>                 chan = get_chan(&frame);
>
> @@ -2634,6 +2636,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
>                 case 0x001f:
>                         att_packet(index, in, handle, cid, data, size);
>                         break;
> +               case 0x0017:
> +               case 0x001B:
> +                       avctp_packet(&frame);
> +                       break;
>                 default:
>                         packet_hexdump(data, size);
>                         break;
> diff --git a/monitor/l2cap.h b/monitor/l2cap.h
> index 0d18478..851b5c4 100644
> --- a/monitor/l2cap.h
> +++ b/monitor/l2cap.h
> @@ -32,6 +32,7 @@ struct l2cap_frame {
>         uint16_t cid;
>         const void *data;
>         uint16_t size;
> +       uint16_t psm;
>  };
>
>  static inline void l2cap_frame_init(struct l2cap_frame *frame,
> --
> 1.9.1

Applied, thanks.


-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* RE: [PATCH] monitor: Add AVCTP support to btmon
  2014-07-28 12:35 ` Luiz Augusto von Dentz
@ 2014-07-28 13:33   ` Vikrampal
  0 siblings, 0 replies; 8+ messages in thread
From: Vikrampal @ 2014-07-28 13:33 UTC (permalink / raw)
  To: 'Luiz Augusto von Dentz'
  Cc: linux-bluetooth, 'Dmitry Kasatkin',
	p.sinha, sanjay.nm, 'Bharat Panda',
	cpgs, vikrampal

Hi Luiz,

> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Monday, July 28, 2014 6:05 PM
> To: Vikrampal Yadav
> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin;
> p.sinha@samsung.com; sanjay.nm@samsung.com; Bharat Panda;
> cpgs@samsung.com
> Subject: Re: [PATCH] monitor: Add AVCTP support to btmon
> 
> Hi,
> 
> On Thu, Jul 24, 2014 at 2:36 PM, Vikrampal Yadav
> <vikram.pal@samsung.com> wrote:
> > Support for decoding AVCTP packets added in Bluetooth monitor.
> > ---
> >  Makefile.tools  |  1 +
> >  monitor/avctp.c | 75
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  monitor/avctp.h | 25 +++++++++++++++++++  monitor/l2cap.c |  5 ++++
> >  4 files changed, 106 insertions(+)
> >  create mode 100644 monitor/avctp.c
> >  create mode 100644 monitor/avctp.h
> >
> > diff --git a/Makefile.tools b/Makefile.tools index dc9dde9..9226386
> > 100644
> > --- a/Makefile.tools
> > +++ b/Makefile.tools
> > @@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c
> monitor/bt.h \
> >                                 monitor/ll.h monitor/ll.c \
> >                                 monitor/l2cap.h monitor/l2cap.c \
> >                                 monitor/sdp.h monitor/sdp.c \
> > +                               monitor/avctp.h monitor/avctp.c \
> >                                 monitor/uuid.h monitor/uuid.c \
> >                                 monitor/hwdb.h monitor/hwdb.c \
> >                                 monitor/keys.h monitor/keys.c \ diff
> > --git a/monitor/avctp.c b/monitor/avctp.c new file mode 100644 index
> > 0000000..68a5a56
> > --- /dev/null
> > +++ b/monitor/avctp.c
> > @@ -0,0 +1,75 @@
> > +/*
> > + *
> > + *  BlueZ - Bluetooth protocol stack for Linux
> > + *
> > + *  Copyright (C) 2011-2014  Intel Corporation
> > + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> > + *
> > + *
> > + *  This library is free software; you can redistribute it and/or
> > + *  modify it under the terms of the GNU Lesser General Public
> > + *  License as published by the Free Software Foundation; either
> > + *  version 2.1 of the License, or (at your option) any later version.
> > + *
> > + *  This library is distributed in the hope that it will be useful,
> > + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> GNU
> > + *  Lesser General Public License for more details.
> > + *
> > + *  You should have received a copy of the GNU Lesser General Public
> > + *  License along with this library; if not, write to the Free
> > +Software
> > + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> > +02110-1301  USA
> > + *
> > + */
> > +
> > +#ifdef HAVE_CONFIG_H
> > +#include <config.h>
> > +#endif
> > +
> > +#include <stdio.h>
> > +#include <stdlib.h>
> > +#include <string.h>
> > +#include <inttypes.h>
> > +
> > +#include <bluetooth/bluetooth.h>
> > +
> > +#include "src/shared/util.h"
> > +#include "bt.h"
> > +#include "packet.h"
> > +#include "display.h"
> > +#include "l2cap.h"
> > +#include "uuid.h"
> > +#include "keys.h"
> > +#include "sdp.h"
> > +#include "avctp.h"
> > +
> > +void avctp_packet(const struct l2cap_frame *frame, uint16_t psm) {
> > +        uint8_t hdr;
> > +        uint16_t pid;
> > +        const char *pdu_color;
> > +
> > +        if (frame->size < 3) {
> > +                print_text(COLOR_ERROR, "frame too short");
> > +                packet_hexdump(frame->data, frame->size);
> > +                return;
> > +        }
> > +
> > +        hdr = *((uint8_t *) frame->data);
> > +
> > +        pid = get_be16(frame->data + 1);
> > +
> > +        if (frame->in)
> > +                pdu_color = COLOR_MAGENTA;
> > +        else
> > +                pdu_color = COLOR_BLUE;
> > +
> > +        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
> > +                        " %s: %s: Packet_type 0x%02x Transaction label %d "
> > +                        "PID 0x%04x",
> > +                        psm == 23 ? "Control" : "Browsing",
> > +                        hdr & 0x02 ? "Response" : "Command",
> > +                        hdr & 0x0c, hdr >> 4, pid);
> > +
> > +       packet_hexdump(frame->data + 3, frame->size - 3); }
> > diff --git a/monitor/avctp.h b/monitor/avctp.h new file mode 100644
> > index 0000000..559193e
> > --- /dev/null
> > +++ b/monitor/avctp.h
> > @@ -0,0 +1,25 @@
> > +/*
> > + *
> > + *  BlueZ - Bluetooth protocol stack for Linux
> > + *
> > + *  Copyright (C) 2011-2014  Intel Corporation
> > + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> > + *
> > + *
> > + *  This library is free software; you can redistribute it and/or
> > + *  modify it under the terms of the GNU Lesser General Public
> > + *  License as published by the Free Software Foundation; either
> > + *  version 2.1 of the License, or (at your option) any later version.
> > + *
> > + *  This library is distributed in the hope that it will be useful,
> > + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> > + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> GNU
> > + *  Lesser General Public License for more details.
> > + *
> > + *  You should have received a copy of the GNU Lesser General Public
> > + *  License along with this library; if not, write to the Free
> > +Software
> > + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
> > +02110-1301  USA
> > + *
> > + */
> > +
> > +void avctp_packet(const struct l2cap_frame *frame, uint16_t psm);
> > diff --git a/monitor/l2cap.c b/monitor/l2cap.c index 993aa8b..2752ee4
> > 100644
> > --- a/monitor/l2cap.c
> > +++ b/monitor/l2cap.c
> > @@ -41,6 +41,7 @@
> >  #include "uuid.h"
> >  #include "keys.h"
> >  #include "sdp.h"
> > +#include "avctp.h"
> >
> >  #define MAX_CHAN 64
> >
> > @@ -2634,6 +2635,10 @@ static void l2cap_frame(uint16_t index, bool in,
> uint16_t handle,
> >                 case 0x001f:
> >                         att_packet(index, in, handle, cid, data, size);
> >                         break;
> > +               case 0x0017:
> > +               case 0x001B:
> > +                       avctp_packet(&frame, psm);
> > +                       break;
> 
> This looks almost good enough I just don't get why we need to pass the psm,
> that btw should probably be made part of l2cap_frame, just have 2 different
> functions avctp_control_packet and avctp_browsing_packet they could
> internally call the same function to print AVCTP header details but you don't
> really need to check the PSM twice.

The better solution seems that psm be made part of l2cap_frame structure.
It saves us from passing psm as an argument and checking it twice.
It looks generic and other things remain same.

> 
> >                 default:
> >                         packet_hexdump(data, size);
> >                         break;
> > --
> > 1.9.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 
> --
> Luiz Augusto von Dentz

Regards,
Vikram


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH] monitor: Add AVCTP support to btmon
  2014-07-24 11:36 [PATCH] " Vikrampal Yadav
@ 2014-07-28 12:35 ` Luiz Augusto von Dentz
  2014-07-28 13:33   ` Vikrampal
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2014-07-28 12:35 UTC (permalink / raw)
  To: Vikrampal Yadav
  Cc: linux-bluetooth, Dmitry Kasatkin, p.sinha, sanjay.nm, Bharat Panda, cpgs

Hi,

On Thu, Jul 24, 2014 at 2:36 PM, Vikrampal Yadav <vikram.pal@samsung.com> wrote:
> Support for decoding AVCTP packets added in Bluetooth monitor.
> ---
>  Makefile.tools  |  1 +
>  monitor/avctp.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  monitor/avctp.h | 25 +++++++++++++++++++
>  monitor/l2cap.c |  5 ++++
>  4 files changed, 106 insertions(+)
>  create mode 100644 monitor/avctp.c
>  create mode 100644 monitor/avctp.h
>
> diff --git a/Makefile.tools b/Makefile.tools
> index dc9dde9..9226386 100644
> --- a/Makefile.tools
> +++ b/Makefile.tools
> @@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
>                                 monitor/ll.h monitor/ll.c \
>                                 monitor/l2cap.h monitor/l2cap.c \
>                                 monitor/sdp.h monitor/sdp.c \
> +                               monitor/avctp.h monitor/avctp.c \
>                                 monitor/uuid.h monitor/uuid.c \
>                                 monitor/hwdb.h monitor/hwdb.c \
>                                 monitor/keys.h monitor/keys.c \
> diff --git a/monitor/avctp.c b/monitor/avctp.c
> new file mode 100644
> index 0000000..68a5a56
> --- /dev/null
> +++ b/monitor/avctp.c
> @@ -0,0 +1,75 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2011-2014  Intel Corporation
> + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <inttypes.h>
> +
> +#include <bluetooth/bluetooth.h>
> +
> +#include "src/shared/util.h"
> +#include "bt.h"
> +#include "packet.h"
> +#include "display.h"
> +#include "l2cap.h"
> +#include "uuid.h"
> +#include "keys.h"
> +#include "sdp.h"
> +#include "avctp.h"
> +
> +void avctp_packet(const struct l2cap_frame *frame, uint16_t psm)
> +{
> +        uint8_t hdr;
> +        uint16_t pid;
> +        const char *pdu_color;
> +
> +        if (frame->size < 3) {
> +                print_text(COLOR_ERROR, "frame too short");
> +                packet_hexdump(frame->data, frame->size);
> +                return;
> +        }
> +
> +        hdr = *((uint8_t *) frame->data);
> +
> +        pid = get_be16(frame->data + 1);
> +
> +        if (frame->in)
> +                pdu_color = COLOR_MAGENTA;
> +        else
> +                pdu_color = COLOR_BLUE;
> +
> +        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
> +                        " %s: %s: Packet_type 0x%02x Transaction label %d "
> +                        "PID 0x%04x",
> +                        psm == 23 ? "Control" : "Browsing",
> +                        hdr & 0x02 ? "Response" : "Command",
> +                        hdr & 0x0c, hdr >> 4, pid);
> +
> +       packet_hexdump(frame->data + 3, frame->size - 3);
> +}
> diff --git a/monitor/avctp.h b/monitor/avctp.h
> new file mode 100644
> index 0000000..559193e
> --- /dev/null
> +++ b/monitor/avctp.h
> @@ -0,0 +1,25 @@
> +/*
> + *
> + *  BlueZ - Bluetooth protocol stack for Linux
> + *
> + *  Copyright (C) 2011-2014  Intel Corporation
> + *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
> + *
> + *
> + *  This library is free software; you can redistribute it and/or
> + *  modify it under the terms of the GNU Lesser General Public
> + *  License as published by the Free Software Foundation; either
> + *  version 2.1 of the License, or (at your option) any later version.
> + *
> + *  This library is distributed in the hope that it will be useful,
> + *  but WITHOUT ANY WARRANTY; without even the implied warranty of
> + *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> + *  Lesser General Public License for more details.
> + *
> + *  You should have received a copy of the GNU Lesser General Public
> + *  License along with this library; if not, write to the Free Software
> + *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
> + *
> + */
> +
> +void avctp_packet(const struct l2cap_frame *frame, uint16_t psm);
> diff --git a/monitor/l2cap.c b/monitor/l2cap.c
> index 993aa8b..2752ee4 100644
> --- a/monitor/l2cap.c
> +++ b/monitor/l2cap.c
> @@ -41,6 +41,7 @@
>  #include "uuid.h"
>  #include "keys.h"
>  #include "sdp.h"
> +#include "avctp.h"
>
>  #define MAX_CHAN 64
>
> @@ -2634,6 +2635,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
>                 case 0x001f:
>                         att_packet(index, in, handle, cid, data, size);
>                         break;
> +               case 0x0017:
> +               case 0x001B:
> +                       avctp_packet(&frame, psm);
> +                       break;

This looks almost good enough I just don't get why we need to pass the
psm, that btw should probably be made part of l2cap_frame, just have 2
different functions avctp_control_packet and avctp_browsing_packet
they could internally call the same function to print AVCTP header
details but you don't really need to check the PSM twice.

>                 default:
>                         packet_hexdump(data, size);
>                         break;
> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH] monitor: Add AVCTP support to btmon
@ 2014-07-24 11:36 Vikrampal Yadav
  2014-07-28 12:35 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: Vikrampal Yadav @ 2014-07-24 11:36 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: d.kasatkin, p.sinha, sanjay.nm, bharat.panda, vikram.pal, cpgs

Support for decoding AVCTP packets added in Bluetooth monitor.
---
 Makefile.tools  |  1 +
 monitor/avctp.c | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 monitor/avctp.h | 25 +++++++++++++++++++
 monitor/l2cap.c |  5 ++++
 4 files changed, 106 insertions(+)
 create mode 100644 monitor/avctp.c
 create mode 100644 monitor/avctp.h

diff --git a/Makefile.tools b/Makefile.tools
index dc9dde9..9226386 100644
--- a/Makefile.tools
+++ b/Makefile.tools
@@ -26,6 +26,7 @@ monitor_btmon_SOURCES = monitor/main.c monitor/bt.h \
 				monitor/ll.h monitor/ll.c \
 				monitor/l2cap.h monitor/l2cap.c \
 				monitor/sdp.h monitor/sdp.c \
+				monitor/avctp.h monitor/avctp.c \
 				monitor/uuid.h monitor/uuid.c \
 				monitor/hwdb.h monitor/hwdb.c \
 				monitor/keys.h monitor/keys.c \
diff --git a/monitor/avctp.c b/monitor/avctp.c
new file mode 100644
index 0000000..68a5a56
--- /dev/null
+++ b/monitor/avctp.c
@@ -0,0 +1,75 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011-2014  Intel Corporation
+ *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <inttypes.h>
+
+#include <bluetooth/bluetooth.h>
+
+#include "src/shared/util.h"
+#include "bt.h"
+#include "packet.h"
+#include "display.h"
+#include "l2cap.h"
+#include "uuid.h"
+#include "keys.h"
+#include "sdp.h"
+#include "avctp.h"
+
+void avctp_packet(const struct l2cap_frame *frame, uint16_t psm)
+{
+        uint8_t hdr;
+        uint16_t pid;
+        const char *pdu_color;
+
+        if (frame->size < 3) {
+                print_text(COLOR_ERROR, "frame too short");
+                packet_hexdump(frame->data, frame->size);
+                return;
+        }
+
+        hdr = *((uint8_t *) frame->data);
+
+        pid = get_be16(frame->data + 1);
+
+        if (frame->in)
+                pdu_color = COLOR_MAGENTA;
+        else
+                pdu_color = COLOR_BLUE;
+
+        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
+                        " %s: %s: Packet_type 0x%02x Transaction label %d "
+                        "PID 0x%04x",
+                        psm == 23 ? "Control" : "Browsing",
+                        hdr & 0x02 ? "Response" : "Command",
+                        hdr & 0x0c, hdr >> 4, pid);
+
+	packet_hexdump(frame->data + 3, frame->size - 3);
+}
diff --git a/monitor/avctp.h b/monitor/avctp.h
new file mode 100644
index 0000000..559193e
--- /dev/null
+++ b/monitor/avctp.h
@@ -0,0 +1,25 @@
+/*
+ *
+ *  BlueZ - Bluetooth protocol stack for Linux
+ *
+ *  Copyright (C) 2011-2014  Intel Corporation
+ *  Copyright (C) 2002-2010  Marcel Holtmann <marcel@holtmann.org>
+ *
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Lesser General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2.1 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Lesser General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Lesser General Public
+ *  License along with this library; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ */
+
+void avctp_packet(const struct l2cap_frame *frame, uint16_t psm);
diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index 993aa8b..2752ee4 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -41,6 +41,7 @@
 #include "uuid.h"
 #include "keys.h"
 #include "sdp.h"
+#include "avctp.h"
 
 #define MAX_CHAN 64
 
@@ -2634,6 +2635,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 		case 0x001f:
 			att_packet(index, in, handle, cid, data, size);
 			break;
+		case 0x0017:
+		case 0x001B:
+			avctp_packet(&frame, psm);
+			break;
 		default:
 			packet_hexdump(data, size);
 			break;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* RE: [PATCH ] monitor: Add AVCTP support to btmon
  2014-07-24  8:10 ` Luiz Augusto von Dentz
@ 2014-07-24 10:02   ` Vikrampal
  0 siblings, 0 replies; 8+ messages in thread
From: Vikrampal @ 2014-07-24 10:02 UTC (permalink / raw)
  To: 'Luiz Augusto von Dentz'
  Cc: linux-bluetooth, 'Dmitry Kasatkin',
	p.sinha, sanjay.nm, 'Bharat Panda',
	cpgs

Hi Luiz,

> -----Original Message-----
> From: Luiz Augusto von Dentz [mailto:luiz.dentz@gmail.com]
> Sent: Thursday, July 24, 2014 1:41 PM
> To: Vikrampal Yadav
> Cc: linux-bluetooth@vger.kernel.org; Dmitry Kasatkin;
> p.sinha@samsung.com; sanjay.nm@samsung.com; Bharat Panda;
> cpgs@samsung.com
> Subject: Re: [PATCH ] monitor: Add AVCTP support to btmon
> 
> Hi,
> 
> On Tue, Jul 22, 2014 at 1:57 PM, Vikrampal Yadav
> <vikram.pal@samsung.com> wrote:
> > Support for decoding AVCTP packets added in Bluetooth monitor.
> > ---
> >  monitor/l2cap.c | 64
> > +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> >  1 file changed, 64 insertions(+)
> >
> > diff --git a/monitor/l2cap.c b/monitor/l2cap.c index 993aa8b..3475263
> > 100644
> > --- a/monitor/l2cap.c
> > +++ b/monitor/l2cap.c
> > @@ -2220,6 +2220,66 @@ static void att_packet(uint16_t index, bool in,
> uint16_t handle,
> >         opcode_data->func(&frame);
> >  }
> >
> > +static void avrcp_control_packet(const struct l2cap_frame *frame) { }
> > +
> > +static void avrcp_browsing_packet(const struct l2cap_frame *frame,
> > +uint8_t hdr) { }
> 
> Please use avctp prefix while processing AVCTP part of the packets.

The above function skeleton is meant for AVRCP decoding. Otherwise, I've used
avctp prefix while processing AVCTP part of the packets.

> 
> > +static void avrcp_packet(const struct l2cap_frame *frame, uint8_t hdr,
> > +                               uint16_t psm) {
> > +        switch (psm) {
> > +                case 0x17:
> > +                        avrcp_control_packet(frame);
> > +                        break;
> > +                case 0x1B:
> > +                        avrcp_browsing_packet(frame, hdr);
> > +                        break;
> > +                default:
> > +                        packet_hexdump(frame->data, frame->size);
> > +        }
> > +}
> 
> Here as well.

The above function skeleton is meant for AVRCP decoding. Otherwise, I've used
avctp prefix while processing AVCTP part of the packets.

> 
> > +static void avctp_packet(const struct l2cap_frame *frame, uint16_t
> > +psm) {
> > +        uint8_t hdr;
> > +        uint16_t pid;
> > +        struct l2cap_frame avctp_frame;
> > +        const char *pdu_color;
> > +
> > +        if (frame->size < 3) {
> > +                print_text(COLOR_ERROR, "frame too short");
> > +                packet_hexdump(frame->data, frame->size);
> > +                return;
> > +        }
> > +
> > +        hdr = *((uint8_t *) frame->data);
> > +
> > +        pid = get_be16(frame->data + 1);
> > +
> > +        if (frame->in)
> > +                pdu_color = COLOR_MAGENTA;
> > +        else
> > +                pdu_color = COLOR_BLUE;
> > +
> > +        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
> > +                        " %s: %s: Packet_type 0x%02x Transaction label %d "
> > +                        "PID 0x%04x",
> > +                        psm == 23 ? "Control" : "Browsing",
> > +                        hdr & 0x02 ? "Response" : "Command",
> > +                        hdr & 0x0c, hdr >> 4, pid);
> > +
> > +        l2cap_frame_pull(&avctp_frame, frame, 3);
> > +
> > +        if (pid == 0x110e || pid == 0x110c)
> > +                avrcp_packet(&avctp_frame, hdr, psm);
> > +        else
> > +                packet_hexdump(frame->data + 3, frame->size - 3); }
> > +
> >  static void print_addr(const uint8_t *addr, uint8_t addr_type)  {
> >         const char *str;
> > @@ -2634,6 +2694,10 @@ static void l2cap_frame(uint16_t index, bool in,
> uint16_t handle,
> >                 case 0x001f:
> >                         att_packet(index, in, handle, cid, data, size);
> >                         break;
> > +               case 0x0017:
> > +               case 0x001B:
> > +                       avctp_packet(&frame, psm);
> > +                       break;
> >                 default:
> >                         packet_hexdump(data, size);
> >                         break;
> 
> Perhaps we should split this into avctp.c to keep l2cap.c just for L2CAP layer,
> otherwise this file will grow quite big.

Ok, I'll do that and submit again. Thanks!

> 
> > --
> > 1.9.1
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe
> > linux-bluetooth" in the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> 
> --
> Luiz Augusto von Dentz

Regards,
Vikram


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH ] monitor: Add AVCTP support to btmon
  2014-07-22 10:57 [PATCH ] " Vikrampal Yadav
@ 2014-07-24  8:10 ` Luiz Augusto von Dentz
  2014-07-24 10:02   ` Vikrampal
  0 siblings, 1 reply; 8+ messages in thread
From: Luiz Augusto von Dentz @ 2014-07-24  8:10 UTC (permalink / raw)
  To: Vikrampal Yadav
  Cc: linux-bluetooth, Dmitry Kasatkin, p.sinha, sanjay.nm, Bharat Panda, cpgs

Hi,

On Tue, Jul 22, 2014 at 1:57 PM, Vikrampal Yadav <vikram.pal@samsung.com> wrote:
> Support for decoding AVCTP packets added in Bluetooth monitor.
> ---
>  monitor/l2cap.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 64 insertions(+)
>
> diff --git a/monitor/l2cap.c b/monitor/l2cap.c
> index 993aa8b..3475263 100644
> --- a/monitor/l2cap.c
> +++ b/monitor/l2cap.c
> @@ -2220,6 +2220,66 @@ static void att_packet(uint16_t index, bool in, uint16_t handle,
>         opcode_data->func(&frame);
>  }
>
> +static void avrcp_control_packet(const struct l2cap_frame *frame)
> +{
> +}
> +
> +static void avrcp_browsing_packet(const struct l2cap_frame *frame, uint8_t hdr)
> +{
> +}

Please use avctp prefix while processing AVCTP part of the packets.

> +static void avrcp_packet(const struct l2cap_frame *frame, uint8_t hdr,
> +                               uint16_t psm)
> +{
> +        switch (psm) {
> +                case 0x17:
> +                        avrcp_control_packet(frame);
> +                        break;
> +                case 0x1B:
> +                        avrcp_browsing_packet(frame, hdr);
> +                        break;
> +                default:
> +                        packet_hexdump(frame->data, frame->size);
> +        }
> +}

Here as well.

> +static void avctp_packet(const struct l2cap_frame *frame, uint16_t psm)
> +{
> +        uint8_t hdr;
> +        uint16_t pid;
> +        struct l2cap_frame avctp_frame;
> +        const char *pdu_color;
> +
> +        if (frame->size < 3) {
> +                print_text(COLOR_ERROR, "frame too short");
> +                packet_hexdump(frame->data, frame->size);
> +                return;
> +        }
> +
> +        hdr = *((uint8_t *) frame->data);
> +
> +        pid = get_be16(frame->data + 1);
> +
> +        if (frame->in)
> +                pdu_color = COLOR_MAGENTA;
> +        else
> +                pdu_color = COLOR_BLUE;
> +
> +        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
> +                        " %s: %s: Packet_type 0x%02x Transaction label %d "
> +                        "PID 0x%04x",
> +                        psm == 23 ? "Control" : "Browsing",
> +                        hdr & 0x02 ? "Response" : "Command",
> +                        hdr & 0x0c, hdr >> 4, pid);
> +
> +        l2cap_frame_pull(&avctp_frame, frame, 3);
> +
> +        if (pid == 0x110e || pid == 0x110c)
> +                avrcp_packet(&avctp_frame, hdr, psm);
> +        else
> +                packet_hexdump(frame->data + 3, frame->size - 3);
> +}
> +
>  static void print_addr(const uint8_t *addr, uint8_t addr_type)
>  {
>         const char *str;
> @@ -2634,6 +2694,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
>                 case 0x001f:
>                         att_packet(index, in, handle, cid, data, size);
>                         break;
> +               case 0x0017:
> +               case 0x001B:
> +                       avctp_packet(&frame, psm);
> +                       break;
>                 default:
>                         packet_hexdump(data, size);
>                         break;

Perhaps we should split this into avctp.c to keep l2cap.c just for
L2CAP layer, otherwise this file will grow quite big.

> --
> 1.9.1
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Luiz Augusto von Dentz

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH ] monitor: Add AVCTP support to btmon
@ 2014-07-22 10:57 Vikrampal Yadav
  2014-07-24  8:10 ` Luiz Augusto von Dentz
  0 siblings, 1 reply; 8+ messages in thread
From: Vikrampal Yadav @ 2014-07-22 10:57 UTC (permalink / raw)
  To: linux-bluetooth
  Cc: d.kasatkin, p.sinha, sanjay.nm, bharat.panda, vikram.pal, cpgs

Support for decoding AVCTP packets added in Bluetooth monitor.
---
 monitor/l2cap.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)

diff --git a/monitor/l2cap.c b/monitor/l2cap.c
index 993aa8b..3475263 100644
--- a/monitor/l2cap.c
+++ b/monitor/l2cap.c
@@ -2220,6 +2220,66 @@ static void att_packet(uint16_t index, bool in, uint16_t handle,
 	opcode_data->func(&frame);
 }
 
+static void avrcp_control_packet(const struct l2cap_frame *frame)
+{
+}
+
+static void avrcp_browsing_packet(const struct l2cap_frame *frame, uint8_t hdr)
+{
+}
+
+static void avrcp_packet(const struct l2cap_frame *frame, uint8_t hdr,
+				uint16_t psm)
+{
+        switch (psm) {
+                case 0x17:
+                        avrcp_control_packet(frame);
+                        break;
+                case 0x1B:
+                        avrcp_browsing_packet(frame, hdr);
+                        break;
+                default:
+                        packet_hexdump(frame->data, frame->size);
+        }
+}
+
+static void avctp_packet(const struct l2cap_frame *frame, uint16_t psm)
+{
+        uint8_t hdr;
+        uint16_t pid;
+        struct l2cap_frame avctp_frame;
+        const char *pdu_color;
+
+        if (frame->size < 3) {
+                print_text(COLOR_ERROR, "frame too short");
+                packet_hexdump(frame->data, frame->size);
+                return;
+        }
+
+        hdr = *((uint8_t *) frame->data);
+
+        pid = get_be16(frame->data + 1);
+
+        if (frame->in)
+                pdu_color = COLOR_MAGENTA;
+        else
+                pdu_color = COLOR_BLUE;
+
+        print_indent(6, pdu_color, "AVCTP", "", COLOR_OFF,
+                        " %s: %s: Packet_type 0x%02x Transaction label %d "
+                        "PID 0x%04x",
+                        psm == 23 ? "Control" : "Browsing",
+                        hdr & 0x02 ? "Response" : "Command",
+                        hdr & 0x0c, hdr >> 4, pid);
+
+        l2cap_frame_pull(&avctp_frame, frame, 3);
+
+        if (pid == 0x110e || pid == 0x110c)
+                avrcp_packet(&avctp_frame, hdr, psm);
+        else
+                packet_hexdump(frame->data + 3, frame->size - 3);
+}
+
 static void print_addr(const uint8_t *addr, uint8_t addr_type)
 {
 	const char *str;
@@ -2634,6 +2694,10 @@ static void l2cap_frame(uint16_t index, bool in, uint16_t handle,
 		case 0x001f:
 			att_packet(index, in, handle, cid, data, size);
 			break;
+		case 0x0017:
+		case 0x001B:
+			avctp_packet(&frame, psm);
+			break;
 		default:
 			packet_hexdump(data, size);
 			break;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2014-07-31 13:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-07-28 14:24 [PATCH ] monitor: Add AVCTP support to btmon Vikrampal Yadav
2014-07-31 13:07 ` Luiz Augusto von Dentz
  -- strict thread matches above, loose matches on Subject: below --
2014-07-24 11:36 [PATCH] " Vikrampal Yadav
2014-07-28 12:35 ` Luiz Augusto von Dentz
2014-07-28 13:33   ` Vikrampal
2014-07-22 10:57 [PATCH ] " Vikrampal Yadav
2014-07-24  8:10 ` Luiz Augusto von Dentz
2014-07-24 10:02   ` Vikrampal

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.