summaryrefslogtreecommitdiff
path: root/net/bluetooth/mgmt.c
AgeCommit message (Collapse)Author
2012-12-03Merge branch 'for-upstream' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
2012-12-03Bluetooth: Move double negation to macrosGustavo Padovan
Some comparisons needs to double negation(!!) in order to make the value of the field boolean. Add it to the macro makes the code more readable. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-21Merge branch 'for-upstream' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
2012-11-21Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c drivers/net/wireless/iwlwifi/pcie/tx.c
2012-11-19Bluetooth: Use proper invalid value for tx_powerJohan Hedberg
The core specification defines 127 as the "not available" value (well, "reserved" for BR/EDR and "not available" for LE - but essentially the same). Therefore, instead of testing for 0 (which is in fact a valid value) we should be using this invalid value to test if the tx_power is available. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-09Bluetooth: Fix memory leak when removing a UUIDJohan Hedberg
When removing a UUID from the list in the remove_uuid() function we must also kfree the entry in addition to removing it from the list. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-09Bluetooth: Fix having bogus entries in mgmt_read_index_list replyJohan Hedberg
The mgmt_read_index_list uses one loop to calculate the max needed size of its response with the help of an upper-bound of the controller count. The second loop is more strict as it checks for HCI_SETUP (which might have gotten set after the first loop) and could result in some indexes being skipped. Because of this the function needs to readjust the event length and index count after filling in the response array. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: mgmt: Use __constant when dealing with constantsSyam Sidhardhan
__constant_cpu_to_le*() is the right go here. Signed-off-by: Syam Sidhardhan <s.syam@samsung.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: Fix sending unnecessary HCI_LE_Host_EnableJohan Hedberg
This patch fixes sending an unnecessary HCI_LE_Host_Enable command if the command has already been sent as part of the default HCI init sequence. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: Fix unnecessary EIR update during powering onJohan Hedberg
When powered on the EIR data gets updated as the last step by mgmt. Therefore avoid an update when getting a local name update as that's part of the normal HCI init sequence. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: Fix sending unnecessary HCI_Write_SSP_Mode commandJohan Hedberg
This patch fixes sending an unnecessary HCI_Write_SSP_Mode command if the command has already been sent as part of the default HCI init sequence. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: Make use feature test macrosJohan Hedberg
For better code readability and avoiding simple bugs of checking the wrong byte of the features make use of feature test macros whenever possible. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: mgmt: Restrict BR/EDR settings to BR/EDR-only adaptersJohan Hedberg
This patch makes sure that settings which are specific for BR/EDR capable adapters are not allowed for non-BR/EDR (e.g. LE-only) adapters. Instead, a "not supported" error is returned of such a setting is attempted to be set for a non-BR/EDR adapter. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-11-01Bluetooth: Fix HCI command sending when powering on LE-only adaptersJohan Hedberg
This patch makes sure that we don't send BR/EDR-only commands for LE-only adapters when they get powered on. Doing this would just cause command errors. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-10-19Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth-next
2012-09-30Merge branch 'for-davem' of ↵David S. Miller
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next John W. Linville says: ==================== Here is another batch of updates intended for 3.7... Highlights include an hci_connect re-write in Bluetooth, HCI/LLC layer separation in NFC, removal of the raw pn544 NFC driver, NFC LLCP raw sockets support, improved IBSS auth frame handling in mac80211, full-MAC AP mode notification support in mac80211, a lot of attention paid to brcmfmac, and the usual level of updates to iwlwifi, ath9k, mwifiex, and rt2x00, and various other updates. ==================== Signed-off-by: David S. Miller <davem@davemloft.net>
2012-09-28Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/netDavid S. Miller
Conflicts: drivers/net/team/team.c drivers/net/usb/qmi_wwan.c net/batman-adv/bat_iv_ogm.c net/ipv4/fib_frontend.c net/ipv4/route.c net/l2tp/l2tp_netlink.c The team, fib_frontend, route, and l2tp_netlink conflicts were simply overlapping changes. qmi_wwan and bat_iv_ogm were of the "use HEAD" variety. With help from Antonio Quartulli. Signed-off-by: David S. Miller <davem@davemloft.net>
2012-09-27Bluetooth: Force the process of unpair command if disconnect failedJefferson Delfes
The unpair process tries to disconnect any connection pending with remote. If there are some connection in connecting state, disconnect command will fail and unpair mgmt command will stay pending. That pending mgmt command can cause strange behavior like automatic unpair after a lost connection. Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-09-19Bluetooth: Update management interface revisionJohan Hedberg
For each kernel release where commands or events are added to the management interface, the revision field should be increment by one. The increment should only happen once per kernel release and not for every command/event that gets added. The revision value is for informational purposes only, but this simple policy would make any future debugging a lot simple. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-09-19Bluetooth: mgmt: Implement support for passkey notificationJohan Hedberg
This patch adds support for Secure Simple Pairing with devices that have KeyboardOnly as their IO capability. Such devices will cause a passkey notification on our side and optionally also keypress notifications. Without this patch some keyboards cannot be paired using the mgmt interface. Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Cc: stable@vger.kernel.org Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-09-18Bluetooth: mgmt: Fix enabling LE while powered offAndrzej Kaczmarek
When new BT USB adapter is plugged in it's configured while still being powered off (HCI_AUTO_OFF flag is set), thus Set LE will only set dev_flags but won't write changes to controller. As a result it's not possible to start device discovery session on LE controller as it uses interleaved discovery which requires LE Supported Host flag in extended features. This patch ensures HCI Write LE Host Supported is sent when Set Powered is called to power on controller and clear HCI_AUTO_OFF flag. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> Cc: stable@vger.kernel.org Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-09-18Bluetooth: mgmt: Fix enabling SSP while powered offAndrzej Kaczmarek
When new BT USB adapter is plugged in it's configured while still being powered off (HCI_AUTO_OFF flag is set), thus Set SSP will only set dev_flags but won't write changes to controller. As a result remote devices won't use Secure Simple Pairing with our device due to SSP Host Support flag disabled in extended features and may also reject SSP attempt from our side (with possible fallback to legacy pairing). This patch ensures HCI Write Simple Pairing Mode is sent when Set Powered is called to power on controller and clear HCI_AUTO_OFF flag. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> Cc: stable@vger.kernel.org Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-08-21Bluetooth: mgmt: Add device disconnect reasonMikel Astiz
MGMT_EV_DEVICE_DISCONNECTED will now expose the disconnection reason to userland, distinguishing four possible values: 0x00 Reason not known or unspecified 0x01 Connection timeout 0x02 Connection terminated by local host 0x03 Connection terminated by remote host Note that the local/remote distinction just determines which side terminated the low-level connection, regardless of the disconnection of the higher-level profiles. This can sometimes be misleading and thus must be used with care. For example, some hardware combinations would report a locally initiated disconnection even if the user turned Bluetooth off in the remote side. Signed-off-by: Mikel Astiz <mikel.astiz@bmw-carit.de> Acked-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-08-06Bluetooth: Use lmp_ssp_capable where applicableAndre Guedes
This patch replaces all LMP_SIMPLE_PAIR bit checking by the helper macro lmp_ssp_capable. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-08-06Bluetooth: Use lmp_le_capable where applicableAndre Guedes
This patch replaces all LMP_LE bit checking by the helper macro lmp_le_capable. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-08-06Bluetooth: Use lmp_bredr_capable where applicableAndre Guedes
This patch replaces all LMP_NO_BREDR bit checking by the helper macro lmp_bredr_capable. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-08-06Bluetooth: mgmt: Managing only BR/EDR HCI controllersAndrei Emeltchenko
Add check that HCI controller is BR/EDR. AMP controller shall not be managed by mgmt interface and consequently user space. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-07-16Bluetooth: Change page scan interval in fast connectable modeJohan Hedberg
This patch is based on a user space (hciops) patch which never made it upstream but does make sense to include in the mgmt part of the kernel. (User space) commit message from Dmitriy Paliy: " Page scan interval in fast connectable mode is changed from 22.5 msec to 160 msec to perform less aggressive page scanning. This is done accordingly to controller vendor recommendation. Primary concern is that current parameters 22.5 interval, 11.25 window, and interleaved scanning occupy whole radio bandwidth. Changing interval to 160 msec should be sufficient for both speeding up connection establishment and leaving space for other activities, like inquiry scan, e.g. " Signed-off-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-07-10Bluetooth: Refactor PIN code rejection to use user_pairing_resp()Jaganath Kanakkassery
Reuse user_pairing_resp() to send PIN code negative reply Signed-off-by: Jaganath Kanakkassery <jaganath.k@samsung.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-26Merge branch 'for-upstream' of ↵Gustavo Padovan
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth
2012-06-19Bluetooth: Use GFP_KERNEL in mgmt events functionsAndre Guedes
cmd_status, cmd_complete and mgmt_event functions are executed in process context and they are not called inside atomic sections. Thus, they should use GFP_KERNEL for memory allocation instead of GFP_ATOMIC. Signed-off-by: Andre Guedes <aguedespe@gmail.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-19Bluetooth: Use GFP_KERNEL in mgmt_pending_addAndre Guedes
We are allowed to sleep in mgmt_pending_add, so we should use GFP_KERNEL for memory allocations instead of GFP_ATOMIC. Signed-off-by: Andre Guedes <aguedespe@gmail.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-19Bluetooth: Use GFP_KERNEL in mgmt_handlersAndre Guedes
add_uuid and get_connections mgmt_handlers are executed by user threads running in kernel-mode. Signed-off-by: Andre Guedes <aguedespe@gmail.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-19Bluetooth: Fix compile warnings in mgmtAndrei Emeltchenko
Commit af7985bf85840e3dc90ba108a679db044f91f00e introduced regression resulting in complie warnings: ... net/bluetooth/mgmt.c:3568:27: warning: invalid assignment: |= net/bluetooth/mgmt.c:3568:27: left side has type restricted __le32 net/bluetooth/mgmt.c:3568:27: right side has type int net/bluetooth/mgmt.c:3570:27: warning: invalid assignment: |= net/bluetooth/mgmt.c:3570:27: left side has type restricted __le32 net/bluetooth/mgmt.c:3570:27: right side has type int net/bluetooth/mgmt.c:3580:21: warning: cast from restricted __le32 ... Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-14Bluetooth: Fix sending HCI_Disconnect only when connectedVishal Agarwal
HCI_Disconnect should only be sent after connection is established. If connection is not yet established and HCI_Disconnect is called then disconnection complete will be received with a handle which does not exist and hence this event will be ignored. But as mgmt.c will not receive this event, its variable for pending command is not cleared.This will result in future Disconnect commands for that BD Address to be blocked with error busy. Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-13Bluetooth: Remove magic value in disconnect mgmt handlerAndre Guedes
This patch replaces the magic value of variable 'reason' by the proper macro. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-13Bluetooth: Fix flags of mgmt_device_found eventJefferson Delfes
Change flags field to matches userspace structure. This field needs to be converted to little endian before forward it. Signed-off-by: Jefferson Delfes <jefferson.delfes@openbossa.org> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-12Merge branch 'for-upstream' of ↵Gustavo Padovan
git://git.kernel.org/pub/scm/linux/kernel/git/bluetooth/bluetooth Conflicts: net/bluetooth/hci_event.c
2012-06-08Bluetooth: Fix LE pairing completion on connection failureVishal Agarwal
For BR/EDR pairing is assumed to be finished when connection is done. For LE if connection is successful it did not necessarily mean that pairing is also done but if the connection is unsuccessful it should be assumed that pairing procedure is also finished. This patch registers a new function with connect_cfm_cb callback for LE link which sends the pairing complete signal to user space if connection is unsuccessful. Signed-off-by: Vishal Agarwal <vishal.agarwal@stericsson.com> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-05Bluetooth: Return proper mgmt state when LE pairing connection failedAndrzej Kaczmarek
MGMT_STATUS_BUSY should be returned when LE pairing cannot be started due to another outgoing connection attempt is ongoing. Signed-off-by: Andrzej Kaczmarek <andrzej.kaczmarek@tieto.com> Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk>
2012-06-05Bluetooth: Remove unnecessary headers includeGustavo Padovan
Most of the include were unnecessary or already included by some other header. Replace module.h by export.h where possible. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-06-05Bluetooth: Fix coding style in the subsystemGustavo Padovan
This is some leftover from the last patches that fixed style. It is mostly line over 80 characters fixes reported by checkpatch.pl. checkpatch.pl is clean for these files now. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-06-05Bluetooth: Remove most of the inline usageGustavo Padovan
Only obvious cases were left as inline, mostly oneline functions. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-06-05Bluetooth: Use defined link key sizeAndrei Emeltchenko
Remove magic number with defined link key size. Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-06-05Bluetooth: Fix coding style in mgmt.cGustavo Padovan
Follow the coding style of the net subsystem. Signed-off-by: Gustavo Padovan <gustavo.padovan@collabora.co.uk> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-05-09Bluetooth: Fixed checkpatch warningsCristian Chilipirea
Fixed some checkpatch warnings in mgmt.c. Signed-off-by: Cristian Chilipirea <cristian.chilipirea@gmail.com> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
2012-05-09Bluetooth: Enable Low Energy support by defaultMarcel Holtmann
The Bluetooth Low Energy support so far was disabled by default via a module parameter. With this change the module parameter will be removed and Low Energy is enabled by default. Signed-off-by: Marcel Holtmann <marcel@holtmann.org> Signed-off-by: Gustavo Padovan <gustavo@padovan.org>
2012-05-09Bluetooth: Add dst_type parameter to hci_connectAndre Guedes
This patch adds the dst_type parameter to hci_connect function. Instead of searching the address type in advertising cache, we use the dst_type parameter to establish LE connections. The dst_type is ignored for BR/EDR connection establishment. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-05-09Bluetooth: Move bdaddr_to_le to hci_coreAndre Guedes
This patch moves the helper function bdaddr_to_le to hci_core, so it can be used in mgmt.c and hci_conn.c. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>
2012-05-09Bluetooth: Rename mgmt_to_le to bdaddr_to_leAndre Guedes
Since address type macros are not only related to Management Interface anymore, it makes sense to rename the helper function mgmt_to_le to bdaddr_to_le. Signed-off-by: Andre Guedes <andre.guedes@openbossa.org> Acked-by: Johan Hedberg <johan.hedberg@intel.com> Signed-off-by: Marcel Holtmann <marcel@holtmann.org>