Extra Buttons Up, Down, Left Right

Hi,

I’ve received my DevTerm :grinning: :grinning: :grinning:

and already I have a question. How do I read the state of the four arrow keys at the top left of the keyboard and the ‘game’ buttons (Y X B A) at the top right ?

Thanks,
Andrew

1 Like

What do you mean by key states? Like key presses?

Maybe what you are looking for is xev or showkey

Those keys is a Joystick, not a normal keyboard.
I think you could use those keys in game playing, not is text editing, just like a normal seperated gamepad.

屏幕快照 2021-09-04 07.56.56 屏幕快照 2021-09-04 07.57.00

The defines in source code looks like this:

_JOYSTICK_UP, //B1 //Joystick.Y()
_JOYSTICK_DOWN, //Joystick.Y()
_JOYSTICK_LEFT, //Joystick.X()
_JOYSTICK_RIGHT, //Joystick.X()
_JOYSTICK_A, //Joystick.button(1)
_JOYSTICK_B, //Joystick.button(2)
_JOYSTICK_X, //Joystick.button(3)
_JOYSTICK_Y, //Joystick.button(4)

Can confirm. In SDL games these keys behave as if you have a generic gamepad/joystick attached.

1 Like

If you want keyboard keypress you have to move one of the switch on the back.

2 Likes

I would like to use them in my own programs. Is there a library, or header file I can use ? If so where Will I find them ?

1 Like

It does show up as a normal USB joypad, there is nothing special other than accessing a joystick

Exemple, if you use SDL, it should directly use the Joypad/Joystick related functions

2 Likes

I found this:

https://www.kernel.org/doc/Documentation/input/joystick-api.txt

Which answered most of my questions, plus I installed a package (joystick) which contains “jstest” run this and press buttons, you can see the results.

Thanks for the tips.

1 Like

Could you link to where this is documented?

Hi @andypiper, I’ve also been looking around for the documention. I think I found the git commit where they added the switch condition though! here is the commit to the clockwork/DevTerm repo

1 Like

Thanks, I haven’t been able to find very much information on the switches on the keyboard in general, apart from reading through these threads and learning, which is why I was asking :slight_smile: appreciate the sleuthing.

It is not, but you can find it by looking at the keyboard code. that’s why I shared it here.

2 Likes