[Cbe-oss-dev] [PATCH] reset unexpected bluetooth data connections

Ranulf Doswell ralf at ranulf.net
Sun Jul 1 01:44:21 EST 2007


This is my first patch, so apologies if I've got the protocol wrong! I'm not
sure if this is the best place to post this patch or even if I've done
everything correctly (I assume I simply add a signed-off-by in my name).

I came across this bug when getting sixaxis controllers to work under Linux
on the PS3, although it actually seems to be a generic bluetooth problem
under Linux.

Basically, the problem is that unless the bluetooth connection is killed
prior to reboot, the PS3 controllers continue sending out data which the
kernel correctly identifies as not associated with an active connection.
However, it simply logs the error and continues, so the syslog rapidly fills
up. It addition, because the device it will not attempt to re-initiate a new
bluetooth connection, so the only current solution is to halt the linux box
until the controller times out.

This one line addition sends the device a reset which causes it to switch
off.

Signed-off-by: Ranulf Doswell <ralf at ranulf.net>

=====================================

diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 8943c93..77b7eca 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -1340,6 +1340,12 @@ static inline void hci_acldata_packet(struct hci_dev
*hdev, struct sk_buff *skb)
        } else {
                BT_ERR("%s ACL packet for unknown connection handle %d",
                        hdev->name, handle);
+
+               // Force the device to reset in the hope that it will then
leave us alone.
+               // This is needed at least for PS3 sixaxis as the
controllers will keep
+               // sending data until they are forcibly terminated. A reboot
doesn't provide
+               // enough time for the controller's bluetooth stack to time
out.
+               hci_reset_req(hdev, 0);
        }

        kfree_skb(skb);
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/cbe-oss-dev/attachments/20070630/1d8890d8/attachment.htm>


More information about the cbe-oss-dev mailing list