Joypad Raw Inputs

Hello,
I want to write a python script that allows me to jog a motor based off a joypad button press. Where can I find access to the raw input commands for the joypad and game buttons?

It’s at /dev/input/js0, though you may want to use a higher-level library with Joystick support, like Pygame.

Do note that the HID device descriptor reports way more inputs than it actually has :slightly_frowning_face:.

If you do want to go down the route of reading the raw commands, do note they are a binary data format. You’ll need to use the struct module to align with what the Kernel provides. See the Kernel documentation for details.

I think something like pygame is more than perfect for what I need! Thanks!

Edit i am using the keyboard libray now, i assume that wont work for the joypads.

1 Like

I haven’t tried that library, though I’m not sure that’s a safe assumption. I guess you’ll see as you use it :slight_smile: