Usr1/Usr2 Mapping


Splintercat

Member
Joined
Oct 3, 2015
Messages
58
Location
United States
I've been trying to figure out how to get the Usr1 and Usr2 keys to work on my Prya.

In keyboard shortcuts the button won't register.
I tried the following to see if I could track down the keycode or some kind or recognition that the key works:
  • sudo libinput debug-events
  • xev
  • sudo evtest (checked keyboard, gamepad, user buttons, and mouse devices, couldn't check gamebuttons or tca8418)
  • (In tty1) sudo showkey -s
I looked at the FunKey-MonKey pyra repo, but was having a hard time understanding how I could use it to make the button work.

I glanced through the forums to see if there were hints, but I didn't find anything that seemed to help. I looked through the wiki as well.


I am on Bookworm 12.

Thank you.
 
xev doesn't display anything?

and why are people giving you thumbs up for stating a problem?? sheesh....
 
It seems like pyrainput has a bug. pyraKeyMap.cpp uses 3 names that are not defined in pyrainput.cpp:

1763813768625.png


pyrainput.cpp uses
  • "PYRA_KEY_PAUSE" instead of "PYRA_KEY_USER1"
  • "PAUSE" instead of "PYRA_KEY_FN_USR1"
  • "ESC" instead of "PYRA_KEY_FN_ESC"

1763813859921.png

So it is not only Usr1 and Usr2 that are not working. PrtScrn also does not work.
I fixed the names in pyrainput.cpp and now I have those keys working on my Pyra.

I add the compiled libpyrainput.so with the bugfix to this post. Please note that this libpyrainput.so also already has another bugfix (nub deadzones).
To do the update of libpyrainput.so:
  • do a backup of your old libpyrainput.so
    • cp -p /usr/lib/funkeymonkey/libpyrainput.so /tmp/libpyrainput.so.old
  • stop the service
    • systemctl stop pyrainput
  • override the file
    • sudo cp -p libpyrainput.so /usr/lib/funkeymonkey/libpyrainput.so
  • start the service
    • systemctl start pyrainput
If you want to build libpyrainput.so yourself: in the spoiler I describe exactly how I built it.
Code:
    First make sure you have the correct version of pyrainput. The version on GitHub is outdated. Instead you have to use the version in https://dev.pyra-handheld.com/packages/funkeymonkey-pyrainput (sadly unreliable right now, answers a lot with 503).
    Make sure you checked out the correct branch: it has to be the branch "bookworm", not "master"!
    You have to install 3 packages:
        sudo apt install cmake
        sudo apt install pkg-config
        sudo apt install funkeymonkey-dev
    Apply the bugfixes to the source code.
    Now you can proceed building pyrainput like it is described in the readme:
        mkdir build
        cd build
        cmake ..
        make
 

Attachments

Last edited:
Since I was already on it, I also checked the other key names.
There are two more key names that are wrong. This time they should be fixed in pyraKeyMap.cpp since they are clearly just misspelled:
  • PYRA_KEY_RIFHT
    xev still seems to recognize this button anyway
  • PYRA_KEY_LEFTAL
    That ist the "Start"/"Alt" button and I can confirm that xev doesn't recognize pressing this button
Also the Select/Ctrl button doesn't do anything. I'll have to look deeper into this one since it is a button that is also used by the GamePad and the GamePad seems to recognize the button.

Edit: I had "keypad" disabled on my Pyra. After enabling it I relized that "Start"/"Alt" also works even though it is misspelled. I think that is because all those buttons that are used as game pad buttons and also as keyboard buttons have a different mechanism that keeps them working even if the pyraKeyMap.cpp is wrong. I did the spelling fixes in pyraKeyMap.cpp anyway, since that is clearly what was intended and e.g. it is also not doing any harm for the other d-pad buttons. I attach the new libpyrainput.so again. But since the fixed spellings don't really have an effect, it should behave exactly as the other version that I uploaded on my first post.
 

Attachments

Last edited:
Back
Top