Skip to contentSkip to conversation

firedtv: fix remote control with newer Xorg evdev

PATCH In review Stefan Richter 2 participants 5 messages Jan 16, 2011 – Jan 17, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 firedtv: fix remote control with newer Xorg evdev

After a recent update of xf86-input-evdev and xorg-server, I noticed that X11 applications did not receive keypresses from the FireDTV infrared remote control anymore. Instead, the Xorg log featured lots of

"FireDTV remote control: dropping event due to full queue!"

exclamations. The Linux console did not have an issue with the FireDTV's RC though.

The fix is to insert EV_SYN events after the key-down/-up events.

---
 drivers/media/dvb/firewire/firedtv-rc.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/media/dvb/firewire/firedtv-rc.c +5 -3
Index: b/drivers/media/dvb/firewire/firedtv-rc.c
===================================================================
@@ -172,7 +172,8 @@ void fdtv_unregister_rc(struct firedtv *
 
 void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
 {
-	u16 *keycode = fdtv->remote_ctrl_dev->keycode;
+	struct input_dev *idev = fdtv->remote_ctrl_dev;
+	u16 *keycode = idev->keycode;
 
 	if (code >= 0x0300 && code <= 0x031f)
 		code = keycode[code - 0x0300];
@@ -188,6 +189,7 @@ void fdtv_handle_rc(struct firedtv *fdtv
 		return;
 	}
 
-	input_report_key(fdtv->remote_ctrl_dev, code, 1);
-	input_report_key(fdtv->remote_ctrl_dev, code, 0);
+	input_report_key(idev, code, 1);
+	input_report_key(idev, code, 0);
+	input_sync(idev);
 }
Signature · 3 lines
Stefan Richter
-=====-==-== ---= =----
http://arcgraph.de/sr/
#1 lore raw

Hi Stefan,

drivers/media/dvb/firewire/firedtv-rc.c void fdtv_handle_rc(struct firedtv *fdtv · line 192

Quoted 7 lines · Stefan Richter
drivers/media/dvb/firewire/firedtv-rc.c +1 -2
@@ -188,6 +189,7 @@ void fdtv_handle_rc(struct firedtv *fdtv
 		return;
 	}
 
-	input_report_key(fdtv->remote_ctrl_dev, code, 1);
-	input_report_key(fdtv->remote_ctrl_dev, code, 0);
+	input_report_key(idev, code, 1);

input_sync() is needed here as well - userspace is free to accumulate device state between EV_SYN events.

Quoted 4 lines
drivers/media/dvb/firewire/firedtv-rc.c +2 -0
+	input_report_key(idev, code, 0);
+	input_sync(idev);
 }
Signature · 1 line
Dmitry
#2 lore raw

PATCH 1/1 firedtv: fix remote control with newer Xorg evdev

After a recent update of xf86-input-evdev and xorg-server, I noticed that X11 applications did not receive keypresses from the FireDTV infrared remote control anymore. Instead, the Xorg log featured lots of

"FireDTV remote control: dropping event due to full queue!"

exclamations. The Linux console did not have an issue with the FireDTV's RC though.

The fix is to insert EV_SYN events after the key-down/-up events. Dimitry notes that EV_SYN is also necessary between down and up, otherwise userspace could combine their state.

---
 drivers/media/dvb/firewire/firedtv-rc.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/media/dvb/firewire/firedtv-rc.c +6 -3
Index: b/drivers/media/dvb/firewire/firedtv-rc.c
===================================================================
@@ -172,7 +172,8 @@ void fdtv_unregister_rc(struct firedtv *
 
 void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
 {
-	u16 *keycode = fdtv->remote_ctrl_dev->keycode;
+	struct input_dev *idev = fdtv->remote_ctrl_dev;
+	u16 *keycode = idev->keycode;
 
 	if (code >= 0x0300 && code <= 0x031f)
 		code = keycode[code - 0x0300];
@@ -188,6 +189,8 @@ void fdtv_handle_rc(struct firedtv *fdtv
 		return;
 	}
 
-	input_report_key(fdtv->remote_ctrl_dev, code, 1);
-	input_report_key(fdtv->remote_ctrl_dev, code, 0);
+	input_report_key(idev, code, 1);
+	input_sync(idev);
+	input_report_key(idev, code, 0);
+	input_sync(idev);
 }
Signature · 3 lines
Stefan Richter
-=====-==-== ---= =---=
http://arcgraph.de/sr/
Acked-by on v1 1/1
#3 lore raw
Quoted 6 lines · Stefan Richter

After a recent update of xf86-input-evdev and xorg-server, I noticed that X11 applications did not receive keypresses from the FireDTV infrared remote control anymore. Instead, the Xorg log featured lots of

"FireDTV remote control: dropping event due to full queue!"

Quoted 8 lines

exclamations. The Linux console did not have an issue with the FireDTV's RC though.

The fix is to insert EV_SYN events after the key-down/-up events. Dimitry notes that EV_SYN is also necessary between down and up, otherwise userspace could combine their state.

Quoted 35 lines
---
 drivers/media/dvb/firewire/firedtv-rc.c |    9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

Index: b/drivers/media/dvb/firewire/firedtv-rc.c
===================================================================

drivers/media/dvb/firewire/firedtv-rc.c +6 -3
@@ -172,7 +172,8 @@ void fdtv_unregister_rc(struct firedtv *
 
 void fdtv_handle_rc(struct firedtv *fdtv, unsigned int code)
 {
-	u16 *keycode = fdtv->remote_ctrl_dev->keycode;
+	struct input_dev *idev = fdtv->remote_ctrl_dev;
+	u16 *keycode = idev->keycode;
 
 	if (code >= 0x0300 && code <= 0x031f)
 		code = keycode[code - 0x0300];
@@ -188,6 +189,8 @@ void fdtv_handle_rc(struct firedtv *fdtv
 		return;
 	}
 
-	input_report_key(fdtv->remote_ctrl_dev, code, 1);
-	input_report_key(fdtv->remote_ctrl_dev, code, 0);
+	input_report_key(idev, code, 1);
+	input_sync(idev);
+	input_report_key(idev, code, 0);
+	input_sync(idev);
 }
Signature · 4 lines
-- 
Stefan Richter
-=====-==-== ---= =---=
http://arcgraph.de/sr/
Signature · 1 line
Dmitry
#4 lore raw

PATCH 1/1 firedtv: fix remote control - addendum

Dimitry notes that EV_SYN is also necessary between down and up, otherwise userspace could combine their state.

---
Hi Mauro,
since you already pushed out the first version of "firedtv: fix remote control with newer Xorg evdev", here is the differential patch to the updated version. It's surely not super urgent though.

 drivers/media/dvb/firewire/firedtv-rc.c |    1 +
 1 file changed, 1 insertion(+)
drivers/media/dvb/firewire/firedtv-rc.c +1 -0
Index: b/drivers/media/dvb/firewire/firedtv-rc.c
===================================================================
@@ -190,6 +190,7 @@ void fdtv_handle_rc(struct firedtv *fdtv
 	}
 
 	input_report_key(idev, code, 1);
+	input_sync(idev);
 	input_report_key(idev, code, 0);
 	input_sync(idev);
 }
Signature · 3 lines
Stefan Richter
-=====-==-== ---= =---=
http://arcgraph.de/sr/