Commit Graph

309 Commits

Author SHA1 Message Date
Duy Truong
04e554807c Update copyright to The Linux Foundation
Change-Id: Ibead64ce2e901dede2ddd1b86088b88f2350ce92
Signed-off-by: Duy Truong <dtruong@codeaurora.org>
2013-03-15 17:07:39 -07:00
Archana Ramachandran
f028fff7fe Bluetooth: Fix for LE cancel Create Connection not working
Added management method to send LE cancel create connection
HCI command

CRs-fixed: 366284
Change-Id: I17a75ecf4ecaa32cab7e3a4cb8beb8cc4b4580c4
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-03-15 17:06:40 -07:00
Ram Mohan Korukonda
07e1499c08 Bluetooth: Support for Remote name request cancel command
Add support for remote name request cancel command in mgmtops
plugin.

Change-Id: If8bec8b457461f7bca90af940d2473b810677322
CRs-fixed: 414884
Signed-off-by: Ram Mohan Korukonda <rkorukon@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-03-15 17:05:31 -07:00
Bhasker Neti
4eb2d58a0d Bluetooth: Avoid a case where sleep is getting called in soft irq context
While turning off BT, sleep is getting called in the soft isr context
from work queue which is queued from a code section guarded under the
bh lock,
To resolve this released the bh lock before queing the work, as it wont
impact any BT functionality.

CRs-fixed: 405917
Change-Id: I1b872d724b4d0d384cc5314e0f493facd9829a54
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-03-15 17:05:29 -07:00
Bhasker Neti
581f1ca032 Bluetooth:Show bonding dialog if neither side requires no bonding
If the bonded remote device is removed from the list of paired
devices in the DUT, it is still possible to connect to the DUT
from the remote device without any user confirmation.

CRs-fixed: 413132
Change-Id: Iea3e4cf41e5403c3e304ca5f82cf42266be35b79
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-03-15 17:05:28 -07:00
Srinivas Krovvidi
f21bcad1a9 Bluetooth: Update pending_sec_level on auth update.
Based on the user requirement for auth type, update even
the pending security level. This will make sure the authentication
requirement matches the action at kernel space on connection
establishment.

CRs-Fixed: 385463
Change-Id: I94c7e621c105bb2180e6e722cc8cca17869ff2e5
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
Signed-off-by: Mallikarjuna GB <gbmalli@codeaurora.org>
2013-03-15 17:05:27 -07:00
Sunny Kapdi
ea7e387d3a bluetooth: LE conn whitelist implementation
Add support to create connection to LE devices using
whitelist. With this, the Controller can try to connect
to multiple devices at the same time. The following
interfaces are added.
1. Add/Remove device from whitelist
2. Clear all the devices from whitelist
3. Create Connection to devices from whitelist
4. Cancel create connection to whitelist devices

CRs-fixed: 388980
Change-Id: I3900c71255e754f80bb2873ae19a41b94cca76c3
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
(cherry picked from commit 93bef895b01b79f49af60ba1394c9c3f6e563212)
(cherry picked from commit 377ee2bf1fc37bcbeae872661646bdd6a5f8da31)
2013-03-07 15:19:52 -08:00
Archana Ramachandran
4cd292be59 Bluetooth: Send Disconnection reason to Bluez
Send device disconnection reason to bluez on receiving the
diconnection complete event so that low energy profiles
such as proximity can decide to reconnect if the reason
is link loss.

CRs-Fixed: 378240
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
(cherry picked from commit da09d26a75ee1c7c1911dcfbe0128fd09f6631f4)

Change-Id: Iab1fede47f44342d87be6c3c5aa7590754fd950c
Signed-off-by: Sudhir Sharma <sudsha@codeaurora.org>
2013-03-07 15:19:32 -08:00
Sunny Kapdi
3c4589484c bluetooth: Add support for LE conn param
Added support to let the userspace know about the updated
LE connection parameters. On receiving successful connection
complete and connection parameters update event from the BT
Controller, send a mgmt event to the userspace bluetoothd.

CRs-fixed: 380271
Change-Id: If8c3d785188e0d4f38c7431d01c016f399137408
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
2013-02-27 18:17:16 -08:00
Bhasker Neti
9bcc739e7a Bluetooth: Update the scan state with Inquiry commands in non-LE case
Update the hdev scan state with Inquiry start/cancel commands in
non-LE case accordingly. And also there was no check to see the
SCAN_BR mode before sending inquiry cancel.Added a check to see
if the scan state is SCAN_BR,then send inquiry cancel

Change-Id: I222f500fc20b991f4c3ec7eb1fc70bf20649f142
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
CRs-fixed: 359771
2013-02-27 18:14:53 -08:00
Srinivas Krovvidi
07d3851ad6 Bluetooth: Update Local COD to bluez userspace on write complete.
Class of device information is required to the bluez userspace
to write to persistant storage and also update upper layers on
request. So update the local CoD info to bluez once the hci write
is successful.

Change-Id: If45910d4b391616592b49d77d87ca0314be1f033
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-27 18:14:17 -08:00
Stephen Boyd
9263fbdb9c bluetooth: Add interrupt.h and module.h
Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:39:39 -08:00
Johan Hedberg
c2301e3b2b Bluetooth: Fix mgmt response when adapter goes down or is removed
When an adapter gets powered off or is removed any pending commands
should receive a ENETDOWN or ENODEV status response.

Change-Id: I2fec5fa19b2349a48a6aafd5b33ef7946067f16b
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
CRs-fixed: 364664
[bneti@codeaurora.org: Resolved conflict]
2013-02-25 11:39:37 -08:00
Brian Gix
2225011b7e Bluetooth: Add sockopts for LE Connection Params
Various LE profiles require very specific LE parameters for
both establishing and maintaining LE connections to remote
peripherals. These LE only parameters are encapsulated into
a single sockopts structure, and may be passed from user space.

CRs-Fixed: 335971
Change-Id: I408edb97ab0fa9717c7d3fe5fc8ad6ac179a2fff
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:33 -08:00
Brian Gix
120d95f5dd Bluetooth: Stability fix: dev locking
The hci_dev should be locked/unlocked with the _bh form of
the spin lock, and function may not return while lock is held.

Change-Id: I2179a59506c2b212db5fb5b57bc27bff165b2cc6
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:29 -08:00
Archana Ramachandran
f028b1ae03 Bluetooth: Change locking function for process context code
Code executing in process context should use hci_dev_lock_bh()
and hci_dev_unlock_bh() instead of hci_dev_lock/hci_dev_unlock
when dealing with the hci_dev lock so that it cannot be
interrupted while the lock is held.

Change-Id: Iebc2da96837db29ab4911b0429399e3e9ba4b93e
CRs-fixed: 350532
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
2013-02-25 11:39:26 -08:00
Prabhakaran Mc
3e9e6d91cd Bluetooth: Enforce MEDIUM_SECURITY for 2.0 pairing.
The Security levels have been decided based on
remote_features or remote_extended_features for 2.0
and 2.1 devices. In case of security mode - 3 pairing,
this data is not available since pairing happens before
ACL connection complete. This patch fixes this problem.

Change-Id: I0397d090fb1eecaf7b8cf385c3bf47c75fa5a8fb
CRs-fixed: 350377
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:39:24 -08:00
Archana Ramachandran
ed01b291f6 Bluetooth: Fix Low energy Proximity path loss threshold alert
Fix sending alert from the proximity client when the
received RSSI of the remote device equals the threshold
set on the client.

CRs-fixed: 344936
Change-Id: I598d7d66b492cb76754280d657b6e6d55dd0903b
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
2013-02-25 11:39:20 -08:00
Archana Ramachandran
4f5119df8a Bluetooth: Poll for RSSI updates from the remote device
This feature is required for implementing Low energy
proximity client immediate alert service. The proximtiy
client registers with the kernel for receiving RSSI updates
of the remote device. The kernel starts polling for RSSI
value using READ_RSSI HCI command and When it reaches
a particular threshold set by the proximity client,
updates are sent to the client.

Change-Id: I723dd140ad3bf02978c57b3ab127bb6768f28cca
CRs-fixed: 344936
Signed-off-by: Archana Ramachandran <archanar@codeaurora.org>
2013-02-25 11:39:14 -08:00
Prabhakaran Mc
272bb5f22a Bluetooth: Set security level based on remote device features.
Connection security level is modified based on remote device's
extended feature. Deciding SSP capability of remote device
by EIR response is incorrect, because few BT2.1 devices do not
send EIR and few BT2.1 devices which send EIR do not support
SSP. SSP capability of remote device has to be decided based on
remote_extended_features event. This patch makes sure that
MEDIUM_SECURITY is set for non ssp devices' pairing process.

Change-Id: I328a35a30895f2ab6abaaeec51b364ecd633e642
CRs-fixed: 339166
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:39:12 -08:00
Sunny Kapdi
cdf6dea686 bluetooth: Add support for remote_features
Expose Bluetooth remote features to the userspace. A2DP profile
setup in the userspace would need this information to
determine if the remote side supports EDR ACL link or not.

Change-Id: Ib6713707baaf30ffe872247313b2185ae2897385
Signed-off-by: Sunny Kapdi <sunnyk@codeaurora.org>
2013-02-25 11:39:10 -08:00
AnubhavGupta
56f931c645 Bluetooth: SSP: Just Works Model in no MITM
In case both side have no MITM requirements, we need
to use Just Works Association Model. We should not
display PassKey in this case and just YES/NO option
should be displayed

Change-Id: I447aa84a0d021e8834138062a26a9380d3b9b2d9
Signed-off-by: AnubhavGupta <anubhavg@codeaurora.org>
2013-02-25 11:39:08 -08:00
Brian Gix
8cc56a66e6 Bluetooth: Fix LE Connection refcnts
Some rebalancing of refcnts due to issues found during testing:

Refcnt was not being released on security completion, if local side
was paired but the remote side had deleted the pairing info, and then
the re-pair failed to complete successfully.

Additionally, the refcnt was not held-released properly if pairing
was initiated due to the client socket being opened with security
level elevated from the start.

Change-Id: I120fed4dc74035d280781ca949a23d4cbcfa3f3e
CRs-fixed: 335993
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:39:04 -08:00
Bhasker Neti
102336bd44 Bluetooth: Block incoming commands from mgmtops when hci device is down
Even after the device is down, some hci commands are getting queued in
some scenarios, since there is no command queue purge mechanism in the
initialization sequence, so the immediate device up initialization
sequence is messed up with unexpected commands.
The current change blocks some of the hci commands to get queued if the
device is down and also purges the queue in the beginning of the next
device initialization sequence.

CRs-fixed: 336160
Change-Id: Ice5a38da47af11babd5b9dd33b9d711ef96e6732
Signed-off-by: Bhasker Neti <bneti@codeaurora.org>
2013-02-25 11:39:01 -08:00
Brian Gix
f5bca82175 Bluetooth: prevent dup DISCOVERY_STOP's pending
It is possible to redundently request Discovery
operations.  This fix cleans up some stored state to
prevent MGMT event overload when discovery finally completes.

Change-Id: I2ffb5c0749df95e40cd39e8c64c87a62a93fb896
CRs-fixed: 329657
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:55 -08:00
Srinivas Krovvidi
6fefa46cee Bluetooth: Reading remote device lmp_version from controller.
On ACL connection complete with a remote device, the remote
device lmp version should be available with Controller. The
current change is to read this information from controller to
host and update to bluez userspace through management APIs.

Change-Id: Ie152ed98fa0a6cf9ab170a6bb8c6a05b5b9dfcb0
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:54 -08:00
Brian Gix
a0bfd58531 Bluetooth: Discovery Timer stability fixes
This change prevents running timers from being re-initialized
which causes system instablility. Also prevents starting a
discovery operation when already in progress.

CRs-fixed: 328673
Change-Id: Icda36a25fdcb40dab4f95f9cc39ca124b299e308
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:53 -08:00
Srinivas Krovvidi
94010817b9 Bluetooth: Management API changes in Bluetooth to update remote Class.
When connection initiated from the remote device the class of device
information is required to be updated to userspace through this
event.

Change-Id: I97d715a0b80e12d414ecf03d099955c8b12c82b4
Signed-off-by: Srinivas Krovvidi <skrovvid@codeaurora.org>
2013-02-25 11:38:48 -08:00
Brian Gix
387921f639 Bluetooth: Move Discovery timers to hci_dev struct
To prevent timers from expiring on potentiatially free'd dynamic memory.

Change-Id: I8b9685150bcee72fa7ca71b221bc54b54516021e
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:38 -08:00
Subramanian Srinivasan
3c5ce6e5cb Bluetooth: Avoid deadlock in management ops code
Fixes a deadlock issue due to spinlock being acquired
first in the process context and followed by a second
acquisition in the interrupt context

CRs-fixed: 319052
Change-Id: If17be9fa6f020dd1abd248f8999c2614251fc509
Signed-off-by: Subramanian Srinivasan <subrsrin@codeaurora.org>
2013-02-25 11:38:37 -08:00
Prabhakaran Mc
17c20ba4e9 Bluetooth: changes to implement mgmt_encrypt_link procedure
mgmt_encrypt_link procedure is added by implementing
MGMT_OP_ENCRYPT_LINK and MGMT_EV_ENCRYPT_CHANGE

Change-Id: Ibed6e24c67bbea83318a67c636e02a93518de29d
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:38:36 -08:00
Brian Gix
5fe493aaf9 Bluetooth: Allow auto-accept if remote NoInNoOut
If we initiated a Dedicated pairing, and the remote device
is a NoInputNoOutput capable device, allow auto-acceptance
of pairing.

Change-Id: Ia5cc3e3d458cee98aef0493a423d29e9955638c3
CRs-fixed: 318144
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:29 -08:00
Brian Gix
3fb0b0ba88 Bluetooth: Add API to set LE Connection Parameters
Include auto-setting connection parameters during Pairing for
low latenecy, and default (high latency) settings for non-Pairing
connections.

Change-Id: Ie8e3f65da52213451dcc01fce38d95ae07d1b13b
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:27 -08:00
Brian Gix
064afd8708 Bluetooth: Cache LE Address Type with LTK, and use for reconnections
LE-Only devices require that an Address Type (Public or Random) be
included in Connection Requests. This info is available at Pairing
but must be cached so that it is available at reconnection time.
This change includes the Address type with the Pairing data.

Change-Id: I50c78ad31d8be70f5c3f49a0529039e4a26daaac
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:24 -08:00
Brian Gix
caeb7623c8 Bluetooth: Fix Limited Discoverability for MGMTOPS
CRs-fixed: 309551
Change-Id: I42c46c62dcb4b227d9ac48146ee61cb52063a6ae
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:20 -08:00
Brian Gix
326abc1bd7 Bluetooth: Timeout LE Connection requests
If LE devices stop advertising or go out of range, we need
to apply a timeout because the baseband doesn't.

Change-Id: I115672e21fd8aef56ac688b2df4664bb74b725e4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:16 -08:00
Brian Gix
79ba864f6a Bluetooth: Add EIR flags to LE Adv data cache
Use the EIR flags to prevent LE pairing attempts to
BR/EDR capable (Dual Mode) devices.

Change-Id: I41fc96ea5d912b49502ff15ab5f77da5190beaf4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:09 -08:00
Brian Gix
535024c78e Bluetooth: Fix Deadlock on Legacy Scan/Pair
Fix nested calls to hci_dev_lock().

Change-Id: I968faaae59f300bb5a45cd279028488bd7dfcb11
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:02 -08:00
Brian Gix
cfa732f906 Bluetooth: Add LE/BR flag to Connect notification
When remote device is connected outside the control of BlueZ, it
needs to be informed of whether the new connection is LE or BR/EDR.

Change-Id: I58efe8ed3cf5db2b7cc0b3417447b1e3abcdc1c2
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:38:00 -08:00
Brian Gix
3cc80ce399 Bluetooth: Fix dead-lock failure during LE scan
Timer being deleted durings it's time-out callback execution caused
spinlock deadlock on multicore systems.

CRs-fixed: 305677
Change-Id: Id3d9b41410ea30120c9292f8a15fdbf2d86941e4
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:59 -08:00
Brian Gix
b0fd66f9f6 Bluetooth: Fix balancing of hci_conn refcnts
When LE was added, the refcnt's for the hci_conns used were not balanced
and some of this bleeded over between LE pairing and Legacy pairing.

CRs-fixed: 305391
Change-Id: I31070ae827f2eb5a59b317a0ee4bd80eae9e2aa0
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:58 -08:00
Peter Krystad
2b89059eed Bluetooth: Only send mgmt_ops messages for BR-EDR devices
Change-Id: I68ef90d9c6626fe4070424a9334442362e4586ef
Signed-off-by: Peter Krystad <pkrystad@codeaurora.org>
2013-02-25 11:37:57 -08:00
Brian Gix
4fe35cf404 Bluetooth: Fix balance of hci_dev_get/hci_dev_put
Change-Id: I343a5a4db31e9f6ee696de34ca094c63319e7722
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:56 -08:00
Prabhakaran Mc
4fd178a155 Bluetooth: SAP Authentication changes
SAP profile requires 16 pin length authentication for BT 1.2/2.0
devices as per specification. These changes were present for hciops
pluging, the current changes are for Management operations plugin.

Change-Id: I4c27c3f833a001dfe7a4abf3db42253939544658
Signed-off-by: Prabhakaran Mc <prabhakaranmc@codeaurora.org>
2013-02-25 11:37:51 -08:00
Inga Stotland
a9342681d8 Bluetooth: Handle disconnect for LE links.
Additional check whether the disconnect request is
coming on LE link.

Change-Id: I525efe6f3b0eeafbec2c5b60ba0a10b7cd298eea
Signed-off-by: Inga Stotland <ingas@codeaurora.org>
2013-02-25 11:37:50 -08:00
Mat Martineau
4c0394c36c Bluetooth: Change socket release context
When sock_put() is called on an L2CAP socket, if the reference count
on a sock goes to 0, l2cap_sock_release() is called. As part of the
release, l2cap_sock_shutdown() locks the socket. This is not allowable
in interrupt context.  This change makes calls to sock_put() on the
system workqueue, where it can safely lock.

This addresses "scheduling while atomic" issues in both the Bluetooth
mgmt_ops pairing code and when RFCOMM sessions are deleted in a
security_cfm callback.

Change-Id: I4ff91a6849ec29707731adce2ccd40a7ada386a8
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
2013-02-25 11:37:49 -08:00
Brian Gix
dc7314fec4 Bluetooth: Fix Connection persistence, SSP caching
Fix key storage when not bonding
Fix when LE ACL is disconnected after use

Change-Id: I4425612ebc3720d614c43574ddfc449722eb26d2
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:49 -08:00
Brian Gix
d81a637f4d Bluetooth: Add LE SecMgr and mgmtops support
Enabled ECB Block encoding for Low Energy pairing
Implemented missing components of MGMTOPS interface
Differentiated as needed between BR/EDR pairing and LE pairing

Change-Id: Ifb26a9c8ca0c57286fcee92e840835560930c093
Signed-off-by: Brian Gix <bgix@codeaurora.org>
2013-02-25 11:37:48 -08:00
Stephen Boyd
069047086b Revert upstream bluetooth
This undoes all upstream bluetooth core changes since around
b79f44c (Bluetooth: Fix keeping the command timer running,
2011-04-11).

Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
2013-02-25 11:37:04 -08:00
Colin Cross
f02fac6330 Merge commit 'v3.4-rc6' into android-3.4
Conflicts:
	arch/arm/mm/cache-l2x0.c
	arch/arm/mm/mmu.c

Change-Id: If4f371a21c052fa597d107c44b128a093e4a8b91
2012-05-07 18:20:34 -07:00