Thread (1 message) 1 message, 1 author, 2011-08-05
DORMANTno replies

[PATCH BlueZ 4/4] plugins/sixaxis: Wait for the PS button before setting the LEDs

From: Antonio Ospite <hidden>
Date: 2011-08-05 14:09:18
Also in: linux-bluetooth
Subsystem: the rest · Maintainer: Linus Torvalds

Wait for actual input events, that is PS button has been pressed, before
setting the LEDs to indicate the controller number.
This makes setting LEDs look more like on the PS3.
---
 plugins/sixaxis.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
diff --git a/plugins/sixaxis.c b/plugins/sixaxis.c
index 2b0616a..d64ad6d 100644
--- a/plugins/sixaxis.c
+++ b/plugins/sixaxis.c
@@ -511,8 +511,14 @@ static void handle_device_plug(struct udev_device *udevice)
 		sixpair(fd, adapter);
 	}
 
-	if (js_num > 0)
+	if (js_num > 0) {
+		char c;
+
+		/* wait for events before setting leds */
+		if (read(fd, &c, 1) != 1)
+			perror("read error");
 		set_controller_number(fd, js_num);
+	}
 
 	close(fd);
 }
-- 
1.7.5.4
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help