All of lore.kernel.org
 help / color / mirror / Atom feed
* Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
@ 2015-05-11 16:21 Ethan
  0 siblings, 0 replies; 6+ messages in thread
From: Ethan @ 2015-05-11 16:21 UTC (permalink / raw)
  To: Marcel Holtmann, jpawlowski, mansito; +Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 5942 bytes --]

Hi,

We found this issue in Chromebook with kernel 3.14. From btmon, Stack
received event of Remote Name Req Complete with Device name “Name:
VGP-BMS21”, but it’s after @ Discovering: 0x00 (7).

It means le_scan_disable_work_complete set discover status to STOPPED
for starting new discovery which caused hci_check_pending_name return
without update the name information because discovery status is
STOPPED. Then user space will always get null name, even
hci_remote_name_evt shows everything is correct at HCI layer.



Is it possible setting LE Set Scan Enable to disable after Remote Name Req
Complete? Or adding condition for hci_discovery_set_state(hdev,
DISCOVERY_STOPPED) in function of le_scan_disable_work_complete?





static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status,

                                                       u16 opcode)

{

           /* General inquiry access code (GIAC) */

           u8 lap[3] = { 0x33, 0x8b, 0x9e };

           struct hci_cp_inquiry cp;

           int err;



           if (status) {

                     BT_ERR("Failed to disable LE scanning: status %d",
status);

                     return;

           }



           hdev->discovery.scan_start = 0;



           switch (hdev->discovery.type) {

           case DISCOV_TYPE_LE:

                     hci_dev_lock(hdev);

                     hci_discovery_set_state(hdev, DISCOVERY_STOPPED);

                     hci_dev_unlock(hdev);

                     break;



           case DISCOV_TYPE_INTERLEAVED:

                     hci_dev_lock(hdev);



                     if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY,

                                     &hdev->quirks)) {

                                /* If we were running LE only scan, change
discovery

                                * state. If we were running both LE and
BR/EDR inquiry

                                * simultaneously, and BR/EDR inquiry is
already

                                * finished, stop discovery, otherwise
BR/EDR inquiry

                                * will stop discovery when finished.

                                */

                                if (!test_bit(HCI_INQUIRY, &hdev->flags))

                                           hci_discovery_set_state(hdev,


DISCOVERY_STOPPED);


static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn
*conn,
                   bdaddr_t *bdaddr, u8 *name, u8 name_len)
{
    struct discovery_state *discov = &hdev->discovery;
    struct inquiry_entry *e;

    /* Update the mgmt connected state if necessary. Be careful with
     * conn objects that exist but are not (yet) connected however.
     * Only those in BT_CONFIG or BT_CONNECTED states can be
     * considered connected.
     */
    if (conn &&
        (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) &&
        !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
        mgmt_device_connected(hdev, conn, 0, name, name_len);

    if (discov->state == DISCOVERY_STOPPED)
        return;


btmon:

@ Discovering: 0x01 (7)

...
....
> HCI Event: Inquiry Complete (0x01) plen 1                    [hci0]
39.027238
        Status: Success (0x00)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10       [hci0]
39.027342
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Page scan repetition mode: R1 (0x01)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x7774
> HCI Event: Command Status (0x0f) plen 4                      [hci0]
39.028072
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0]
39.060051
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
39.062071
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

@ Discovering: 0x00 (7)


> HCI Event: Remote Host Supported Features (0x3d) plen 14     [hci0]
39.536284
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255          [hci0]
39.628124
        Status: Success (0x00)
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Name: VGP-BMS21
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6      [hci0]
44.786231
        Address: 24:AF:E7:B5:2D:00 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.946206
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7     [hci0]
44.946270
        Type: Active (0x01)
        Interval: 22.500 msec (0x0024)
        Window: 11.250 msec (0x0012)
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.947201
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0]
44.947296
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.948203
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5                    [hci0]
44.948266
        Access code: 0x9e8b33 (General Inquiry)
        Length: 10.24s (0x08)
        Num responses: 0
> HCI Event: Command Status (0x0f) plen 4                      [hci0]
44.949207
      Inquiry (0x01|0x0001) ncmd 2
        Status: Success (0x00)



Regards,

Ethan

[-- Attachment #2: Type: text/html, Size: 11233 bytes --]

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

* Re: Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
  2015-05-11 16:39 Ethan
@ 2015-05-11 17:15 ` Marcel Holtmann
  0 siblings, 0 replies; 6+ messages in thread
From: Marcel Holtmann @ 2015-05-11 17:15 UTC (permalink / raw)
  To: Ethan; +Cc: jpawlowski, armansito, Luiz Augusto von Dentz, linux-bluetooth

Hi Ethan,

so first of all, you need to stop sending HTML emails to the mailing list. They will not get through and are not helping you in getting attention.

> We found this issue in Chromebook with kernel 3.14. From btmon, Stack received event of Remote Name Req Complete with Device name “Name: VGP-BMS21”, but it’s after @ Discovering: 0x00 (7). It means le_scan_disable_work_complete set discover status to STOPPED for starting new discovery which caused hci_check_pending_name return without update the name information because discovery status is STOPPED. Then user space will always get null name, even hci_remote_name_evt shows everything is correct at HCI layer.
> 
> Is it possible setting LE Set Scan Enable to disable after Remote Name Req Complete? Or adding condition for hci_discovery_set_state(hdev, DISCOVERY_STOPPED) in function of le_scan_disable_work_complete?

I have been asking for mgmt-tester test cases for simultaneous discovery for a while. Getting this feature tested in more detail and reproducible is needed. Things need to happen reliable.

I am not convinced that the name request result is something that I would consider relevant. If it comes in too late, then it comes in too late. Bad luck. However the code should have send a HCI Remote Name Request Cancel command to actual free the baseband resources in case this is ongoing.

Now the real question might be is if we disable LE scanning after the time and continue trying to resolve BR/EDR names that still need resolving. Even these days with 4.2 out the door, there are still new devices that do not want to include their name in EIR and behave like 2.0 and earlier devices.

I feel really uncomfortable trying to change anything until we have mgmt-tester test case that can be run on a regular basis and ensuring the behavior stays the same.

Regards

Marcel


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

* RE: Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
  2015-05-11 16:44 Ge, Ethan
@ 2015-05-11 16:47 ` Ge, Ethan
  0 siblings, 0 replies; 6+ messages in thread
From: Ge, Ethan @ 2015-05-11 16:47 UTC (permalink / raw)
  To: Ge, Ethan, Marcel Holtmann, jpawlowski, luiz.dentz, armansito
  Cc: linux-bluetooth

Add Arman

Hi,

We found this issue in Chromebook with kernel 3.14. From btmon, Stack recei=
ved event of Remote Name Req Complete with Device name "Name: VGP-BMS21", b=
ut it's after @ Discovering: 0x00 (7). It means le_scan_disable_work_comple=
te set discover status to STOPPED for starting new discovery which caused h=
ci_check_pending_name return without update the name information because di=
scovery status is STOPPED. Then user space will always get null name, even =
hci_remote_name_evt shows everything is correct at HCI layer.

Is it possible setting LE Set Scan Enable to disable after Remote Name Req =
Complete? Or adding condition for hci_discovery_set_state(hdev, DISCOVERY_S=
TOPPED) in function of le_scan_disable_work_complete?

static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status,

                                                       u16 opcode)

{
           /* General inquiry access code (GIAC) */

  .....
.......

           case DISCOV_TYPE_INTERLEAVED:

                     hci_dev_lock(hdev);

=20

                     if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY,

                                     &hdev->quirks)) {

                                /* If we were running LE only scan, change =
discovery

                                * state. If we were running both LE and BR/=
EDR inquiry

                                * simultaneously, and BR/EDR inquiry is alr=
eady

                                * finished, stop discovery, otherwise BR/ED=
R inquiry

                                * will stop discovery when finished.

                                */

                                if (!test_bit(HCI_INQUIRY, &hdev->flags))

                                           hci_discovery_set_state(hdev,   =
                                  /* <-------------   Here set set discover=
 status to STOPPED */

                                                                           =
DISCOVERY_STOPPED);


static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *c=
onn,
                   bdaddr_t *bdaddr, u8 *name, u8 name_len) {
    struct discovery_state *discov =3D &hdev->discovery;
    struct inquiry_entry *e;

    /* Update the mgmt connected state if necessary. Be careful with
     * conn objects that exist but are not (yet) connected however.
     * Only those in BT_CONFIG or BT_CONNECTED states can be
     * considered connected.
     */
    if (conn &&
        (conn->state =3D=3D BT_CONFIG || conn->state =3D=3D BT_CONNECTED) &=
&
        !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
        mgmt_device_connected(hdev, conn, 0, name, name_len);

    if (discov->state =3D=3D DISCOVERY_STOPPED)                            =
                       /* <-------------   Return due to  (discov->state =
=3D=3D DISCOVERY_STOPPED) */
        return;


btmon:

@ Discovering: 0x01 (7) =20

...
....       =20
> HCI Event: Inquiry Complete (0x01) plen 1                    [hci0] 39.02=
7238
        Status: Success (0x00)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10       [hci0] 39.02=
7342
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Page scan repetition mode: R1 (0x01)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x7774
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 39.02=
8072
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 39.06=
0051
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 39.06=
2071
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

@ Discovering: 0x00 (7)


> HCI Event: Remote Host Supported Features (0x3d) plen 14     [hci0] 39.53=
6284
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255          [hci0] 39.62=
8124
        Status: Success (0x00)
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Name: VGP-BMS21
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6      [hci0] 44.78=
6231
        Address: 24:AF:E7:B5:2D:00 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.94=
6206
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7     [hci0] 44.94=
6270
        Type: Active (0x01)
        Interval: 22.500 msec (0x0024)
        Window: 11.250 msec (0x0012)
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.94=
7201
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 44.94=
7296
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.94=
8203
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5                    [hci0] 44.94=
8266
        Access code: 0x9e8b33 (General Inquiry)
        Length: 10.24s (0x08)
        Num responses: 0
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 44.94=
9207
      Inquiry (0x01|0x0001) ncmd 2
        Status: Success (0x00)


Regards,
Ethan
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" =
in the body of a message to majordomo@vger.kernel.org More majordomo info a=
t  http://vger.kernel.org/majordomo-info.html

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

* RE: Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
@ 2015-05-11 16:44 Ge, Ethan
  2015-05-11 16:47 ` Ge, Ethan
  0 siblings, 1 reply; 6+ messages in thread
From: Ge, Ethan @ 2015-05-11 16:44 UTC (permalink / raw)
  To: Marcel Holtmann, jpawlowski, luiz.dentz, amansito; +Cc: linux-bluetooth

Hi,

We found this issue in Chromebook with kernel 3.14. From btmon, Stack received event of Remote Name Req Complete with Device name "Name: VGP-BMS21", but it's after @ Discovering: 0x00 (7). It means le_scan_disable_work_complete set discover status to STOPPED for starting new discovery which caused hci_check_pending_name return without update the name information because discovery status is STOPPED. Then user space will always get null name, even hci_remote_name_evt shows everything is correct at HCI layer.

Is it possible setting LE Set Scan Enable to disable after Remote Name Req Complete? Or adding condition for hci_discovery_set_state(hdev, DISCOVERY_STOPPED) in function of le_scan_disable_work_complete?

static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status,

                                                       u16 opcode)

{
           /* General inquiry access code (GIAC) */

  .....
.......

           case DISCOV_TYPE_INTERLEAVED:

                     hci_dev_lock(hdev);

 

                     if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY,

                                     &hdev->quirks)) {

                                /* If we were running LE only scan, change discovery

                                * state. If we were running both LE and BR/EDR inquiry

                                * simultaneously, and BR/EDR inquiry is already

                                * finished, stop discovery, otherwise BR/EDR inquiry

                                * will stop discovery when finished.

                                */

                                if (!test_bit(HCI_INQUIRY, &hdev->flags))

                                           hci_discovery_set_state(hdev,                                     /* <-------------   Here set set discover status to STOPPED */

                                                                           DISCOVERY_STOPPED);


static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
                   bdaddr_t *bdaddr, u8 *name, u8 name_len)
{
    struct discovery_state *discov = &hdev->discovery;
    struct inquiry_entry *e;

    /* Update the mgmt connected state if necessary. Be careful with
     * conn objects that exist but are not (yet) connected however.
     * Only those in BT_CONFIG or BT_CONNECTED states can be
     * considered connected.
     */
    if (conn &&
        (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) &&
        !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
        mgmt_device_connected(hdev, conn, 0, name, name_len);

    if (discov->state == DISCOVERY_STOPPED)                                                   /* <-------------   Return due to  (discov->state == DISCOVERY_STOPPED) */
        return;


btmon:

@ Discovering: 0x01 (7)  

...
....        
> HCI Event: Inquiry Complete (0x01) plen 1                    [hci0] 39.027238
        Status: Success (0x00)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10       [hci0] 39.027342
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Page scan repetition mode: R1 (0x01)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x7774
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 39.028072
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 39.060051
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 39.062071
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

@ Discovering: 0x00 (7)


> HCI Event: Remote Host Supported Features (0x3d) plen 14     [hci0] 39.536284
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255          [hci0] 39.628124
        Status: Success (0x00)
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Name: VGP-BMS21
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6      [hci0] 44.786231
        Address: 24:AF:E7:B5:2D:00 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.946206
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7     [hci0] 44.946270
        Type: Active (0x01)
        Interval: 22.500 msec (0x0024)
        Window: 11.250 msec (0x0012)
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.947201
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 44.947296
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.948203
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5                    [hci0] 44.948266
        Access code: 0x9e8b33 (General Inquiry)
        Length: 10.24s (0x08)
        Num responses: 0
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 44.949207
      Inquiry (0x01|0x0001) ncmd 2
        Status: Success (0x00)


Regards,
Ethan

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

* Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
@ 2015-05-11 16:39 Ethan
  2015-05-11 17:15 ` Marcel Holtmann
  0 siblings, 1 reply; 6+ messages in thread
From: Ethan @ 2015-05-11 16:39 UTC (permalink / raw)
  To: Marcel Holtmann, jpawlowski, armansito, Luiz Augusto von Dentz
  Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 5531 bytes --]

Hi,

We found this issue in Chromebook with kernel 3.14. From btmon, Stack
received event of Remote Name Req Complete with Device name “Name:
VGP-BMS21”, but it’s after @ Discovering: 0x00 (7). It means
le_scan_disable_work_complete set discover status to STOPPED for starting
new discovery which caused hci_check_pending_name return without update the
name information because discovery status is STOPPED. Then user space will
always get null name, even hci_remote_name_evt shows everything is correct
at HCI layer.

Is it possible setting LE Set Scan Enable to disable after Remote Name Req
Complete? Or adding condition for hci_discovery_set_state(hdev,
DISCOVERY_STOPPED) in function of le_scan_disable_work_complete?



static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status,

                                                       u16 opcode)

{
           /* General inquiry access code (GIAC) */

  .....
.......

           case DISCOV_TYPE_INTERLEAVED:

                     hci_dev_lock(hdev);



                     if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY,

                                     &hdev->quirks)) {

                                /* If we were running LE only scan, change
discovery

                                * state. If we were running both LE and
BR/EDR inquiry

                                * simultaneously, and BR/EDR inquiry is
already

                                * finished, stop discovery, otherwise
BR/EDR inquiry

                                * will stop discovery when finished.

                                */

                                if (!test_bit(HCI_INQUIRY, &hdev->flags))

                                           hci_discovery_set_state(hdev,
                                  /* <-------------   Here set set discover
status to STOPPED */


 DISCOVERY_STOPPED);


static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn
*conn,
                   bdaddr_t *bdaddr, u8 *name, u8 name_len)
{
    struct discovery_state *discov = &hdev->discovery;
    struct inquiry_entry *e;

    /* Update the mgmt connected state if necessary. Be careful with
     * conn objects that exist but are not (yet) connected however.
     * Only those in BT_CONFIG or BT_CONNECTED states can be
     * considered connected.
     */
    if (conn &&
        (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) &&
        !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
        mgmt_device_connected(hdev, conn, 0, name, name_len);

    if (discov->state == DISCOVERY_STOPPED)
                  /* <-------------   Return due to  (discov->state ==
DISCOVERY_STOPPED) */
        return;


btmon:

@ Discovering: 0x01 (7)

...
....
> HCI Event: Inquiry Complete (0x01) plen 1                    [hci0]
39.027238
        Status: Success (0x00)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10       [hci0]
39.027342
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Page scan repetition mode: R1 (0x01)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x7774
> HCI Event: Command Status (0x0f) plen 4                      [hci0]
39.028072
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0]
39.060051
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
39.062071
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

@ Discovering: 0x00 (7)


> HCI Event: Remote Host Supported Features (0x3d) plen 14     [hci0]
39.536284
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255          [hci0]
39.628124
        Status: Success (0x00)
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Name: VGP-BMS21
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6      [hci0]
44.786231
        Address: 24:AF:E7:B5:2D:00 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.946206
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7     [hci0]
44.946270
        Type: Active (0x01)
        Interval: 22.500 msec (0x0024)
        Window: 11.250 msec (0x0012)
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.947201
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0]
44.947296
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0]
44.948203
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5                    [hci0]
44.948266
        Access code: 0x9e8b33 (General Inquiry)
        Length: 10.24s (0x08)
        Num responses: 0
> HCI Event: Command Status (0x0f) plen 4                      [hci0]
44.949207
      Inquiry (0x01|0x0001) ncmd 2
        Status: Success (0x00)


Regards,
Ethan

[-- Attachment #2: Type: text/html, Size: 6602 bytes --]

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

* Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED
@ 2015-05-11 16:04 Ge, Ethan
  0 siblings, 0 replies; 6+ messages in thread
From: Ge, Ethan @ 2015-05-11 16:04 UTC (permalink / raw)
  To: Marcel Holtmann, jpawlowski, mansito, luiz.dentz; +Cc: linux-bluetooth

[-- Attachment #1: Type: text/plain, Size: 5884 bytes --]

Hi,

We found this issue in Chromebook with kernel 3.14. From btmon, Stack received event of Remote Name Req Complete with Device name "Name: VGP-BMS21", but it's after @ Discovering: 0x00 (7).

It means le_scan_disable_work_complete set discover status to STOPPED for starting new discovery which caused hci_check_pending_name return without update the name information because discovery status is STOPPED. Then user space will always get null name, even hci_remote_name_evt shows everything is correct at HCI layer.

Is it possible setting LE Set Scan Enable to disable after Remote Name Req Complete? Or adding condition for hci_discovery_set_state(hdev, DISCOVERY_STOPPED) in function of le_scan_disable_work_complete?


static void le_scan_disable_work_complete(struct hci_dev *hdev, u8 status,
                                                       u16 opcode)
{
           /* General inquiry access code (GIAC) */
           u8 lap[3] = { 0x33, 0x8b, 0x9e };
           struct hci_cp_inquiry cp;
           int err;

           if (status) {
                     BT_ERR("Failed to disable LE scanning: status %d", status);
                     return;
           }

           hdev->discovery.scan_start = 0;

           switch (hdev->discovery.type) {
           case DISCOV_TYPE_LE:
                     hci_dev_lock(hdev);
                     hci_discovery_set_state(hdev, DISCOVERY_STOPPED);
                     hci_dev_unlock(hdev);
                     break;

           case DISCOV_TYPE_INTERLEAVED:
                     hci_dev_lock(hdev);

                     if (test_bit(HCI_QUIRK_SIMULTANEOUS_DISCOVERY,
                                     &hdev->quirks)) {
                                /* If we were running LE only scan, change discovery
                                * state. If we were running both LE and BR/EDR inquiry
                                * simultaneously, and BR/EDR inquiry is already
                                * finished, stop discovery, otherwise BR/EDR inquiry
                                * will stop discovery when finished.
                                */
                                if (!test_bit(HCI_INQUIRY, &hdev->flags))
                                           hci_discovery_set_state(hdev,
                                                                           DISCOVERY_STOPPED);


static void hci_check_pending_name(struct hci_dev *hdev, struct hci_conn *conn,
                   bdaddr_t *bdaddr, u8 *name, u8 name_len)
{
    struct discovery_state *discov = &hdev->discovery;
    struct inquiry_entry *e;

    /* Update the mgmt connected state if necessary. Be careful with
     * conn objects that exist but are not (yet) connected however.
     * Only those in BT_CONFIG or BT_CONNECTED states can be
     * considered connected.
     */
    if (conn &&
        (conn->state == BT_CONFIG || conn->state == BT_CONNECTED) &&
        !test_and_set_bit(HCI_CONN_MGMT_CONNECTED, &conn->flags))
        mgmt_device_connected(hdev, conn, 0, name, name_len);

    if (discov->state == DISCOVERY_STOPPED)
        return;



@ Discovering: 0x01 (7)

...
....
> HCI Event: Inquiry Complete (0x01) plen 1                    [hci0] 39.027238
        Status: Success (0x00)
< HCI Command: Remote Name Request (0x01|0x0019) plen 10       [hci0] 39.027342
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Page scan repetition mode: R1 (0x01)
        Page scan mode: Mandatory (0x00)
        Clock offset: 0x7774
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 39.028072
      Remote Name Request (0x01|0x0019) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 39.060051
        Scanning: Disabled (0x00)
        Filter duplicates: Disabled (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 39.062071
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)

@ Discovering: 0x00 (7)

> HCI Event: Remote Host Supported Features (0x3d) plen 14     [hci0] 39.536284
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Features: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
> HCI Event: Remote Name Req Complete (0x07) plen 255          [hci0] 39.628124
        Status: Success (0x00)
        Address: 90:7F:61:0F:24:41 (OUI 90-7F-61)
        Name: VGP-BMS21
< HCI Command: LE Set Random Address (0x08|0x0005) plen 6      [hci0] 44.786231
        Address: 24:AF:E7:B5:2D:00 (Non-Resolvable)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.946206
      LE Set Random Address (0x08|0x0005) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Parameters (0x08|0x000b) plen 7     [hci0] 44.946270
        Type: Active (0x01)
        Interval: 22.500 msec (0x0024)
        Window: 11.250 msec (0x0012)
        Own address type: Random (0x01)
        Filter policy: Accept all advertisement (0x00)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.947201
      LE Set Scan Parameters (0x08|0x000b) ncmd 1
        Status: Success (0x00)
< HCI Command: LE Set Scan Enable (0x08|0x000c) plen 2         [hci0] 44.947296
        Scanning: Enabled (0x01)
        Filter duplicates: Enabled (0x01)
> HCI Event: Command Complete (0x0e) plen 4                    [hci0] 44.948203
      LE Set Scan Enable (0x08|0x000c) ncmd 2
        Status: Success (0x00)
< HCI Command: Inquiry (0x01|0x0001) plen 5                    [hci0] 44.948266
        Access code: 0x9e8b33 (General Inquiry)
        Length: 10.24s (0x08)
        Num responses: 0
> HCI Event: Command Status (0x0f) plen 4                      [hci0] 44.949207
      Inquiry (0x01|0x0001) ncmd 2
        Status: Success (0x00)

Regards,
Ethan

[-- Attachment #2: Type: text/html, Size: 20674 bytes --]

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

end of thread, other threads:[~2015-05-11 17:15 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-11 16:21 Can't update remote name in function of "hci_check_pending_name" because of discov->state == DISCOVERY_STOPPED Ethan
  -- strict thread matches above, loose matches on Subject: below --
2015-05-11 16:44 Ge, Ethan
2015-05-11 16:47 ` Ge, Ethan
2015-05-11 16:39 Ethan
2015-05-11 17:15 ` Marcel Holtmann
2015-05-11 16:04 Ge, Ethan

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