1. 21 8月, 2013 1 次提交
    • M
      Bluetooth: Set different event mask for LE-only controllers · c7882cbd
      Marcel Holtmann 提交于
      In case of a Low Energy only controller it makes no sense to configure
      the full BR/EDR event mask. It will just enable events that can not be
      send anyway and there is no guarantee that such a controller will accept
      this value.
      
      Use event mask 0x90 0xe8 0x04 0x02 0x00 0x80 0x00 0x20 for LE-only
      controllers which enables the following events:
      
                Disconnection Complete
                Encryption Change
                Read Remote Version Information Complete
                Command Complete
                Command Status
                Hardware Error
                Number of Completed Packets
                Data Buffer Overflow
                Encryption Key Refresh Complete
                LE Meta
      
      This is according to Core Specification, Part E, Section 3.
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      c7882cbd
  2. 29 7月, 2013 2 次提交
    • J
      Bluetooth: Fix calling request callback more than once · 53e21fbc
      Johan Hedberg 提交于
      In certain circumstances, such as an HCI driver using __hci_cmd_sync_ev
      with HCI_EV_CMD_COMPLETE as the expected completion event there is the
      chance that hci_event_packet will call hci_req_cmd_complete twice (once
      for the explicitly looked after event and another time in the actual
      handler of cmd_complete).
      
      In the case of __hci_cmd_sync_ev this introduces a race where the first
      call wakes up the blocking __hci_cmd_sync_ev and lets it complete.
      However, by the time that a second __hci_cmd_sync_ev call is already in
      progress the second hci_req_cmd_complete call (from the previous
      operation) will wake up the blocking function prematurely and cause it
      to fail, as witnessed by the following log:
      
      [  639.232195] hci_rx_work: hci0 Event packet
      [  639.232201] hci_req_cmd_complete: opcode 0xfc8e status 0x00
      [  639.232205] hci_sent_cmd_data: hci0 opcode 0xfc8e
      [  639.232210] hci_req_sync_complete: hci0 result 0x00
      [  639.232220] hci_cmd_complete_evt: hci0 opcode 0xfc8e
      [  639.232225] hci_req_cmd_complete: opcode 0xfc8e status 0x00
      [  639.232228] __hci_cmd_sync_ev: hci0 end: err 0
      [  639.232234] __hci_cmd_sync_ev: hci0
      [  639.232238] hci_req_add_ev: hci0 opcode 0xfc8e plen 250
      [  639.232242] hci_prepare_cmd: skb len 253
      [  639.232246] hci_req_run: length 1
      [  639.232250] hci_sent_cmd_data: hci0 opcode 0xfc8e
      [  639.232255] hci_req_sync_complete: hci0 result 0x00
      [  639.232266] hci_cmd_work: hci0 cmd_cnt 1 cmd queued 1
      [  639.232271] __hci_cmd_sync_ev: hci0 end: err 0
      [  639.232276] Bluetooth: hci0 sending Intel patch command (0xfc8e) failed (-61)
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      53e21fbc
    • J
      Bluetooth: Fix HCI init for BlueFRITZ! devices · 3f8e2d75
      Johan Hedberg 提交于
      None of the BlueFRITZ! devices with manufacurer ID 31 (AVM Berlin)
      support HCI_Read_Local_Supported_Commands. It is safe to use the
      manufacturer ID (instead of e.g. a USB ID specific quirk) because the
      company never created any newer controllers.
      
      < HCI Command: Read Local Supported Comm.. (0x04|0x0002) plen 0 [hci0] 0.210014
      > HCI Event: Command Status (0x0f) plen 4 [hci0] 0.217361
            Read Local Supported Commands (0x04|0x0002) ncmd 1
              Status: Unknown HCI Command (0x01)
      Reported-by: NJörg Esser <jackfritt@boh.de>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Tested-by: NJörg Esser <jackfritt@boh.de>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      3f8e2d75
  3. 26 7月, 2013 1 次提交
    • G
      Bluetooth: Fix race between hci_register_dev() and hci_dev_open() · fcee3377
      Gustavo Padovan 提交于
      If hci_dev_open() is called after hci_register_dev() added the device to
      the hci_dev_list but before the workqueue are created we could run into a
      NULL pointer dereference (see below).
      
      This bug is very unlikely to happen, systems using bluetoothd to
      manage their bluetooth devices will never see this happen.
      
      BUG: unable to handle kernel NULL pointer dereference
      0100
      IP: [<ffffffff81077502>] __queue_work+0x32/0x3d0
      (...)
      Call Trace:
       [<ffffffff81077be5>] queue_work_on+0x45/0x50
       [<ffffffffa016e8ff>] hci_req_run+0xbf/0xf0 [bluetooth]
       [<ffffffffa01709b0>] ? hci_init2_req+0x720/0x720 [bluetooth]
       [<ffffffffa016ea06>] __hci_req_sync+0xd6/0x1c0 [bluetooth]
       [<ffffffff8108ee10>] ? try_to_wake_up+0x2b0/0x2b0
       [<ffffffff8150e3f0>] ? usb_autopm_put_interface+0x30/0x40
       [<ffffffffa016fad5>] hci_dev_open+0x275/0x2e0 [bluetooth]
       [<ffffffffa0182752>] hci_sock_ioctl+0x1f2/0x3f0 [bluetooth]
       [<ffffffff815c6050>] sock_do_ioctl+0x30/0x70
       [<ffffffff815c75f9>] sock_ioctl+0x79/0x2f0
       [<ffffffff811a8046>] do_vfs_ioctl+0x96/0x560
       [<ffffffff811a85a1>] SyS_ioctl+0x91/0xb0
       [<ffffffff816d989d>] system_call_fastpath+0x1a/0x1f
      Reported-by: NSedat Dilek <sedat.dilek@gmail.com>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      fcee3377
  4. 25 7月, 2013 1 次提交
  5. 04 7月, 2013 1 次提交
  6. 23 6月, 2013 5 次提交
  7. 14 6月, 2013 1 次提交
    • J
      Bluetooth: Fix conditions for HCI_Delete_Stored_Link_Key · 59f45d57
      Johan Hedberg 提交于
      Even though the HCI_Delete_Stored_Link_Key command is mandatory for 1.1
      and later controllers some controllers do not seem to support it
      properly as was witnessed by one Broadcom based controller:
      
      < HCI Command: Delete Stored Link Key (0x03|0x0012) plen 7
          bdaddr 00:00:00:00:00:00 all 1
      > HCI Event: Command Complete (0x0e) plen 4
          Delete Stored Link Key (0x03|0x0012) ncmd 1
          status 0x11 deleted 0
          Error: Unsupported Feature or Parameter Value
      
      Luckily this same controller also doesn't list the command in its
      supported commands bit mask (counting from 0 bit 7 of octet 6):
      
      < HCI Command: Read Local Supported Commands (0x04|0x0002) plen 0
      > HCI Event: Command Complete (0x0e) plen 68
          Read Local Supported Commands (0x04|0x0002) ncmd 1
          status 0x00
          Commands: ffffffffffff1ffffffffffff30fffff3f
      
      Therefore, it makes sense to move sending of HCI_Delete_Stored_Link_Key
      to after receiving the supported commands response and to only send it
      if its respective bit in the mask is set. The downside of this is that
      we no longer send the HCI_Delete_Stored_Link_Key command for Bluetooth
      1.1 controllers since HCI_Read_Local_Supported_Command was introduced in
      version 1.2, but this is an acceptable penalty as the command in
      question shouldn't affect critical behavior.
      Reported-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Tested-by: NPavel Machek <pavel@ucw.cz>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
      59f45d57
  8. 12 6月, 2013 1 次提交
  9. 24 4月, 2013 2 次提交
  10. 19 4月, 2013 1 次提交
  11. 18 4月, 2013 4 次提交
  12. 05 4月, 2013 6 次提交
  13. 04 4月, 2013 2 次提交
  14. 19 3月, 2013 4 次提交
  15. 10 3月, 2013 6 次提交
  16. 08 3月, 2013 2 次提交
    • J
      Bluetooth: Remove unused hdev->init_last_cmd · cecbb967
      Johan Hedberg 提交于
      This variable is no longer needed (due to async HCI request support and
      the conversion of hci_req_sync to use it), so it can be safely removed.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      cecbb967
    • J
      Bluetooth: Use async requests internally in hci_req_sync · 42c6b129
      Johan Hedberg 提交于
      This patch converts the hci_req_sync() procedure to internaly use the
      asynchronous HCI requests.
      
      The hci_req_sync mechanism relies on hci_req_complete() calls from
      hci_event.c into hci_core.c whenever a HCI command completes. This is
      very similar to what asynchronous requests do and makes the conversion
      fairly straight forward by converting hci_req_complete into a request
      complete callback. By this change hci_req_complete (renamed to
      hci_req_sync_complete) becomes private to hci_core.c and all calls to it
      can be removed from hci_event.c.
      
      The commands in each hci_req_sync procedure are collected into their own
      request by passing the hci_request pointer to the request callback
      (instead of the hci_dev pointer). The one slight exception is the HCI
      init request which has the special handling of HCI driver specific
      initialization commands. These commands are run in their own request
      prior to the "main" init request.
      
      One other extra change that this patch must contain is the handling of
      spontaneous HCI reset complete events that some controllers exhibit.
      These were previously handled in the hci_req_complete function but the
      right place for them now becomes the hci_req_cmd_complete function.
      Signed-off-by: NJohan Hedberg <johan.hedberg@intel.com>
      Acked-by: NMarcel Holtmann <marcel@holtmann.org>
      Signed-off-by: NGustavo Padovan <gustavo.padovan@collabora.co.uk>
      42c6b129