* Re: [PATCH hcidump] Add TI Logger dump support
From: Arik Nemtsov @ 2012-12-23 14:30 UTC (permalink / raw)
To: chen.ganir; +Cc: marcel, linux-bluetooth
In-Reply-To: <CA+XVXfcm5k7qN_tgbX6zVtWjxo_5w+FNmmbhthw3+UtrH3tnYg@mail.gmail.com>
On Sun, Dec 23, 2012 at 4:11 PM, Arik Nemtsov <arik@wizery.com> wrote:
> On Sun, Dec 23, 2012 at 2:07 PM, <chen.ganir@ti.com> wrote:
>> From: Chen Ganir <chen.ganir@ti.com>
>>
>> Texas Instruments controllers can be configured to send the
>> internal firmware log through a vendor specific HCI event on
>> the hci transport.
>> This patch allows capturing those log events, and writing them
>> to a file, which can then be used with the latest TI Logger
>> application to read and show the logs.
>>
>> This is usefull in case there is no other way to get the TI log
>> (for example, the lack of a connection to the controller Log TX
>> hardware line).
> [...]
>> @@ -300,7 +308,24 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
> [...]
>> + char out[2];
>> + int i;
>> +
>> + for(i = 0;i < tp->size-2;i++) {
>> + sprintf(out,"%02X",tp->data[i]);
>> + if (write_n(fd, out, 2) < 0) {
>
> Seems to me this can overflow when tp->size - 2 > sizeof(out) ?
I'm sorry. I misread the code - but there's still an off-by-one here,
since 3 bytes are written to out (the null terminator).
Arik
^ permalink raw reply
* Re: [PATCH hcidump] Add TI Logger dump support
From: Arik Nemtsov @ 2012-12-23 14:11 UTC (permalink / raw)
To: chen.ganir; +Cc: marcel, linux-bluetooth
In-Reply-To: <1356264452-21200-1-git-send-email-chen.ganir@ti.com>
On Sun, Dec 23, 2012 at 2:07 PM, <chen.ganir@ti.com> wrote:
> From: Chen Ganir <chen.ganir@ti.com>
>
> Texas Instruments controllers can be configured to send the
> internal firmware log through a vendor specific HCI event on
> the hci transport.
> This patch allows capturing those log events, and writing them
> to a file, which can then be used with the latest TI Logger
> application to read and show the logs.
>
> This is usefull in case there is no other way to get the TI log
> (for example, the lack of a connection to the controller Log TX
> hardware line).
[...]
> @@ -300,7 +308,24 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
[...]
> + char out[2];
> + int i;
> +
> + for(i = 0;i < tp->size-2;i++) {
> + sprintf(out,"%02X",tp->data[i]);
> + if (write_n(fd, out, 2) < 0) {
Seems to me this can overflow when tp->size - 2 > sizeof(out) ?
Arik
^ permalink raw reply
* [PATCH hcidump] Add TI Logger dump support
From: chen.ganir @ 2012-12-23 12:07 UTC (permalink / raw)
To: marcel, linux-bluetooth; +Cc: Chen Ganir
From: Chen Ganir <chen.ganir@ti.com>
Texas Instruments controllers can be configured to send the
internal firmware log through a vendor specific HCI event on
the hci transport.
This patch allows capturing those log events, and writing them
to a file, which can then be used with the latest TI Logger
application to read and show the logs.
This is usefull in case there is no other way to get the TI log
(for example, the lack of a connection to the controller Log TX
hardware line).
---
parser/parser.h | 1 +
src/hcidump.c | 44 ++++++++++++++++++++++++++++++++++++++++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/parser/parser.h b/parser/parser.h
index f8f7009..d4fecf0 100644
--- a/parser/parser.h
+++ b/parser/parser.h
@@ -63,6 +63,7 @@ struct frame {
#define DUMP_BTSNOOP 0x1000
#define DUMP_PKTLOG 0x2000
#define DUMP_NOVENDOR 0x4000
+#define DUMP_TILOGGER 0x8000
#define DUMP_TYPE_MASK (DUMP_ASCII | DUMP_HEX | DUMP_EXT)
/* Parser filter */
diff --git a/src/hcidump.c b/src/hcidump.c
index 18ae64e..3daf2b6 100644
--- a/src/hcidump.c
+++ b/src/hcidump.c
@@ -110,6 +110,14 @@ struct pktlog_hdr {
} __attribute__ ((packed));
#define PKTLOG_HDR_SIZE (sizeof(struct pktlog_hdr))
+struct tilogger_pkt {
+ uint8_t type;
+ uint8_t vendor;
+ uint8_t size;
+ uint16_t opcode;
+ uint8_t data[0]; /* Packet Data */
+} __attribute__ ((packed));
+
static inline int read_n(int fd, char *buf, int len)
{
int t = 0, w;
@@ -300,7 +308,24 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
case WRITE:
case SERVER:
/* Save or send dump */
- if (flags & DUMP_BTSNOOP) {
+ if (flags & DUMP_TILOGGER && mode == WRITE) {
+ struct tilogger_pkt *tp = frm.ptr;
+ if (tp->type == HCI_EVENT_PKT &&
+ tp->vendor == 0xFF &&
+ tp->opcode == 0x0400) {
+ char out[2];
+ int i;
+
+ for(i = 0;i < tp->size-2;i++) {
+ sprintf(out,"%02X",tp->data[i]);
+ if (write_n(fd, out, 2) < 0) {
+ perror("Write error");
+ return -1;
+ }
+ }
+ }
+ continue;
+ } else if (flags & DUMP_BTSNOOP) {
uint64_t ts;
uint8_t pkt_type = ((uint8_t *) frm.data)[0];
dp->size = htonl(frm.data_len);
@@ -542,7 +567,9 @@ static int open_file(char *file, int mode, unsigned long flags)
return fd;
}
} else {
- if (flags & DUMP_BTSNOOP) {
+ if (flags & DUMP_TILOGGER) {
+ printf ("TI Logger dump\n");
+ } else if (flags & DUMP_BTSNOOP) {
btsnoop_version = 1;
btsnoop_type = 1002;
@@ -895,6 +922,7 @@ static void usage(void)
" -a, --ascii Dump data in ascii\n"
" -x, --hex Dump data in hex\n"
" -X, --ext Dump data in hex and ascii\n"
+ " -T, --tilogger=file Dump TI hci log data to file\n"
" -R, --raw Dump raw data\n"
" -C, --cmtp=psm PSM for CMTP\n"
" -H, --hcrp=psm PSM for HCRP\n"
@@ -936,6 +964,7 @@ static struct option main_options[] = {
{ "nopermcheck", 0, 0, 'Z' },
{ "ipv4", 0, 0, '4' },
{ "ipv6", 0, 0, '6' },
+ { "tilogger", 1, 0, 'T' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
{ 0 }
@@ -952,7 +981,7 @@ int main(int argc, char *argv[])
uint16_t obex_port;
while ((opt = getopt_long(argc, argv,
- "i:l:p:m:w:r:d:taxXRC:H:O:P:S:D:A:YZ46hv",
+ "i:l:p:m:w:r:d:taxT:XRC:H:O:P:S:D:A:YZ46hv",
main_options, NULL)) != -1) {
switch(opt) {
case 'i':
@@ -1009,6 +1038,12 @@ int main(int argc, char *argv[])
flags |= DUMP_RAW;
break;
+ case 'T':
+ mode = WRITE;
+ dump_file = strdup(optarg);
+ flags |= DUMP_TILOGGER;
+ break;
+
case 'C':
set_proto(0, atoi(optarg), 0, SDP_UUID_CMTP);
break;
@@ -1101,7 +1136,8 @@ int main(int argc, char *argv[])
break;
case WRITE:
- flags |= DUMP_BTSNOOP;
+ if ((flags & DUMP_TILOGGER) == 0)
+ flags |= DUMP_BTSNOOP;
process_frames(device, open_socket(device, flags),
open_file(dump_file, mode, flags), flags);
break;
--
1.7.10.4
^ permalink raw reply related
* [PATCH hcidump] Add TI Logger dump support
From: chen.ganir @ 2012-12-23 11:58 UTC (permalink / raw)
To: marcel, linux-bluetooth; +Cc: Chen Ganir
From: Chen Ganir <chen.ganir@ti.com>
Texas Instruments controllers can be configured to send the
internal firmware log through a vendor specific HCI event on
the hci transport.
This patch allows capturing those log events, and writing them
to a file, which can then be used with the latest TI Logger
application to read and show the logs.
This is usefull in case there is no other way to get the TI log
(for example, the lack of a connection to the controller Log TX
hardware line).
---
parser/parser.h | 1 +
src/hcidump.c | 44 ++++++++++++++++++++++++++++++++++++++++----
2 files changed, 41 insertions(+), 4 deletions(-)
diff --git a/parser/parser.h b/parser/parser.h
index f8f7009..d4fecf0 100644
--- a/parser/parser.h
+++ b/parser/parser.h
@@ -63,6 +63,7 @@ struct frame {
#define DUMP_BTSNOOP 0x1000
#define DUMP_PKTLOG 0x2000
#define DUMP_NOVENDOR 0x4000
+#define DUMP_TILOGGER 0x8000
#define DUMP_TYPE_MASK (DUMP_ASCII | DUMP_HEX | DUMP_EXT)
/* Parser filter */
diff --git a/src/hcidump.c b/src/hcidump.c
index 18ae64e..3daf2b6 100644
--- a/src/hcidump.c
+++ b/src/hcidump.c
@@ -110,6 +110,14 @@ struct pktlog_hdr {
} __attribute__ ((packed));
#define PKTLOG_HDR_SIZE (sizeof(struct pktlog_hdr))
+struct tilogger_pkt {
+ uint8_t type;
+ uint8_t vendor;
+ uint8_t size;
+ uint16_t opcode;
+ uint8_t data[0]; /* Packet Data */
+} __attribute__ ((packed));
+
static inline int read_n(int fd, char *buf, int len)
{
int t = 0, w;
@@ -300,7 +308,24 @@ static int process_frames(int dev, int sock, int fd, unsigned long flags)
case WRITE:
case SERVER:
/* Save or send dump */
- if (flags & DUMP_BTSNOOP) {
+ if (flags & DUMP_TILOGGER && mode == WRITE) {
+ struct tilogger_pkt *tp = frm.ptr;
+ if (tp->type == HCI_EVENT_PKT &&
+ tp->vendor == 0xFF &&
+ tp->opcode == 0x0400) {
+ char out[2];
+ int i;
+
+ for(i = 0;i < tp->size-2;i++) {
+ sprintf(out,"%02X",tp->data[i]);
+ if (write_n(fd, out, 2) < 0) {
+ perror("Write error");
+ return -1;
+ }
+ }
+ }
+ continue;
+ } else if (flags & DUMP_BTSNOOP) {
uint64_t ts;
uint8_t pkt_type = ((uint8_t *) frm.data)[0];
dp->size = htonl(frm.data_len);
@@ -542,7 +567,9 @@ static int open_file(char *file, int mode, unsigned long flags)
return fd;
}
} else {
- if (flags & DUMP_BTSNOOP) {
+ if (flags & DUMP_TILOGGER) {
+ printf ("TI Logger dump\n");
+ } else if (flags & DUMP_BTSNOOP) {
btsnoop_version = 1;
btsnoop_type = 1002;
@@ -895,6 +922,7 @@ static void usage(void)
" -a, --ascii Dump data in ascii\n"
" -x, --hex Dump data in hex\n"
" -X, --ext Dump data in hex and ascii\n"
+ " -T, --tilogger=file Dump TI hci log data to file\n"
" -R, --raw Dump raw data\n"
" -C, --cmtp=psm PSM for CMTP\n"
" -H, --hcrp=psm PSM for HCRP\n"
@@ -936,6 +964,7 @@ static struct option main_options[] = {
{ "nopermcheck", 0, 0, 'Z' },
{ "ipv4", 0, 0, '4' },
{ "ipv6", 0, 0, '6' },
+ { "tilogger", 1, 0, 'T' },
{ "help", 0, 0, 'h' },
{ "version", 0, 0, 'v' },
{ 0 }
@@ -952,7 +981,7 @@ int main(int argc, char *argv[])
uint16_t obex_port;
while ((opt = getopt_long(argc, argv,
- "i:l:p:m:w:r:d:taxXRC:H:O:P:S:D:A:YZ46hv",
+ "i:l:p:m:w:r:d:taxT:XRC:H:O:P:S:D:A:YZ46hv",
main_options, NULL)) != -1) {
switch(opt) {
case 'i':
@@ -1009,6 +1038,12 @@ int main(int argc, char *argv[])
flags |= DUMP_RAW;
break;
+ case 'T':
+ mode = WRITE;
+ dump_file = strdup(optarg);
+ flags |= DUMP_TILOGGER;
+ break;
+
case 'C':
set_proto(0, atoi(optarg), 0, SDP_UUID_CMTP);
break;
@@ -1101,7 +1136,8 @@ int main(int argc, char *argv[])
break;
case WRITE:
- flags |= DUMP_BTSNOOP;
+ if ((flags & DUMP_TILOGGER) == 0)
+ flags |= DUMP_BTSNOOP;
process_frames(device, open_socket(device, flags),
open_file(dump_file, mode, flags), flags);
break;
--
1.7.10.4
^ permalink raw reply related
* Re: [PATCH BlueZ] core: Fix memory leak from pending UUID removal
From: Johan Hedberg @ 2012-12-23 9:31 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1356217161-3787-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Lizardo,
On Sat, Dec 22, 2012, Anderson Lizardo wrote:
> When bluetoothd is shutting down, profile cleanup will usually issue
> many "Remove UUID" management commands. These may not complete before
> the process exits, resulting on this memory leak:
>
> ==2461== 144 (8 direct, 136 indirect) bytes in 1 blocks are definitely
> lost in loss record 153 of 176
> ==2461== at 0x402BE68: malloc (in
> /usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
> ==2461== by 0x40869AA: standard_malloc (gmem.c:85)
> ==2461== by 0x4086E42: g_malloc (gmem.c:159)
> ==2461== by 0x409B26D: g_slice_alloc (gslice.c:1003)
> ==2461== by 0x409C659: g_slist_append (gslist.c:222)
> ==2461== by 0x80B5E12: mgmt_remove_uuid (mgmt.c:1034)
> ==2461== by 0x80A734E: adapter_service_remove (adapter.c:708)
> ==2461== by 0x80994B4: sdp_record_remove (sdpd-database.c:272)
> ==2461== by 0x8098CC0: remove_record_from_server (sdpd-service.c:290)
> ==2461== by 0x8062B5B: avrcp_unregister (avrcp.c:2354)
> ==2461== by 0x409C797: g_slist_foreach (gslist.c:840)
> ==2461== by 0x80A7D77: adapter_remove (adapter.c:1630)
>
> The leak seems to only happen during bluetoothd shutdown, because the
> list of pending UUIDs is cleared when controller is removed. Therefore,
> only cleanup the list on shutdown path.
> ---
> src/mgmt.c | 11 +++++++++++
> 1 file changed, 11 insertions(+)
Applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ] core: Fix memory leak from pending UUID removal
From: Anderson Lizardo @ 2012-12-22 22:59 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Anderson Lizardo
When bluetoothd is shutting down, profile cleanup will usually issue
many "Remove UUID" management commands. These may not complete before
the process exits, resulting on this memory leak:
==2461== 144 (8 direct, 136 indirect) bytes in 1 blocks are definitely
lost in loss record 153 of 176
==2461== at 0x402BE68: malloc (in
/usr/lib/valgrind/vgpreload_memcheck-x86-linux.so)
==2461== by 0x40869AA: standard_malloc (gmem.c:85)
==2461== by 0x4086E42: g_malloc (gmem.c:159)
==2461== by 0x409B26D: g_slice_alloc (gslice.c:1003)
==2461== by 0x409C659: g_slist_append (gslist.c:222)
==2461== by 0x80B5E12: mgmt_remove_uuid (mgmt.c:1034)
==2461== by 0x80A734E: adapter_service_remove (adapter.c:708)
==2461== by 0x80994B4: sdp_record_remove (sdpd-database.c:272)
==2461== by 0x8098CC0: remove_record_from_server (sdpd-service.c:290)
==2461== by 0x8062B5B: avrcp_unregister (avrcp.c:2354)
==2461== by 0x409C797: g_slist_foreach (gslist.c:840)
==2461== by 0x80A7D77: adapter_remove (adapter.c:1630)
The leak seems to only happen during bluetoothd shutdown, because the
list of pending UUIDs is cleared when controller is removed. Therefore,
only cleanup the list on shutdown path.
---
src/mgmt.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/mgmt.c b/src/mgmt.c
index 52441e8..ae4a95c 100644
--- a/src/mgmt.c
+++ b/src/mgmt.c
@@ -2231,6 +2231,17 @@ fail:
void mgmt_cleanup(void)
{
+ int index;
+
+ for (index = 0; index <= max_index; index++) {
+ struct controller_info *info = &controllers[index];
+
+ if (!info->valid)
+ continue;
+
+ g_slist_free_full(info->pending_uuids, g_free);
+ }
+
g_free(controllers);
controllers = NULL;
max_index = -1;
--
1.7.9.5
^ permalink raw reply related
* Re: [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: Marcel Holtmann @ 2012-12-22 19:56 UTC (permalink / raw)
To: Joao Paulo Rechi Vita; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CAAngNMbS0oDkxe0TQEu2mrxrf7dyViYcHZFeKgtREDd1jtp-yA@mail.gmail.com>
Hi Joao Paulo,
> >> If bluetoothd crashes the exit routine of the suspend plugin will not be
> >> executed, leaving the suspend FIFO behind and preventing the plugin load
> >> on subsequent executions. This commit checks for pre-existence of the
> >> suspend FIFO and tries to remove and re-create it.
> >> ---
> >> profiles/input/suspend-dummy.c | 16 ++++++++++++++++
> >> 1 file changed, 16 insertions(+)
> >>
> >> diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
> >> index 33b790a..43384c0 100644
> >> --- a/profiles/input/suspend-dummy.c
> >> +++ b/profiles/input/suspend-dummy.c
> >> @@ -119,6 +119,22 @@ int suspend_init(suspend_event suspend, resume_event resume)
> >>
> >> if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
> >> int err = -errno;
> >> +
> >> + if (err == -EEXIST) {
> >> + DBG("FIFO (%s) already exists, trying to remove",
> >> + HOG_SUSPEND_FIFO);
> >> +
> >> + /* remove pre-existing FIFO and retry */
> >> + if (remove(HOG_SUSPEND_FIFO) < 0) {
> >
> > you are looking for unlink() to use here.
> >
>
> What's the problem with remove()? From the manpage it's part of
> stdio.h and calls unlink() for files, and rmdir() for directories.
> From my understanding if someone else created a directory on the FIFO
> path, unlink() will return with EISDIR and we would need to handle
> this error as well.
if it accidentally has been a directory with that name, then I want to
see a big fat error. Not some magic to make it work.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: Joao Paulo Rechi Vita @ 2012-12-22 18:41 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <CAAngNMbS0oDkxe0TQEu2mrxrf7dyViYcHZFeKgtREDd1jtp-yA@mail.gmail.com>
On Sat, Dec 22, 2012 at 3:39 PM, Joao Paulo Rechi Vita
<jprvita@openbossa.org> wrote:
> On Sat, Dec 22, 2012 at 1:36 PM, Marcel Holtmann <marcel@holtmann.org> wr=
ote:
>> Hi Joao Paulo,
>>
>>> If bluetoothd crashes the exit routine of the suspend plugin will not b=
e
>>> executed, leaving the suspend FIFO behind and preventing the plugin loa=
d
>>> on subsequent executions. This commit checks for pre-existence of the
>>> suspend FIFO and tries to remove and re-create it.
>>> ---
>>> profiles/input/suspend-dummy.c | 16 ++++++++++++++++
>>> 1 file changed, 16 insertions(+)
>>>
>>> diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-du=
mmy.c
>>> index 33b790a..43384c0 100644
>>> --- a/profiles/input/suspend-dummy.c
>>> +++ b/profiles/input/suspend-dummy.c
>>> @@ -119,6 +119,22 @@ int suspend_init(suspend_event suspend, resume_eve=
nt resume)
>>>
>>> if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
>>> int err =3D -errno;
>>> +
>>> + if (err =3D=3D -EEXIST) {
>>> + DBG("FIFO (%s) already exists, trying to remove",
>>> + HOG_SUSPEND_FIFO)=
;
>>> +
>>> + /* remove pre-existing FIFO and retry */
>>> + if (remove(HOG_SUSPEND_FIFO) < 0) {
>>
>> you are looking for unlink() to use here.
>>
>
> What's the problem with remove()? From the manpage it's part of
> stdio.h and calls unlink() for files, and rmdir() for directories.
> From my understanding if someone else created a directory on the FIFO
> path, unlink() will return with EISDIR and we would need to handle
> this error as well.
>
And BTW, remove() is also been used on suspend_exit().
--
Jo=C3=A3o Paulo Rechi Vita
Openbossa Labs - INdT
^ permalink raw reply
* Re: [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: Joao Paulo Rechi Vita @ 2012-12-22 18:39 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: linux-bluetooth@vger.kernel.org
In-Reply-To: <1356194171.29264.14.camel@aeonflux>
On Sat, Dec 22, 2012 at 1:36 PM, Marcel Holtmann <marcel@holtmann.org> wrot=
e:
> Hi Joao Paulo,
>
>> If bluetoothd crashes the exit routine of the suspend plugin will not be
>> executed, leaving the suspend FIFO behind and preventing the plugin load
>> on subsequent executions. This commit checks for pre-existence of the
>> suspend FIFO and tries to remove and re-create it.
>> ---
>> profiles/input/suspend-dummy.c | 16 ++++++++++++++++
>> 1 file changed, 16 insertions(+)
>>
>> diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dum=
my.c
>> index 33b790a..43384c0 100644
>> --- a/profiles/input/suspend-dummy.c
>> +++ b/profiles/input/suspend-dummy.c
>> @@ -119,6 +119,22 @@ int suspend_init(suspend_event suspend, resume_even=
t resume)
>>
>> if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
>> int err =3D -errno;
>> +
>> + if (err =3D=3D -EEXIST) {
>> + DBG("FIFO (%s) already exists, trying to remove",
>> + HOG_SUSPEND_FIFO);
>> +
>> + /* remove pre-existing FIFO and retry */
>> + if (remove(HOG_SUSPEND_FIFO) < 0) {
>
> you are looking for unlink() to use here.
>
What's the problem with remove()? From the manpage it's part of
stdio.h and calls unlink() for files, and rmdir() for directories.
>From my understanding if someone else created a directory on the FIFO
path, unlink() will return with EISDIR and we would need to handle
this error as well.
--
Jo=C3=A3o Paulo Rechi Vita
Openbossa Labs - INdT
^ permalink raw reply
* Re: setting BT connection over RFCOMM
From: Kevin Wilson @ 2012-12-22 17:22 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <CAGXs5wXEEnO084sg1Er-SgB3-TU+W5HtjsKnY7CdT9Hsw+jjew@mail.gmail.com>
Hi all,
Please ignore my question. It turns out that
CONFIG_BT_RFCOMM_TTY was not set.
As a result, there was an error on the server
which prevented connection establishment,
Now after setting CONFIG_BT_RFCOMM_TTY,
it works.
rgs
Kevin
On Sat, Dec 22, 2012 at 6:48 AM, Kevin Wilson <wkevils@gmail.com> wrote:
> connect rfcomm0
^ permalink raw reply
* Re: [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: Johan Hedberg @ 2012-12-22 16:51 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: João Paulo Rechi Vita, linux-bluetooth
In-Reply-To: <1356194171.29264.14.camel@aeonflux>
Hi Marcel,
On Sat, Dec 22, 2012, Marcel Holtmann wrote:
> > + if (remove(HOG_SUSPEND_FIFO) < 0) {
>
> you are looking for unlink() to use here.
Since I already applied the patches I went ahead and fixed this myself.
Johan
^ permalink raw reply
* Re: [PATCH 1/2] Bluetooth: Fix to update EIR for uuid16 properly
From: Marcel Holtmann @ 2012-12-22 16:39 UTC (permalink / raw)
To: Johan Hedberg; +Cc: Syam Sidhardhan, linux-bluetooth
In-Reply-To: <20121221193112.GA31432@x220.ger.corp.intel.com>
Hi Johan,
> > If we register a uuid other than uuid16, especially custom 128 bit uuid
> > then nothing is updated in the EIR and it was broken.
> >
> > After registering a 16 bit uuid. ex: "sdptool add SP", we can see the
> > uuid in the EIR as below.
> > < 0000: 01 52 0c f1 00 08 09 52 65 64 77 6f 6f 64 15 03 .R.....Redwood..
> > 0010: 01 11 32 11 2f 11 06 11 05 11 0a 11 0e 11 0c 11 ..2./...........
> > 0020: 1f 11 12 11 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00f0: 00 00 00 00 00 .....
> > > 0000: 04 0e 04 01 52 0c 00 ....R..
> >
> > But after register a user defined 128 bit uuid, nothing is
> > updated in the EIR.
> >
> > < 0000: 01 52 0c f1 00 08 09 52 65 64 77 6f 6f 64 00 00 .R.....Redwood..
> > 0010: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0040: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0050: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0060: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0070: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0080: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 0090: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00a0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00b0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00c0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00d0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00e0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
> > 00f0: 00 00 00 00 00 .....
> > > 0000: 04 0e 04 01 52 0c 00 ....R..
> >
> > With this fix, we can see the EIR is updated properly.
> >
> > Signed-off-by: Syam Sidhardhan <s.syam@samsung.com>
> > ---
> > net/bluetooth/mgmt.c | 2 --
> > 1 file changed, 2 deletions(-)
> >
> > diff --git a/net/bluetooth/mgmt.c b/net/bluetooth/mgmt.c
> > index f559b96..512a3f5 100644
> > --- a/net/bluetooth/mgmt.c
> > +++ b/net/bluetooth/mgmt.c
> > @@ -514,8 +514,6 @@ static void create_eir(struct hci_dev *hdev, u8 *data)
> > u16 uuid16;
> >
> > uuid16 = get_uuid16(uuid->uuid);
> > - if (uuid16 == 0)
> > - return;
> >
> > if (uuid16 < 0x1100)
> > continue;
>
> Nak. The bug is real and should be fixed but your fix is wrong. The
> right fix it to convert this return statement into a continue statement
> since we do still want to check for a 0 return value from get_uuid16.
>
> Along with this patch please prepare another one to increment the mgmt
> revision. These two should go together to upstream trees so that we can
> introduce a check in user space to know whether it's safe to pass
> non-16bit UUIDs to the kernel or not.
I want a fix that introduces also support for 32-bit and 128-bit UUIDs
now. No paper over the hole fixing here.
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: Marcel Holtmann @ 2012-12-22 16:36 UTC (permalink / raw)
To: João Paulo Rechi Vita; +Cc: linux-bluetooth
In-Reply-To: <1356189162-11584-4-git-send-email-jprvita@openbossa.org>
Hi Joao Paulo,
> If bluetoothd crashes the exit routine of the suspend plugin will not be
> executed, leaving the suspend FIFO behind and preventing the plugin load
> on subsequent executions. This commit checks for pre-existence of the
> suspend FIFO and tries to remove and re-create it.
> ---
> profiles/input/suspend-dummy.c | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
>
> diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
> index 33b790a..43384c0 100644
> --- a/profiles/input/suspend-dummy.c
> +++ b/profiles/input/suspend-dummy.c
> @@ -119,6 +119,22 @@ int suspend_init(suspend_event suspend, resume_event resume)
>
> if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
> int err = -errno;
> +
> + if (err == -EEXIST) {
> + DBG("FIFO (%s) already exists, trying to remove",
> + HOG_SUSPEND_FIFO);
> +
> + /* remove pre-existing FIFO and retry */
> + if (remove(HOG_SUSPEND_FIFO) < 0) {
you are looking for unlink() to use here.
> + err = -errno;
> + error("Failed to remove FIFO (%s): %s (%d)",
> + HOG_SUSPEND_FIFO, strerror(-err), -err);
> + return err;
> + }
> +
> + return suspend_init(suspend, resume);
> + }
> +
> error("Can't create FIFO (%s): %s (%d)", HOG_SUSPEND_FIFO,
> strerror(-err), -err);
> return err;
Regards
Marcel
^ permalink raw reply
* Re: [PATCH BlueZ 1/4] hog: Fix message text and level when failing to load suspend plugin
From: Johan Hedberg @ 2012-12-22 16:35 UTC (permalink / raw)
To: João Paulo Rechi Vita; +Cc: linux-bluetooth
In-Reply-To: <1356189162-11584-1-git-send-email-jprvita@openbossa.org>
Hi João Paulo,
On Sat, Dec 22, 2012, João Paulo Rechi Vita wrote:
> ---
> profiles/input/hog.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
All four patches have been applied. Thanks.
Johan
^ permalink raw reply
* [PATCH BlueZ 4/4] hog: Remove pre-existing suspend FIFO
From: João Paulo Rechi Vita @ 2012-12-22 15:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: João Paulo Rechi Vita
In-Reply-To: <1356189162-11584-1-git-send-email-jprvita@openbossa.org>
If bluetoothd crashes the exit routine of the suspend plugin will not be
executed, leaving the suspend FIFO behind and preventing the plugin load
on subsequent executions. This commit checks for pre-existence of the
suspend FIFO and tries to remove and re-create it.
---
profiles/input/suspend-dummy.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index 33b790a..43384c0 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -119,6 +119,22 @@ int suspend_init(suspend_event suspend, resume_event resume)
if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
int err = -errno;
+
+ if (err == -EEXIST) {
+ DBG("FIFO (%s) already exists, trying to remove",
+ HOG_SUSPEND_FIFO);
+
+ /* remove pre-existing FIFO and retry */
+ if (remove(HOG_SUSPEND_FIFO) < 0) {
+ err = -errno;
+ error("Failed to remove FIFO (%s): %s (%d)",
+ HOG_SUSPEND_FIFO, strerror(-err), -err);
+ return err;
+ }
+
+ return suspend_init(suspend, resume);
+ }
+
error("Can't create FIFO (%s): %s (%d)", HOG_SUSPEND_FIFO,
strerror(-err), -err);
return err;
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 3/4] hog: Fix error message formating
From: João Paulo Rechi Vita @ 2012-12-22 15:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: João Paulo Rechi Vita
In-Reply-To: <1356189162-11584-1-git-send-email-jprvita@openbossa.org>
---
profiles/input/suspend-dummy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index 14aabd0..33b790a 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -119,7 +119,7 @@ int suspend_init(suspend_event suspend, resume_event resume)
if (mkfifo(HOG_SUSPEND_FIFO, S_IRWXU) < 0) {
int err = -errno;
- error("Can't create FIFO (%s) : %s(%d)", HOG_SUSPEND_FIFO,
+ error("Can't create FIFO (%s): %s (%d)", HOG_SUSPEND_FIFO,
strerror(-err), -err);
return err;
}
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 2/4] hog: Add debug info when initializing the suspend plugin
From: João Paulo Rechi Vita @ 2012-12-22 15:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: João Paulo Rechi Vita
In-Reply-To: <1356189162-11584-1-git-send-email-jprvita@openbossa.org>
---
profiles/input/suspend-dummy.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/profiles/input/suspend-dummy.c b/profiles/input/suspend-dummy.c
index b43946d..14aabd0 100644
--- a/profiles/input/suspend-dummy.c
+++ b/profiles/input/suspend-dummy.c
@@ -124,6 +124,8 @@ int suspend_init(suspend_event suspend, resume_event resume)
return err;
}
+ DBG("Created suspend-dummy FIFO on %s", HOG_SUSPEND_FIFO);
+
ret = fifo_open();
if (ret < 0)
remove(HOG_SUSPEND_FIFO);
--
1.7.11.7
^ permalink raw reply related
* [PATCH BlueZ 1/4] hog: Fix message text and level when failing to load suspend plugin
From: João Paulo Rechi Vita @ 2012-12-22 15:12 UTC (permalink / raw)
To: linux-bluetooth; +Cc: João Paulo Rechi Vita
---
profiles/input/hog.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/profiles/input/hog.c b/profiles/input/hog.c
index b6ac61d..a9018f5 100644
--- a/profiles/input/hog.c
+++ b/profiles/input/hog.c
@@ -885,7 +885,8 @@ static int hog_init(void)
err = suspend_init(suspend_callback, resume_callback);
if (err < 0)
- DBG("Suspend: %s(%d)", strerror(-err), -err);
+ error("Loading suspend plugin failed: %s (%d)", strerror(-err),
+ -err);
else
suspend_supported = TRUE;
--
1.7.11.7
^ permalink raw reply related
* setting BT connection over RFCOMM
From: Kevin Wilson @ 2012-12-22 4:48 UTC (permalink / raw)
To: linux-bluetooth
Hi.
I am trying to establish BT connections between two PCs over RFCOMM serial port.
I ran on both:
sdptool add --channel=15 SP
then, on the server, I ran:
rfcomm listen rfcomm0 15
Waiting for connection on channel 15
and on the client, I ran:
hcitool scan
Scanning ...
00:23:4E:E5:70:3A n-0
rfcomm connect rfcomm0 00:23:4E:E5:70:3A
I got: (after a while)
Can't connect RFCOMM socket: Connection refused
shouldn't it work?
hcidump on the server gives this:
[root@n ~]\>hcidump
HCI sniffer - Bluetooth packet analyzer ver 2.2
device: hci0 snap_len: 1028 filter: 0xffffffffffffffff
> HCI Event: Connect Request (0x04) plen 10
bdaddr 00:02:72:AA:FB:94 class 0x500100 type ACL
< HCI Command: Accept Connection Request (0x01|0x0009) plen 7
bdaddr 00:02:72:AA:FB:94 role 0x00
Role: Master
> HCI Event: Command Status (0x0f) plen 4
Accept Connection Request (0x01|0x0009) status 0x00 ncmd 1
> HCI Event: Role Change (0x12) plen 8
status 0x00 bdaddr 00:02:72:AA:FB:94 role 0x00
Role: Master
> HCI Event: Connect Complete (0x03) plen 11
status 0x00 handle 12 bdaddr 00:02:72:AA:FB:94 type ACL encrypt 0x00
< HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
handle 12
> HCI Event: Command Status (0x0f) plen 4
Read Remote Supported Features (0x01|0x001b) status 0x00 ncmd 1
> HCI Event: Read Remote Supported Features (0x0b) plen 11
status 0x00 handle 12
Features: 0xff 0xff 0x8f 0xfe 0x9b 0xff 0x79 0x83
< HCI Command: Read Remote Extended Features (0x01|0x001c) plen 3
handle 12 page 1
> HCI Event: Command Status (0x0f) plen 4
Read Remote Extended Features (0x01|0x001c) status 0x00 ncmd 1
> HCI Event: Max Slots Change (0x1b) plen 3
handle 12 slots 5
> HCI Event: Read Remote Extended Features (0x23) plen 13
status 0x00 handle 12 page 1 max 1
Features: 0x01 0x00 0x00 0x00 0x00 0x00 0x00 0x00
< HCI Command: Remote Name Request (0x01|0x0019) plen 10
bdaddr 00:02:72:AA:FB:94 mode 2 clkoffset 0x0000
> HCI Event: Command Status (0x0f) plen 4
Remote Name Request (0x01|0x0019) status 0x00 ncmd 1
> HCI Event: Remote Name Req Complete (0x07) plen 255
status 0x00 bdaddr 00:02:72:AA:FB:94 name 'h-0'
> HCI Event: IO Capability Response (0x32) plen 9
bdaddr 00:02:72:AA:FB:94 capability 0x01 oob 0x00 auth 0x00
Capability: DisplayYesNo (OOB data not present)
Authentication: No Bonding (No MITM Protection)
> HCI Event: IO Capability Request (0x31) plen 6
bdaddr 00:02:72:AA:FB:94
< HCI Command: IO Capability Request Reply (0x01|0x002b) plen 9
bdaddr 00:02:72:AA:FB:94 capability 0x03 oob 0x00 auth 0x00
Capability: NoInputNoOutput (OOB data not present)
Authentication: No Bonding (No MITM Protection)
> HCI Event: Command Complete (0x0e) plen 10
IO Capability Request Reply (0x01|0x002b) ncmd 1
status 0x00 bdaddr 00:02:72:AA:FB:94
> HCI Event: User Confirmation Request (0x33) plen 10
bdaddr 00:02:72:AA:FB:94 passkey 215699
< HCI Command: User Confirmation Request Reply (0x01|0x002c) plen 6
bdaddr 00:02:72:AA:FB:94
> HCI Event: Command Complete (0x0e) plen 10
User Confirmation Request Reply (0x01|0x002c) ncmd 1
status 0x00 bdaddr 00:02:72:AA:FB:94
> HCI Event: Simple Pairing Complete (0x36) plen 7
status 0x00 bdaddr 00:02:72:AA:FB:94
> HCI Event: Link Key Notification (0x18) plen 23
bdaddr 00:02:72:AA:FB:94 key 774160EF3B5C52E709937AF2D82885F4 type 4
Type: Unauthenticated Combination Key
> HCI Event: Encrypt Change (0x08) plen 4
status 0x00 handle 12 encrypt 0x01
> ACL data: handle 12 flags 0x02 dlen 10
L2CAP(s): Info req: type 2
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x00b8
Enhanced Retransmission mode
Streaming mode
FCS Option
Fixed Channels
> ACL data: handle 12 flags 0x02 dlen 10
L2CAP(s): Info req: type 3
< ACL data: handle 12 flags 0x00 dlen 20
L2CAP(s): Info rsp: type 3 result 0
Fixed channel list 0x00000002
L2CAP Signalling Channel
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 3 scid 0x0040
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 1 status 0
Connection pending - No futher information available
< ACL data: handle 12 flags 0x00 dlen 10
L2CAP(s): Info req: type 2
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 16
L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x00b8
Enhanced Retransmission mode
Streaming mode
FCS Option
Fixed Channels
< ACL data: handle 12 flags 0x00 dlen 10
L2CAP(s): Info req: type 3
> ACL data: handle 12 flags 0x02 dlen 20
L2CAP(s): Info rsp: type 3 result 0
Fixed channel list 0x00000002
L2CAP Signalling Channel
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
Connection successful
< ACL data: handle 12 flags 0x00 dlen 27
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 15
MTU 1013
RFC 0x00 (Basic)
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 27
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 15
MTU 1013
RFC 0x00 (Basic)
< ACL data: handle 12 flags 0x00 dlen 18
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
MTU 1013
> ACL data: handle 12 flags 0x02 dlen 18
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 4
MTU 1013
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 8
L2CAP(d): cid 0x0040 len 4 [psm 3]
RFCOMM(s): SABM: cr 1 dlci 0 pf 1 ilen 0 fcs 0x1c
< ACL data: handle 12 flags 0x00 dlen 8
L2CAP(d): cid 0x0040 len 4 [psm 3]
RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7
> ACL data: handle 12 flags 0x02 dlen 18
L2CAP(d): cid 0x0040 len 14 [psm 3]
RFCOMM(s): PN CMD: cr 1 dlci 0 pf 0 ilen 10 fcs 0x70 mcc_len 8
dlci 2 frame_type 0 credit_flow 15 pri 7 ack_timer 0
frame_size 1008 max_retrans 0 credits 7
< ACL data: handle 12 flags 0x00 dlen 8
L2CAP(d): cid 0x0040 len 4 [psm 3]
RFCOMM(s): DM: cr 1 dlci 2 pf 1 ilen 0 fcs 0x73
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
< ACL data: handle 12 flags 0x00 dlen 12
L2CAP(s): Connect req: psm 1 scid 0x0041
> ACL data: handle 12 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0041 scid 0x0041 result 0 status 0
Connection successful
< ACL data: handle 12 flags 0x00 dlen 23
L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 11
RFC 0x00 (Basic)
> ACL data: handle 12 flags 0x02 dlen 23
L2CAP(s): Config req: dcid 0x0041 flags 0x00 clen 11
RFC 0x00 (Basic)
< ACL data: handle 12 flags 0x00 dlen 18
L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
MTU 672
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Connect req: psm 1 scid 0x0042
< ACL data: handle 12 flags 0x00 dlen 16
L2CAP(s): Connect rsp: dcid 0x0042 scid 0x0042 result 0 status 0
Connection successful
< ACL data: handle 12 flags 0x00 dlen 23
L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 11
RFC 0x00 (Basic)
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 18
L2CAP(s): Config rsp: scid 0x0041 flags 0x00 result 0 clen 4
MTU 672
< ACL data: handle 12 flags 0x00 dlen 24
L2CAP(d): cid 0x0041 len 20 [psm 1]
SDP SSA Req: tid 0x0 len 0xf
pat uuid-16 0x0100 (L2CAP)
max 65535
aid(s) 0x0000 - 0xffff
cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 23
L2CAP(s): Config req: dcid 0x0042 flags 0x00 clen 11
RFC 0x00 (Basic)
< ACL data: handle 12 flags 0x00 dlen 18
L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
MTU 672
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 18
L2CAP(s): Config rsp: scid 0x0042 flags 0x00 result 0 clen 4
MTU 672
> ACL data: handle 12 flags 0x02 dlen 676
L2CAP(d): cid 0x0041 len 672 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x29b
count 656
cont 08 E7 35 D5 50 90 02 00 00
< ACL data: handle 12 flags 0x00 dlen 32
L2CAP(d): cid 0x0041 len 28 [psm 1]
SDP SSA Req: tid 0x1 len 0x17
pat uuid-16 0x0100 (L2CAP)
max 65535
aid(s) 0x0000 - 0xffff
cont 08 E7 35 D5 50 90 02 00 00
> ACL data: handle 12 flags 0x02 dlen 24
L2CAP(d): cid 0x0042 len 20 [psm 1]
SDP SSA Req: tid 0x0 len 0xf
pat uuid-16 0x0100 (L2CAP)
max 65535
aid(s) 0x0000 - 0xffff
cont 00
< ACL data: handle 12 flags 0x00 dlen 676
L2CAP(d): cid 0x0042 len 672 [psm 1]
SDP SSA Rsp: tid 0x0 len 0x29b
count 656
cont 08 5A 28 D5 50 90 02 00 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 100
L2CAP(d): cid 0x0041 len 96 [psm 1]
SDP SSA Rsp: tid 0x1 len 0x5b
count 88
record #0
aid 0x0000 (SrvRecHndl)
uint 0x10000
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1112 (Headset AG) uuid-16 0x1203 (Audio) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xc > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1108 (Headset) uint 0x102 > >
aid 0x0100 (SrvName)
str "Headset Audio Gateway"
record #1
aid 0x0000 (SrvRecHndl)
uint 0x10001
aid 0x0001 (SrvClassIDList)
< uuid-16 0x111f (Handsfree AG) uuid-16 0x1203 (Audio) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xd > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x111e (Handsfree) uint 0x105 > >
aid 0x0100 (SrvName)
str "Hands-Free Audio Gateway"
aid 0x0301 (SuppDataStoresList)
uint 0x1
aid 0x0311 (SuppFeatures)
uint 0x0
record #2
aid 0x0000 (SrvRecHndl)
uint 0x10002
aid 0x0001 (SrvClassIDList)
< uuid-16 0x110c (AVRemTarget) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) uint 0x17 > <
uuid-16 0x0017 (AVCTP) uint 0x103 > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x110e (AVRemote) uint 0x103 > >
aid 0x0100 (SrvName)
str "AVRCP TG"
aid 0x0311 (SuppFeatures)
uint 0xf
record #3
aid 0x0000 (SrvRecHndl)
uint 0x10003
aid 0x0001 (SrvClassIDList)
< uuid-16 0x110e (AVRemote) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) uint 0x17 > <
uuid-16 0x0017 (AVCTP) uint 0x103 > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x110e (AVRemote) uint 0x100 > >
aid 0x0100 (SrvName)
str "AVRCP CT"
aid 0x0311 (SuppFeatures)
uint 0xf
record #4
aid 0x0000 (SrvRecHndl)
uint 0x10004
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1101 (SP) >
aid 0x0002 (SrvRecState)
uint 0x1234
aid 0x0003 (SrvID)
uuid-16 0x1101 (SP)
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xf > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0006 (LangBaseAttrIDList)
< uint 0x656e uint 0x6a uint 0x100 >
aid 0x0007 (SrvInfoTimeToLive)
uint 0xffff
aid 0x0008 (SrvAvail)
uint 0xff
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1101 (SP) uint 0x100 > >
aid 0x000a (DocURL)
url "http://www.bluez.org/"
aid 0x000b (ClientExeURL)
url "http://www.bluez.org/"
aid 0x000c (IconURL)
url "http://www.bluez.org/"
aid 0x0100 (SrvName)
str "Serial Port"
aid 0x0101 (SrvDesc)
str "COM Port"
aid 0x0102 (ProviderName)
str "BlueZ"
record #5
aid 0x0000 (SrvRecHndl)
uint 0x10005
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1105 (OBEXObjPush) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0x9 > <
uuid-16 0x0008 (OBEX) > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1105 (OBEXObjPush) uint 0x100 > >
aid 0x0100 (SrvName)
str "OBEX Object Push"
aid 0x0303 (SuppFormatsList)
< uint 0x1 uint 0x2 uint 0x3 uint 0x4 uint 0x5 uint
0x6 uint 0xff >
record #6
aid 0x0000 (SrvRecHndl)
uint 0x10006
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1106 (OBEXObjTrnsf) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xa > <
uuid-16 0x0008 (OBEX) > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1106 (OBEXObjTrnsf) uint 0x100 > >
aid 0x0100 (SrvName)
str "OBEX File Transfer"
cont 00
> ACL data: handle 12 flags 0x02 dlen 32
L2CAP(d): cid 0x0042 len 28 [psm 1]
SDP SSA Req: tid 0x1 len 0x17
pat uuid-16 0x0100 (L2CAP)
max 65535
aid(s) 0x0000 - 0xffff
cont 08 5A 28 D5 50 90 02 00 00
> ACL data: handle 12 flags 0x02 dlen 8
L2CAP(d): cid 0x0040 len 4 [psm 3]
RFCOMM(s): DISC: cr 1 dlci 0 pf 1 ilen 0 fcs 0xfd
< ACL data: handle 12 flags 0x00 dlen 8
L2CAP(d): cid 0x0040 len 4 [psm 3]
RFCOMM(s): UA: cr 1 dlci 0 pf 1 ilen 0 fcs 0xd7
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Disconn req: dcid 0x0040 scid 0x0040
< ACL data: handle 12 flags 0x00 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0040
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 1
< ACL data: handle 12 flags 0x00 dlen 129
L2CAP(d): cid 0x0042 len 125 [psm 1]
SDP SSA Rsp: tid 0x1 len 0x78
count 117
record #0
aid 0x0000 (SrvRecHndl)
uint 0x10000
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1112 (Headset AG) uuid-16 0x1203 (Audio) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xc > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1108 (Headset) uint 0x102 > >
aid 0x0100 (SrvName)
str "Headset Audio Gateway"
record #1
aid 0x0000 (SrvRecHndl)
uint 0x10001
aid 0x0001 (SrvClassIDList)
< uuid-16 0x111f (Handsfree AG) uuid-16 0x1203 (Audio) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xd > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x111e (Handsfree) uint 0x105 > >
aid 0x0100 (SrvName)
str "Hands-Free Audio Gateway"
aid 0x0301 (SuppDataStoresList)
uint 0x1
aid 0x0311 (SuppFeatures)
uint 0x0
record #2
aid 0x0000 (SrvRecHndl)
uint 0x10002
aid 0x0001 (SrvClassIDList)
< uuid-16 0x110c (AVRemTarget) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) uint 0x17 > <
uuid-16 0x0017 (AVCTP) uint 0x103 > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x110e (AVRemote) uint 0x103 > >
aid 0x0100 (SrvName)
str "AVRCP TG"
aid 0x0311 (SuppFeatures)
uint 0xf
record #3
aid 0x0000 (SrvRecHndl)
uint 0x10003
aid 0x0001 (SrvClassIDList)
< uuid-16 0x110e (AVRemote) >
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) uint 0x17 > <
uuid-16 0x0017 (AVCTP) uint 0x103 > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x110e (AVRemote) uint 0x100 > >
aid 0x0100 (SrvName)
str "AVRCP CT"
aid 0x0311 (SuppFeatures)
uint 0xf
record #4
aid 0x0000 (SrvRecHndl)
uint 0x10004
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1101 (SP) >
aid 0x0002 (SrvRecState)
uint 0x1234
aid 0x0003 (SrvID)
uuid-16 0x1101 (SP)
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xf > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0006 (LangBaseAttrIDList)
< uint 0x656e uint 0x6a uint 0x100 >
aid 0x0007 (SrvInfoTimeToLive)
uint 0xffff
aid 0x0008 (SrvAvail)
uint 0xff
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1101 (SP) uint 0x100 > >
aid 0x000a (DocURL)
url "http://www.bluez.org/"
aid 0x000b (ClientExeURL)
url "http://www.bluez.org/"
aid 0x000c (IconURL)
url "http://www.bluez.org/"
aid 0x0100 (SrvName)
str "Serial Port"
aid 0x0101 (SrvDesc)
str "COM Port"
aid 0x0102 (ProviderName)
str "BlueZ"
record #5
aid 0x0000 (SrvRecHndl)
uint 0x10005
aid 0x0001 (SrvClassIDList)
< uuid-16 0x1101 (SP) >
aid 0x0002 (SrvRecState)
uint 0x1234
aid 0x0003 (SrvID)
uuid-16 0x1101 (SP)
aid 0x0004 (ProtocolDescList)
< < uuid-16 0x0100 (L2CAP) > <
uuid-16 0x0003 (RFCOMM) uint 0xf > >
aid 0x0005 (BrwGrpList)
< uuid-16 0x1002 (PubBrwsGrp) >
aid 0x0006 (LangBaseAttrIDList)
< uint 0x656e uint 0x6a uint 0x100 >
aid 0x0007 (SrvInfoTimeToLive)
uint 0xffff
aid 0x0008 (SrvAvail)
uint 0xff
aid 0x0009 (BTProfileDescList)
< < uuid-16 0x1101 (SP) uint 0x100 > >
aid 0x000a (DocURL)
url "http://www.bluez.org/"
aid 0x000b (ClientExeURL)
url "http://www.bluez.org/"
aid 0x000c (IconURL)
url "http://www.bluez.org/"
aid 0x0100 (SrvName)
str "Serial Port"
aid 0x0101 (SrvDesc)
str "COM Port"
aid 0x0102 (ProviderName)
str "BlueZ"
cont 00
< ACL data: handle 12 flags 0x00 dlen 24
L2CAP(d): cid 0x0041 len 20 [psm 1]
SDP SSA Req: tid 0x2 len 0xf
pat uuid-16 0x1200 (PNPInfo)
max 65535
aid(s) 0x0000 - 0xffff
cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> ACL data: handle 12 flags 0x02 dlen 14
L2CAP(d): cid 0x0041 len 10 [psm 1]
SDP SSA Rsp: tid 0x2 len 0x5
count 2
cont 00
> ACL data: handle 12 flags 0x02 dlen 24
L2CAP(d): cid 0x0042 len 20 [psm 1]
SDP SSA Req: tid 0x2 len 0xf
pat uuid-16 0x1200 (PNPInfo)
max 65535
aid(s) 0x0000 - 0xffff
cont 00
< ACL data: handle 12 flags 0x00 dlen 14
L2CAP(d): cid 0x0042 len 10 [psm 1]
SDP SSA Rsp: tid 0x2 len 0x5
count 2
cont 00
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 1
< ACL data: handle 12 flags 0x00 dlen 12
L2CAP(s): Disconn req: dcid 0x0041 scid 0x0041
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0041 scid 0x0041
> ACL data: handle 12 flags 0x02 dlen 12
L2CAP(s): Disconn req: dcid 0x0042 scid 0x0042
< ACL data: handle 12 flags 0x00 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0042 scid 0x0042
> HCI Event: Number of Completed Packets (0x13) plen 5
handle 12 packets 2
> HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 12 reason 0x13
Reason: Remote User Terminated Connection
< HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7
bdaddr 00:02:72:AA:FB:94 all 0
> HCI Event: Command Complete (0x0e) plen 6
Delete Stored Link Key (0x03|0x0012) ncmd 1
status 0x00 deleted 0
rgs,
Kevin
^ permalink raw reply
* [PATCH] Bluetooth: Fix skb allocation check for A2MP
From: Gustavo Padovan @ 2012-12-22 3:22 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
vtable's method alloc_skb() needs to return a ERR_PTR in case of err and
not a NULL.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/a2mp.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/net/bluetooth/a2mp.c b/net/bluetooth/a2mp.c
index 0a2ec84..cd9410c 100644
--- a/net/bluetooth/a2mp.c
+++ b/net/bluetooth/a2mp.c
@@ -693,7 +693,13 @@ static void a2mp_chan_state_change_cb(struct l2cap_chan *chan, int state, int er
static struct sk_buff *a2mp_chan_alloc_skb_cb(struct l2cap_chan *chan,
unsigned long len, int nb)
{
- return bt_skb_alloc(len, GFP_KERNEL);
+ struct sk_buff *skb;
+
+ skb = bt_skb_alloc(len, GFP_KERNEL);
+ if (!skb)
+ return ERR_PTR(-ENOMEM);
+
+ return skb;
}
static struct l2cap_ops a2mp_chan_ops = {
--
1.8.0.2
^ permalink raw reply related
* [PATCH 12/25] bluetooth/l2cap: don't use [delayed_]work_pending()
From: Tejun Heo @ 2012-12-22 1:57 UTC (permalink / raw)
To: linux-kernel
Cc: Tejun Heo, Marcel Holtmann, Gustavo Padovan, Johan Hedberg,
linux-bluetooth
In-Reply-To: <1356141435-17340-1-git-send-email-tj@kernel.org>
There's no need to test whether a (delayed) work item in pending
before queueing, flushing or cancelling it. Most uses are unnecessary
and quite a few of them are buggy.
Reimplement l2cap_set_timer() such that it uses mod_delayed_work() or
schedule_delayed_work() depending on a new param @override and let the
users specify whether to override or not instead of using
delayed_work_pending().
Only compile tested.
Signed-off-by: Tejun Heo <tj@kernel.org>
Cc: Marcel Holtmann <marcel@holtmann.org>
Cc: Gustavo Padovan <gustavo@padovan.org>
Cc: Johan Hedberg <johan.hedberg@gmail.com>
Cc: linux-bluetooth@vger.kernel.org
---
Please let me know how this patch should be routed. I can take it
through the workqueue tree if necessary.
Thanks.
include/net/bluetooth/l2cap.h | 24 ++++++++++++++++--------
net/bluetooth/l2cap_core.c | 7 +++----
2 files changed, 19 insertions(+), 12 deletions(-)
diff --git a/include/net/bluetooth/l2cap.h b/include/net/bluetooth/l2cap.h
index 7588ef4..f12cbeb 100644
--- a/include/net/bluetooth/l2cap.h
+++ b/include/net/bluetooth/l2cap.h
@@ -718,17 +718,25 @@ static inline void l2cap_chan_unlock(struct l2cap_chan *chan)
}
static inline void l2cap_set_timer(struct l2cap_chan *chan,
- struct delayed_work *work, long timeout)
+ struct delayed_work *work, long timeout,
+ bool override)
{
+ bool was_pending;
+
BT_DBG("chan %p state %s timeout %ld", chan,
state_to_string(chan->state), timeout);
- /* If delayed work cancelled do not hold(chan)
- since it is already done with previous set_timer */
- if (!cancel_delayed_work(work))
- l2cap_chan_hold(chan);
+ /* @work should hold a reference to @chan */
+ l2cap_chan_hold(chan);
+
+ if (override)
+ was_pending = mod_delayed_work(system_wq, work, timeout);
+ else
+ was_pending = !schedule_delayed_work(work, timeout);
- schedule_delayed_work(work, timeout);
+ /* if @work was already pending, lose the extra ref */
+ if (was_pending)
+ l2cap_chan_put(chan);
}
static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
@@ -745,12 +753,12 @@ static inline bool l2cap_clear_timer(struct l2cap_chan *chan,
return ret;
}
-#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t))
+#define __set_chan_timer(c, t) l2cap_set_timer(c, &c->chan_timer, (t), true)
#define __clear_chan_timer(c) l2cap_clear_timer(c, &c->chan_timer)
#define __clear_retrans_timer(c) l2cap_clear_timer(c, &c->retrans_timer)
#define __clear_monitor_timer(c) l2cap_clear_timer(c, &c->monitor_timer)
#define __set_ack_timer(c) l2cap_set_timer(c, &chan->ack_timer, \
- msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO));
+ msecs_to_jiffies(L2CAP_DEFAULT_ACK_TO), true);
#define __clear_ack_timer(c) l2cap_clear_timer(c, &c->ack_timer)
static inline int __seq_offset(struct l2cap_chan *chan, __u16 seq1, __u16 seq2)
diff --git a/net/bluetooth/l2cap_core.c b/net/bluetooth/l2cap_core.c
index 2c78208..91db91c 100644
--- a/net/bluetooth/l2cap_core.c
+++ b/net/bluetooth/l2cap_core.c
@@ -246,10 +246,9 @@ static inline void l2cap_chan_set_err(struct l2cap_chan *chan, int err)
static void __set_retrans_timer(struct l2cap_chan *chan)
{
- if (!delayed_work_pending(&chan->monitor_timer) &&
- chan->retrans_timeout) {
+ if (chan->retrans_timeout) {
l2cap_set_timer(chan, &chan->retrans_timer,
- msecs_to_jiffies(chan->retrans_timeout));
+ msecs_to_jiffies(chan->retrans_timeout), false);
}
}
@@ -258,7 +257,7 @@ static void __set_monitor_timer(struct l2cap_chan *chan)
__clear_retrans_timer(chan);
if (chan->monitor_timeout) {
l2cap_set_timer(chan, &chan->monitor_timer,
- msecs_to_jiffies(chan->monitor_timeout));
+ msecs_to_jiffies(chan->monitor_timeout), true);
}
}
--
1.8.0.2
^ permalink raw reply related
* [PATCH] Bluetooth: Fix uuid output in debugfs
From: Gustavo Padovan @ 2012-12-21 22:58 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
The uuid should be printed in the CPU endianness and not in little-endian.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/hci_sysfs.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 55cceee..05b78c7 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -461,19 +461,18 @@ static const struct file_operations blacklist_fops = {
static void print_bt_uuid(struct seq_file *f, u8 *uuid)
{
- __be32 data0, data4;
- __be16 data1, data2, data3, data5;
-
- memcpy(&data0, &uuid[0], 4);
- memcpy(&data1, &uuid[4], 2);
- memcpy(&data2, &uuid[6], 2);
- memcpy(&data3, &uuid[8], 2);
- memcpy(&data4, &uuid[10], 4);
- memcpy(&data5, &uuid[14], 2);
-
- seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
- ntohl(data0), ntohs(data1), ntohs(data2), ntohs(data3),
- ntohl(data4), ntohs(data5));
+ u32 data0, data5;
+ u16 data1, data2, data3, data4;
+
+ data5 = le32_to_cpu(*(__le32 *)uuid);
+ data4 = le16_to_cpu(*(__le16 *)(uuid + 4));
+ data3 = le16_to_cpu(*(__le16 *)(uuid + 6));
+ data2 = le16_to_cpu(*(__le16 *)(uuid + 8));
+ data1 = le16_to_cpu(*(__le16 *)(uuid + 10));
+ data0 = le32_to_cpu(*(__le32 *)(uuid + 12));
+
+ seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.4x%.8x\n",
+ data0, data1, data2, data3, data4, data5);
}
static int uuids_show(struct seq_file *f, void *p)
--
1.8.0.2
^ permalink raw reply related
* [PATCH] Bluetooth: Fix uuid output in debugfs
From: Gustavo Padovan @ 2012-12-21 22:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
The uuid should be printed in the CPU endianness and not in little-endian.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/hci_sysfs.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 55cceee..05b78c7 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -461,19 +461,18 @@ static const struct file_operations blacklist_fops = {
static void print_bt_uuid(struct seq_file *f, u8 *uuid)
{
- __be32 data0, data4;
- __be16 data1, data2, data3, data5;
-
- memcpy(&data0, &uuid[0], 4);
- memcpy(&data1, &uuid[4], 2);
- memcpy(&data2, &uuid[6], 2);
- memcpy(&data3, &uuid[8], 2);
- memcpy(&data4, &uuid[10], 4);
- memcpy(&data5, &uuid[14], 2);
-
- seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
- ntohl(data0), ntohs(data1), ntohs(data2), ntohs(data3),
- ntohl(data4), ntohs(data5));
+ u32 data0, data5;
+ u16 data1, data2, data3, data4;
+
+ data5 = le32_to_cpu(*(__le32 *)uuid);
+ data4 = le16_to_cpu(*(__le16 *)(uuid + 4));
+ data3 = le16_to_cpu(*(__le16 *)(uuid + 6));
+ data2 = le16_to_cpu(*(__le16 *)(uuid + 8));
+ data1 = le16_to_cpu(*(__le16 *)(uuid + 10));
+ data0 = le32_to_cpu(*(__le32 *)(uuid + 12));
+
+ seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.4x%.8x\n",
+ data0, data1, data2, data3, data4, data5);
}
static int uuids_show(struct seq_file *f, void *p)
--
1.8.0.2
^ permalink raw reply related
* [PATCH] Bluetooth: Fix uuid output in debugfs
From: Gustavo Padovan @ 2012-12-21 22:57 UTC (permalink / raw)
To: linux-bluetooth; +Cc: Gustavo Padovan
From: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
The uuid should be printed in the CPU endianness and not in little-endian.
Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
---
net/bluetooth/hci_sysfs.c | 25 ++++++++++++-------------
1 file changed, 12 insertions(+), 13 deletions(-)
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 55cceee..05b78c7 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -461,19 +461,18 @@ static const struct file_operations blacklist_fops = {
static void print_bt_uuid(struct seq_file *f, u8 *uuid)
{
- __be32 data0, data4;
- __be16 data1, data2, data3, data5;
-
- memcpy(&data0, &uuid[0], 4);
- memcpy(&data1, &uuid[4], 2);
- memcpy(&data2, &uuid[6], 2);
- memcpy(&data3, &uuid[8], 2);
- memcpy(&data4, &uuid[10], 4);
- memcpy(&data5, &uuid[14], 2);
-
- seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.8x%.4x\n",
- ntohl(data0), ntohs(data1), ntohs(data2), ntohs(data3),
- ntohl(data4), ntohs(data5));
+ u32 data0, data5;
+ u16 data1, data2, data3, data4;
+
+ data5 = le32_to_cpu(*(__le32 *)uuid);
+ data4 = le16_to_cpu(*(__le16 *)(uuid + 4));
+ data3 = le16_to_cpu(*(__le16 *)(uuid + 6));
+ data2 = le16_to_cpu(*(__le16 *)(uuid + 8));
+ data1 = le16_to_cpu(*(__le16 *)(uuid + 10));
+ data0 = le32_to_cpu(*(__le32 *)(uuid + 12));
+
+ seq_printf(f, "%.8x-%.4x-%.4x-%.4x-%.4x%.8x\n",
+ data0, data1, data2, data3, data4, data5);
}
static int uuids_show(struct seq_file *f, void *p)
--
1.8.0.2
^ permalink raw reply related
* Re: [PATCH BlueZ 1/4] core: Use ERROR_INTERFACE instead of org.bluez.Error
From: Johan Hedberg @ 2012-12-21 22:17 UTC (permalink / raw)
To: Anderson Lizardo; +Cc: linux-bluetooth
In-Reply-To: <1356107103-18039-1-git-send-email-anderson.lizardo@openbossa.org>
Hi Lizardo,
On Fri, Dec 21, 2012, Anderson Lizardo wrote:
> This will simplify changing interface name later (e.g. adding
> versioning).
> ---
> src/adapter.c | 4 ++--
> src/agent.c | 5 +++--
> src/device.c | 2 +-
> 3 files changed, 6 insertions(+), 5 deletions(-)
All four patches have been applied, though I removed the comment about
versioning in this one as I don't think anything like that will be done
for the errors.
Johan
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox