[PATCH] spurious disconnection attempt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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
From 15da4dc5ae66235f7274008938ed0a21412634d3 Mon Sep 17 00:00:00 2001
From: Daniel Orstadius <daniel.orstadius@xxxxxxxxx>
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


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux