# Extra Buttons Up, Down, Left Right

**URL:** <https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020>\
**Category:** DevTerm\
**Created:** [September 3, 2021, 12:15pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020 "2021-09-03T12:15:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![Andrew\_Holt](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andrew_holt/32/4699_2.png) [@Andrew\_Holt](https://forum.clockworkpi.com/u/Andrew_Holt)\
**Post date:** [September 3, 2021, 12:15pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/1 "2021-09-03T12:15:32Z")

</div>

Hi,

I’ve received my DevTerm 😀 😀 😀

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

---

<div class="post-metadata">

**Author:** ![Petrakis](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/petrakis/32/256_2.png) [@Petrakis](https://forum.clockworkpi.com/u/Petrakis)\
**Post date:** [September 3, 2021, 5:52pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/2 "2021-09-03T17:52:03Z")

</div>

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

Maybe what you are looking for is [xev](https://linux.die.net/man/1/xev) or [showkey](https://linux.die.net/man/1/showkey)

---

<div class="post-metadata">

**Author:** ![hengying](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/hengying/32/4647_2.png) [@hengying](https://forum.clockworkpi.com/u/hengying)\
**Post date:** [September 3, 2021, 11:51pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/3 "2021-09-03T23:51:55Z")

</div>

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](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/c/c0b649ee9f19d12abe3bc6966e89d6b93ee0d6a3.png) ![屏幕快照 2021-09-04 07.57.00](https://canada1.discourse-cdn.com/flex029/uploads/clockworkpi/original/2X/d/d298e98df921001a7c1a1571a3b6bceef20e4555.png)

The defines in source code looks like this:

> \_JOYSTICK\_UP, //B1 [//Joystick.Y](https://Joystick.Y)()  
> \_JOYSTICK\_DOWN, [//Joystick.Y](https://Joystick.Y)()  
> \_JOYSTICK\_LEFT, [//Joystick.X](https://Joystick.X)()  
> \_JOYSTICK\_RIGHT, [//Joystick.X](https://Joystick.X)()  
> \_JOYSTICK\_A, [//Joystick.button](https://Joystick.button)(1)  
> \_JOYSTICK\_B, [//Joystick.button](https://Joystick.button)(2)  
> \_JOYSTICK\_X, [//Joystick.button](https://Joystick.button)(3)  
> \_JOYSTICK\_Y, [//Joystick.button](https://Joystick.button)(4)

---

<div class="post-metadata">

**Author:** ![JohnEarnest](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/johnearnest/32/4514_2.png) [@JohnEarnest](https://forum.clockworkpi.com/u/JohnEarnest)\
**Post date:** [September 4, 2021, 2:02am UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/4 "2021-09-04T02:02:03Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Godzil](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/godzil/32/60_2.png) [@Godzil](https://forum.clockworkpi.com/u/Godzil)\
**Post date:** [September 4, 2021, 10:31am UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/5 "2021-09-04T10:31:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrew\_Holt](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andrew_holt/32/4699_2.png) [@Andrew\_Holt](https://forum.clockworkpi.com/u/Andrew_Holt)\
**Post date:** [September 4, 2021, 10:53am UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/6 "2021-09-04T10:53:38Z")

</div>

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 ?

---

<div class="post-metadata">

**Author:** ![Godzil](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/godzil/32/60_2.png) [@Godzil](https://forum.clockworkpi.com/u/Godzil)\
**Post date:** [September 4, 2021, 11:11am UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/7 "2021-09-04T11:11:36Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Andrew\_Holt](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andrew_holt/32/4699_2.png) [@Andrew\_Holt](https://forum.clockworkpi.com/u/Andrew_Holt)\
**Post date:** [September 4, 2021, 2:14pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/8 "2021-09-04T14:14:47Z")

</div>

I found this:

[https://www.kernel.org/doc/Documentation/input/joystick-api.txt](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.

---

<div class="post-metadata">

**Author:** ![andypiper](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andypiper/32/7970_2.png) [@andypiper](https://forum.clockworkpi.com/u/andypiper)\
**Post date:** [June 8, 2022, 10:50pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/9 "2022-06-08T22:50:48Z")

</div>

> [@Godzil](#):
>
> If you want keyboard keypress you have to move one of the switch on the back.

Could you link to where this is documented?

---

<div class="post-metadata">

**Author:** ![Andersen98](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andersen98/32/6413_2.png) [@Andersen98](https://forum.clockworkpi.com/u/Andersen98)\
**Post date:** [June 12, 2022, 7:06pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/10 "2022-06-12T19:06:39Z")

</div>

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](https://github.com/clockworkpi/DevTerm/commit/c626e1f797b971b1f8f2fef75fea37e19af8f5f2)

---

<div class="post-metadata">

**Author:** ![andypiper](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/andypiper/32/7970_2.png) [@andypiper](https://forum.clockworkpi.com/u/andypiper)\
**Post date:** [June 12, 2022, 10:23pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/11 "2022-06-12T22:23:23Z")

</div>

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 🙂 appreciate the sleuthing.

---

<div class="post-metadata">

**Author:** ![Godzil](https://yyz1.discourse-cdn.com/flex029/user_avatar/forum.clockworkpi.com/godzil/32/60_2.png) [@Godzil](https://forum.clockworkpi.com/u/Godzil)\
**Post date:** [June 16, 2022, 6:36pm UTC](https://forum.clockworkpi.com/t/extra-buttons-up-down-left-right/7020/12 "2022-06-16T18:36:34Z")

</div>

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