1. 12 3月, 2014 1 次提交
    • A
      Bluetooth: Enable duplicates filter in background scan · 4340a124
      Andre Guedes 提交于
      To avoid flooding the host with useless advertising reports during
      background scan, we enable the duplicates filter from controller.
      
      However, enabling duplicates filter requires a small change in
      background scan routine in order to fix the following scenario:
        1) Background scan is running.
        2) A device disconnects and starts advertising.
        3) Before host gets the disconnect event, the advertising is reported
           to host. Since there is no pending LE connection at that time,
           nothing happens.
        4) Host gets the disconnection event and adds a pending connection.
        5) No advertising is reported (since controller is filtering) and the
           connection is never established.
      
      So, to address this scenario, we should always restart background scan
      to unsure we don't miss any advertising report (due to duplicates
      filter).
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      4340a124
  2. 28 2月, 2014 6 次提交
  3. 27 2月, 2014 10 次提交
    • A
      Bluetooth: Create hci_req_add_le_passive_scan helper · 8ef30fd3
      Andre Guedes 提交于
      This patches creates the public hci_req_add_le_passive_scan helper so
      it can be re-used outside hci_core.c in the next patch.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      8ef30fd3
    • A
      Bluetooth: Add le_auto_conn file on debugfs · 7d474e06
      Andre Guedes 提交于
      This patch adds to debugfs the le_auto_conn file. This file will be
      used to test LE auto connection infrastructure.
      
      This file accept writes in the following format:
        "add <address> <address_type> [auto_connect]"
        "del <address> <address_type>"
        "clr"
      
      The <address type> values are:
        * 0 for public address
        * 1 for random address
      
      The [auto_connect] values are (for more details see struct hci_
      conn_params):
        * 0 for disabled (default)
        * 1 for always
        * 2 for link loss
      
      So for instance, if you want the kernel autonomously establishes
      connections with device AA:BB:CC:DD:EE:FF (public address) every
      time the device enters in connectable mode (starts advertising),
      you should run the command:
      $ echo "add AA:BB:CC:DD:EE:FF 0 1" > /sys/kernel/debug/bluetooth/hci0/le_auto_conn
      
      To delete the connection parameters for that device, run the command:
      $ echo "del AA:BB:CC:DD:EE:FF 0" > /sys/kernel/debug/bluetooth/hci0/le_auto_conn
      
      To clear the connection parameters list, run the command:
      $ echo "clr" > /sys/kernel/debug/bluetooth/hci0/le_auto_conn
      
      Finally. to get the list of connection parameters configured in kernel,
      read the le_auto_conn file:
      $ cat /sys/kernel/debug/bluetooth/hci0/le_auto_conn
      
      This file is created only if LE is enabled.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      7d474e06
    • A
      Bluetooth: Connection parameters and resolvable address · a9b0a04c
      Andre Guedes 提交于
      We should only accept connection parameters from identity addresses
      (public or random static). Thus, we should check the address type
      in hci_conn_params_add().
      
      Additionally, since the IRK is removed during unpair, we should also
      remove the connection parameters from that device.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      a9b0a04c
    • A
      Bluetooth: Auto connection and power on · 6046dc3e
      Andre Guedes 提交于
      When hdev is closed (e.g. Mgmt power off command, RFKILL or controller
      is reset), the ongoing active connections are silently dropped by the
      controller (no Disconnection Complete Event is sent to host). For that
      reason, the devices that require HCI_AUTO_CONN_ALWAYS are not added to
      hdev->pend_le_conns list and they won't auto connect.
      
      So to fix this issue, during hdev closing, we remove all pending LE
      connections. After adapter is powered on, we add a pending LE connection
      for each HCI_AUTO_CONN_ALWAYS address.
      
      This way, the auto connection mechanism works propely after a power
      off and power on sequence as well as RFKILL block/unblock.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      6046dc3e
    • A
      Bluetooth: Temporarily stop background scanning on discovery · c54c3860
      Andre Guedes 提交于
      If the user sends a mgmt start discovery command while the background
      scanning is running, we should temporarily stop it. Once the discovery
      finishes, we start the background scanning again.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      c54c3860
    • A
      Bluetooth: Connection parameters and auto connection · cef952ce
      Andre Guedes 提交于
      This patch modifies hci_conn_params_add() and hci_conn_params_del() so
      they also add/delete pending LE connections according to the auto_
      connect option. This way, background scan is automatically triggered/
      untriggered when connection parameters are added/removed.
      
      For instance, when a new connection parameters with HCI_AUTO_CONN_ALWAYS
      option is added and we are not connected to the device, we add a pending
      LE connection for that device.
      
      Likewise, when the connection parameters are updated we add or delete
      a pending LE connection according to its new auto_connect option.
      
      Finally, when the connection parameter is deleted we also delete the
      pending LE connection (if any).
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      cef952ce
    • A
      Bluetooth: Introduce LE auto connect options · 9fcb18ef
      Andre Guedes 提交于
      This patch introduces the LE auto connection options: HCI_AUTO_CONN_
      ALWAYS and HCI_AUTO_CONN_LINK_LOSS. Their working mechanism are
      described as follows:
      
      The HCI_AUTO_CONN_ALWAYS option configures the kernel to always re-
      establish the connection, no matter the reason the connection was
      terminated. This feature is required by some LE profiles such as
      HID over GATT, Health Thermometer and Blood Pressure. These profiles
      require the host autonomously connect to the device as soon as it
      enters in connectable mode (start advertising) so the device is able
      to delivery notifications or indications.
      
      The BT_AUTO_CONN_LINK_LOSS option configures the kernel to re-
      establish the connection in case the connection was terminated due
      to a link loss. This feature is required by the majority of LE
      profiles such as Proximity, Find Me, Cycling Speed and Cadence and
      Time.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      9fcb18ef
    • A
      Bluetooth: Introduce LE auto connection infrastructure · a4790dbd
      Andre Guedes 提交于
      This patch introduces the LE auto connection infrastructure which
      will be used to implement the LE auto connection options.
      
      In summary, the auto connection mechanism works as follows: Once the
      first pending LE connection is created, the background scanning is
      started. When the target device is found in range, the kernel
      autonomously starts the connection attempt. If connection is
      established successfully, that pending LE connection is deleted and
      the background is stopped.
      
      To achieve that, this patch introduces the hci_update_background_scan()
      which controls the background scanning state. This function starts or
      stops the background scanning based on the hdev->pend_le_conns list. If
      there is no pending LE connection, the background scanning is stopped.
      Otherwise, we start the background scanning.
      
      Then, every time a pending LE connection is added we call hci_update_
      background_scan() so the background scanning is started (in case it is
      not already running). Likewise, every time a pending LE connection is
      deleted we call hci_update_background_scan() so the background scanning
      is stopped (in case this was the last pending LE connection) or it is
      started again (in case we have more pending LE connections). Finally,
      we also call hci_update_background_scan() in hci_le_conn_failed() so
      the background scan is restarted in case the connection establishment
      fails. This way the background scanning keeps running until all pending
      LE connection are established.
      
      At this point, resolvable addresses are not support by this
      infrastructure. The proper support is added in upcoming patches.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      a4790dbd
    • A
      Bluetooth: Introduce hdev->pend_le_conn list · 77a77a30
      Andre Guedes 提交于
      This patch introduces the hdev->pend_le_conn list which holds the
      device addresses the kernel should autonomously connect. It also
      introduces some helper functions to manipulate the list.
      
      The list and helper functions will be used by the next patch which
      implements the LE auto connection infrastructure.
      Signed-off-by: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      77a77a30
    • A
      Bluetooth: Create hci_req_add_le_scan_disable helper · b1efcc28
      Andre Guedes 提交于
      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: NAndre Guedes <andre.guedes@openbossa.org>
      Signed-off-by: NMarcel Holtmann <marcel@holtmann.org>
      b1efcc28
  4. 25 2月, 2014 1 次提交
  5. 24 2月, 2014 8 次提交
  6. 21 2月, 2014 2 次提交
  7. 20 2月, 2014 6 次提交
  8. 19 2月, 2014 6 次提交