Archive for March 22nd, 2010

EMC2 HAL Pin Names: Logitech Dual Action Gamepad

Here are the pin names for a Logitech Dual Action USB (wired) gamepad, according to EMC2 2.3.4. You’ll need these to wire it up as a control pendant for your EMC2 CNC milling machine…

Front View

Front View

From /proc/bus/input/devices we find:

I: Bus=0003 Vendor=046d Product=c216 Version=0110
N: Name="Logitech Logitech Dual Action"
P: Phys=usb-0000:00:1d.1-2/input0
S: Sysfs=/devices/pci0000:00/0000:00:1d.1/usb2/2-2/2-2:1.0/input/input2
U: Uniq=
H: Handlers=event2 js0
B: EV=1b
B: KEY=fff 0 0 0 0 0 0 0 0 0
B: ABS=30027
B: MSC=10

That tells us to use:

halrun
loadusr -W hal_input -KRA Dual
loadusr halmeter

There’s no need for -KRAL because it has no programmable LEDs.

Prefix all these with input.0. to get the complete name.

Hat Left-Right abs-hat0x-counts
abs-hat0x-position
Hat Up-Down abs-hat0y-counts
abs-hat0y-position
Hat Push none
Left Knob Left-Right abs-x-counts
abs-x-position
Left Knob Up-Down abs-y-counts
abs-y-position
Left Knob Push btn-base5
Right Knob Left-Right abs-z-counts
abs-z-position
Right Knob Up-Down abs-rz-counts
abs-rz-position
Right Knob Push btn-base6
Button 1 btn-trigger
Button 2 btn-thumb
Button 3 btn-thumb2
Button 4 btn-top
Button 5 btn-top2
Button 6 btn-pinkie
Button 7 btn-base
Button 8 btn-base2
Button 9 btn-base3
Button 10 btn-base4
Mode button swap Hat & Left Knob
lights red LED

All of the buttons have -not output pins.

The Knob position values run from -1.0 to +1.0 (float) and rest (almost) at 0.0 when centered. Their counts (s32) run from 0 to 255 and rest at 127 when centered.

The Hat button position values are only -1.0 and +1.0, centered at 0.0. The counts are only -1 and +1, with 0 when un-pushed. Although they take on only integer values, the position values are floats.

Both Knobs and the Hat have -Y position values at the top and +Y values at the bottom, exactly backwards from what you want. Expect to reverse the Y axis sign when you write the HAL code.

The -X position values are to the left, where you want them.

Although there’s a tactile click when pushing the Hat straight down, there is no corresponding button output. I don’t know if this is an oversight in the HAL interface or if there’s no actual switch in there.

The Mode button swaps the Hat and Left Knob functions. With the red LED on, both the Hat Knob axes produce only -1 and +1 position and counts values.

A guide to figuring this stuff out is there, with useful pointers elsewhere on the main doc page.

Tomorrow: turning it into an EMC2 pendant.

About these ads

,

5 Comments