Bug 135431 - HCI User Channel is not exclusive
Summary: HCI User Channel is not exclusive
Status: NEW
Alias: None
Product: Drivers
Classification: Unclassified
Component: Bluetooth (show other bugs)
Hardware: All Linux
: P1 normal
Assignee: linux-bluetooth@vger.kernel.org
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-07-17 13:40 UTC by Emil Lenngren
Modified: 2016-07-17 13:40 UTC (History)
0 users

See Also:
Kernel Version: 4.4.0
Subsystem:
Regression: No
Bisected commit-id:


Attachments

Description Emil Lenngren 2016-07-17 13:40:25 UTC
Hi. I'm using HCI_CHANNEL_USER and I've read that "The application gains exclusive access to this device and forces the kernel to stay away and not manage it."

But this does not seem to be true. For example both a "hciconfig -a" as well as a "hcitool lescan" sends some packets over the HCI.

However, "hciconfig -a" fails with "Can't read class of device on hci0: Connection timed out (110)" but still the messages are sent on the socket. And "hcitool lescan" disables scan right after it has enabled it for some reason.

When I have an active HCI_CHANNEL_USER socket and issue "hciconfig -a", I see this in btmon:

< HCI Command: Read Local Name (0x03|0x0014) plen 0           [hci0] 3.287660
> HCI Event: Command Complete (0x0e) plen 252                 [hci0] 3.303241
      Read Local Name (0x03|0x0014) ncmd 1
        Status: Success (0x00)
        Name: Bluetooth USB Host Controller
< HCI Command: Read Class of Device (0x03|0x0023) plen 0      [hci0] 5.288940
> HCI Event: Command Complete (0x0e) plen 7                   [hci0] 5.290457
      Read Class of Device (0x03|0x0023) ncmd 1
        Status: Success (0x00)
        Class: 0x000000
          Major class: Miscellaneous
          Minor class: 0x00

For "sudo hcitool lescan":

< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7    [hci0] 22.557600
        Type: Active (0x01)
        Interval: 10.000 msec (0x0010)
        Window: 10.000 msec (0x0010)
        Own address type: Public (0x00)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                   [hci0] 22.558289
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2        [hci0] 24.561344
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                   [hci0] 24.562613
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2        [hci0] 24.562879
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                   [hci0] 24.563499
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2        [hci0] 26.565344
        Scanning: Disabled (0x00)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                   [hci0] 26.566494
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2        [hci0] 26.568638
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                   [hci0] 26.569530
      LE Set Scan Enable (0x08|0x000c) ncmd 1
        Status: Success (0x00)

Trying to connect to a BLE device using gatttool however fails as expected.

Note You need to log in before you can comment on or make changes to this bug.