Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Okay, I have two joysticks attached to my linux box and they show up as /dev/js0 and /dev/js1. My problem is, I have a third party application, (that I cannot change), that uses a joystick, and it can only listen to one node, (so only one joystick at a time).

I can determine which node the application will "listen" to, (e.g. /dev/js0), but I can only specify one node. This means I can determine which joystick the application will use, but that also means it can only use one joystick at a time. I have been tasked to come up with a way that this application can use both joysticks at the same time in an either/or scenario and not one or the other.

Is there a way to redirect the outputs of the two joystick nodes into a third node to which I could then point the application? Is there another way that comes to mind to somehow "merge" these two drivers/nodes into one?

I tried creating a new third node, (dev/js2) using mknod, but I couldn't figure out how to redirect the output of js0 and js1 to js2.

I'm also not opposed to doing this using a small program and udev, but I'm not sure how to go about it.

share|improve this question

1 Answer 1

Quickly searching, it appears that there is a Linux Joystick Mapper on Sourceforge which claims to do what you want.

I believe it is built on top of uinput which is probably what you'll want to use if you have to build your own. There wrappers to that in various languages, so you won't necessarily have to work in C. Python appears to definitely by possible.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.