linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RFC] HCI commands flow fix
@ 2012-12-10 14:08 Szymon Janc
  2012-12-10 14:08 ` [RFC] Bluetooth: Don't send new commands before CC for reset is received Szymon Janc
  0 siblings, 1 reply; 3+ messages in thread
From: Szymon Janc @ 2012-12-10 14:08 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: Szymon Janc

Hi,

I'm seeing issues with some of BT dongles. With mgmt interface this results
in not being able to further communicate with chip due to state mismatch in
kernel e.g. kernel is replying busy for every command that could update CoD.
This can be quite easy reproduced by quickly restarting bluetoothd.

This patch fix 1 issue noticed: sending new commands before CC for reset
is received.

This makes things better on my PC but...

There is still a window for getting stuck: when closing device kernel is not
waiting for last command to complete and (depending on command) this sometimes
(but less frequent comparing to command-reply mismatch without this patch)
result in getting into wrong state and chip stops responding (or maybe commands
don't get to chip..?):

< HCI Command: Write Extended Inquiry Response (0x03|0x0052) plen 241  [hci0] 2078.141360
        FEC: Not required (0x00)
        Name (complete): uw000953
        16-bit Service UUIDs (complete): 0x1801 0x1800 
> HCI Event: Command Complete (0x0e) plen 4                            [hci0] 2078.143329
      Write Extended Inquiry Response (0x03|0x0052) ncmd 1
        Status: Success (0x00)
< HCI Command: Write Extended Inquiry Response (0x03|0x0052) plen 241  [hci0] 2078.188088
        FEC: Not required (0x00)
        Name (complete): uw000953
        16-bit Service UUIDs (complete): 0x1800 
@ New Settings: 0x00d2
            connectable pairable ssp br/edr 
@ Local Name Changed: uw000953 ()
< HCI Command: Reset (0x03|0x0003) plen 0                              [hci0] 2078.445154
@ Local Name Changed: uw000953 ()
@ Local Name Changed: uw000953 ()

bluetoothd[28619]: Bluetooth Management interface initialized
bluetoothd[28619]: hci0: Set Powered (0x0005) failed: Busy (0x0a)

hciconfig hci0 up
Can't init device hci0: Connection timed out (110)

So, maybe (along with this patch) kernel should not discard last sent command on close but
wait for CC (or tx TO)?

Any comments on how this could be solved are welcome.

Szymon Janc (1):
  Bluetooth: Don't send new commands before CC for reset is received

 net/bluetooth/hci_event.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
1.7.9.5


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

end of thread, other threads:[~2012-12-11  7:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-10 14:08 [RFC] HCI commands flow fix Szymon Janc
2012-12-10 14:08 ` [RFC] Bluetooth: Don't send new commands before CC for reset is received Szymon Janc
2012-12-11  7:32   ` Johan Hedberg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).