Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Joystick support! #23

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mdraves91
Copy link

Hey all, I've added joystick support. You can now bind actions in a keyconfig file to one or more joysticks! All of the changes are explained in the commit comment and the changes to the readme, but I thought I'd highlight the most important one (binding joysticks in a key config) here.

The short version of it is to bind a joystick axis you use the following syntax:

ACTION:js /path/to/js a[number][+-]

and the following for a button:

ACTION:js /path/to/js b[number]

[number] is just the number of the axis or button (watch out, they can overlap! There can exist an axis 0 and a button 0), and [+-] indicates the direction of movement of the axis that should trigger the event. If a direction is missing, it won't work.

I've tested it a bit and it all looks okay, but I'd appreciate it if anyone else with a joystick handy could test it out too. Some cases that I've tested that work properly:

  • Multiple joysticks
  • No joysticks
  • Binding the same action to keyboard and multiple joysticks
  • Having multiple joysticks plugged in but only one (or none) defined.
  • Having multiple joysticks defined in keyconfig but not all of them exist (i.e. some are unplugged). The joysticks that ARE plugged in work fine.

If you have any questions feel free to ask, or if you have any more edge cases you want me to try out let me know that too!

…eviously static functions are not anymore. KEY_LEFT, KEY_RIGHT etc were changed due to a conflict with the newly included linux/joystick.h. Updated the README file with information on how to bind actions to joysticks.
@popcornmix
Copy link
Owner

Thanks.
Someone is working on #10, which will make patches like this cleaner.
I'll need to check if it's better to accept this before or after #10.

@mdraves91
Copy link
Author

I was a little worried that this might conflict with #10, but I wanted to add joystick support because my pi only has joysticks hooked up to it usually (it's pretty much an emulator box). If #10 gets implemented and it's better to not accept this request or I need to make some changes, that's fine. This isn't a very groundbreaking or vital feature, so if it doesn't get merged right away it's not really a problem.

@JontomXire
Copy link

Would this work with a games console style controller? I have a USB one I plan to use for playing games. It would be nice to be able to control omxplayer with it.

@Ruffio
Copy link

Ruffio commented Jun 16, 2015

@popcornmix @mdraves91 is this PR going to be implemented?

@popcornmix
Copy link
Owner

I don't believe this should be implemented inside omxplayer.
The dbuscontrol.sh interface allows external programs/scripts to send control messages.
It would be pretty easy to make a C program (or even a bash script) that reads joystick events and sends dbuscontrol messages.

@Ruffio
Copy link

Ruffio commented May 4, 2016

@mdraves91 can you close this PR, as it is not going to be implemeted

@Ruffio
Copy link

Ruffio commented May 17, 2016

@mdraves91 please close this PR, as it is not going to be implemeted

@Ruffio
Copy link

Ruffio commented Dec 29, 2016

@popcornmix is this going to be merged? Else reject it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants