How can I get my joystick name, in a shell/bash context?

When running from a terminal I type:

jstest /dev/input/js1 | grep '^Joystick'

and get the name.

But the jstest cmd is interactive, and needs a Ctrl+c to finish.

How can I get such result into a shell script?


xinput -list does not list my usb joysticks. I could use lsusb: it returns names but not the js position.

Suppose I have 2 joysticks (but don't know in which positions they are) and want to calibrate them. My goal is:

if (name("/dev/input/js0")=="Thrustmaster") then jscal -s <Thrustmaster params> /dev/input/js0 jscal -s <FooJs params> /dev/input/js1
elif (name("/dev/input/js0")=="FooJs") then jscal -s <FooJs params> /dev/input/js0 jscal -s <Thrustmaster params> /dev/input/js1
fi
Reset to default

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like