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
Updated a restaurant
Created a bench
Updated a cafe
But I think my favourite photo was of this Carrion Crow in flight.
The new birds I saw, were mostly too far away to get good photos.
But I saw my first Spoonbill, Corn Bunting, and a flock of Black-tailed Godwits.
I had a lovely walk around RSPB Bowers Marsh yesterday, where I saw some expected birds, and a bunch of new species.
When I got there, there was this welcome committee of Starlings.
#BirdPhotography #nature #BirdsOfFediverse #Birds #Photography #RSPB
RSPB Bowers Marsh
Created 2 benches
I hiked 11.3km in 3h31m08s
Updated a pub
Updated a pub
Updated 4 pubs; Confirmed a pub
Created a restaurant
I walked 0.8km in 9m31s
I walked 2.1km in 16m42s
I walked 4.7km in 48m42s
I walked 7.4km in 1h16m10s
Updated a fast_food
Updated a cafe, a pet shop, and a bench; Confirmed a cafe, a convenience shop, and a motorcycle_repair shop
I walked 5.0km in 1h2m27s
I walked 1.1km in 10m08s
Updated a cafe; Confirmed 3 convenience shops, a fast_food, and a laundry shop
Created a fitness_centre; Updated an event_caterer office and a social_facility; Confirmed a restaurant and a pharmacy
I walked 7.6km in 1h29m58s
Updated a pub




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