[PATCH] [input] Set up uinput device again, if it was previously closed.

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

 



If you connect a PS3 controller to bluetoothd as an input device, then
take the batteries out of a PS3 controller, then put them back in and
push a few buttons, it will eventually cause an error which causes the
uinput socket to be closed. It will then re-connect to bluetoothd, but
the uinput socket fd will be -1, so it needs to be set up again after
the re-connect.

Signed-off-by: Jeff Hansen <x@xxxxxxxxxxxxxx>
---
 input/fakehid.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/input/fakehid.c b/input/fakehid.c
index eebca05..a83f8c3 100644
--- a/input/fakehid.c
+++ b/input/fakehid.c
@@ -393,12 +393,15 @@ struct fake_input *fake_hid_connadd(struct fake_input *fake,
 
 	/* New device? Add it to the list of known devices,
 	 * and create the uinput necessary */
-	if (old == NULL) {
+	if (old == NULL || old->uinput == -1) {
 		if (fake_hid->setup_uinput(fake, fake_hid)) {
 			error("Error setting up uinput");
 			g_free(fake);
 			return NULL;
 		}
+	}
+
+	if (old == NULL) {
 		fake_hid->devices = g_list_append(fake_hid->devices, fake);
 	}
 
-- 
1.7.3.4

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[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