Linux, X and Logitech

I’ve had a Logitech diNovo Mini as my TV computer keyboard for a few years.  It works as well as you’d suspect a wireless keyboard to work: It loses contact with the receiver a couple of times a month and needs to be switched off and then on again, but otherwise it’s OK.  Doesn’t lose too many keystrokes.

Logitech diNovo Mini

But it’s starting to fail mechanically, I think.  The larger buttons (Enter, Del, etc) now only work if I press them…  just…  so…

I looked around for new media keyboards, but they’re either too big, or unusably small.  This was kinda just right.  So I went off to eBay and got a couple of new old ones.

At least that’s what I thought I bought.  Instead I got a couple of Lenovo TV730 keyboards, which is apparently also called Logitech Mini Controller.

Logitech TV730

See?  Very similar.

And here my troubles began.  This Logitech came with a different, smaller receiver:

Much small

The receiver works fine under Linux, but I could only get about two meters range.  (That’s seven microfurloughs in Imperial measurements, I think.)  But I had it plugged in like this:

I should wash those grease stains off the front

After bitching about this on IRC a bit, I tried using an USB extension cord.  Like this:

Very finger

And then I got, like, an 11 meter range, through two (pretty light) walls!  So the metal in the computer case messed up those radio signals or something?  Ok, we’re on!  This is doable!

And then I discovered that some of the keys don’t work in Xorg.  In particular, the PgUp and PgDown keys give exactly zero X events, according to xev.  That’s no fun.

I fired up the ever-useful evrouter utility:

quimbies:~# evrouter -f -d /dev/input/event*
"Logitech TV730" "/dev/input/event9" none key/402 "fill this in!"
"Logitech TV730" "/dev/input/event9" none key/403 "fill this in!"

key/402?  That’s a suspiciously high number.  And duckgoing around shows that this is a well-known ancient X problem: X can’t deal with events that has a numerical value over 255.

This was reported as a bug at least as early as 2007, and apparently they (sort of) started working on it.  But they didn’t fix it.  Instead this very nice person wrote a simpler fix that allows you to just remap these problematic keystrokes into other keystrokes.  Yes, it’s a hack, but if you’re not going to provide a real solution in 8 years, I think it might be better to just include the hack, don’t you think?

Obviously the Xorg people didn’t, so you still have to build your own  The link up there has good instructions on how to build and install this driver into your X, so I won’t repeat that.

For my device, I put the following into my /etc/X11/xorg.conf:

Section "InputDevice"
 Identifier "Logitec TV730"
 Driver "evdev"
 Option "Device" "/dev/input/tv730"
 Option "event_key_remap" "402=112 403=117 272=89"

This remaps the weird PgUp/PgDown keystrokes into the normal ones.

To get the device to show up under that name, I put the following into my udev setup.  This is with the current Debian; your mileage will vary.

quimbies:~# cat /etc/udev/rules.d/10-tv730.rules
KERNEL=="event[0-9]*", ATTRS{idVendor}=="046d", ATTRS{idProduct}=="c52b", SYMLINK+="input/tv730", GROUP="input"

However, it’s not totally unproblematic.  If I pull the receiver out and then put it back in again, X will sometimes not believe that it’s been inserted:

[3275248.027] (**) Logitech TV730: Applying InputClass "evdev keyboard catchall"
[3275248.027] (II) Using input driver 'evdev' for 'Logitech TV730'
[3275248.027] (**) Logitech TV730: always reports core events
[3275248.027] (**) evdev: Logitech TV730: Device: "/dev/input/event9"
[3275248.027] (WW) evdev: Logitech TV730: device file is duplicate. Ignoring.
[3275248.032] (EE) PreInit returned 8 for "Logitech TV730"


2 thoughts on “Linux, X and Logitech”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s