* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Lucas De Marchi @ 2014-02-17 19:01 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org), kay.sievers,
gregkh
In-Reply-To: <6D43DF5A-CFA0-4867-8518-ECDA167BDB71@holtmann.org>
[ CC'ing Kay and Greg ]
On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
> Hi Lucas,
>
> > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> > driver) added the module alias to hci_vhci module so it's possible to
> > create the /dev/vhci node. However creating an alias without
> > specifying the minor doesn't allow us to create the node ahead,
> > triggerring module auto-load when it's first accessed.
> >
> > Starting with depmod from kmod 16 we started to warn if there's a
> > devname alias without specifying the major and minor.
> >
> > Let's do the same done for uhid, kvm, fuse and others, specifying a
> > fixed minor. In systems with systemd as the init the following will
> > happen: on early boot systemd will call "kmod static-nodes" to read
> > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> > first accessed these "dead" nodes will trigger the module loading.
> >
> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > ---
> > drivers/bluetooth/hci_vhci.c | 3 ++-
> > include/linux/miscdevice.h | 1 +
> > 2 files changed, 3 insertions(+), 1 deletion(-)
> >
> > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> > index 1ef6990..add1c6a 100644
> > --- a/drivers/bluetooth/hci_vhci.c
> > +++ b/drivers/bluetooth/hci_vhci.c
> > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
> > static struct miscdevice vhci_miscdev= {
> > .name = "vhci",
> > .fops = &vhci_fops,
> > - .minor = MISC_DYNAMIC_MINOR,
> > + .minor = VHCI_MINOR,
> > };
> >
> > static int __init vhci_init(void)
> > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
> > MODULE_VERSION(VERSION);
> > MODULE_LICENSE("GPL");
> > MODULE_ALIAS("devname:vhci");
> > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
> > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> > index 3737f72..846a317 100644
> > --- a/include/linux/miscdevice.h
> > +++ b/include/linux/miscdevice.h
> > @@ -48,6 +48,7 @@
> > #define LOOP_CTRL_MINOR 237
> > #define VHOST_NET_MINOR 238
> > #define UHID_MINOR 239
> > +#define VHCI_MINOR 240
> > #define MISC_DYNAMIC_MINOR 255
>
> you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
I haven't seen that. So, are we out of minors or.. can I use e.g.
142, 129 or the ones below 128?
Kay? Greg?
--
Lucas De Marchi
^ permalink raw reply
* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Kay Sievers @ 2014-02-17 20:03 UTC (permalink / raw)
To: Lucas De Marchi
Cc: Marcel Holtmann, Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org),
Greg Kroah-Hartman
In-Reply-To: <20140217190125.GA1851@intel.com>
On Mon, Feb 17, 2014 at 8:01 PM, Lucas De Marchi
<lucas.demarchi@intel.com> wrote:
> [ CC'ing Kay and Greg ]
>
> On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
>> Hi Lucas,
>>
>> > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
>> > driver) added the module alias to hci_vhci module so it's possible to
>> > create the /dev/vhci node. However creating an alias without
>> > specifying the minor doesn't allow us to create the node ahead,
>> > triggerring module auto-load when it's first accessed.
>> >
>> > Starting with depmod from kmod 16 we started to warn if there's a
>> > devname alias without specifying the major and minor.
>> >
>> > Let's do the same done for uhid, kvm, fuse and others, specifying a
>> > fixed minor. In systems with systemd as the init the following will
>> > happen: on early boot systemd will call "kmod static-nodes" to read
>> > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
>> > first accessed these "dead" nodes will trigger the module loading.
>> >
>> > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
>> > ---
>> > drivers/bluetooth/hci_vhci.c | 3 ++-
>> > include/linux/miscdevice.h | 1 +
>> > 2 files changed, 3 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
>> > index 1ef6990..add1c6a 100644
>> > --- a/drivers/bluetooth/hci_vhci.c
>> > +++ b/drivers/bluetooth/hci_vhci.c
>> > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
>> > static struct miscdevice vhci_miscdev= {
>> > .name = "vhci",
>> > .fops = &vhci_fops,
>> > - .minor = MISC_DYNAMIC_MINOR,
>> > + .minor = VHCI_MINOR,
>> > };
>> >
>> > static int __init vhci_init(void)
>> > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
>> > MODULE_VERSION(VERSION);
>> > MODULE_LICENSE("GPL");
>> > MODULE_ALIAS("devname:vhci");
>> > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
>> > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
>> > index 3737f72..846a317 100644
>> > --- a/include/linux/miscdevice.h
>> > +++ b/include/linux/miscdevice.h
>> > @@ -48,6 +48,7 @@
>> > #define LOOP_CTRL_MINOR 237
>> > #define VHOST_NET_MINOR 238
>> > #define UHID_MINOR 239
>> > +#define VHCI_MINOR 240
>> > #define MISC_DYNAMIC_MINOR 255
>>
>> you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
>
> I haven't seen that. So, are we out of minors or.. can I use e.g.
> 142, 129 or the ones below 128?
>
> Kay? Greg?
The minors should be able to carry 20 not 7 or 8 bits, the 32 bit
dev_t is split at 12:20.
Kay
^ permalink raw reply
* Help with AVDTP Connection accept
From: tony @ 2014-02-17 20:08 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 913 bytes --]
Hi,
I have BlueZ 4.101 and the daemon is running(log file
daemon.txt). I am trying to initiate an AVDTP connection from PTS suite.
But couldn’t get(or not sure how) the BlueZ side accept the connection.
From the log I can see the device reply with no Link key message. But
the connection gets dropped quickly.
1) From browsing the SDP entries (log :- sdptool.txt ), I don't see an
entry for A2DP. I ran the configure file with --enable audio and can see
from the daemon.txt audio plugin is loaded. Should I be adding SDP
record manually? How can I do that?
2) Am I right in understanding, I should be using test/simple-agent to
manage SSP? At present I don’t see anything. From forums, I understand,
the script would prompt for PIN or any security as required. But in my
case nothing happens. I have attached the btmon log as well.
Thank you for any pointers or suggestions.
Thanks,
Tony
[-- Attachment #2: btmon.txt --]
[-- Type: text/plain, Size: 16384 bytes --]
Bluetooth monitor ver 4.101
[hci0] 19:43:18.206988 = New Index: 00:1A:7D:DA:71:11 (BR/EDR,USB,hci0)
[hci0] 19:43:33.416132 < HCI Command: Reset (0x03|0x0003) plen 0
[hci0] 19:43:33.551962 > HCI Event: Command Complete (0x0e) plen 4
01 03 0c 00 ....
[hci0] 19:43:33.552145 < HCI Command: Read Local Supported Features (0x04|0x0003) plen 0
[hci0] 19:43:33.555026 > HCI Event: Command Complete (0x0e) plen 12
01 03 10 00 ff ff 8f fe db ff 5b 87 ..........[.
[hci0] 19:43:33.555257 < HCI Command: Read Local Version Information (0x04|0x0001) plen 0
[hci0] 19:43:33.557883 > HCI Event: Command Complete (0x0e) plen 12
01 01 10 00 06 bb 22 06 0a 00 bb 22 ......"...."
[hci0] 19:43:33.558084 < HCI Command: Read Buffer Size (0x04|0x0005) plen 0
[hci0] 19:43:33.561876 > HCI Event: Command Complete (0x0e) plen 11
01 05 10 00 36 01 40 0a 00 08 00 ....6.@....
[hci0] 19:43:33.562027 < HCI Command: Read BD ADDR (0x04|0x0009) plen 0
[hci0] 19:43:33.564840 > HCI Event: Command Complete (0x0e) plen 10
01 09 10 00 11 71 da 7d 1a 00 .....q.}..
[hci0] 19:43:33.564990 < HCI Command: Read Class of Device (0x03|0x0023) plen 0
[hci0] 19:43:33.567851 > HCI Event: Command Complete (0x0e) plen 7
01 23 0c 00 00 00 00 .#.....
[hci0] 19:43:33.568013 < HCI Command: Read Local Name (0x03|0x0014) plen 0
[hci0] 19:43:33.604743 > HCI Event: Command Complete (0x0e) plen 252
01 14 0c 00 43 53 52 38 35 31 30 20 41 31 30 00 ....CSR8510 A10.
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ............
[hci0] 19:43:33.604916 < HCI Command: Read Voice Setting (0x03|0x0025) plen 0
[hci0] 19:43:33.606730 > HCI Event: Command Complete (0x0e) plen 6
01 25 0c 00 60 00 .%..`.
[hci0] 19:43:33.606896 < HCI Command: Set Event Filter (0x03|0x0005) plen 1
00 .
[hci0] 19:43:33.609757 > HCI Event: Command Complete (0x0e) plen 4
01 05 0c 00 ....
[hci0] 19:43:33.609940 < HCI Command: Write Connection Accept Timeout (0x03|0x0016) plen 2
00 7d .}
[hci0] 19:43:33.612756 > HCI Event: Command Complete (0x0e) plen 4
01 16 0c 00 ....
[hci0] 19:43:33.612941 < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7
00 00 00 00 00 00 01 .......
[hci0] 19:43:33.615808 > HCI Event: Command Complete (0x0e) plen 6
01 12 0c 00 00 00 ......
[hci0] 19:43:33.615980 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
ff ff fb ff 07 f8 bf 3d .......=
[hci0] 19:43:33.622265 > HCI Event: Command Complete (0x0e) plen 4
01 01 0c 00 ....
[hci0] 19:43:33.622465 < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0
[hci0] 19:43:33.637295 > HCI Event: Command Complete (0x0e) plen 68
01 02 10 00 ff ff ff 03 fe ff ff ff ff ff ff ff ................
f3 0f e8 fe 3f f7 83 ff 1c 00 00 00 61 f7 ff ff ....?.......a...
7f 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 ....
[hci0] 19:43:33.637390 < HCI Command: Write Simple Pairing Mode (0x03|0x0056) plen 1
01 .
[hci0] 19:43:33.640306 > HCI Event: Command Complete (0x0e) plen 4
01 56 0c 00 .V..
[hci0] 19:43:33.640389 < HCI Command: Write Inquiry Mode (0x03|0x0045) plen 1
02 .
[hci0] 19:43:33.643335 > HCI Event: Command Complete (0x0e) plen 4
01 45 0c 00 .E..
[hci0] 19:43:33.643424 < HCI Command: Read Inquiry Response TX Power Level (0x03|0x0058) plen 0
[hci0] 19:43:33.646297 > HCI Event: Command Complete (0x0e) plen 5
01 58 0c 00 04 .X...
[hci0] 19:43:33.646394 < HCI Command: Read Local Extended Features (0x04|0x0004) plen 1
01 .
[hci0] 19:43:33.648982 > HCI Event: Command Complete (0x0e) plen 14
01 04 10 00 01 01 01 00 00 00 00 00 00 00 ..............
[hci0] 19:43:33.649144 < HCI Command: Write LE Host Supported (0x03|0x006d) plen 2
00 00 ..
[hci0] 19:43:33.654647 > HCI Event: Command Complete (0x0e) plen 4
01 6d 0c 00 .m..
[hci0] 19:43:33.654859 < HCI Command: Write Default Link Policy Settings (0x02|0x000f) plen 2
0f 00 ..
[hci0] 19:43:33.657554 > HCI Event: Command Complete (0x0e) plen 4
01 0f 08 00 ....
[hci0] 19:43:33.657784 < HCI Command: Read Local Extended Features (0x04|0x0004) plen 1
01 .
[hci0] 19:43:33.661143 > HCI Event: Command Complete (0x0e) plen 14
01 04 10 00 01 01 01 00 00 00 00 00 00 00 ..............
[hci0] 19:43:33.662535 < HCI Command: Read Local Extended Features (0x04|0x0004) plen 1
01 .
[hci0] 19:43:33.666142 > HCI Event: Command Complete (0x0e) plen 14
01 04 10 00 01 01 01 00 00 00 00 00 00 00 ..............
[hci0] 19:43:33.666279 < HCI Command: Write Page Timeout (0x03|0x0018) plen 2
00 20 .
[hci0] 19:43:33.671070 > HCI Event: Command Complete (0x0e) plen 4
01 18 0c 00 ....
[hci0] 19:43:33.671127 < HCI Command: Read Stored Link Key (0x03|0x000d) plen 7
00 00 00 00 00 00 01 .......
[hci0] 19:43:33.674217 > HCI Event: Command Complete (0x0e) plen 8
01 0d 0c 00 10 00 00 00 ........
[hci0] 19:43:33.674280 < HCI Command: Write Local Name (0x03|0x0013) plen 248
75 62 75 6e 74 75 2d 56 69 72 74 75 61 6c 42 6f ubuntu-VirtualBo
78 2d 30 00 00 00 00 00 00 00 00 00 00 00 00 00 x-0.............
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 ........
[hci0] 19:43:33.677219 > HCI Event: Command Complete (0x0e) plen 4
01 13 0c 00 ....
[hci0] 19:43:33.834766 < HCI Command: Set Event Mask (0x03|0x0001) plen 8
ff ff fb ff 07 f8 bf 3d .......=
[hci0] 19:43:33.853516 > HCI Event: Command Complete (0x0e) plen 4
01 01 0c 00 ....
[hci0] 19:43:33.853579 < HCI Command: Write Simple Pairing Mode (0x03|0x0056) plen 1
01 .
[hci0] 19:43:33.856412 > HCI Event: Command Complete (0x0e) plen 4
01 56 0c 00 .V..
[hci0] 19:43:33.856461 < HCI Command: Write Inquiry Mode (0x03|0x0045) plen 1
02 .
[hci0] 19:43:33.859494 > HCI Event: Command Complete (0x0e) plen 4
01 45 0c 00 .E..
[hci0] 19:43:33.859678 < HCI Command: Read Inquiry Response TX Power Level (0x03|0x0058) plen 0
[hci0] 19:43:33.862403 > HCI Event: Command Complete (0x0e) plen 5
01 58 0c 00 04 .X...
[hci0] 19:43:33.862498 < HCI Command: Write Default Link Policy Settings (0x02|0x000f) plen 2
0f 00 ..
[hci0] 19:43:33.866803 > HCI Event: Command Complete (0x0e) plen 4
01 0f 08 00 ....
[hci0] 19:43:33.866926 < HCI Command: Write Class of Device (0x03|0x0024) plen 3
00 01 42 ..B
[hci0] 19:43:33.870102 > HCI Event: Command Complete (0x0e) plen 4
01 24 0c 00 .$..
[hci0] 19:43:33.870207 < HCI Command: Write Scan Enable (0x03|0x001a) plen 1
02 .
[hci0] 19:43:33.873942 > HCI Event: Command Complete (0x0e) plen 4
01 1a 0c 00 ....
[hci0] 19:43:33.876508 < HCI Command: Read Local Name (0x03|0x0014) plen 0
[hci0] 19:43:33.918422 > HCI Event: Command Complete (0x0e) plen 252
01 14 0c 00 75 62 75 6e 74 75 2d 56 69 72 74 75 ....ubuntu-Virtu
61 6c 42 6f 78 2d 30 00 00 00 00 00 00 00 00 00 alBox-0.........
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 ............
[hci0] 19:43:33.918464 < HCI Command: Read Simple Pairing Mode (0x03|0x0055) plen 0
[hci0] 19:43:33.921419 > HCI Event: Command Complete (0x0e) plen 5
01 55 0c 00 01 .U...
[hci0] 19:43:33.941488 < HCI Command: Read Scan Enable (0x03|0x0019) plen 0
[hci0] 19:43:33.944040 > HCI Event: Command Complete (0x0e) plen 5
01 19 0c 00 02 .....
[hci0] 19:43:33.944133 < HCI Command: Write Extended Inquiry Response (0x03|0x0052) plen 241
00 14 09 75 62 75 6e 74 75 2d 56 69 72 74 75 61 ...ubuntu-Virtua
6c 42 6f 78 2d 30 02 0a 04 0d 03 2d 11 12 11 1f lBox-0.....-....
11 0c 11 0e 11 03 11 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
00 .
[hci0] 19:43:33.948993 > HCI Event: Command Complete (0x0e) plen 4
01 52 0c 00 .R..
[hci0] 19:45:24.002014 > HCI Event: Connect Request (0x04) plen 10
95 2e 07 dc 1b 00 1c 04 04 01 ..........
[hci0] 19:45:24.002286 < HCI Command: Accept Connection Request (0x01|0x0009) plen 7
95 2e 07 dc 1b 00 00 .......
[hci0] 19:45:24.010030 > HCI Event: Command Status (0x0f) plen 4
00 01 09 04 ....
[hci0] 19:45:24.183604 > HCI Event: Role Change (0x12) plen 8
00 95 2e 07 dc 1b 00 00 ........
[hci0] 19:45:24.198571 > HCI Event: Connect Complete (0x03) plen 11
00 48 00 95 2e 07 dc 1b 00 01 00 .H.........
[hci0] 19:45:24.198897 < HCI Command: Read Remote Supported Features (0x01|0x001b) plen 2
48 00 H.
[hci0] 19:45:24.200321 > HCI Event: Page Scan Repetition Mode Change (0x20) plen 7
95 2e 07 dc 1b 00 01 .......
[hci0] 19:45:24.205250 > HCI Event: Max Slots Change (0x1b) plen 3
48 00 05 H..
[hci0] 19:45:24.207249 > HCI Event: Command Status (0x0f) plen 4
00 00 1b 04 ....
[hci0] 19:45:24.220160 > HCI Event: Command Status (0x0f) plen 4
00 01 00 00 ....
[hci0] 19:45:24.226113 > HCI Event: Read Remote Supported Features (0x0b) plen 11
00 48 00 ff ff 8f 7e d8 1f 5b 87 .H....~..[.
[hci0] 19:45:24.226215 <
[-- Attachment #3: daemon.txt --]
[-- Type: text/plain, Size: 17876 bytes --]
tony@ubuntu-VirtualBox:~/work/git/dev-team/tony/btPTest/blueZgit/bluez/src$ sudo ./bluetoothd -nd | tee ~/Desktop/btDaemon.txt
bluetoothd[11556]: Bluetooth daemon 4.101
bluetoothd[11556]: src/main.c:parse_config() parsing main.conf
bluetoothd[11556]: src/main.c:parse_config() discovto=0
bluetoothd[11556]: src/main.c:parse_config() pairto=0
bluetoothd[11556]: src/main.c:parse_config() pageto=8192
bluetoothd[11556]: src/main.c:parse_config() auto_to=60
bluetoothd[11556]: src/main.c:parse_config() name=%h-%d
bluetoothd[11556]: src/main.c:parse_config() class=0x000100
bluetoothd[11556]: src/main.c:parse_config() Key file does not have key 'DeviceID'
bluetoothd[11556]: Starting SDP server
bluetoothd[11556]: src/plugin.c:plugin_init() Loading builtin plugins
bluetoothd[11556]: src/plugin.c:add_plugin() Loading pnat plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading audio plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading sap plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading input plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading serial plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading network plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading service plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading health plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading thermometer plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading alert plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading time plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading gatt_example plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading proximity plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading deviceinfo plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading hciops plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading mgmtops plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading formfactor plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading storage plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading adaptername plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading wiimote plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading maemo6 plugin
bluetoothd[11556]: src/plugin.c:add_plugin() Loading dbusoob plugin
bluetoothd[11556]: src/plugin.c:plugin_init() Loading plugins /usr/local/lib/bluetooth/plugins
bluetoothd[11556]: plugins/service.c:register_interface() path /org/bluez/11556/any
bluetoothd[11556]: plugins/service.c:register_interface() Registered interface org.bluez.Service on path /org/bluez/11556/any
bluetoothd[11556]: plugins/dbusoob.c:dbusoob_init() Setup dbusoob plugin
bluetoothd[11556]: plugins/maemo6.c:maemo6_init() init maemo6 plugin
bluetoothd[11556]: DIS cannot start: GATT is disabled
bluetoothd[11556]: Failed to init deviceinfo plugin
bluetoothd[11556]: proximity/main.c:proximity_init() GATT is disabled
bluetoothd[11556]: Failed to init proximity plugin
bluetoothd[11556]: time/main.c:time_init() GATT is disabled
bluetoothd[11556]: Failed to init time plugin
bluetoothd[11556]: alert/main.c:alert_init() GATT is disabled
bluetoothd[11556]: Failed to init alert plugin
bluetoothd[11556]: thermometer/main.c:thermometer_init() GATT is disabled
bluetoothd[11556]: Failed to init thermometer plugin
bluetoothd[11556]: health/hdp.c:hdp_manager_start() Starting Health manager
bluetoothd[11556]: network/manager.c:read_config() /usr/local/etc/bluetooth/network.conf: Key file does not have key 'DisableSecurity'
bluetoothd[11556]: network/manager.c:read_config() Config options: Security=true
bluetoothd[11556]: input/manager.c:input_manager_init() input.conf: Key file does not have key 'IdleTimeout'
bluetoothd[11556]: plugins/pnat.c:pnat_init() Setup Phonet AT (DUN) plugin
bluetoothd[11556]: plugins/hciops.c:hciops_init()
bluetoothd[11556]: plugins/gatt-example.c:gatt_example_init() GATT is disabled
bluetoothd[11556]: Failed to init gatt_example plugin
bluetoothd[11556]: plugins/hciops.c:hciops_setup()
bluetoothd[11556]: src/main.c:main() Entering main loop
bluetoothd[11556]: src/rfkill.c:rfkill_event() RFKILL event idx 0 type 2 op 0 soft 0 hard 0
bluetoothd[11556]: plugins/hciops.c:init_known_adapters()
bluetoothd[11556]: plugins/hciops.c:init_device() hci0
bluetoothd[11556]: Listening for HCI events on hci0
bluetoothd[11556]: plugins/hciops.c:init_device() child 11557 forked
bluetoothd[11556]: plugins/hciops.c:read_local_features_complete() Got features for hci0
bluetoothd[11556]: plugins/hciops.c:read_local_version_complete() Got version for hci0
bluetoothd[11556]: plugins/hciops.c:read_bd_addr_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:read_bd_addr_complete() Got bdaddr for hci0
bluetoothd[11556]: plugins/hciops.c:read_local_name_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:read_local_name_complete() Got name for hci0
bluetoothd[11556]: plugins/hciops.c:read_tx_power_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/hciops.c:read_local_ext_features_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:read_local_ext_features_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:child_exit() child 11557 exited
bluetoothd[11556]: HCI dev 0 up
bluetoothd[11556]: plugins/hciops.c:device_devup_setup() hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=1
bluetoothd[11556]: plugins/hciops.c:hciops_read_bdaddr() hci0
bluetoothd[11556]: src/sdpd-database.c:sdp_init_services_list()
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 0
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 0
bluetoothd[11556]: plugins/service.c:register_interface() path /org/bluez/11556/hci0
bluetoothd[11556]: plugins/service.c:register_interface() Registered interface org.bluez.Service on path /org/bluez/11556/hci0
bluetoothd[11556]: plugins/maemo6.c:mce_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=2
bluetoothd[11556]: network/manager.c:network_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=3
bluetoothd[11556]: network/server.c:server_register() Registered interface org.bluez.NetworkServer on path /org/bluez/11556/hci0
bluetoothd[11556]: serial/manager.c:proxy_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=4
bluetoothd[11556]: serial/proxy.c:proxy_register() Registered interface org.bluez.SerialProxyManager on path /org/bluez/11556/hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=5
bluetoothd[11556]: sap/manager.c:sap_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10000
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 64
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000112d-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001204-0000-1000-8000-00805f9
bluetoothd[11556]: sap/server.c:sap_server_register() Listen socket 0x14
bluetoothd[11556]: audio/manager.c:media_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=6
bluetoothd[11556]: audio/manager.c:audio_adapter_ref() 0xb79b5a58: ref=1
bluetoothd[11556]: audio/manager.c:headset_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: audio/manager.c:audio_adapter_ref() 0xb79b5a58: ref=2
bluetoothd[11556]: audio/manager.c:headset_server_init() audio.conf: Key file does not have key 'Master'
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10001
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 64
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001108-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001112-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001203-0000-1000-8000-00805f9
bluetoothd[11556]: audio/headset.c:headset_config_init() audio.conf: Key file does not have key 'SCORouting'
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10002
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 64
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000111e-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000111f-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001203-0000-1000-8000-00805f9
bluetoothd[11556]: audio/manager.c:a2dp_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: audio/manager.c:audio_adapter_ref() 0xb79b5a58: ref=3
bluetoothd[11556]: audio/a2dp.c:a2dp_register() audio.conf: Key file does not have key 'Disable'
bluetoothd[11556]: audio/avdtp.c:avdtp_init() audio.conf: Key file does not have key 'Master'
bluetoothd[11556]: audio/manager.c:avrcp_server_probe() path /org/bluez/11556/hci0
bluetoothd[11556]: audio/manager.c:audio_adapter_ref() 0xb79b5a58: ref=4
bluetoothd[11556]: audio/avrcp.c:avrcp_register() audio.conf: Key file does not have key 'Master'
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10003
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 64
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110c-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10004
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 64
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000017-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 0000110e-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Adding record with handle 0x10005
bluetoothd[11556]: plugins/hciops.c:hciops_add_uuid() hci0
bluetoothd[11556]: plugins/hciops.c:update_service_classes() hci0 value 66
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000003-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00000100-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001002-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001103-0000-1000-8000-00805f9
bluetoothd[11556]: src/sdpd-service.c:add_record_to_server() Record pattern UUID 00001201-0000-1000-8000-00805f9
bluetoothd[11556]: plugins/adaptername.c:adaptername_probe() Setting name 'ubuntu-VirtualBox-0' for device 'hci0'
bluetoothd[11556]: plugins/hciops.c:hciops_set_name() hci0, name ubuntu-VirtualBox-0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/formfactor.c:formfactor_probe() Setting 0x000100 for major/minor device class
bluetoothd[11556]: plugins/hciops.c:hciops_set_dev_class() hci0 major 1 minor 0
bluetoothd[11556]: plugins/hciops.c:hciops_unblock_device() hci0 dba 00:00:00:00:00:00
bluetoothd[11556]: plugins/hciops.c:hciops_load_keys() hci0 keys 0 debug_keys 0
bluetoothd[11556]: Unable to load keys to adapter_ops: Function not implemented (38)
bluetoothd[11556]: plugins/hciops.c:hciops_get_conn_list() hci0
bluetoothd[11556]: src/manager.c:btd_manager_register_adapter() Adapter /org/bluez/11556/hci0 registered
bluetoothd[11556]: src/adapter.c:btd_adapter_ref() 0xb79b4968: ref=7
bluetoothd[11556]: plugins/hciops.c:hciops_set_dev_class() hci0 major 1 minor 0
bluetoothd[11556]: plugins/maemo6.c:adapter_powered() adapter_powered called with 1
bluetoothd[11556]: plugins/maemo6.c:adapter_powered() Startup: reading MCE Bluetooth radio state...
bluetoothd[11556]: audio/manager.c:state_changed() /org/bluez/11556/hci0 powered on
bluetoothd[11556]: audio/telephony.c:telephony_init()
bluetoothd[11556]: audio/headset.c:telephony_ready_ind() Telephony plugin initialized
bluetoothd[11556]: audio/headset.c:print_ag_features() HFP AG features: "Ability to reject a call" "Enhanced call status" "Extended Error Result Codes"
bluetoothd[11556]: plugins/hciops.c:hciops_disable_cod_cache() hci0 cache_enable 1
bluetoothd[11556]: plugins/hciops.c:hciops_disable_cod_cache() hci0 current_cod 0x000000 wanted_cod 0x420100
bluetoothd[11556]: plugins/hciops.c:write_class() hci0 class 0x420100
bluetoothd[11556]: Adapter /org/bluez/11556/hci0 has been enabled
bluetoothd[11556]: plugins/hciops.c:hciops_set_discoverable() hci0 discoverable 0
bluetoothd[11556]: plugins/hciops.c:hciops_set_pairable() hci0 pairable 1
bluetoothd[11556]: src/adapter.c:btd_adapter_unref() 0xb79b4968: ref=6
bluetoothd[11556]: mce replied with an error: org.freedesktop.DBus.Error.ServiceUnknown, The name com.nokia.mce was not provided by any .service files
bluetoothd[11556]: plugins/hciops.c:read_local_ext_features_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:read_tx_power_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/hciops.c:read_local_name_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/hciops.c:read_simple_pairing_mode_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:update_ext_inquiry_response() hci0
bluetoothd[11556]: plugins/hciops.c:read_scan_complete() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:hciops_set_limited_discoverable() hci0 limited 0
bluetoothd[11556]: src/adapter.c:adapter_mode_changed() old 0x00 new 0x02
bluetoothd[11556]: src/adapter.c:set_mode_complete()
bluetoothd[11556]: src/adapter.c:register_agent() Agent registered for hci0 at :1.105:/test/agent
bluetoothd[11556]: plugins/hciops.c:conn_complete() status 0x00
bluetoothd[11556]: src/adapter.c:adapter_get_device() 00:1B:DC:07:2E:95
bluetoothd[11556]: src/adapter.c:adapter_create_device() 00:1B:DC:07:2E:95
bluetoothd[11556]: src/device.c:device_create() Creating device /org/bluez/11556/hci0/dev_00_1B_DC_07_2E_95
bluetoothd[11556]: src/device.c:btd_device_ref() 0xb79b9988: ref=1
bluetoothd[11556]: src/device.c:device_set_temporary() temporary 1
bluetoothd[11556]: plugins/hciops.c:remote_features_information() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:link_key_request() hci0 dba 00:1B:DC:07:2E:95
bluetoothd[11556]: plugins/hciops.c:get_auth_info() hci0 dba 00:1B:DC:07:2E:95
bluetoothd[11556]: plugins/hciops.c:link_key_request() kernel auth requirements = 0x04
bluetoothd[11556]: plugins/hciops.c:link_key_request() Matching key not found
bluetoothd[11556]: plugins/hciops.c:remote_name_information() hci0 status 0
bluetoothd[11556]: plugins/hciops.c:disconn_complete() handle 72 status 0x00
bluetoothd[11556]: src/event.c:btd_event_disconn_complete()
bluetoothd[11556]: src/adapter.c:adapter_remove_connection()
bluetoothd[11556]: src/adapter.c:adapter_remove_connection() Removing temporary device /org/bluez/11556/hci0/dev_00_1B_DC_07_2E_95
bluetoothd[11556]: src/device.c:device_remove() Removing device /org/bluez/11556/hci0/dev_00_1B_DC_07_2E_95
bluetoothd[11556]: src/device.c:btd_device_unref() 0xb79b9988: ref=0
bluetoothd[11556]: src/device.c:device_free() 0xb79b9988
bluetoothd[11556]: plugins/hciops.c:__get_remote_version() hci0 handle 72
[-- Attachment #4: sdptool.txt --]
[-- Type: text/plain, Size: 1745 bytes --]
Browsing FF:FF:FF:00:00:00 ...
Service Name: SIM Access Server
Service RecHandle: 0x10000
Service Class ID List:
"SIM Access" (0x112d)
"Generic Telephony" (0x1204)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 8
Profile Descriptor List:
"SIM Access" (0x112d)
Version: 0x0101
Service Name: Headset Audio Gateway
Service RecHandle: 0x10001
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 12
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0102
Service Name: Hands-Free Audio Gateway
Service RecHandle: 0x10002
Service Class ID List:
"Handsfree Audio Gateway" (0x111f)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 13
Profile Descriptor List:
"Handsfree" (0x111e)
Version: 0x0105
Service Name: AVRCP TG
Service RecHandle: 0x10003
Service Class ID List:
"AV Remote Target" (0x110c)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0104
Service Name: AVRCP CT
Service RecHandle: 0x10004
Service Class ID List:
"AV Remote" (0x110e)
Protocol Descriptor List:
"L2CAP" (0x0100)
PSM: 23
"AVCTP" (0x0017)
uint16: 0x103
Profile Descriptor List:
"AV Remote" (0x110e)
Version: 0x0100
Service Name: Dial-Up Networking
Service RecHandle: 0x10005
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100
[-- Attachment #5: simpleAgent.txt --]
[-- Type: text/plain, Size: 45 bytes --]
sudo ./simple-agent hci0
Agent registered
^ permalink raw reply
* Re: [PATCH] Bluetooth: hidp: make sure input buffers are big enough
From: Jiri Kosina @ 2014-02-17 20:21 UTC (permalink / raw)
To: Marcel Holtmann
Cc: Gustavo F. Padovan, David Herrmann, open list:HID CORE LAYER,
linux-bluetooth@vger.kernel.org development
In-Reply-To: <37F7D8DE-5861-4452-B2F7-00D5E5F952B0@holtmann.org>
On Mon, 17 Feb 2014, Marcel Holtmann wrote:
> >> Gustavo, what is your take on this please? I can take it through hid.git
> >> in case you don't have anything else queued for -rc2.
> >
> > ... ping?
> >
> > In case this doesn't get reacted upon by the end of the week, I am
> > inclined to take it through hid.git.
>
> take it through hid.git please.
Now applied, thanks.
--
Jiri Kosina
SUSE Labs
^ permalink raw reply
* Re: [RFC v8 01/10] Bluetooth: Create hci_stop_le_scan_req() helper
From: Andre Guedes @ 2014-02-17 20:23 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <FCE4645F-A564-46FC-AA36-A265BB9CC35C@holtmann.org>
Hi Marcel,
On Fri, 2014-02-14 at 14:21 -0800, Marcel Holtmann wrote:
> Hi Andre,
>
> > This patch moves stop LE scanning duplicate code to one single
> > place and reuses it. This will avoid more duplicate code in
> > upcoming patches.
> >
> > Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
> > ---
> > include/net/bluetooth/hci_core.h | 2 ++
> > net/bluetooth/hci_core.c | 14 ++++++++++----
> > net/bluetooth/mgmt.c | 6 +-----
> > 3 files changed, 13 insertions(+), 9 deletions(-)
> >
> > diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
> > index 92fa75f..8aff7f9 100644
> > --- a/include/net/bluetooth/hci_core.h
> > +++ b/include/net/bluetooth/hci_core.h
> > @@ -1212,4 +1212,6 @@ void hci_le_start_enc(struct hci_conn *conn, __le16 ediv, __u8 rand[8],
> > #define SCO_AIRMODE_CVSD 0x0000
> > #define SCO_AIRMODE_TRANSP 0x0003
> >
> > +void hci_stop_le_scan_req(struct hci_request *req);
> > +
>
> this should be close to hci_req_add definition.
I'll move it.
>
> > #endif /* __HCI_CORE_H */
> > diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
> > index e774669..6529f4a 100644
> > --- a/net/bluetooth/hci_core.c
> > +++ b/net/bluetooth/hci_core.c
> > @@ -3058,7 +3058,6 @@ static void le_scan_disable_work(struct work_struct *work)
> > {
> > struct hci_dev *hdev = container_of(work, struct hci_dev,
> > le_scan_disable.work);
> > - struct hci_cp_le_set_scan_enable cp;
> > struct hci_request req;
> > int err;
> >
> > @@ -3066,9 +3065,7 @@ static void le_scan_disable_work(struct work_struct *work)
> >
> > hci_req_init(&req, hdev);
> >
> > - memset(&cp, 0, sizeof(cp));
> > - cp.enable = LE_SCAN_DISABLE;
> > - hci_req_add(&req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> > + hci_stop_le_scan_req(&req);
> >
> > err = hci_req_run(&req, le_scan_disable_work_complete);
> > if (err)
> > @@ -4523,3 +4520,12 @@ static void hci_cmd_work(struct work_struct *work)
> > }
> > }
> > }
> > +
> > +void hci_stop_le_scan_req(struct hci_request *req)
> > +{
> > + struct hci_cp_le_set_scan_enable cp;
> > +
> > + memset(&cp, 0, sizeof(cp));
> > + cp.enable = LE_SCAN_DISABLE;
> > + hci_req_add(req, HCI_OP_LE_SET_SCAN_ENABLE, sizeof(cp), &cp);
> > +}
>
> Can we call this function hci_req_add_le_scan_disable. We should be explicit on what functions are doing. Helpers are just helpers.
I'll rename it.
BR,
Andre
^ permalink raw reply
* Re: [RFC v8 02/10] Bluetooth: Declare le_conn_failed in hci_core.h
From: Andre Guedes @ 2014-02-17 20:24 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <A8310D59-06E5-4AEF-AA28-13D421DA8323@holtmann.org>
Hi Marcel,
On Fri, Feb 14, 2014 at 7:26 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Andre,
>
>> This patch adds the "hci_" prefix to le_conn_failed() helper and
>> declares it in hci_core.h so it can be reused in hci_event.c.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>> include/net/bluetooth/hci_core.h | 2 ++
>> net/bluetooth/hci_conn.c | 4 ++--
>> net/bluetooth/hci_event.c | 6 +-----
>> 3 files changed, 5 insertions(+), 7 deletions(-)
>>
>> diff --git a/include/net/bluetooth/hci_core.h b/include/net/bluetooth/hci_core.h
>> index 8aff7f9..6e5062c 100644
>> --- a/include/net/bluetooth/hci_core.h
>> +++ b/include/net/bluetooth/hci_core.h
>> @@ -627,6 +627,8 @@ int hci_conn_switch_role(struct hci_conn *conn, __u8 role);
>>
>> void hci_conn_enter_active_mode(struct hci_conn *conn, __u8 force_active);
>>
>> +void hci_le_conn_failed(struct hci_conn *conn, u8 status);
>> +
>> /*
>> * hci_conn_get() and hci_conn_put() are used to control the life-time of an
>> * "hci_conn" object. They do not guarantee that the hci_conn object is running,
>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>> index 6797292..4f5029c 100644
>> --- a/net/bluetooth/hci_conn.c
>> +++ b/net/bluetooth/hci_conn.c
>> @@ -515,7 +515,7 @@ struct hci_dev *hci_get_route(bdaddr_t *dst, bdaddr_t *src)
>> EXPORT_SYMBOL(hci_get_route);
>>
>> /* This function requires the caller holds hdev->lock */
>> -static void le_conn_failed(struct hci_conn *conn, u8 status)
>> +void hci_le_conn_failed(struct hci_conn *conn, u8 status)
>> {
>> struct hci_dev *hdev = conn->hdev;
>>
>> @@ -545,7 +545,7 @@ static void create_le_conn_complete(struct hci_dev *hdev, u8 status)
>> if (!conn)
>> goto done;
>>
>> - le_conn_failed(conn, status);
>> + hci_le_conn_failed(conn, status);
>>
>> done:
>> hci_dev_unlock(hdev);
>> diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
>> index d2c6878..df58cde 100644
>> --- a/net/bluetooth/hci_event.c
>> +++ b/net/bluetooth/hci_event.c
>> @@ -3601,11 +3601,7 @@ static void hci_le_conn_complete_evt(struct hci_dev *hdev, struct sk_buff *skb)
>> }
>>
>> if (ev->status) {
>> - mgmt_connect_failed(hdev, &conn->dst, conn->type,
>> - conn->dst_type, ev->status);
>> - hci_proto_connect_cfm(conn, ev->status);
>> - conn->state = BT_CLOSED;
>> - hci_conn_del(conn);
>> + hci_le_conn_failed(conn, ev->status);
>> goto unlock;
>> }
>
> what is the difference between a le_conn_failed and a generic conn_failed.
BR/EDR connection failure doesn't have a pretty straightforward flow
(e.g see hci_conn_complete_evt) so I'm not 100% sure. It seems to me
LE_LINK and ACL_LINK connections might have similar connection failure
routine, however SCO_LINK doesn 't.
Moreover, in le_conn_failed() we'll always call
hci_update_background_scan() in order to keep background scan running
(see patch "[RFC v8 06/10] Bluetooth: Introduce LE auto connection
infrastructure").
> I am not sure about the naming of this function if we make it non-static. Not that I have a better name at the moment. So we might just go ahead with it.
I don't have a better name for this function also so I'll keep this
name. We can always rename it later if appropriate.
BR,
Andre
^ permalink raw reply
* Re: [RFC v8 04/10] Bluetooth: Remove unused function
From: Andre Guedes @ 2014-02-17 20:24 UTC (permalink / raw)
To: Marcel Holtmann; +Cc: bluez mailin list (linux-bluetooth@vger.kernel.org)
In-Reply-To: <B1545869-A8B6-4E2B-83AA-EF425235F79E@holtmann.org>
Hi Marcel,
On Fri, Feb 14, 2014 at 7:28 PM, Marcel Holtmann <marcel@holtmann.org> wrote:
> Hi Andre,
>
>> This patch removes hci_create_le_conn() since it is not used anymore.
>>
>> Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
>> ---
>> net/bluetooth/hci_conn.c | 32 --------------------------------
>> 1 file changed, 32 deletions(-)
>>
>> diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
>> index 166d7a5..70f4226 100644
>> --- a/net/bluetooth/hci_conn.c
>> +++ b/net/bluetooth/hci_conn.c
>> @@ -551,38 +551,6 @@ done:
>> hci_dev_unlock(hdev);
>> }
>>
>> -static int hci_create_le_conn(struct hci_conn *conn)
>> -{
>> - struct hci_dev *hdev = conn->hdev;
>> - struct hci_cp_le_create_conn cp;
>> - struct hci_request req;
>> - int err;
>> -
>> - hci_req_init(&req, hdev);
>> -
>> - memset(&cp, 0, sizeof(cp));
>> - cp.scan_interval = cpu_to_le16(hdev->le_scan_interval);
>> - cp.scan_window = cpu_to_le16(hdev->le_scan_window);
>> - bacpy(&cp.peer_addr, &conn->dst);
>> - cp.peer_addr_type = conn->dst_type;
>> - cp.own_address_type = conn->src_type;
>> - cp.conn_interval_min = cpu_to_le16(conn->le_conn_min_interval);
>> - cp.conn_interval_max = cpu_to_le16(conn->le_conn_max_interval);
>> - cp.supervision_timeout = __constant_cpu_to_le16(0x002a);
>> - cp.min_ce_len = __constant_cpu_to_le16(0x0000);
>> - cp.max_ce_len = __constant_cpu_to_le16(0x0000);
>> -
>> - hci_req_add(&req, HCI_OP_LE_CREATE_CONN, sizeof(cp), &cp);
>> -
>> - err = hci_req_run(&req, create_le_conn_complete);
>> - if (err) {
>> - hci_conn_del(conn);
>> - return err;
>> - }
>> -
>> - return 0;
>> -}
>> -
>> static void create_le_conn_req(struct hci_request *req, struct hci_conn *conn)
>> {
>> struct hci_cp_le_create_conn cp;
>
> not about this patch, but with my other comment, this one might be better renamed into hci_req_add_le_create_conn at some point. Not urgent though.
I'll rename it.
BR,
Andre
^ permalink raw reply
* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Greg KH @ 2014-02-17 22:52 UTC (permalink / raw)
To: Lucas De Marchi
Cc: Marcel Holtmann, Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org), kay.sievers
In-Reply-To: <20140217190125.GA1851@intel.com>
On Mon, Feb 17, 2014 at 04:01:25PM -0300, Lucas De Marchi wrote:
> [ CC'ing Kay and Greg ]
>
> On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
> > Hi Lucas,
> >
> > > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> > > driver) added the module alias to hci_vhci module so it's possible to
> > > create the /dev/vhci node. However creating an alias without
> > > specifying the minor doesn't allow us to create the node ahead,
> > > triggerring module auto-load when it's first accessed.
> > >
> > > Starting with depmod from kmod 16 we started to warn if there's a
> > > devname alias without specifying the major and minor.
> > >
> > > Let's do the same done for uhid, kvm, fuse and others, specifying a
> > > fixed minor. In systems with systemd as the init the following will
> > > happen: on early boot systemd will call "kmod static-nodes" to read
> > > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> > > first accessed these "dead" nodes will trigger the module loading.
> > >
> > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > ---
> > > drivers/bluetooth/hci_vhci.c | 3 ++-
> > > include/linux/miscdevice.h | 1 +
> > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> > > index 1ef6990..add1c6a 100644
> > > --- a/drivers/bluetooth/hci_vhci.c
> > > +++ b/drivers/bluetooth/hci_vhci.c
> > > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
> > > static struct miscdevice vhci_miscdev= {
> > > .name = "vhci",
> > > .fops = &vhci_fops,
> > > - .minor = MISC_DYNAMIC_MINOR,
> > > + .minor = VHCI_MINOR,
> > > };
> > >
> > > static int __init vhci_init(void)
> > > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
> > > MODULE_VERSION(VERSION);
> > > MODULE_LICENSE("GPL");
> > > MODULE_ALIAS("devname:vhci");
> > > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
> > > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> > > index 3737f72..846a317 100644
> > > --- a/include/linux/miscdevice.h
> > > +++ b/include/linux/miscdevice.h
> > > @@ -48,6 +48,7 @@
> > > #define LOOP_CTRL_MINOR 237
> > > #define VHOST_NET_MINOR 238
> > > #define UHID_MINOR 239
> > > +#define VHCI_MINOR 240
> > > #define MISC_DYNAMIC_MINOR 255
> >
> > you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
>
> I haven't seen that. So, are we out of minors or.. can I use e.g.
> 142, 129 or the ones below 128?
As Kay said, larger than 255 should be fine, but you should test this,
and also provide a patch for the devices.txt file to ensure you reserve
the minor number properly. Looks like someone forgot to do that for the
UHID minor number :(
thanks,
greg k-h
^ permalink raw reply
* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Lucas De Marchi @ 2014-02-17 22:52 UTC (permalink / raw)
To: Greg KH
Cc: Marcel Holtmann, Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org), kay.sievers
In-Reply-To: <20140217225209.GC17047@kroah.com>
On Mon, Feb 17, 2014 at 02:52:09PM -0800, Greg KH wrote:
> On Mon, Feb 17, 2014 at 04:01:25PM -0300, Lucas De Marchi wrote:
> > [ CC'ing Kay and Greg ]
> >
> > On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
> > > Hi Lucas,
> > >
> > > > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> > > > driver) added the module alias to hci_vhci module so it's possible to
> > > > create the /dev/vhci node. However creating an alias without
> > > > specifying the minor doesn't allow us to create the node ahead,
> > > > triggerring module auto-load when it's first accessed.
> > > >
> > > > Starting with depmod from kmod 16 we started to warn if there's a
> > > > devname alias without specifying the major and minor.
> > > >
> > > > Let's do the same done for uhid, kvm, fuse and others, specifying a
> > > > fixed minor. In systems with systemd as the init the following will
> > > > happen: on early boot systemd will call "kmod static-nodes" to read
> > > > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> > > > first accessed these "dead" nodes will trigger the module loading.
> > > >
> > > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > > ---
> > > > drivers/bluetooth/hci_vhci.c | 3 ++-
> > > > include/linux/miscdevice.h | 1 +
> > > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> > > > index 1ef6990..add1c6a 100644
> > > > --- a/drivers/bluetooth/hci_vhci.c
> > > > +++ b/drivers/bluetooth/hci_vhci.c
> > > > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
> > > > static struct miscdevice vhci_miscdev= {
> > > > .name = "vhci",
> > > > .fops = &vhci_fops,
> > > > - .minor = MISC_DYNAMIC_MINOR,
> > > > + .minor = VHCI_MINOR,
> > > > };
> > > >
> > > > static int __init vhci_init(void)
> > > > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
> > > > MODULE_VERSION(VERSION);
> > > > MODULE_LICENSE("GPL");
> > > > MODULE_ALIAS("devname:vhci");
> > > > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
> > > > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> > > > index 3737f72..846a317 100644
> > > > --- a/include/linux/miscdevice.h
> > > > +++ b/include/linux/miscdevice.h
> > > > @@ -48,6 +48,7 @@
> > > > #define LOOP_CTRL_MINOR 237
> > > > #define VHOST_NET_MINOR 238
> > > > #define UHID_MINOR 239
> > > > +#define VHCI_MINOR 240
> > > > #define MISC_DYNAMIC_MINOR 255
> > >
> > > you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
> >
> > I haven't seen that. So, are we out of minors or.. can I use e.g.
> > 142, 129 or the ones below 128?
>
> As Kay said, larger than 255 should be fine, but you should test this,
> and also provide a patch for the devices.txt file to ensure you reserve
> the minor number properly. Looks like someone forgot to do that for the
> UHID minor number :(
yep, doing that now.
Do you prefer 256 or that I fill a gap by using e.g. 196?
--
Lucas De Marchi
^ permalink raw reply
* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Lucas De Marchi @ 2014-02-17 22:54 UTC (permalink / raw)
To: Greg KH
Cc: Marcel Holtmann, Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org), kay.sievers
In-Reply-To: <20140217225244.GD1851@intel.com>
On Mon, Feb 17, 2014 at 07:52:44PM -0300, Lucas De Marchi wrote:
> On Mon, Feb 17, 2014 at 02:52:09PM -0800, Greg KH wrote:
> > On Mon, Feb 17, 2014 at 04:01:25PM -0300, Lucas De Marchi wrote:
> > > [ CC'ing Kay and Greg ]
> > >
> > > On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
> > > > Hi Lucas,
> > > >
> > > > > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> > > > > driver) added the module alias to hci_vhci module so it's possible to
> > > > > create the /dev/vhci node. However creating an alias without
> > > > > specifying the minor doesn't allow us to create the node ahead,
> > > > > triggerring module auto-load when it's first accessed.
> > > > >
> > > > > Starting with depmod from kmod 16 we started to warn if there's a
> > > > > devname alias without specifying the major and minor.
> > > > >
> > > > > Let's do the same done for uhid, kvm, fuse and others, specifying a
> > > > > fixed minor. In systems with systemd as the init the following will
> > > > > happen: on early boot systemd will call "kmod static-nodes" to read
> > > > > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> > > > > first accessed these "dead" nodes will trigger the module loading.
> > > > >
> > > > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > > > ---
> > > > > drivers/bluetooth/hci_vhci.c | 3 ++-
> > > > > include/linux/miscdevice.h | 1 +
> > > > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > > > >
> > > > > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> > > > > index 1ef6990..add1c6a 100644
> > > > > --- a/drivers/bluetooth/hci_vhci.c
> > > > > +++ b/drivers/bluetooth/hci_vhci.c
> > > > > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
> > > > > static struct miscdevice vhci_miscdev= {
> > > > > .name = "vhci",
> > > > > .fops = &vhci_fops,
> > > > > - .minor = MISC_DYNAMIC_MINOR,
> > > > > + .minor = VHCI_MINOR,
> > > > > };
> > > > >
> > > > > static int __init vhci_init(void)
> > > > > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
> > > > > MODULE_VERSION(VERSION);
> > > > > MODULE_LICENSE("GPL");
> > > > > MODULE_ALIAS("devname:vhci");
> > > > > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
> > > > > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> > > > > index 3737f72..846a317 100644
> > > > > --- a/include/linux/miscdevice.h
> > > > > +++ b/include/linux/miscdevice.h
> > > > > @@ -48,6 +48,7 @@
> > > > > #define LOOP_CTRL_MINOR 237
> > > > > #define VHOST_NET_MINOR 238
> > > > > #define UHID_MINOR 239
> > > > > +#define VHCI_MINOR 240
> > > > > #define MISC_DYNAMIC_MINOR 255
> > > >
> > > > you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
> > >
> > > I haven't seen that. So, are we out of minors or.. can I use e.g.
> > > 142, 129 or the ones below 128?
> >
> > As Kay said, larger than 255 should be fine, but you should test this,
> > and also provide a patch for the devices.txt file to ensure you reserve
> > the minor number properly. Looks like someone forgot to do that for the
> > UHID minor number :(
>
> yep, doing that now.
>
> Do you prefer 256 or that I fill a gap by using e.g. 196?
oops, I mean 197
--
Lucas De Marchi
^ permalink raw reply
* Re: [PATCH] Bluetooth: allocate static minor for vhci
From: Greg KH @ 2014-02-18 0:43 UTC (permalink / raw)
To: Lucas De Marchi
Cc: Marcel Holtmann, Lucas De Marchi,
bluez mailin list (linux-bluetooth@vger.kernel.org), kay.sievers
In-Reply-To: <20140217225432.GE1851@intel.com>
On Mon, Feb 17, 2014 at 07:54:32PM -0300, Lucas De Marchi wrote:
> On Mon, Feb 17, 2014 at 07:52:44PM -0300, Lucas De Marchi wrote:
> > On Mon, Feb 17, 2014 at 02:52:09PM -0800, Greg KH wrote:
> > > On Mon, Feb 17, 2014 at 04:01:25PM -0300, Lucas De Marchi wrote:
> > > > [ CC'ing Kay and Greg ]
> > > >
> > > > On Mon, Feb 17, 2014 at 08:34:32AM -0800, Marcel Holtmann wrote:
> > > > > Hi Lucas,
> > > > >
> > > > > > Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> > > > > > driver) added the module alias to hci_vhci module so it's possible to
> > > > > > create the /dev/vhci node. However creating an alias without
> > > > > > specifying the minor doesn't allow us to create the node ahead,
> > > > > > triggerring module auto-load when it's first accessed.
> > > > > >
> > > > > > Starting with depmod from kmod 16 we started to warn if there's a
> > > > > > devname alias without specifying the major and minor.
> > > > > >
> > > > > > Let's do the same done for uhid, kvm, fuse and others, specifying a
> > > > > > fixed minor. In systems with systemd as the init the following will
> > > > > > happen: on early boot systemd will call "kmod static-nodes" to read
> > > > > > /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> > > > > > first accessed these "dead" nodes will trigger the module loading.
> > > > > >
> > > > > > Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> > > > > > ---
> > > > > > drivers/bluetooth/hci_vhci.c | 3 ++-
> > > > > > include/linux/miscdevice.h | 1 +
> > > > > > 2 files changed, 3 insertions(+), 1 deletion(-)
> > > > > >
> > > > > > diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
> > > > > > index 1ef6990..add1c6a 100644
> > > > > > --- a/drivers/bluetooth/hci_vhci.c
> > > > > > +++ b/drivers/bluetooth/hci_vhci.c
> > > > > > @@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
> > > > > > static struct miscdevice vhci_miscdev= {
> > > > > > .name = "vhci",
> > > > > > .fops = &vhci_fops,
> > > > > > - .minor = MISC_DYNAMIC_MINOR,
> > > > > > + .minor = VHCI_MINOR,
> > > > > > };
> > > > > >
> > > > > > static int __init vhci_init(void)
> > > > > > @@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
> > > > > > MODULE_VERSION(VERSION);
> > > > > > MODULE_LICENSE("GPL");
> > > > > > MODULE_ALIAS("devname:vhci");
> > > > > > +MODULE_ALIAS_MISCDEV(VHCI_MINOR);
> > > > > > diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
> > > > > > index 3737f72..846a317 100644
> > > > > > --- a/include/linux/miscdevice.h
> > > > > > +++ b/include/linux/miscdevice.h
> > > > > > @@ -48,6 +48,7 @@
> > > > > > #define LOOP_CTRL_MINOR 237
> > > > > > #define VHOST_NET_MINOR 238
> > > > > > #define UHID_MINOR 239
> > > > > > +#define VHCI_MINOR 240
> > > > > > #define MISC_DYNAMIC_MINOR 255
> > > > >
> > > > > you have read Documentation/devices.txt where it states that 240-254 is reserved for local use.
> > > >
> > > > I haven't seen that. So, are we out of minors or.. can I use e.g.
> > > > 142, 129 or the ones below 128?
> > >
> > > As Kay said, larger than 255 should be fine, but you should test this,
> > > and also provide a patch for the devices.txt file to ensure you reserve
> > > the minor number properly. Looks like someone forgot to do that for the
> > > UHID minor number :(
> >
> > yep, doing that now.
> >
> > Do you prefer 256 or that I fill a gap by using e.g. 196?
>
> oops, I mean 197
197 is great to use, just make sure that no one else is using it
in-kernel at the moment. It looks like I need to update the file with
some more #defines to catch up with what is being used at the moment.
thanks,
greg k-h
^ permalink raw reply
* [PATCH v2] Bluetooth: allocate static minor for vhci
From: Lucas De Marchi @ 2014-02-18 5:19 UTC (permalink / raw)
To: linux-bluetooth
Cc: Marcel Holtmann, Greg Kroah-Hartman, kay.sievers, linux-kernel,
Lucas De Marchi
From: Lucas De Marchi <lucas.demarchi@intel.com>
Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
driver) added the module alias to hci_vhci module so it's possible to
create the /dev/vhci node. However creating an alias without
specifying the minor doesn't allow us to create the node ahead,
triggerring module auto-load when it's first accessed.
Starting with depmod from kmod 16 we started to warn if there's a
devname alias without specifying the major and minor.
Let's do the same done for uhid, kvm, fuse and others, specifying a
fixed minor. In systems with systemd as the init the following will
happen: on early boot systemd will call "kmod static-nodes" to read
/lib/modules/$(uname -r)/modules.devname and then create the nodes. When
first accessed these "dead" nodes will trigger the module loading.
Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
---
Changes from v1:
- use minor=137, since 240 is reserved for local use
We talked about using 197, but that's being used by pxa3xx-gcu, too.
Documentation/devices.txt | 1 +
drivers/bluetooth/hci_vhci.c | 3 ++-
include/linux/miscdevice.h | 1 +
3 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/Documentation/devices.txt b/Documentation/devices.txt
index 10378cc..04356f5 100644
--- a/Documentation/devices.txt
+++ b/Documentation/devices.txt
@@ -353,6 +353,7 @@ Your cooperation is appreciated.
133 = /dev/exttrp External device trap
134 = /dev/apm_bios Advanced Power Management BIOS
135 = /dev/rtc Real Time Clock
+ 137 = /dev/vhci Bluetooth virtual HCI driver
139 = /dev/openprom SPARC OpenBoot PROM
140 = /dev/relay8 Berkshire Products Octal relay card
141 = /dev/relay16 Berkshire Products ISO-16 relay card
diff --git a/drivers/bluetooth/hci_vhci.c b/drivers/bluetooth/hci_vhci.c
index 1ef6990..add1c6a 100644
--- a/drivers/bluetooth/hci_vhci.c
+++ b/drivers/bluetooth/hci_vhci.c
@@ -359,7 +359,7 @@ static const struct file_operations vhci_fops = {
static struct miscdevice vhci_miscdev= {
.name = "vhci",
.fops = &vhci_fops,
- .minor = MISC_DYNAMIC_MINOR,
+ .minor = VHCI_MINOR,
};
static int __init vhci_init(void)
@@ -385,3 +385,4 @@ MODULE_DESCRIPTION("Bluetooth virtual HCI driver ver " VERSION);
MODULE_VERSION(VERSION);
MODULE_LICENSE("GPL");
MODULE_ALIAS("devname:vhci");
+MODULE_ALIAS_MISCDEV(VHCI_MINOR);
diff --git a/include/linux/miscdevice.h b/include/linux/miscdevice.h
index 3737f72..7bb6148 100644
--- a/include/linux/miscdevice.h
+++ b/include/linux/miscdevice.h
@@ -23,6 +23,7 @@
#define TEMP_MINOR 131 /* Temperature Sensor */
#define RTC_MINOR 135
#define EFI_RTC_MINOR 136 /* EFI Time services */
+#define VHCI_MINOR 137
#define SUN_OPENPROM_MINOR 139
#define DMAPI_MINOR 140 /* DMAPI */
#define NVRAM_MINOR 144
--
1.9.0
^ permalink raw reply related
* Bluetooth: Help need on RegisterPlayer in simpleagent python script on bluez 5.7
From: Pradeep Vivekanandan @ 2014-02-18 6:10 UTC (permalink / raw)
To: linux-bluetooth@vger.kernel.org
Hi,
I am running the bluetoothd in bluez 5.7.
I have execute test folder scripts i python.
For getting metadata information i run simple-player python script.
But i got the below error could please help on that how to get metadata information.
error:
File "./simple-player", line 149, in <module>
media.RegisterPlayer(dbus.ObjectPath(path), player.properties)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: Method "RegisterPlayer" with signature "oa{sv}" on interface "org.bluez.Media1" doesn't exist
Also I could not found the method RegisterPlayer in org.bluez.Media1 using d-feet.
Thanks and Regards,
Pradeep V
end
::DISCLAIMER::
----------------------------------------------------------------------------------------------------------------------------------------------------
The contents of this e-mail and any attachment(s) are confidential and intended for the named recipient(s) only.
E-mail transmission is not guaranteed to be secure or error-free as information could be intercepted, corrupted,
lost, destroyed, arrive late or incomplete, or may contain viruses in transmission. The e mail and its contents
(with or without referred errors) shall therefore not attach any liability on the originator or HCL or its affiliates.
Views or opinions, if any, presented in this email are solely those of the author and may not necessarily reflect the
views or opinions of HCL or its affiliates. Any form of reproduction, dissemination, copying, disclosure, modification,
distribution and / or publication of this message without the prior written consent of authorized representative of
HCL is strictly prohibited. If you have received this email in error please delete it and notify the sender immediately.
Before opening any email and/or attachments, please check them for viruses and other defects.
----------------------------------------------------------------------------------------------------------------------------------------------------
^ permalink raw reply
* Re: [PATCH v2] Bluetooth: allocate static minor for vhci
From: Marcel Holtmann @ 2014-02-18 7:01 UTC (permalink / raw)
To: Lucas De Marchi
Cc: bluez mailin list (linux-bluetooth@vger.kernel.org),
Greg Kroah-Hartman, Kay Sievers, linux-kernel, Lucas De Marchi
In-Reply-To: <1392700766-4374-1-git-send-email-lucas.demarchi@intel.com>
Hi Lucas,
> Commit bfacbb9 (Bluetooth: Use devname:vhci module alias for virtual HCI
> driver) added the module alias to hci_vhci module so it's possible to
> create the /dev/vhci node. However creating an alias without
> specifying the minor doesn't allow us to create the node ahead,
> triggerring module auto-load when it's first accessed.
>
> Starting with depmod from kmod 16 we started to warn if there's a
> devname alias without specifying the major and minor.
>
> Let's do the same done for uhid, kvm, fuse and others, specifying a
> fixed minor. In systems with systemd as the init the following will
> happen: on early boot systemd will call "kmod static-nodes" to read
> /lib/modules/$(uname -r)/modules.devname and then create the nodes. When
> first accessed these "dead" nodes will trigger the module loading.
>
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
> ---
>
> Changes from v1:
> - use minor=137, since 240 is reserved for local use
>
> We talked about using 197, but that's being used by pxa3xx-gcu, too.
looks fine to me. If Kay and/or Greg want to ack it, then I take it through bluetooth-next tree.
Regards
Marcel
^ permalink raw reply
* [RFC v8] doc: Add management commands and events for privacy support
From: Marcel Holtmann @ 2014-02-18 7:24 UTC (permalink / raw)
To: linux-bluetooth
---
doc/mgmt-api.txt | 143 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 143 insertions(+)
diff --git a/doc/mgmt-api.txt b/doc/mgmt-api.txt
index 5a8073f6493e..e5c13f75dc1a 100644
--- a/doc/mgmt-api.txt
+++ b/doc/mgmt-api.txt
@@ -213,6 +213,7 @@ Read Controller Information Command
11 Advertising
12 Secure Connections
13 Debug Keys
+ 14 Privacy
This command generates a Command Complete event on success or
a Command Status event on failure.
@@ -730,6 +731,17 @@ Load Long Term Keys Command
again upon the receiption of New Long Term Key events since the
kernel updates its list automatically.
+ Possible values for the Address_Type parameter:
+ 0 Reserved (not in use)
+ 1 LE Public
+ 2 LE Random
+
+ The provided Address and Address_Type are the identity of
+ a device. So either its public address or static random address.
+
+ Unresolvable random addresses and resolvable random addresses are
+ not valid and will be rejected.
+
Currently defined Key_Type values are:
0x00 Unauthenticated key
@@ -1456,6 +1468,15 @@ Set Static Address Command
The special BDADDR_ANY address (00:00:00:00:00:00) can be used
to disable the static address.
+ When a controller has a public address (which is required for
+ all dual-mode controllers), this address is not used. Only when
+ the controller information reports BDADDR_ANY (00:00:00:00:00:00),
+ it is required to configure a static address first.
+
+ If privacy mode is enabled and the controller is single mode
+ LE only without a public address, the static random address is
+ used as identity address.
+
This command generates a Command Complete event on success or a
Command Status event on failure.
@@ -1545,6 +1566,76 @@ Set Debug Keys Command
Invalid Index
+Set Privacy Command
+===================
+
+ Command Code: 0x002F
+ Controller Index: <controller id>
+ Command Parameters: Privacy (1 Octet)
+ Identity_Resolving_Key (16 Octets)
+ Return Parameters: Current_Settings (4 Octets)
+
+ This command is used to enable Low Energy Privacy feature using
+ resolvable private addresses.
+
+ The value 0x00 disables privacy mode, the value 0x01 enables
+ privacy mode.
+
+ When the controller has a public address (mandatory for dual-mode
+ controllers) it is used as identity address. In case the controller
+ is single mode LE only without a public address, it is required
+ to configure a static random andress first. The privacy mode can
+ only be enabled when an identity address is available.
+
+ The Identity_Resolving_Key is the local key assigned for the local
+ resolvable private address.
+
+ Possible errors: Busy
+ Not Supported
+ Invalid Parameters
+ Invalid Index
+
+
+Load Identity Resolving Keys Command
+====================================
+
+ Command Code: 0x0030
+ Controller Index: <controller id>
+ Command Parameters: Key_Count (2 Octets)
+ Key1 {
+ Address (6 Octets)
+ Address_Type (1 Octet)
+ Value (16 Octets)
+ }
+ Key2 { }
+ ...
+ Return Parameters:
+
+ This command is used to feed the kernel with currently known
+ identity resolving keys. The command does not need to be called
+ again upon the receiption of New Identity Resolving Key events
+ since the kernel updates its list automatically.
+
+ Possible values for the Address_Type parameter:
+ 0 Reserved (not in use)
+ 1 LE Public
+ 2 LE Random
+
+ The provided Address and Address_Type are the identity of
+ a device. So either its public address or static random address.
+
+ Unresolvable random addresses and resolvable random addresses are
+ not valid and will be rejected.
+
+ This command can be used when the controller is not powered.
+
+ This command generates a Command Complete event on success or
+ a Command Status event on failure.
+
+ Possible errors: Invalid Parameters
+ Invalid Index
+
+
Command Complete Event
======================
@@ -1713,6 +1804,18 @@ Event Parameters Store_Hint (1 Octet)
to store the key persistently or not (e.g. this would not be set
if the authentication requirement was "No Bonding").
+ Possible values for the Address_Type parameter:
+ 0 Reserved (not in use)
+ 1 LE Public
+ 2 LE Random
+
+ The provided Address and Address_Type are the identity of
+ a device. So either its public address or static random address.
+
+ For unresolvable random addresses and resolvable random addresses
+ without identity information and identity resolving key, the
+ Store_Hint will be set to not store the long term key.
+
Currently defined Key_Type values are:
0x00 Unauthenticated key
@@ -2020,3 +2123,43 @@ Event Parameters Address (6 Octets)
The Passkey parameter indicates the passkey to be shown to the
user whereas the Entered parameter indicates how many characters
the user has entered on the remote side.
+
+
+New Identity Resolving Key Event
+================================
+
+Event Code 0x0018
+Controller Index <controller id>
+Event Parameters Store_Hint (1 Octet)
+ Random_Address (6 Octets)
+ Key {
+ Address (6 Octets)
+ Address_Type (1 Octet)
+ Value (16 Octets)
+ }
+
+ This event indicates that a new identity resolving key has been
+ generated for a remote device.
+
+ The Store_Hint parameter indicates whether the host is expected
+ to store the key persistently or not.
+
+ The Random_Address provides the resolvable random address that
+ was resolved into an identity. A value of 00:00:00:00:00:00
+ indicates that the identity resolving key was provided for
+ a public address or static random address.
+
+ Once this event has been send for a resolvable random address,
+ all further events mapping this device will send out using the
+ identity address information.
+
+ This event also indicates that now the identity address should
+ be used for commands instead of the resolvable random address.
+
+ Possible values for the Address_Type parameter:
+ 0 Reserved (not in use)
+ 1 LE Public
+ 2 LE Random
+
+ The provided Address and Address_Type are the identity of
+ a device. So either its public address or static random address.
--
1.8.5.3
^ permalink raw reply related
* [PATCHv2 0/6] RFCOMM data transfer support in bthost
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
v2:
- Added rfcomm prefixes in API functions and internal structs
- Values returned by read() and write stored in local variables
for clarity
- Few coding style fixes
Marcin Kraglak (6):
emulator/bthost: Add api to handle RFCOMM data on bthost
tools/rfcomm-tester: Add RFCOMM client write test case
tools/rfcomm-tester: Add RFCOMM server write test case
emulator/bthost: Add function to send RFCOMM UIH frames from bthost
tools/rfcomm-tester: Add RFCOMM client read test case
tools/rfcomm-tester: Add RFCOMM server read test case
emulator/bthost.c | 167 ++++++++++++++++++++++++++++++++++++++-
emulator/bthost.h | 13 ++++
tools/rfcomm-tester.c | 212 +++++++++++++++++++++++++++++++++++++++++++++++++-
3 files changed, 387 insertions(+), 5 deletions(-)
--
1.8.3.1
^ permalink raw reply
* [PATCHv2 1/6] emulator/bthost: Add api to handle RFCOMM data on bthost
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
With this change user can handle data received on RFCOMM connection.
---
emulator/bthost.c | 70 +++++++++++++++++++++++++++++++++++++++++++++++++++----
emulator/bthost.h | 9 +++++++
2 files changed, 75 insertions(+), 4 deletions(-)
diff --git a/emulator/bthost.c b/emulator/bthost.c
index 6fbabe8..9bf9ad3 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -126,6 +126,13 @@ struct cid_hook {
struct cid_hook *next;
};
+struct rfcomm_channel_hook {
+ uint8_t channel;
+ bthost_rfcomm_channel_hook_func_t func;
+ void *user_data;
+ struct rfcomm_channel_hook *next;
+};
+
struct btconn {
uint16_t handle;
uint8_t bdaddr[6];
@@ -134,6 +141,7 @@ struct btconn {
uint16_t next_cid;
struct l2conn *l2conns;
struct cid_hook *cid_hooks;
+ struct rfcomm_channel_hook *rfcomm_channel_hooks;
struct btconn *next;
void *smp_data;
};
@@ -233,6 +241,13 @@ static void btconn_free(struct btconn *conn)
free(hook);
}
+ while (conn->rfcomm_channel_hooks) {
+ struct rfcomm_channel_hook *hook = conn->rfcomm_channel_hooks;
+
+ conn->rfcomm_channel_hooks = hook->next;
+ free(hook);
+ }
+
free(conn);
}
@@ -1547,6 +1562,18 @@ static struct cid_hook *find_cid_hook(struct btconn *conn, uint16_t cid)
return NULL;
}
+static struct rfcomm_channel_hook *find_rfcomm_channel_hook(struct btconn *conn,
+ uint16_t channel)
+{
+ struct rfcomm_channel_hook *hook;
+
+ for (hook = conn->rfcomm_channel_hooks; hook != NULL; hook = hook->next)
+ if (hook->channel == channel)
+ return hook;
+
+ return NULL;
+}
+
static void rfcomm_ua_send(struct bthost *bthost, struct btconn *conn,
struct l2conn *l2conn, uint8_t cr, uint8_t dlci)
{
@@ -1801,9 +1828,6 @@ static void rfcomm_uih_recv(struct bthost *bthost, struct btconn *conn,
if (len < sizeof(*hdr))
return;
- if (RFCOMM_GET_DLCI(hdr->address))
- return;
-
if (RFCOMM_TEST_EA(hdr->length))
hdr_len = sizeof(*hdr);
else
@@ -1814,7 +1838,19 @@ static void rfcomm_uih_recv(struct bthost *bthost, struct btconn *conn,
p = data + hdr_len;
- rfcomm_mcc_recv(bthost, conn, l2conn, p, len - hdr_len);
+ if (RFCOMM_GET_DLCI(hdr->address)) {
+ struct rfcomm_channel_hook *hook;
+
+ hook = find_rfcomm_channel_hook(conn,
+ RFCOMM_GET_CHANNEL(hdr->address));
+ if (!hook)
+ return;
+
+ hook->func(p, len - hdr_len - sizeof(uint8_t),
+ hook->user_data);
+ } else {
+ rfcomm_mcc_recv(bthost, conn, l2conn, p, len - hdr_len);
+ }
}
static void process_rfcomm(struct bthost *bthost, struct btconn *conn,
@@ -2112,6 +2148,32 @@ bool bthost_connect_rfcomm(struct bthost *bthost, uint16_t handle,
&req, sizeof(req), NULL, NULL);
}
+void bthost_add_rfcomm_channel_hook(struct bthost *bthost, uint16_t handle,
+ uint8_t channel,
+ bthost_rfcomm_channel_hook_func_t func,
+ void *user_data)
+{
+ struct rfcomm_channel_hook *hook;
+ struct btconn *conn;
+
+ conn = bthost_find_conn(bthost, handle);
+ if (!conn)
+ return;
+
+ hook = malloc(sizeof(*hook));
+ if (!hook)
+ return;
+
+ memset(hook, 0, sizeof(*hook));
+
+ hook->channel = channel;
+ hook->func = func;
+ hook->user_data = user_data;
+
+ hook->next = conn->rfcomm_channel_hooks;
+ conn->rfcomm_channel_hooks = hook;
+}
+
void bthost_stop(struct bthost *bthost)
{
if (bthost->smp_data) {
diff --git a/emulator/bthost.h b/emulator/bthost.h
index a3c26a1..e922f0b 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -99,6 +99,15 @@ bool bthost_connect_rfcomm(struct bthost *bthost, uint16_t handle,
uint8_t channel, bthost_rfcomm_connect_cb func,
void *user_data);
+typedef void (*bthost_rfcomm_channel_hook_func_t) (const void *data,
+ uint16_t len,
+ void *user_data);
+
+void bthost_add_rfcomm_channel_hook(struct bthost *bthost, uint16_t handle,
+ uint8_t channel,
+ bthost_rfcomm_channel_hook_func_t func,
+ void *user_data);
+
void bthost_start(struct bthost *bthost);
void bthost_stop(struct bthost *bthost);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv2 2/6] tools/rfcomm-tester: Add RFCOMM client write test case
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
This will test sending data through RFCOMM socket from client to server.
---
tools/rfcomm-tester.c | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 58 insertions(+), 1 deletion(-)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 44df7e7..42355cf 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -57,6 +57,9 @@ struct rfcomm_client_data {
uint8_t server_channel;
uint8_t client_channel;
int expected_connect_err;
+ const uint8_t *send_data;
+ const uint8_t *read_data;
+ uint16_t data_len;
};
struct rfcomm_server_data {
@@ -294,6 +297,15 @@ const struct rfcomm_client_data connect_success = {
.client_channel = 0x0c
};
+const uint8_t data[] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
+
+const struct rfcomm_client_data connect_send_success = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .data_len = sizeof(data),
+ .send_data = data
+};
+
const struct rfcomm_client_data connect_nval = {
.server_channel = 0x0c,
.client_channel = 0x0e,
@@ -389,6 +401,16 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
return false;
}
+ if (client_data->send_data) {
+ ssize_t ret;
+
+ ret = write(sk, client_data->send_data, client_data->data_len);
+ if (client_data->data_len != ret)
+ tester_test_failed();
+
+ return false;
+ }
+
if (err < 0)
tester_test_failed();
else
@@ -397,6 +419,38 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
return false;
}
+static void client_hook_func(const void *data, uint16_t len,
+ void *user_data)
+{
+ struct test_data *test_data = tester_get_data();
+ const struct rfcomm_client_data *client_data = test_data->test_data;
+ ssize_t ret;
+
+ if (client_data->data_len != len) {
+ tester_test_failed();
+ return;
+ }
+
+ ret = memcmp(client_data->send_data, data, len);
+ if (ret)
+ tester_test_failed();
+ else
+ tester_test_passed();
+}
+
+static void rfcomm_connect_cb(uint16_t handle, uint16_t cid,
+ void *user_data, bool status)
+{
+ struct test_data *data = tester_get_data();
+ const struct rfcomm_client_data *client_data = data->test_data;
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
+
+ if (client_data->send_data)
+ bthost_add_rfcomm_channel_hook(bthost, handle,
+ client_data->client_channel,
+ client_hook_func, NULL);
+}
+
static void test_connect(const void *test_data)
{
struct test_data *data = tester_get_data();
@@ -408,7 +462,7 @@ static void test_connect(const void *test_data)
bthost_add_l2cap_server(bthost, 0x0003, NULL, NULL);
bthost_add_rfcomm_server(bthost, client_data->server_channel,
- NULL, NULL);
+ rfcomm_connect_cb, NULL);
master_addr = hciemu_get_master_bdaddr(data->hciemu);
client_addr = hciemu_get_client_bdaddr(data->hciemu);
@@ -540,6 +594,9 @@ int main(int argc, char *argv[])
setup_powered_client, test_basic);
test_rfcomm("Basic RFCOMM Socket Client - Success", &connect_success,
setup_powered_client, test_connect);
+ test_rfcomm("Basic RFCOMM Socket Client - Write Success",
+ &connect_send_success, setup_powered_client,
+ test_connect);
test_rfcomm("Basic RFCOMM Socket Client - Conn Refused",
&connect_nval, setup_powered_client, test_connect);
test_rfcomm("Basic RFCOMM Socket Server - Success", &listen_success,
--
1.8.3.1
^ permalink raw reply related
* [PATCHv2 3/6] tools/rfcomm-tester: Add RFCOMM server write test case
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
This will check data write from server to client.
---
tools/rfcomm-tester.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 51 insertions(+)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 42355cf..765de88 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -66,6 +66,9 @@ struct rfcomm_server_data {
uint8_t server_channel;
uint8_t client_channel;
bool expected_status;
+ const uint8_t *send_data;
+ const uint8_t *read_data;
+ uint16_t data_len;
};
static void mgmt_debug(const char *str, void *user_data)
@@ -318,6 +321,14 @@ const struct rfcomm_server_data listen_success = {
.expected_status = true
};
+const struct rfcomm_server_data listen_send_success = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .expected_status = true,
+ .data_len = sizeof(data),
+ .send_data = data
+};
+
const struct rfcomm_server_data listen_nval = {
.server_channel = 0x0c,
.client_channel = 0x0e,
@@ -438,6 +449,25 @@ static void client_hook_func(const void *data, uint16_t len,
tester_test_passed();
}
+static void server_hook_func(const void *data, uint16_t len,
+ void *user_data)
+{
+ struct test_data *test_data = tester_get_data();
+ const struct rfcomm_server_data *server_data = test_data->test_data;
+ ssize_t ret;
+
+ if (server_data->data_len != len) {
+ tester_test_failed();
+ return;
+ }
+
+ ret = memcmp(server_data->send_data, data, len);
+ if (ret)
+ tester_test_failed();
+ else
+ tester_test_passed();
+}
+
static void rfcomm_connect_cb(uint16_t handle, uint16_t cid,
void *user_data, bool status)
{
@@ -490,7 +520,9 @@ static gboolean rfcomm_listen_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
struct test_data *data = tester_get_data();
+ const struct rfcomm_server_data *server_data = data->test_data;
int sk, new_sk;
+ ssize_t ret;
data->io_id = 0;
@@ -502,6 +534,16 @@ static gboolean rfcomm_listen_cb(GIOChannel *io, GIOCondition cond,
return false;
}
+ if (server_data->send_data) {
+ ret = write(new_sk, server_data->send_data,
+ server_data->data_len);
+ if (ret != server_data->data_len)
+ tester_test_failed();
+
+ close(new_sk);
+ return false;
+ }
+
close(new_sk);
tester_test_passed();
@@ -515,6 +557,9 @@ static void connection_cb(uint16_t handle, uint16_t cid, void *user_data,
struct test_data *data = tester_get_data();
const struct rfcomm_server_data *server_data = data->test_data;
+ if (server_data->data_len)
+ return;
+
if (server_data->expected_status == status)
tester_test_passed();
else
@@ -528,6 +573,9 @@ static void client_new_conn(uint16_t handle, void *user_data)
struct bthost *bthost;
bthost = hciemu_client_get_host(data->hciemu);
+ bthost_add_rfcomm_channel_hook(bthost, handle,
+ server_data->client_channel,
+ server_hook_func, NULL);
bthost_connect_rfcomm(bthost, handle, server_data->client_channel,
connection_cb, NULL);
}
@@ -601,6 +649,9 @@ int main(int argc, char *argv[])
&connect_nval, setup_powered_client, test_connect);
test_rfcomm("Basic RFCOMM Socket Server - Success", &listen_success,
setup_powered_server, test_server);
+ test_rfcomm("Basic RFCOMM Socket Server - Write Success",
+ &listen_send_success, setup_powered_server,
+ test_server);
test_rfcomm("Basic RFCOMM Socket Server - Conn Refused", &listen_nval,
setup_powered_server, test_server);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv2 4/6] emulator/bthost: Add function to send RFCOMM UIH frames from bthost
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
This will make RFCOMM UIH frame and fill with data passed by user.
It also adds bthost internal tracking of RFCOMM connections to store
cid and channel - user have to pass only conenction handle and channel.
---
emulator/bthost.c | 97 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
emulator/bthost.h | 4 +++
2 files changed, 101 insertions(+)
diff --git a/emulator/bthost.c b/emulator/bthost.c
index 9bf9ad3..92c63cd 100644
--- a/emulator/bthost.c
+++ b/emulator/bthost.c
@@ -140,6 +140,7 @@ struct btconn {
uint8_t encr_mode;
uint16_t next_cid;
struct l2conn *l2conns;
+ struct rcconn *rcconns;
struct cid_hook *cid_hooks;
struct rfcomm_channel_hook *rfcomm_channel_hooks;
struct btconn *next;
@@ -153,6 +154,12 @@ struct l2conn {
struct l2conn *next;
};
+struct rcconn {
+ uint8_t channel;
+ uint16_t scid;
+ struct rcconn *next;
+};
+
struct l2cap_pending_req {
uint8_t ident;
bthost_l2cap_rsp_cb cb;
@@ -241,6 +248,13 @@ static void btconn_free(struct btconn *conn)
free(hook);
}
+ while (conn->rcconns) {
+ struct rcconn *rcconn = conn->rcconns;
+
+ conn->rcconns = rcconn->next;
+ free(rcconn);
+ }
+
while (conn->rfcomm_channel_hooks) {
struct rfcomm_channel_hook *hook = conn->rfcomm_channel_hooks;
@@ -299,6 +313,41 @@ static struct l2conn *bthost_add_l2cap_conn(struct bthost *bthost,
return l2conn;
}
+static struct rcconn *bthost_add_rfcomm_conn(struct bthost *bthost,
+ struct btconn *conn,
+ struct l2conn *l2conn,
+ uint8_t channel)
+{
+ struct rcconn *rcconn;
+
+ rcconn = malloc(sizeof(*rcconn));
+ if (!rcconn)
+ return NULL;
+
+ memset(rcconn, 0, sizeof(*rcconn));
+
+ rcconn->channel = channel;
+ rcconn->scid = l2conn->scid;
+
+ rcconn->next = conn->rcconns;
+ conn->rcconns = rcconn;
+
+ return rcconn;
+}
+
+static struct rcconn *btconn_find_rfcomm_conn_by_channel(struct btconn *conn,
+ uint8_t chan)
+{
+ struct rcconn *rcconn;
+
+ for (rcconn = conn->rcconns; rcconn != NULL; rcconn = rcconn->next) {
+ if (rcconn->channel == chan)
+ return rcconn;
+ }
+
+ return NULL;
+}
+
static struct l2conn *btconn_find_l2cap_conn_by_scid(struct btconn *conn,
uint16_t scid)
{
@@ -1617,6 +1666,7 @@ static void rfcomm_sabm_recv(struct bthost *bthost, struct btconn *conn,
cb = bthost_find_rfcomm_cb_by_channel(bthost, chan);
if (!dlci || cb) {
+ bthost_add_rfcomm_conn(bthost, conn, l2conn, chan);
rfcomm_ua_send(bthost, conn, l2conn, 1, dlci);
if (cb && cb->func)
cb->func(conn->handle, l2conn->scid, cb->user_data,
@@ -1661,6 +1711,7 @@ static void rfcomm_ua_recv(struct bthost *bthost, struct btconn *conn,
type = RFCOMM_GET_TYPE(ua_hdr->control);
if (channel && conn_data && conn_data->channel == channel) {
+ bthost_add_rfcomm_conn(bthost, conn, l2conn, channel);
if (conn_data->cb)
conn_data->cb(conn->handle, l2conn->scid,
conn_data->user_data, true);
@@ -1672,6 +1723,8 @@ static void rfcomm_ua_recv(struct bthost *bthost, struct btconn *conn,
if (!conn_data || !RFCOMM_TEST_CR(type))
return;
+ bthost_add_rfcomm_conn(bthost, conn, l2conn, channel);
+
memset(buf, 0, sizeof(buf));
hdr = (struct rfcomm_hdr *) buf;
@@ -2174,6 +2227,50 @@ void bthost_add_rfcomm_channel_hook(struct bthost *bthost, uint16_t handle,
conn->rfcomm_channel_hooks = hook;
}
+void bthost_send_rfcomm_data(struct bthost *bthost, uint16_t handle,
+ uint8_t channel, const void *data,
+ uint16_t len)
+{
+ struct btconn *conn;
+ struct rcconn *rcconn;
+ struct rfcomm_hdr *hdr;
+ uint8_t *uih_frame;
+ uint16_t uih_len;
+
+ conn = bthost_find_conn(bthost, handle);
+ if (!conn)
+ return;
+
+ rcconn = btconn_find_rfcomm_conn_by_channel(conn, channel);
+ if (!rcconn)
+ return;
+
+ if (len > 127)
+ uih_len = len + sizeof(struct rfcomm_cmd) + sizeof(uint8_t);
+ else
+ uih_len = len + sizeof(struct rfcomm_cmd);
+
+ uih_frame = malloc(uih_len);
+ if (!uih_frame)
+ return;
+
+ hdr = (struct rfcomm_hdr *) uih_frame;
+ hdr->address = RFCOMM_ADDR(1, channel * 2);
+ hdr->control = RFCOMM_CTRL(RFCOMM_UIH, 0);
+ if (len > 127) {
+ hdr->length = RFCOMM_LEN16(cpu_to_le16(sizeof(*hdr) + len));
+ memcpy(uih_frame + sizeof(*hdr) + 1, data, len);
+ } else {
+ hdr->length = RFCOMM_LEN8(sizeof(*hdr) + len);
+ memcpy(uih_frame + sizeof(*hdr), data, len);
+ }
+
+ uih_frame[uih_len - 1] = rfcomm_fcs((void *)hdr);
+ send_acl(bthost, handle, rcconn->scid, uih_frame, uih_len);
+
+ free(uih_frame);
+}
+
void bthost_stop(struct bthost *bthost)
{
if (bthost->smp_data) {
diff --git a/emulator/bthost.h b/emulator/bthost.h
index e922f0b..0d4594f 100644
--- a/emulator/bthost.h
+++ b/emulator/bthost.h
@@ -108,6 +108,10 @@ void bthost_add_rfcomm_channel_hook(struct bthost *bthost, uint16_t handle,
bthost_rfcomm_channel_hook_func_t func,
void *user_data);
+void bthost_send_rfcomm_data(struct bthost *bthost, uint16_t handle,
+ uint8_t channel, const void *data,
+ uint16_t len);
+
void bthost_start(struct bthost *bthost);
void bthost_stop(struct bthost *bthost);
--
1.8.3.1
^ permalink raw reply related
* [PATCHv2 5/6] tools/rfcomm-tester: Add RFCOMM client read test case
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
This will test reading data passed to RFCOMM socket on client side.
---
tools/rfcomm-tester.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 46 insertions(+)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 765de88..4066553 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -51,6 +51,7 @@ struct test_data {
enum hciemu_type hciemu_type;
const void *test_data;
unsigned int io_id;
+ uint16_t conn_handle;
};
struct rfcomm_client_data {
@@ -309,6 +310,13 @@ const struct rfcomm_client_data connect_send_success = {
.send_data = data
};
+const struct rfcomm_client_data connect_read_success = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .data_len = sizeof(data),
+ .read_data = data
+};
+
const struct rfcomm_client_data connect_nval = {
.server_channel = 0x0c,
.client_channel = 0x0e,
@@ -389,6 +397,31 @@ static int connect_rfcomm_sock(int sk, const bdaddr_t *bdaddr, uint8_t channel)
return 0;
}
+static gboolean client_received_data(GIOChannel *io, GIOCondition cond,
+ gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct rfcomm_client_data *client_data = data->test_data;
+ int sk;
+ ssize_t ret;
+ char buf[248];
+
+ sk = g_io_channel_unix_get_fd(io);
+
+ ret = read(sk, buf, client_data->data_len);
+ if (client_data->data_len != ret) {
+ tester_test_failed();
+ return false;
+ }
+
+ if (memcmp(client_data->read_data, buf, client_data->data_len))
+ tester_test_failed();
+ else
+ tester_test_passed();
+
+ return false;
+}
+
static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
@@ -420,6 +453,14 @@ static gboolean rc_connect_cb(GIOChannel *io, GIOCondition cond,
tester_test_failed();
return false;
+ } else if (client_data->read_data) {
+ g_io_add_watch(io, G_IO_IN, client_received_data, NULL);
+ bthost_send_rfcomm_data(hciemu_client_get_host(data->hciemu),
+ data->conn_handle,
+ client_data->client_channel,
+ client_data->read_data,
+ client_data->data_len);
+ return false;
}
if (err < 0)
@@ -479,6 +520,8 @@ static void rfcomm_connect_cb(uint16_t handle, uint16_t cid,
bthost_add_rfcomm_channel_hook(bthost, handle,
client_data->client_channel,
client_hook_func, NULL);
+ else if (client_data->read_data)
+ data->conn_handle = handle;
}
static void test_connect(const void *test_data)
@@ -645,6 +688,9 @@ int main(int argc, char *argv[])
test_rfcomm("Basic RFCOMM Socket Client - Write Success",
&connect_send_success, setup_powered_client,
test_connect);
+ test_rfcomm("Basic RFCOMM Socket Client - Read Success",
+ &connect_read_success, setup_powered_client,
+ test_connect);
test_rfcomm("Basic RFCOMM Socket Client - Conn Refused",
&connect_nval, setup_powered_client, test_connect);
test_rfcomm("Basic RFCOMM Socket Server - Success", &listen_success,
--
1.8.3.1
^ permalink raw reply related
* [PATCHv2 6/6] tools/rfcomm-tester: Add RFCOMM server read test case
From: Marcin Kraglak @ 2014-02-18 7:50 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392709855-32600-1-git-send-email-marcin.kraglak@tieto.com>
It will test reading data passed to RFCOMM socket on server side.
---
tools/rfcomm-tester.c | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/tools/rfcomm-tester.c b/tools/rfcomm-tester.c
index 4066553..71c1cf1 100644
--- a/tools/rfcomm-tester.c
+++ b/tools/rfcomm-tester.c
@@ -337,6 +337,14 @@ const struct rfcomm_server_data listen_send_success = {
.send_data = data
};
+const struct rfcomm_server_data listen_read_success = {
+ .server_channel = 0x0c,
+ .client_channel = 0x0c,
+ .expected_status = true,
+ .data_len = sizeof(data),
+ .read_data = data
+};
+
const struct rfcomm_server_data listen_nval = {
.server_channel = 0x0c,
.client_channel = 0x0e,
@@ -559,6 +567,31 @@ static void test_connect(const void *test_data)
tester_print("Connect in progress %d", sk);
}
+static gboolean server_received_data(GIOChannel *io, GIOCondition cond,
+ gpointer user_data)
+{
+ struct test_data *data = tester_get_data();
+ const struct rfcomm_server_data *server_data = data->test_data;
+ char buf[1024];
+ ssize_t ret;
+ int sk;
+
+ sk = g_io_channel_unix_get_fd(io);
+
+ ret = read(sk, buf, server_data->data_len);
+ if (ret != server_data->data_len) {
+ tester_test_failed();
+ return false;
+ }
+
+ if (memcmp(buf, server_data->read_data, server_data->data_len))
+ tester_test_failed();
+ else
+ tester_test_passed();
+
+ return false;
+}
+
static gboolean rfcomm_listen_cb(GIOChannel *io, GIOCondition cond,
gpointer user_data)
{
@@ -585,6 +618,17 @@ static gboolean rfcomm_listen_cb(GIOChannel *io, GIOCondition cond,
close(new_sk);
return false;
+ } else if (server_data->read_data) {
+ GIOChannel *new_io;
+
+ new_io = g_io_channel_unix_new(new_sk);
+ g_io_channel_set_close_on_unref(new_io, TRUE);
+
+ data->io_id = g_io_add_watch(new_io, G_IO_IN,
+ server_received_data, NULL);
+
+ g_io_channel_unref(new_io);
+ return false;
}
close(new_sk);
@@ -599,9 +643,18 @@ static void connection_cb(uint16_t handle, uint16_t cid, void *user_data,
{
struct test_data *data = tester_get_data();
const struct rfcomm_server_data *server_data = data->test_data;
+ struct bthost *bthost = hciemu_client_get_host(data->hciemu);
- if (server_data->data_len)
+ if (server_data->read_data) {
+ data->conn_handle = handle;
+ bthost_send_rfcomm_data(bthost, data->conn_handle,
+ server_data->client_channel,
+ server_data->read_data,
+ server_data->data_len);
+ return;
+ } else if (server_data->data_len) {
return;
+ }
if (server_data->expected_status == status)
tester_test_passed();
@@ -698,6 +751,9 @@ int main(int argc, char *argv[])
test_rfcomm("Basic RFCOMM Socket Server - Write Success",
&listen_send_success, setup_powered_server,
test_server);
+ test_rfcomm("Basic RFCOMM Socket Server - Read Success",
+ &listen_read_success, setup_powered_server,
+ test_server);
test_rfcomm("Basic RFCOMM Socket Server - Conn Refused", &listen_nval,
setup_powered_server, test_server);
--
1.8.3.1
^ permalink raw reply related
* [PATCH 1/9] Bluetooth: Fix missing PDU length checks for SMP
From: johan.hedberg @ 2014-02-18 8:19 UTC (permalink / raw)
To: linux-bluetooth
From: Johan Hedberg <johan.hedberg@intel.com>
For each received SMP PDU we need to check that we have enough data to
fit the specified size of the PDU. This patch adds the necessary checks
for each SMP PDU handler and ensures that buffer overflows do not occur
if to little data has been received.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index efe51ccdc615..1730bb2b6259 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -565,6 +565,9 @@ static u8 smp_cmd_pairing_req(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p", conn);
+ if (skb->len < sizeof(*req))
+ return SMP_UNSPECIFIED;
+
if (conn->hcon->link_mode & HCI_LM_MASTER)
return SMP_CMD_NOTSUPP;
@@ -617,6 +620,9 @@ static u8 smp_cmd_pairing_rsp(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p", conn);
+ if (skb->len < sizeof(*rsp))
+ return SMP_UNSPECIFIED;
+
if (!(conn->hcon->link_mode & HCI_LM_MASTER))
return SMP_CMD_NOTSUPP;
@@ -661,6 +667,9 @@ static u8 smp_cmd_pairing_confirm(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p %s", conn, conn->hcon->out ? "master" : "slave");
+ if (skb->len < sizeof(smp->pcnf))
+ return SMP_UNSPECIFIED;
+
memcpy(smp->pcnf, skb->data, sizeof(smp->pcnf));
skb_pull(skb, sizeof(smp->pcnf));
@@ -686,6 +695,9 @@ static u8 smp_cmd_pairing_random(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p", conn);
+ if (skb->len < sizeof(smp->rrnd))
+ return SMP_UNSPECIFIED;
+
swap128(skb->data, smp->rrnd);
skb_pull(skb, sizeof(smp->rrnd));
@@ -725,6 +737,9 @@ static u8 smp_cmd_security_req(struct l2cap_conn *conn, struct sk_buff *skb)
BT_DBG("conn %p", conn);
+ if (skb->len < sizeof(*rp))
+ return SMP_UNSPECIFIED;
+
if (!(conn->hcon->link_mode & HCI_LM_MASTER))
return SMP_CMD_NOTSUPP;
@@ -814,6 +829,11 @@ static int smp_cmd_encrypt_info(struct l2cap_conn *conn, struct sk_buff *skb)
struct smp_cmd_encrypt_info *rp = (void *) skb->data;
struct smp_chan *smp = conn->smp_chan;
+ BT_DBG("conn %p", conn);
+
+ if (skb->len < sizeof(*rp))
+ return SMP_UNSPECIFIED;
+
skb_pull(skb, sizeof(*rp));
memcpy(smp->tk, rp->ltk, sizeof(smp->tk));
@@ -829,6 +849,11 @@ static int smp_cmd_master_ident(struct l2cap_conn *conn, struct sk_buff *skb)
struct hci_conn *hcon = conn->hcon;
u8 authenticated;
+ BT_DBG("conn %p", conn);
+
+ if (skb->len < sizeof(*rp))
+ return SMP_UNSPECIFIED;
+
skb_pull(skb, sizeof(*rp));
hci_dev_lock(hdev);
--
1.8.5.3
^ permalink raw reply related
* [PATCH 2/9] Bluetooth: Fix minor whitespace issues in SMP code
From: johan.hedberg @ 2014-02-18 8:19 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392711577-31431-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
This patch fixes a couple of unnecessary empty lines in the SMP code.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 1 -
net/bluetooth/smp.h | 1 -
2 files changed, 2 deletions(-)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index 1730bb2b6259..ae487e17380e 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -990,7 +990,6 @@ int smp_distribute_keys(struct l2cap_conn *conn, __u8 force)
*keydist &= req->resp_key_dist;
}
-
BT_DBG("keydist 0x%x", *keydist);
if (*keydist & SMP_DIST_ENC_KEY) {
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index a700bcb490d7..777ee93a6c9b 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -132,7 +132,6 @@ struct smp_chan {
struct crypto_blkcipher *tfm;
struct work_struct confirm;
struct work_struct random;
-
};
/* SMP Commands */
--
1.8.5.3
^ permalink raw reply related
* [PATCH 3/9] Bluetooth: Add smp_irk_matches helper function
From: johan.hedberg @ 2014-02-18 8:19 UTC (permalink / raw)
To: linux-bluetooth
In-Reply-To: <1392711577-31431-1-git-send-email-johan.hedberg@gmail.com>
From: Johan Hedberg <johan.hedberg@intel.com>
This patch adds a helper function to check whether a given IRK matches a
given Resolvable Private Address (RPA). The function will be needed for
implementing the rest of address resolving support.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
---
net/bluetooth/smp.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++
net/bluetooth/smp.h | 3 +++
2 files changed, 49 insertions(+)
diff --git a/net/bluetooth/smp.c b/net/bluetooth/smp.c
index ae487e17380e..5f500b479f45 100644
--- a/net/bluetooth/smp.c
+++ b/net/bluetooth/smp.c
@@ -78,6 +78,52 @@ static int smp_e(struct crypto_blkcipher *tfm, const u8 *k, u8 *r)
return err;
}
+static int smp_ah(struct crypto_blkcipher *tfm, u8 irk[16], u8 r[3], u8 res[3])
+{
+ u8 _res[16], k[16];
+ int err;
+
+ /* r' = padding || r */
+ memset(_res, 0, 13);
+ _res[13] = r[2];
+ _res[14] = r[1];
+ _res[15] = r[0];
+
+ swap128(irk, k);
+ err = smp_e(tfm, k, _res);
+ if (err) {
+ BT_ERR("Encrypt error");
+ return err;
+ }
+
+ /* The output of the random address function ah is:
+ * ah(h, r) = e(k, r') mod 2^24
+ * The output of the security function e is then truncated to 24 bits
+ * by taking the least significant 24 bits of the output of e as the
+ * result of ah.
+ */
+ res[0] = _res[15];
+ res[1] = _res[14];
+ res[2] = _res[13];
+
+ return 0;
+}
+
+bool smp_irk_matches(struct crypto_blkcipher *tfm, u8 irk[16],
+ bdaddr_t *bdaddr)
+{
+ u8 hash[3];
+ int err;
+
+ BT_DBG("RPA %pMR IRK %*phN", bdaddr, 16, irk);
+
+ err = smp_ah(tfm, irk, &bdaddr->b[3], hash);
+ if (err)
+ return false;
+
+ return !memcmp(bdaddr->b, hash, 3);
+}
+
static int smp_c1(struct crypto_blkcipher *tfm, u8 k[16], u8 r[16],
u8 preq[7], u8 pres[7], u8 _iat, bdaddr_t *ia,
u8 _rat, bdaddr_t *ra, u8 res[16])
diff --git a/net/bluetooth/smp.h b/net/bluetooth/smp.h
index 777ee93a6c9b..950d039c2ea2 100644
--- a/net/bluetooth/smp.h
+++ b/net/bluetooth/smp.h
@@ -143,4 +143,7 @@ int smp_user_confirm_reply(struct hci_conn *conn, u16 mgmt_op, __le32 passkey);
void smp_chan_destroy(struct l2cap_conn *conn);
+bool smp_irk_matches(struct crypto_blkcipher *tfm, u8 irk[16],
+ bdaddr_t *bdaddr);
+
#endif /* __SMP_H */
--
1.8.5.3
^ permalink raw reply related
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