Tweaking the Logitech R400 presenter tool on Linux
This article is a updated version of an earlier one, which describes how to tweak the R400 on non-systemd systems.
In 2002, I received a Logitech R400 presenter tool for Christmas as a replacement for the php|architect pointer that has now fallen apart. However, to use it together with my presentation system—pres2, about which I previously wrote—I need it to provide left and right arrow keypresses. By default its left and right buttons generate Prior and Next events in X. It took me a while to get this to work, so in short, this article sets out how I changed it.
First of all, I editted the file /lib/udev/hwdb.d/60-keyboard.hwdb as root. I searched for R400 and changed its entry to:
# Logitech Presenter R400 keyboard:usb:v046DpC52Dd*dc*dsc*dp*ic*isc*ip*in00* KEYBOARD_KEY_070029=f11 KEYBOARD_KEY_07003e=f11 KEYBOARD_KEY_070037=f5 KEYBOARD_KEY_07004b=left KEYBOARD_KEY_07004e=right
This maps the two scan codes that the Play button (lower-left) generates to f11, the empty screen button to f5 and the left and right buttons to the left and right arrow keys.
The first column represents the scancode, which I obtained by first looking up with input event the device was tied to:
stat -t /dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd --printf "%N\n"
Which showed the following for me:
‘/dev/input/by-id/usb-Logitech_USB_Receiver-event-kbd’ -> ‘../event19’
To find out the scan codes, I had to download a getscancodes tool, and then compile it:
wget 'http://downloads.sourceforge.net/project/keytouch/getscancodes/getscancodes%201.0/getscancodes-1.0.tar.gz?r=http%3A%2F%2Fkeytouch.sourceforge.net%2Fdl-getscancodes.php&ts=1412723944&use_mirror=kent' -O getscancodes-1.0.tar.gz tar -xvzf getscancodes-1.0.tar.gz cd getscancodes/ make
With the new binary, and the event19 from above, I ran:
sudo ./getscancodes /dev/input/event19
Which showed:
458807 (0x70037) 458793 (0x70029) 458814 (0x7003e) 458827 (0x7004b) 458830 (0x7004e)
With these numbers, I now had enough information to edit the /lib/udev/hwdb.d/60-keyboard.hwdb file that I mentioned earlier.
After that, I had to run:
sudo udevadm hwdb --update
This consolidated the modified rules and made the keymapping active. My presenter tool now sends the correct key codes again.
The changes will persist after rebooting as well.
Comments
My 60-keyboard.hwdb had evdev:input:b0003v046DpC52D* in it. Did you have that before your edits or did you have keyboard:usb:v046DpC52Dd*dc*dsc*dp*ic*isc*ip*in00*
One other thing which may be of interest. My old presenter went walkies, and I bought a new one which looks the same, but its USB ID is 046d:c538, not 046d:c52d. You might want to make a note about this to help people who find your web page but don't understand the significance of the string in (either your or my version of) 60-keyboard.hwdb.
Cheers.
One other thing. I believe the politically correct thing to do is not to edit the file in /lib, but to put your definition in a file in /etc/udev/hwdb.d/60-keyboard.hwdb
I tried that and (after running udevadm hwdb --update as you say) it works on my system.
Q: if you have the image of the R400 visible on your screen and you look away a bit, does it look like Darth Vader to you? ;-)
Life Line
I walked 3.0km in 33m38s
I walked 0.6km in 11m26s
I walked 6.5km in 1h17m46s
Updated a cafe
Updated a museum
I walked 1.1km in 12m41s
Updated a bench and a waste_basket
Updated a bench
Updated a bench
Updated a bench
I walked 8.0km in 1h44m20s
I walked 7.9km in 1h32m02s
I've just finished reading "Snow Crash" by Neal Stephenson. I found this a fun and excellent read.
I walked 14.7km in 3h51m29s
I walked 0.8km in 8m42s
I walked 6.0km in 1h19m04s
I walked 1.8km in 49m15s
Updated a restaurant
Updated a restaurant
Updated a restaurant
Updated a restaurant
Updated a brewery
Updated a restaurant
Updated a restaurant
Having dessert before even attempting to go to the restaurant for my (early) birthday dinner.
Enjoying this barrel aged quadrupal, in entirely new Dutch city (another Christmas tradition for us).



Shortlink
This article has a short URL available: https://drck.me/r400-b4d