HereIsHowToCheck - rmu75/linuxcnc-wiki GitHub Wiki
date: '2021-02-09T21:54:20' title: HereIsHowToCheck
This page illustrates how to identify pins available on a hal_input joypad device.
Step 1 Identify your joypad
In a terminal window type:
less /proc/bus/input/devices
The output will look something like this:
I: Bus=0003 Vendor=046d Product=c216 Version=0300
N: Name="Logitech Logitech Dual Action"
P: Phys=usb-0000:00:03.2-2/input0
S: Sysfs=/class/input/input3
H: Handlers=event3 js0
B: EV=b
B: KEY=fff 0 0 0 0 0 0 0 0 0
B: ABS=30027
Don't proceed until you identify your joypad! You need to find a unique pattern in the output fields to specify your device. In my case I chose "Dual". See the Input Specification section of http://linuxcnc.org/docs/html/man/man1/hal_input.1.html for details.
Step 2 Check what's available on your joypad.
In a terminal window type:
<b>$ halrun </b>
Now, after you've plugged your joypad, load the hal_input component with the correct input specification from step 1.
halcmd: <b>loadusr -W hal_input -KRAL Dual</b>
Now we load one halmeter to check the axes values:
halcmd: <b>loadusr halmeter</b>
the little halmeter window should open, click on select and you will see all pins created by hal_input:
upload:select.png
select the position of the desired joystick axis, and click on the position; now you should see the little halmeter window showing the position value for that axis:
upload:meter.png
If it is 0 and you are not moving the joypad, everything is fine. Try to move your joypad in order to see which is the axis.0 You can check all other axes if you want, however if the first outputs the right values, others should do the same.
Permissions
If your system doesn't recognize the joypad you may need to modify the udev permissions to access the device. Prepared a one line file as per the description in the man udev.
new syntax:
ATTR{idProduct}=="c216", ATTR{idVendor}=="046d", MODE="0660", GROUP="plugdev"
old syntax:
SUBSYSTEM=="input", mode="0660", group="plugdev"
Save the file to the /etc/udev/rules.d directory. Now tell Ubuntu to reload udev rules by entering the following in the terminal window:
sudo udevadm trigger
Next, add yourself to the plugdev group. adduser $username plugdev
Logitech F310 Specific Absolute Axes and Button Pins
This is the joypad I used
upload:LogitechF310.jpg
The Logitech F310 supports 6 absolute axes and twelve buttons. See http://linuxcnc.org/docs/html/man/man1/hal_input.1.html for the full pin names for these axes and buttons.
Axes Pin Names
- hat0x - Discrete pad.
- hat0y - Discrete pad.
- x - Right joystick.
- y - Right joystick.
- z - Left joystick.
- rz - Left joystick.
Button Pin Names
- top2 - Front left top.
- pinkie - Front right top.
- base - Front left bottom.
- base2 - Front right bottom.
- base3 - "9" or "BACK" depending on vintage.
- base4 - "10" or "START".
- base5 - Left joystick press.
- base6 - Right joystick press.
- joystick - "1" or "X".
- thumb - "2" or "A".
- thumb2 - "3" or "B".
- top - "4" or "Y"