Tweaking the Logitech R400 presenter tool on Linux
This article is outdated, please refer to a new version.
Updated on April 9th, 2013, after comments by Jim Diamond
For Christmas I received a Logitech R400 presenter tool as a replacement for the php|architect one 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 is how I changed it. First of all, I created the file /etc/udev/logitech-r400 as root with contents:
0x70037 f5 0x70029 f11 0x7003E f11 0x7004B left 0x7004E right
This maps the two scan codes that the Play button (lower-left) both 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’ -> ‘../event16’
Then with event16 I ran:
/lib/udev/keymap -i input/event16
And pressed all four buttons (and the Play button twice). This then showed up on the screen:
scan code: 0x7004B key code: pageup scan code: 0x7004E key code: pagedown scan code: 0x7003E key code: f5 scan code: 0x70029 key code: esc scan code: 0x70037 key code: dot
After creating the file, to test things I ran:
sudo /lib/udev/keymap input/event16 /etc/udev/logitech-r400
Which showed:
Remapped scancode 0x70037 to 0x3f (prior: 0x34) Remapped scancode 0x70029 to 0x57 (prior: 0x01) Remapped scancode 0x7003e to 0x57 (prior: 0x3f) Remapped scancode 0x7004b to 0x69 (prior: 0x68) Remapped scancode 0x7004e to 0x6a (prior: 0x6d)
After this ran, the presenter tool now sends the key presses that I want. To make this permanent, I added as root a new file /etc/udev/rules.d/logitech.rules, with as contents:
ENV{ID_VENDOR}=="Logitech*", ATTRS{idProduct}=="c52d", RUN+="keymap $name /etc/udev/logitech-r400"
The changes will now also persist after rebooting as well.
My first possibility to test the new tool will be at PHP Benelux where I will be giving a MongoDB tutorial on January 25th. Tickets are still available.
Comments
Very nice and useful. Thanks!
In new Ubuntu (13.10 or 14.04) this way have changed.
Now, you must edit the file: /lib/udev/hwdb.d/60-keyboard.hwdb
- Find for "Logitech Presenter R400" and change this lines:
-
KEYBOARD_KEY_070029=esc KEYBOARD_KEY_07003e=f5
Example:
- # Logitech Presenter R400 keyboard:usb:v046DpC52Dd*dc*dsc*dp*ic*isc*ip*in00*
-
KEYBOARD_KEY_070029=esc KEYBOARD_KEY_07003e=f5 KEYBOARD_KEY_070037=displaytoggle
After that, run this command: # udevadm hwdb --update
Now reboot you computer. And that's it!
Life Line
I've finished reading Children of Memory, the third book in the series.
Another interesting take on forms of intelligent life.
A fourth one is going to get released later this year.
Updated a post_box, a beauty shop, and a restaurant; Confirmed 2 clothes shops, 2 pet shops, and a restaurant
I walked 5.9km in 1h40m39s
Updated a bicycle_parking
Updated 2 waste_baskets
I walked 7.9km in 1h37m12s
Created 3 waste_baskets; Updated 3 bus_stops, 2 benches, and 2 waste_baskets
I walked 8.1km in 1h25m53s
I walked 1.2km in 9m31s
I walked 9.4km in 1h39m05s
Merge branch 'xdebug_3_5'
Merged pull request #1071
Fixed issue #2411: Native Path Mapping is not applied to the initial …
Created 2 waste_baskets; Updated 3 waste_baskets, 2 benches, and 2 other objects; Deleted a waste_basket
I walked 7.9km in 1h45m36s
RE: https://phpc.social/@phpc_tv/116274041642323081
Now that phpc.tv and phpc.social are part of the same umbrella, I've upped my yearly contributions to their Open Collective: https://opencollective.com/phpcommunity/projects/phpc-social
Merge branch 'xdebug_3_5'
Merged pull request #1070
I walked 7.2km in 1h10m26s
Fixed issue #2405: Handle minimum path in .xdebug directory discovery
I've published a new blog post: "Human Creations", on the difference in content generation by LLMs, and the creation of text, art and code by humans.
You can find it at https://derickrethans.nl/human-creations.html or at @blog
I walked 7.8km in 1h38m32s
RE: https://phpc.social/@afilina/116274024588235234
It's good to see that more and more people are realising that the Web can be for-good, without all the enshittification.
That's why I'm happy to see endeavours like phpc.tv springing up, and helping out where I can.
Taking back the control of how the Web is for people, by people, without big tech making it all shit.
Created a waste_basket; Updated 5 crossings and a bicycle_parking
I walked 10.7km in 2h35m10s


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