Johan Hedberg [Tue, 8 Nov 2011 10:25:52 +0000 (12:25 +0200)]
Bluetooth: Remove redundant code from mgmt_block & mgmt_unblock
There's no need to deal with mgmt_pending_cmd when blocking and
unblocking devices since these actions are synchronous.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Mon, 7 Nov 2011 20:16:04 +0000 (22:16 +0200)]
Bluetooth: Convert power off mechanism to use delayed_work
The power off code doesn't need to use its own custom timer since the
delayed_work API provides the exact same functionality.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Mon, 7 Nov 2011 20:16:03 +0000 (22:16 +0200)]
Bluetooth: Fix mgmt response when HCI_Write_Scan_Enable fails
A proper mgmt_command_status should be returned to user-space if either
discoverable or connectable enabling fails.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Mon, 7 Nov 2011 20:16:02 +0000 (22:16 +0200)]
Bluetooth: Add timeout field to mgmt_set_discoverable
Based on the revised mgmt API set_discoverable has a timeout parameter
to specify how long the adapter will remain discoverable. A value of 0
means "indefinitively".
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Fri, 4 Nov 2011 17:16:53 +0000 (14:16 -0300)]
Bluetooth: Periodic Inquiry and Discovery
By using periodic inquiry command we're not able to detect correctly
when the controller has started inquiry.
Today we have this workaround in inquiry result event handler
to set the HCI_INQUIRY flag when it sees the first inquiry result
event. This workaround isn't enough because the device may be
performing an inquiry but the HCI_INQUIRY flag is not set. For
instance, if there is no device in range, no inquiry result event
is generated, consequently, the HCI_INQUIRY flags isn't set when
it should so.
We rely on HCI_INQUIRY flag to implement the discovery procedure
properly. So, as we aren't able to clear/set the HCI_INQUIRY flag
in a reliable manner, periodic inquiry events shouldn't change
the HCI_INQUIRY flag.
Thus, due to that issue and in order to keep compatibility with
userspace, periodic inquiry events shouldn't send mgmt discovering
events.
In future, we might track if periodic inquiry is enabled or not.
By tracking this state we'll be able to do some improvements in
Discovery such as failing MGMT_OP_START_DISCOVERY command in case
periodic inquiry is on. We can also send no mgmt_device_found
event if periodic inquiry is on.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Fri, 4 Nov 2011 17:16:52 +0000 (14:16 -0300)]
Bluetooth: Create hci_cancel_inquiry()
This patch adds a function to hci_core to cancel an ongoing inquiry.
According to the Bluetooth spec, the inquiry cancel command should
only be issued after the inquiry command has been issued, a command
status event has been received for the inquiry command, and before
the inquiry complete event occurs.
As HCI_INQUIRY flag is only set just after an inquiry command status
event occurs and it is cleared just after an inquiry complete event
occurs, the inquiry cancel command should be issued only if HCI_INQUIRY
flag is set.
Additionally, cancel inquiry related code from stop_discovery() were
replaced by a hci_cancel_inquiry() call.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Mon, 7 Nov 2011 14:45:24 +0000 (11:45 -0300)]
Bluetooth: Create hci_do_inquiry()
This patch adds a function to hci_core to carry out inquiry.
All inquiry code from start_discovery() were replaced by a
hci_do_inquiry() call.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 7 Nov 2011 12:20:33 +0000 (14:20 +0200)]
Bluetooth: EFS: parse L2CAP config response
Add parsing Extended Flow Specification in L2CAP Config Response.
Based upon haijun.liu <haijun.liu@atheros.com> series of patches
(sent Sun, 22 Aug 2010)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 7 Nov 2011 12:20:25 +0000 (14:20 +0200)]
Bluetooth: Define HCI reasons instead of magic number
Use HCI error reasons instead of magic numbers.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 3 Nov 2011 22:17:45 +0000 (00:17 +0200)]
Bluetooth: Clean up logic in hci_cc_write_scan_enable
This patch adds a new label to hci_cc_write_scan_enable to avoid
unnecessary indentation. This will be convenient especially when new
code for the discoverable timeout gets added.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Thu, 3 Nov 2011 15:05:44 +0000 (16:05 +0100)]
Bluetooth: Add debug print to l2cap_chan_create
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Thu, 3 Nov 2011 12:40:33 +0000 (14:40 +0200)]
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.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:36 +0000 (16:18 -0700)]
Bluetooth: Guarantee BR-EDR device will be registered as hci0
It's convenient to use the HCI device index the AMP controller id, but
the spec requires that an AMP controller never has id 0.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:35 +0000 (16:18 -0700)]
Bluetooth: Add signal handlers for channel moves
AMP channels can be moved between BR/EDR and AMP controllers using a
sequence of signals. Every attempted channel move involves a series of
four signals:
Move Initiator Move Responder
| |
| Move Channel Request |
| ----------------------------> |
| |
| Move Channel Response |
| <---------------------------- |
| |
| Move Channel Confirm |
| ----------------------------> |
| |
| Move Channel Confirm Response |
| <---------------------------- |
All four signals are sent even if the move fails.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:34 +0000 (16:18 -0700)]
Bluetooth: Use symbolic values for the fixed channel map
The A2MP fixed channel bit is only set when high-speed mode is enabled.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:33 +0000 (16:18 -0700)]
Bluetooth: Add definitions for L2CAP fixed channels
Symbolic fixed channel IDs will be used instead of magic numbers.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:32 +0000 (16:18 -0700)]
Bluetooth: Add signal handlers for channel creation
Handle both "create channel request" and "create channel response".
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:31 +0000 (16:18 -0700)]
Bluetooth: Add AMP-related data and structures for channel signals
AMP channel creation and channel moves are coordinated using the L2CAP
signaling channel. These definitions cover the "create channel",
"move channel", and "move channel confirm" signals.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:30 +0000 (16:18 -0700)]
Bluetooth: Add channel policy to getsockopt/setsockopt
Each channel has a policy to require BR/EDR (the default),
prefer BR/EDR, or prefer AMP.
Check for valid policy value and L2CAP mode.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:29 +0000 (16:18 -0700)]
Bluetooth: Change scope of the enable_hs module parameter
This variable is currently only accessible within l2cap_core.c, but
it is also needed in l2cap_sock.c
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Mat Martineau [Wed, 2 Nov 2011 23:18:28 +0000 (16:18 -0700)]
Bluetooth: Add BT_CHANNEL_POLICY socket option
Allow control of AMP functionality on L2CAP sockets. By default,
connections will be restricted to BR/EDR. Manipulating the
BT_CHANNEL_POLICY option allows for channels to be moved to or created
on AMP controllers.
Signed-off-by: Mat Martineau <mathewm@codeaurora.org>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Acked-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Wed, 2 Nov 2011 07:57:10 +0000 (09:57 +0200)]
Bluetooth: Initialize tx_win_max for fixed channel
tx_win_max is initialized during L2CAP configuration phase. For fixed
channels (e.g. A2MP) we want to have it initialized when channel is
created.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Wed, 2 Nov 2011 13:52:04 +0000 (15:52 +0200)]
Bluetooth: use buffer priority to mark URB_ISO_ASAP flag
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Wed, 2 Nov 2011 13:52:03 +0000 (15:52 +0200)]
Bluetooth: recalculate priorities when channels are starving
To avoid starvation the priority is recalculated so that the starving
channels are promoted to HCI_PRIO_MAX - 1 (6).
HCI_PRIO_MAX (7) is considered special, because it requires CAP_NET_ADMIN
capability which can be used to provide more guaranties, so it is not used
when promoting.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Wed, 2 Nov 2011 13:52:02 +0000 (15:52 +0200)]
Bluetooth: handle priority change within quote
The quote is calculated based on the first buffer in the queue so if the
priority changes to something lower than the priority of the first skb
the quote needs to be recalculated.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Wed, 2 Nov 2011 13:52:01 +0000 (15:52 +0200)]
Bluetooth: prioritizing data over HCI
This implement priority based scheduler using skbuffer priority set via
SO_PRIORITY socket option.
It introduces hci_chan_hash (list of HCI Channel/hci_chan) per connection,
each item in this list refer to a L2CAP connection and it is used to
queue the data for transmission.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 20 Oct 2011 19:21:34 +0000 (17:21 -0200)]
Bluetooth: Fix hidp_get_connection()
This functions needs crtl_sock and intr_sock to be set first.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Tue, 1 Nov 2011 16:27:50 +0000 (17:27 +0100)]
Bluetooth: hidp: Fix module reference cleanup
Calling module_put(THIS_MODULE) is *never* safe when we cannot go sure that we
own at least two references. This is because the call may unload our module
before it returns and then the "return" will jump into invalid memory.
Gladly, module.h provides a wrapper for kthread-users: module_put_and_exit().
This puts our module and then exits the kthread without returning to the module.
This patch fixes the hidp kthread to use this wrapper instead of manually
freeing its own reference. See nfsd or lockd for other kthreads using this.
Calling __module_get() inside the kthread is safe as the hidp module will always
wait until the kthread sets "waiting_for_startup" to 0.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Wed, 26 Oct 2011 09:22:46 +0000 (11:22 +0200)]
Bluetooth: bfusb: Fix error path on firmware load
When loading the usb-configuration we do not signal the end of configuration on
memory allocation error. This patch moves the memory allocation to the top so
every error path uses "goto error" now to correctly send the usb-ctrl message
when detecting some error.
This also replaces GFP_ATOMIC with GFP_KERNEL as we are allowed to sleep here.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Tue, 25 Oct 2011 19:13:36 +0000 (21:13 +0200)]
Bluetooth: bcm203x: Use GFP_KERNEL in workqueue
A workqueue is allowed to sleep so we can safely use GFP_KERNEL instead of
GFP_ATOMIC. This is still legacy code when the driver used timer BHs and not a
worqueue.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Wed, 26 Oct 2011 09:13:13 +0000 (11:13 +0200)]
Bluetooth: bcm203x: Fix race condition on disconnect
When disconnecting a bcm203x device we kill and destroy the usb-urb, however,
there might still be a pending work-structure which resubmits the now invalid
urb. To avoid this race condition, we simply set a shutdown-flag and
synchronously kill the worker first.
This also adds a comment to all schedule_work()s, as it is really not clear
that they are used as replacement for short timers (which can be seen in the git
history).
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Tue, 25 Oct 2011 10:09:52 +0000 (12:09 +0200)]
Bluetooth: ath3k: Use GFP_KERNEL instead of GFP_ATOMIC
We are allowed to sleep here so no need to use GFP_ATOMIC. The caller
(ath3k_probe) calls request_firmware() which definitely sleeps. Hence, we should
avoid using GFP_ATOMIC.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Mon, 24 Oct 2011 20:36:26 +0000 (22:36 +0200)]
Bluetooth: Set HCI_MGMT flag only in read_controller_info
The HCI_MGMT flag should only be set when user space requests the full
controller information. This way we avoid potential issues with setting
change events ariving before the actual read_controller_info command
finishes.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Mon, 17 Oct 2011 21:05:49 +0000 (23:05 +0200)]
Bluetooth: Increase HCI reset timeout in hci_dev_do_close
I've noticed that my CSR usb dongle was not working if it was plugged in when
PC was booting. It looks like I get two HCI reset command complete events (see
hcidump logs below).
The root cause is reset called from off_timer. Timeout for this reset to
complete is set to 250ms and my bt dongle requires more time for replying with
command complete event. After that, chip seems to reply with reset command
complete event for next non-reset command.
Attached patch increase mentioned timeout to HCI_INIT_TIMEOUT, this value is
already used for timeouting hci_reset_req in hci_dev_reset().
This might also be related to BT not working after suspend that was reported
here some time ago.
Hcidump log:
2011-09-12 23:13:27.379465 < HCI Command: Reset (0x03|0x0003) plen 0
2011-09-12 23:13:27.380797 > HCI Event: Command Complete (0x0e) plen 4
Reset (0x03|0x0003) ncmd 1
status 0x00
2011-09-12 23:13:27.380859 < HCI Command: Read Local Supported Features (0x04|0x000
3) plen 0
2011-09-12 23:13:27.760789 > HCI Event: Command Complete (0x0e) plen 4
Reset (0x03|0x0003) ncmd 1
status 0x00
2011-09-12 23:13:27.760831 < HCI Command: Read Local Version Information (0x04|0x00
01) plen 0
2011-09-12 23:13:27.764780 > HCI Event: Command Complete (0x0e) plen 12
Read Local Version Information (0x04|0x0001) ncmd 1
status 0x00
HCI Version: 1.1 (0x1) HCI Revision: 0x36f
LMP Version: 1.1 (0x1) LMP Subversion: 0x36f
Manufacturer: Cambridge Silicon Radio (10)
Signed-off-by: Szymon Janc <szymon@janc.net.pl>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Mon, 26 Sep 2011 12:19:47 +0000 (14:19 +0200)]
Bluetooth: rfcomm: Fix sleep in invalid context in rfcomm_security_cfm
This was triggered by turning off encryption on ACL link when rfcomm
was using high security. rfcomm_security_cfm (which is called from rx
task) was closing DLC and this involves sending disconnect message
(and locking socket).
Move closing DLC to rfcomm_process_dlcs and only flag DLC for closure
in rfcomm_security_cfm.
BUG: sleeping function called from invalid context at net/core/sock.c:2032
in_atomic(): 1, irqs_disabled(): 0, pid: 1788, name: kworker/0:3
[<
c0068a08>] (unwind_backtrace+0x0/0x108) from [<
c05e25dc>] (dump_stack+0x20/0x24)
[<
c05e25dc>] (dump_stack+0x20/0x24) from [<
c0087ba8>] (__might_sleep+0x110/0x12c)
[<
c0087ba8>] (__might_sleep+0x110/0x12c) from [<
c04801d8>] (lock_sock_nested+0x2c/0x64)
[<
c04801d8>] (lock_sock_nested+0x2c/0x64) from [<
c05670c8>] (l2cap_sock_sendmsg+0x58/0xcc)
[<
c05670c8>] (l2cap_sock_sendmsg+0x58/0xcc) from [<
c047cf6c>] (sock_sendmsg+0xb0/0xd0)
[<
c047cf6c>] (sock_sendmsg+0xb0/0xd0) from [<
c047cfc8>] (kernel_sendmsg+0x3c/0x44)
[<
c047cfc8>] (kernel_sendmsg+0x3c/0x44) from [<
c056b0e8>] (rfcomm_send_frame+0x50/0x58)
[<
c056b0e8>] (rfcomm_send_frame+0x50/0x58) from [<
c056b168>] (rfcomm_send_disc+0x78/0x80)
[<
c056b168>] (rfcomm_send_disc+0x78/0x80) from [<
c056b9f4>] (__rfcomm_dlc_close+0x2d0/0x2fc)
[<
c056b9f4>] (__rfcomm_dlc_close+0x2d0/0x2fc) from [<
c056bbac>] (rfcomm_security_cfm+0x140/0x1e0)
[<
c056bbac>] (rfcomm_security_cfm+0x140/0x1e0) from [<
c0555ec0>] (hci_event_packet+0x1ce8/0x4d84)
[<
c0555ec0>] (hci_event_packet+0x1ce8/0x4d84) from [<
c0550380>] (hci_rx_task+0x1d0/0x2d0)
[<
c0550380>] (hci_rx_task+0x1d0/0x2d0) from [<
c009ee04>] (tasklet_action+0x138/0x1e4)
[<
c009ee04>] (tasklet_action+0x138/0x1e4) from [<
c009f21c>] (__do_softirq+0xcc/0x274)
[<
c009f21c>] (__do_softirq+0xcc/0x274) from [<
c009f6c0>] (do_softirq+0x60/0x6c)
[<
c009f6c0>] (do_softirq+0x60/0x6c) from [<
c009f794>] (local_bh_enable_ip+0xc8/0xd4)
[<
c009f794>] (local_bh_enable_ip+0xc8/0xd4) from [<
c05e5804>] (_raw_spin_unlock_bh+0x48/0x4c)
[<
c05e5804>] (_raw_spin_unlock_bh+0x48/0x4c) from [<
c040d470>] (data_from_chip+0xf4/0xaec)
[<
c040d470>] (data_from_chip+0xf4/0xaec) from [<
c04136c0>] (send_skb_to_core+0x40/0x178)
[<
c04136c0>] (send_skb_to_core+0x40/0x178) from [<
c04139f4>] (cg2900_hu_receive+0x15c/0x2d0)
[<
c04139f4>] (cg2900_hu_receive+0x15c/0x2d0) from [<
c0414cb8>] (hci_uart_tty_receive+0x74/0xa0)
[<
c0414cb8>] (hci_uart_tty_receive+0x74/0xa0) from [<
c02cbd9c>] (flush_to_ldisc+0x188/0x198)
[<
c02cbd9c>] (flush_to_ldisc+0x188/0x198) from [<
c00b2774>] (process_one_work+0x144/0x4b8)
[<
c00b2774>] (process_one_work+0x144/0x4b8) from [<
c00b2e8c>] (worker_thread+0x198/0x468)
[<
c00b2e8c>] (worker_thread+0x198/0x468) from [<
c00b9bc8>] (kthread+0x98/0xa0)
[<
c00b9bc8>] (kthread+0x98/0xa0) from [<
c0061744>] (kernel_thread_exit+0x0/0x8)
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Johan Hedberg [Tue, 1 Nov 2011 15:06:44 +0000 (17:06 +0200)]
Bluetooth: Fix command complete/status for discovery commands
This patch adds the necessary code to send proper command status or
command complete events to the start/stop discovery management commands.
Before this patch these events were completely missing.
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Tue, 1 Nov 2011 08:58:58 +0000 (10:58 +0200)]
Bluetooth: make use sk_priority to priritize RFCOMM packets
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Tue, 1 Nov 2011 08:58:57 +0000 (10:58 +0200)]
Bluetooth: set skbuffer priority based on L2CAP socket priority
This uses SO_PRIORITY to set the skbuffer priority field
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Luiz Augusto von Dentz [Tue, 1 Nov 2011 08:58:56 +0000 (10:58 +0200)]
Bluetooth: replace list_for_each with list_for_each_entry whenever possible
When all items in the list have the same type there is no much of a point
to use list_for_each except if you want to use the list pointer itself.
Signed-off-by: Luiz Augusto von Dentz <luiz.von.dentz@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 31 Oct 2011 14:17:21 +0000 (16:17 +0200)]
Bluetooth: correct debug output
l2cap_set_timer function prints sk instead of chan pointer.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 20 Oct 2011 14:02:44 +0000 (17:02 +0300)]
Bluetooth: remove magic offset and size
make code readable by removing magic numbers
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Tue, 1 Nov 2011 16:06:23 +0000 (14:06 -0200)]
Bluetooth: small styles clean ups to l2cap_core.c
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 11:35:32 +0000 (14:35 +0300)]
Bluetooth: EFS: implement L2CAP config pending state
Add L2CAP Config Pending state for EFS. Currently after receiving
Config Response Pending respond with Config Response Success.
...
> ACL data: handle 1 flags 0x02 dlen 16
L2CAP(s): Connect rsp: dcid 0x0040 scid 0x0040 result 0 status 0
Connection successful
> ACL data: handle 1 flags 0x02 dlen 45
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 33
RFC 0x03 (Enhanced Retransmission, TxWin 63, MaxTx 3, RTo 0, MTo 0, MPS 1009)
EFS (Id 0x01, SerType Best Effort, MaxSDU 0xffff, SDUitime 0xffffffff,
AccLat 0xffffffff, FlushTO 0x0000ffff)
< ACL data: handle 1 flags 0x00 dlen 45
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 33
RFC 0x03 (Enhanced Retransmission, TxWin 63, MaxTx 3, RTo 0, MTo 0, MPS 498)
EFS (Id 0x01, SerType Best Effort, MaxSDU 0xffff, SDUitime 0xffffffff,
AccLat 0xffffffff, FlushTO 0x0000ffff)
< ACL data: handle 1 flags 0x00 dlen 47
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 4 clen 33
Pending
MTU 672
RFC 0x03 (Enhanced Retransmission, TxWin 63, MaxTx 3, RTo 2000, MTo 12000, MPS 498)
EFS (Id 0x01, SerType Best Effort, MaxSDU 0xffff, SDUitime 0xffffffff,
AccLat 0xffffffff, FlushTO 0x0000ffff)
> ACL data: handle 1 flags 0x02 dlen 47
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 4 clen 33
Pending
MTU 672
RFC 0x03 (Enhanced Retransmission, TxWin 63, MaxTx 3, RTo 2000, MTo 12000, MPS 498)
EFS (Id 0x01, SerType Best Effort, MaxSDU 0xffff, SDUitime 0xffffffff,
AccLat 0xffffffff, FlushTO 0x0000ffff)
> ACL data: handle 1 flags 0x02 dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
Success
< ACL data: handle 1 flags 0x00 dlen 14
L2CAP(s): Config rsp: scid 0x0040 flags 0x00 result 0 clen 0
Success
< ACL data: handle 1 flags 0x00 dlen 510
L2CAP(d): cid 0x0040 len 506 ext_ctrl 0x00010000 fcs 0xebe0 [psm 4113]
I-frame: Start (len 672) TxSeq 0 ReqSeq 0
...
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Paul Fertser [Sat, 29 Oct 2011 17:52:49 +0000 (21:52 +0400)]
Bluetooth: ath3k: output firmware filename when request_firmware failed
This makes it much easier for the users to understand why the driver
refuses to load when the firmware is unavailable.
Signed-off-by: Paul Fertser <fercerpav@gmail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Wed, 26 Oct 2011 08:43:19 +0000 (10:43 +0200)]
Bluetooth: Make hci_unregister_dev return void
hci_unregister_dev cannot fail and always returns 0. The drivers already ignore
the return value so we can safely make it return void.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Wed, 26 Oct 2011 08:43:18 +0000 (10:43 +0200)]
Bluetooth: Ignore hci_unregister_dev return value
Make all bluetooth drivers ignore the return value of hci_unregister_dev as it
always returns 0. In the next step, hci_unregister_dev can be modified to return
void.
Some of the drivers already ignore the return value (including btusb), hence,
this will increase consitency in the bluetooth drivers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Mon, 24 Oct 2011 13:30:58 +0000 (15:30 +0200)]
Bluetooth: Replace rfcomm tty tasklet by workqueue
Remove old tasklets and replace by workqueue. To avoid reentrancy (which
tasklets always avoid) we use the system_nrt_wq.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Mon, 24 Oct 2011 13:30:57 +0000 (15:30 +0200)]
Bluetooth: Return proper error codes on rfcomm tty init
Forward error codes from tty core to the rfcomm_init caller instead of using
generic -1 errors.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 11:35:30 +0000 (14:35 +0300)]
Bluetooth: EFS: parse L2CAP config request
Add parsing Extended Flow Specification option in L2CAP Config Request
Based upon haijun.liu <haijun.liu@atheros.com> series of patches
(sent Sun, 22 Aug 2010)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 09:19:59 +0000 (12:19 +0300)]
Bluetooth: EWS: fix max_pdu calculation
Fix max_pdu_size calculationin for RFC. Change magic number to human readable
defines.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 09:19:58 +0000 (12:19 +0300)]
Bluetooth: EWS: remove magic numbers in l2cap
Remove magic numbers for FCS, SDU LEN and PSM LEN
when calculating packet payload.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 09:19:57 +0000 (12:19 +0300)]
Bluetooth: EWS: support extended seq numbers
Adds support for extended sequence numbers found in
extended control fields.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Mon, 17 Oct 2011 09:19:56 +0000 (12:19 +0300)]
Bluetooth: EWS: handling different Control fields
There are three different Control Field formats: the Standard Control
Field, the Enhanced Control Field, and the Extended Control Field.
Patch adds function to handle all those fields seamlessly.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Sat, 15 Oct 2011 21:03:15 +0000 (18:03 -0300)]
Bluetooth: Fix missing cmd_status in mgmt
set_service_cache() was missing a cmd_status for the error case.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 14 Oct 2011 22:56:21 +0000 (19:56 -0300)]
Bluetooth: Fix mgmt interaction with userspace
Partially revert
34918cd7. struct mgmt_key_info needs to have the same
size as its version exported to userspace.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 14 Oct 2011 22:32:56 +0000 (19:32 -0300)]
Bluetooth: Use list_for_each_entry() in mgmt
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 14 Oct 2011 22:23:27 +0000 (19:23 -0300)]
Bluetooth: Add missing cmd_status() in mgmt
Improve error handling in mgmt load_keys()
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 14 Oct 2011 22:20:01 +0000 (19:20 -0300)]
Bluetooth: return proper error if sock_queue_rcv_skb() fails
Improve error handling at cmd_status() and cmd_complete()
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Sat, 8 Oct 2011 12:58:49 +0000 (14:58 +0200)]
Bluetooth: Forward errors from hci_register_dev
We need to catch errors when calling hci_add_sysfs() and return them to
the caller to avoid kernel oopses on device_add() failure.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Sat, 8 Oct 2011 12:58:48 +0000 (14:58 +0200)]
Bluetooth: Rename sysfs un/register to add/del
As we introduced hci_init_sysfs() we should also rename
hci_register_sysfs() and hci_unregister_sysfs() to hci_add_sysfs() and
hci_del_sysfs() like we do with hci_conn_add/del_sysfs(). It looks more
consistent now.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Sat, 8 Oct 2011 12:58:47 +0000 (14:58 +0200)]
Bluetooth: Fix hci core device initialization
We must not call device_del() if we didn't use device_add(). See module.c
for comments on that. Therefore, we need to call device_initialize() when
allocating the hci device and later device_add() instead of
device_register().
This also fixes a bug when hci_register_dev() failed and we call
hci_free_dev() without a valid core device. hci_free_dev() segfaults while
calling put_device() on invalid memory.
We already do this with hci_conn connections (hci_conn_init_sysfs()) so
they do not need to be fixed.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Wed, 12 Oct 2011 07:53:57 +0000 (10:53 +0300)]
Bluetooth: AMP: read local amp info HCI command
Implementation of Read Local AMP Info Command
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 13 Oct 2011 13:18:55 +0000 (16:18 +0300)]
Bluetooth: EFS: add efs option in L2CAP conf req
Add Extended Flow Specification option when building L2CAP
Configuration Request. EFS is added if both the local and
remote L2CAP entities have indicated support for the
Extended Flow Specification for BR/EDR.
...
< ACL data: handle 1 flags 0x00 dlen 10
L2CAP(s): Info req: type 2
> ACL data: handle 1 flags 0x02 dlen 16
L2CAP(s): Info rsp: type 2 result 0
Extended feature mask 0x01f8
Enhanced Retransmission mode
Streaming mode
FCS Option
Extended Flow Specification
Fixed Channels
Extended Window Size
...
< ACL data: handle 1 flags 0x00 dlen 45
L2CAP(s): Config req: dcid 0x0040 flags 0x00 clen 33
RFC 0x03 (Enhanced Retransmission, TxWin 63, MaxTx 3, RTo 0, MTo 0, MPS 498)
EFS (Id 0x01, SerType Best Effort, MaxSDU 0xffff, SDUitime 0xffffffff,
AccLat 0xffffffff, FlushTO 0x0000ffff)
...
Based upon haijun.liu <haijun.liu@atheros.com> series of patches
(sent Sun, 22 Aug 2010)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 13 Oct 2011 13:18:54 +0000 (16:18 +0300)]
Bluetooth: EFS: assign default values in chan add
Assign default EFS values when creating L2CAP channel
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Thu, 13 Oct 2011 13:18:53 +0000 (16:18 +0300)]
Bluetooth: EFS: definitions and headers
Define Extended Flow Specification structures and default values.
Based upon haijun.liu <haijun.liu@atheros.com> series of patches
(sent Sun, 22 Aug 2010)
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:54 +0000 (13:37 +0300)]
Bluetooth: EWS: define L2CAP header sizes
Adds definitins for L2CAP header sizes to be uses when calculating
payload size instead of magic numbers.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:52 +0000 (13:37 +0300)]
Bluetooth: EWS: recalculate L2CAP header size
Recalculate length of L2CAP header based on Control field length.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:50 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite handling POLL (P) bit
Handle POLL (P) bit in L2CAP ERTM using information about control field type.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:49 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite handling FINAL (F) bit
Handle final (F) bit in L2CAP using information about control field type.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:48 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite check frame type function
Check frame function uses now information about control field type.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:47 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite L2CAP ERTM txseq calculation
L2CAP ERTM txseq calculation uses now information about control field type.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:46 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite reqseq calculation
reqseq calculation uses now information about control field type.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:45 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite handling SAR bits
Segmentation and Reassembly (SAR) occupies different windows in standard and
extended control fields. Convert hardcoded masks to relative ones and use shift
to access SAR bits.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:44 +0000 (13:37 +0300)]
Bluetooth: EWS: rewrite handling Supervisory (S) bits
Supervisory bits occupy different windows in standard / extended control
fields. Convert hardcoded masks to relative ones and use shift to access
S-bit window.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:43 +0000 (13:37 +0300)]
Bluetooth: EWS: adds ext control field bit mask
Adds extended control field bit masks and rearrange defines to logical
groups: masks, flags and shift groups.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:42 +0000 (13:37 +0300)]
Bluetooth: EWS: extended window size option support
Adds support for extended window size (EWS) config option. We enable EWS
feature in L2CAP Info RSP when hs enabled. EWS option is included in L2CAP
Config Req if tx_win (which is set via socket) bigger then standard default
value (63) && hs enabled && remote side supports EWS feature.
Using EWS selects extended control field in L2CAP.
Code partly based on Qualcomm and Atheros patches sent upstream a year ago.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Tue, 11 Oct 2011 18:57:01 +0000 (15:57 -0300)]
Bluetooth: Fix permission of enable_le param
With 0444 it is impossible to change the param, changing it to 0644.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 10:37:41 +0000 (13:37 +0300)]
Bluetooth: clean up spaces in L2CAP header
Spaces converted to tabs
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 11:04:34 +0000 (14:04 +0300)]
Bluetooth: convert role_switch variable to flag in l2cap chan
role_switch variable inside l2cap_chan is a logical one and can
be easily converted to flag
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 11:04:33 +0000 (14:04 +0300)]
Bluetooth: convert force_active variable to flag in l2cap chan
force_active variable inside l2cap_chan is a logical one and can
be easily converted to flag
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 11:04:32 +0000 (14:04 +0300)]
Bluetooth: convert force_reliable variable to flag in l2cap chan
force_reliable variable inside l2cap_chan is a logical one and can
be easily converted to flag
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Tue, 11 Oct 2011 11:04:31 +0000 (14:04 +0300)]
Bluetooth: convert flushable variable to flag in l2cap chan
flushable variable inside l2cap_chan is a logical one and can
be easily converted to flag. Added flags in l2cap_chan structure.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Paul Bolle [Sun, 9 Oct 2011 10:12:22 +0000 (12:12 +0200)]
Bluetooth: btusb: hide more usb_submit_urb errors
There are still three calls of usb_submit_urb() that will print errors
if those calls return -EPERM or -ENODEV. I have never triggered these,
so I'm not sure when these return values might be seen. It still makes
sense to be silent if these occur (since "urb is being killed" and
"device got disconnected" aren't things to worry about).
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Paul Bolle [Sun, 9 Oct 2011 10:12:16 +0000 (12:12 +0200)]
Bluetooth: btusb: also be quiet when suspending
usb_submit_urb() returns -ENODEV when a usb device is disconnected. In
commit
4935f1c164ac528dff3538f97953b385ba500710 ("Bluetooth: btusb: be
quiet on device disconnect") I stopped treating that return as an error
in the three btusb_*_complete() functions.
It turns out btusb_send_frame() generates a similar error if the system
is suspended while the bluetooth usb device is enabled. The sensible
thing to do here seems to be to treat -ENODEV (and -EPERM) just like the
btusb_*_complete() functions now do.
Signed-off-by: Paul Bolle <pebolle@tiscali.nl>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 7 Oct 2011 04:29:51 +0000 (01:29 -0300)]
Bluetooth: Rename hidp_find_connection()
hidp_get_connection() makes more sense because we hold a reference to the
connection inside this function.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 7 Oct 2011 02:32:29 +0000 (23:32 -0300)]
Bluetooth: Delay session allocation in hidp
It gets allocated only when it is really needed.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Peter Hurley [Tue, 30 Aug 2011 15:53:35 +0000 (11:53 -0400)]
Bluetooth: hidp: safely acquire hci connection
Claim device lock to safely enumerate hci connection list and bump
hci connection proxy device ref count simultaneously.
This patch incorporates David Herrmann's fix to prevent adding an
HID device when the hci connection no longer exists.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 7 Oct 2011 01:05:37 +0000 (22:05 -0300)]
Bluetooth: Uses test_and_clear_bit() when possible
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 7 Oct 2011 00:27:56 +0000 (21:27 -0300)]
Bluetooth: Remove wrong error check
d458a9dfc add this check, but now it proves to be wrong.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Fri, 7 Oct 2011 00:17:32 +0000 (21:17 -0300)]
Bluetooth: Fix input device registration
This is a regression fix. It made impossible use input device when hid
fails.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 6 Oct 2011 23:51:37 +0000 (20:51 -0300)]
Bluetooth: Trasmit interrupt channel messages first
interrupt channel is low latency.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 6 Oct 2011 21:02:13 +0000 (18:02 -0300)]
Bluetooth: prioritize the interrupt channel in hidp
Interrupt channel has low latency requiments, should be processed first.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Gustavo F. Padovan [Thu, 6 Oct 2011 20:35:31 +0000 (17:35 -0300)]
Bluetooth: use list_for_each_entry() in hidp
list_for_each_entry is much more meaningful.
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
David Herrmann [Fri, 26 Aug 2011 12:06:02 +0000 (14:06 +0200)]
Bluetooth: hidp: Stop I/O on shutdown
Current hidp driver purges the in/out queue on HID shutdown, but does
not prevent further I/O. If a driver uses hidp_output_raw_report or
hidp_get_raw_report during shutdown, the driver hangs for 5 or 10
seconds per call until it gets a timeout.
That is, if the output queue of an HID driver has 10 messages pending,
it will take 50s until hid_destroy_device() will return. The
hidp_session_sem semaphore is held during shutdown so no other HID
device may be added/removed during this time.
This patch makes hidp_output_raw_report and hidp_get_raw_report fail if
session->terminate is true. Also hidp_session will wakeup all current
calls to these functions to cancel the current operations.
We already purge the current I/O queues on hidp_stop(), so this data loss
does not change the behaviour of the HID drivers.
Signed-off-by: David Herrmann <dh.herrmann@googlemail.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Fri, 16 Sep 2011 13:26:32 +0000 (16:26 +0300)]
Bluetooth: EFS: add enable_hs kernel param
Add enable_hs kernel parameter. L2CAP_FEAT_EXT_FLOW depends on it.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andrei Emeltchenko [Fri, 16 Sep 2011 13:26:30 +0000 (16:26 +0300)]
Bluetooth: EFS: l2cap extended feature mask update
Update L2CAP extended feature mask to reflect recent BT spec.
Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Oliver Neukum [Wed, 21 Sep 2011 09:41:45 +0000 (11:41 +0200)]
btusb: add device entry for Broadcom SoftSailing
From
0cea73465cd22373c5cd43a3edd25fbd4bb532ef Mon Sep 17 00:00:00 2001
From: Oliver Neukum <oliver@neukum.org>
Date: Wed, 21 Sep 2011 11:37:15 +0200
Subject: [PATCH] btusb: add device entry for Broadcom SoftSailing
This device declares itself to be vendor specific
It therefore needs to be added to the device table
to make btusb bind.
Signed-off-by: Oliver Neukum <oneukum@suse.de>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Andre Guedes [Mon, 26 Sep 2011 23:48:35 +0000 (20:48 -0300)]
Bluetooth: hci_le_adv_report_evt code refactoring
There is no reason to treat the first advertising entry differently
from the potential other ones. Besides, the current implementation
can easily leads to typos.
Signed-off-by: Andre Guedes <andre.guedes@openbossa.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Waldemar Rymarkiewicz [Fri, 23 Sep 2011 08:01:30 +0000 (10:01 +0200)]
Bluetooth: Fix possible NULL pointer dereference
Checking conn->pending_sec_level if there is no connection leads to potential
null pointer dereference. Don't process pin_code_request_event at all if no
connection exists.
Signed-off-by: Waldemar Rymarkiewicz <waldemar.rymarkiewicz@gmail.com>
Acked-by: Marcel Holtmann <marcel@holtmann.org>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>
Szymon Janc [Thu, 28 Jul 2011 14:24:33 +0000 (16:24 +0200)]
Bluetooth: Mark not declared l2cap_core functions as static
Signed-off-by: Szymon Janc <szymon.janc@tieto.com>
Signed-off-by: Gustavo F. Padovan <padovan@profusion.mobi>