evdev not detecting events from kbdd (Userland BTKeyboard Driver)

simon at mungewell.org simon at mungewell.org
Sat May 29 19:40:01 PDT 2010


> Testing ... (interrupt to exit)
> Event: time 1274941393.660686, type 1 (Key), code 21 (Y), value 1
> Event: time 1274941393.690514, type 1 (Key), code 21 (Y), value 0
> Event: time 1274941394.376683, type 1 (Key), code 18 (E), value 1
> Event: time 1274941394.408689, type 1 (Key), code 18 (E), value 0
> Event: time 1274941394.608681, type 1 (Key), code 31 (S), value 1
> Event: time 1274941394.696673, type 1 (Key), code 31 (S), value 0
> --

>
> Any suggestions as to what might be a miss?
>

Actually figured this one out; it appears that evdev needs a 'SYNC'
between key presses which was not being sent by kbdd - so I added the code
below and it now functions OK.

Keyboard is still a bit crap and not very responsive, but at least it
works now.

Mungewell.

PS. For this particular keyboard the command line is
sudo ./kbdd -t smartbt -p /dev/rfcomm0

--- kbdd/dev_uinput.c	2006-01-04 00:28:21.000000000 -0700
+++ kbdd-sdw/dev_uinput.c	2010-05-29 20:32:33.100432781 -0600
@@ -88,13 +88,26 @@
 int dev_uinput_key(int fd, unsigned short code, int pressed)
 {
 struct uinput_event event;
+int error;

 	memset(&event, 0, sizeof(event));
 	event.type = EV_KEY;
 	event.code = code;
 	event.value = pressed; // (0 release, 1 press?)

-return (write(fd, &event, sizeof(event)));
+	error = write(fd, &event, sizeof(event));
+
+	if (error > 0) {
+		// Send a EV_SYN too
+		memset(&event, 0, sizeof(event));
+		event.type = 0;
+		event.code = 0;
+		event.value = 0;
+
+		return (write(fd, &event, sizeof(event)));
+	} else {
+		return error;
+	}
 }




More information about the xorg mailing list