* [PATCH] spurious disconnection attempt
@ 2009-12-17 13:44 Daniel Örstadius
2009-12-17 14:07 ` Johan Hedberg
0 siblings, 1 reply; 2+ messages in thread
From: Daniel Örstadius @ 2009-12-17 13:44 UTC (permalink / raw)
To: linux-bluetooth
[-- Attachment #1: Type: text/plain, Size: 1324 bytes --]
This sequence can happen when disconnecting the MOTOROKR T505
2009-11-27 12:05:30.636932 > ACL data: handle 11 flags 0x02 dlen 12
L2CAP(s): Disconn req: dcid 0x0040 scid 0x0048
2009-11-27 12:05:30.637054 < ACL data: handle 11 flags 0x02 dlen 12
L2CAP(s): Disconn rsp: dcid 0x0040 scid 0x0048
2009-11-27 12:05:30.822540 > HCI Event: Number of Completed Packets
(0x13) plen 5
handle 11 packets 1
2009-11-27 12:05:30.985656 > HCI Event: Disconn Complete (0x05) plen 4
status 0x00 handle 11 reason 0x13
Reason: Remote User Terminated Connection
2009-11-27 12:05:32.655273 < HCI Command: Disconnect (0x01|0x0006) plen 3
handle 0 reason 0x13
Reason: Remote User Terminated Connection
2009-11-27 12:05:32.661621 > HCI Event: Command Status (0x0f) plen 4
Disconnect (0x01|0x0006) status 0x12 ncmd 1
Error: Invalid HCI Command Parameters
A similar situation (trying to disconnect handle 0) can occur by
increasing the timeout value DISCONNECT_TIMER in src/device.c (default
is 2).
The problem seems to be that bluetoothd still calls
src/device.c:do_disconnect even though the link has been disconnected.
Attaching a patch proposal for function device_remove_connection to
try to avoid this. The function looks to be called only when there is
no longer an hci connection to the remote.
/Daniel
[-- Attachment #2: 0001-adding-removal-of-disconnect-timer-to-avoid-spurious.patch --]
[-- Type: text/x-patch, Size: 781 bytes --]
From 15da4dc5ae66235f7274008938ed0a21412634d3 Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@gmail.com>
Date: Thu, 17 Dec 2009 15:29:51 +0200
Subject: [PATCH] adding removal of disconnect timer to avoid spurious disconnection attempt
---
src/device.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/device.c b/src/device.c
index 17e4ea1..513a813 100644
--- a/src/device.c
+++ b/src/device.c
@@ -765,6 +765,11 @@ void device_remove_connection(struct btd_device *device, DBusConnection *conn,
device->handle = 0;
+ if (device->disconn_timer > 0) {
+ g_source_remove(device->disconn_timer);
+ device->disconn_timer = 0;
+ }
+
while (device->disconnects) {
DBusMessage *msg = device->disconnects->data;
--
1.6.0.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] spurious disconnection attempt
2009-12-17 13:44 [PATCH] spurious disconnection attempt Daniel Örstadius
@ 2009-12-17 14:07 ` Johan Hedberg
0 siblings, 0 replies; 2+ messages in thread
From: Johan Hedberg @ 2009-12-17 14:07 UTC (permalink / raw)
To: Daniel Örstadius; +Cc: linux-bluetooth
Hi Daniel,
On Thu, Dec 17, 2009, Daniel Örstadius wrote:
> The problem seems to be that bluetoothd still calls
> src/device.c:do_disconnect even though the link has been disconnected.
> Attaching a patch proposal for function device_remove_connection to
> try to avoid this. The function looks to be called only when there is
> no longer an hci connection to the remote.
Thanks! The patch looks good and I've pushed it upstream. In the future,
please pay a little bit more attention to your commit messages. Usually
we start the summary lines of bugfixes with "Fix.." and feature
additions with "Add.." or "Implement.." as well as include an
appropriately detailed description of the commit for any non-trivial
change. I now fixed the commit messages of your two latest patches
manually and you can check the result in the upstream git tree.
Johan
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2009-12-17 14:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-12-17 13:44 [PATCH] spurious disconnection attempt Daniel Örstadius
2009-12-17 14:07 ` Johan Hedberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).