Saturday, May 4, 2024
 Popular · Latest · Hot · Upcoming
15
rated 0 times [  15] [ 0]  / answers: 1 / hits: 25316  / 2 Years ago, sat, june 4, 2022, 6:38:51

My Logitech R400 presenter sends the following key codes:



keycode 112 (keysym 0xff55,  Prior) [page up]
keycode 117 (keysym 0xff56, Next) [page down]
keycode 60 (keysym 0x2e, period)
keycode 71 (keysym 0xffc2, F5)
keycode 9 (keysym 0xff1b, Escape)


Basically, I want to use this presenter to remotely control Banshee, so I'd like to remap Prior to B, Next to N, and so on.



How can I change the keymap for this device only (as I certainly don't want to remap those key codes globally)?


More From » udev

 Answers
1

I never did that but I think you need to create a keymap file in /lib/udev/keymaps/ and add a rule for your device to /lib/udev/rules.d/95-keymap.rules






Details:




  • An udev keymap maps scan codes to key codes, so you need to find both to create the keymap file. To find the scan codes run the following and press the buttons on the device:



    sudo /lib/udev/keymap -i input/event5


    You might need to try different numbers for event*. The output should look like this:



    scan code: 0x70037   key code: dot
    scan code: 0x70029 key code: esc
    scan code: 0x7003E key code: f5
    scan code: 0x7004B key code: pageup
    scan code: 0x7004E key code: pagedown


    A list of key codes can be found here.



    Now create the keymap file (I'm storing it as /lib/udev/keymaps/logitech-r400):



    0x70037 brightnessdown
    0x70029 brightnessup
    0x7003E brightnessdown
    0x7004B brightnessup
    0x7004E brightnessdown


    Doesn't do anything useful - just a test to easily see if it works.


  • To test the new keymap temporarily, run:



    sudo /lib/udev/keymap input/event5 /lib/udev/keymaps/logitech-r400


    which should result in output like this:



    Remapped scancode 0x70037 to 0xe0 (prior: 0x34)
    Remapped scancode 0x70029 to 0xe1 (prior: 0x01)
    Remapped scancode 0x7003e to 0xe0 (prior: 0x3f)
    Remapped scancode 0x7004b to 0xe1 (prior: 0x68)
    Remapped scancode 0x7004e to 0xe0 (prior: 0x6d)


    The buttons should now change the brightness.


  • If you want to make that change permanent, you need to add an udev rule to /lib/udev/rules.d/95-keymap.rules that applies the keymap file to the device.




    1. Open the file: gksudo gedit /lib/udev/rules.d/95-keymap.rules

    2. At the bottom of the file, but before the LABEL="keyboard_end" line, add:



      ENV{ID_VENDOR}=="Logitech*", ATTRS{idProduct}=="c52d", RUN+="keymap $name logitech-r400"

    3. Save, close, and after a reboot the buttons should change the brightness.




[#42735] Sunday, June 5, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
brasiplacar

Total Points: 314
Total Questions: 124
Total Answers: 97

Location: Dominican Republic
Member since Wed, Mar 17, 2021
3 Years ago
brasiplacar questions
Sat, Sep 4, 21, 13:11, 3 Years ago
Tue, Jan 10, 23, 06:22, 1 Year ago
Wed, Oct 13, 21, 15:19, 3 Years ago
Wed, May 4, 22, 00:06, 2 Years ago
Thu, Jan 5, 23, 15:40, 1 Year ago
;