evdev+hal => Too many input devices.

Gabor Gombas gombasg at sztaki.hu
Thu Jul 23 00:19:18 PDT 2009


Hi,

On Wed, Jul 22, 2009 at 02:45:32PM -0700, Brian Rogers wrote:

> @@ -118,14 +113,16 @@ static void del_conn(struct work_struct *work)
>  	if (!device_is_registered(&conn->dev))
>  		return;
>  
> +	/* wait for child devices to go away first */
>  	while (1) {
>  		struct device *dev;
>  
> -		dev = device_find_child(&conn->dev, NULL, __match_tty);
> +		dev = device_find_child(&conn->dev, NULL, __match_any);
>  		if (!dev)
>  			break;
> -		device_move(dev, NULL, DPM_ORDER_DEV_LAST);
>  		put_device(dev);
> +
> +		msleep(100);
>  	}
>  
>  	device_del(&conn->dev);

Won't this cause problems for rfcomm devices (again)? This code was added
for the reason in the comment you've deleted: the rfcomm device can
remain alive long after the connection is done, and it won't go away
until you find & manually kill the process that holds the device open.

How about this:

diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 95f7a7a..f709439 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -100,14 +100,9 @@ static void add_conn(struct work_struct *work)
 	hci_dev_hold(hdev);
 }
 
-/*
- * The rfcomm tty device will possibly retain even when conn
- * is down, and sysfs doesn't support move zombie device,
- * so we should move the device before conn device is destroyed.
- */
-static int __match_tty(struct device *dev, void *data)
+static int __match_any(struct device *dev, void *data)
 {
-	return !strncmp(dev_name(dev), "rfcomm", 6);
+	return 1;
 }
 
 static void del_conn(struct work_struct *work)
@@ -124,8 +119,18 @@ static void del_conn(struct work_struct *work)
 		dev = device_find_child(&conn->dev, NULL, __match_tty);
 		if (!dev)
 			break;
-		device_move(dev, NULL, DPM_ORDER_DEV_LAST);
+
+		/*
+		 * The rfcomm tty device will possibly retain even when conn
+		 * is down, and sysfs doesn't support move zombie device,
+		 * so we should move the device before conn device is destroyed.
+		 */
+		if (!strncmp(dev_name(dev), "rfcomm", 6))
+			device_move(dev, NULL, DPM_ORDER_DEV_LAST);
+
 		put_device(dev);
+
+		msleep(100);
 	}
 
 	device_del(&conn->dev);

Gabor

-- 
     ---------------------------------------------------------
     MTA SZTAKI Computer and Automation Research Institute
                Hungarian Academy of Sciences
     ---------------------------------------------------------



More information about the xorg mailing list