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.
$ halrun
Now, after you've plugged your joypad, load the hal_input component with the correct input specification from step 1.
halcmd: loadusr -W hal_input -KRAL Dual
Now we load one halmeter to check the axes values:
halcmd: loadusr halmeter
the little halmeter window should open, click on select and you will see all pins created by hal_input:
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:
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.
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
This is the joypad I used
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
Button Pin Names