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:

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
Hat Up-Down abs-hat0y-counts
Hat Push none
Left Knob Left-Right abs-x-counts
Left Knob Up-Down abs-y-counts
Left Knob Push btn-base5
Right Knob Left-Right abs-z-counts
Right Knob Up-Down abs-rz-counts
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 and 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.

5 thoughts on “EMC2 HAL Pin Names: Logitech Dual Action Gamepad

  1. You might take a look at HIDComp (http://hidcomp.sourceforge.net/). I used it to set up the same controller with EMC2 to run my mill.

    Unfortunately, the approach I followed to do analog velocity control using the analog sticks doesn’t work very well – it’s very quantized and notchy.

    1. using the analog sticks

      Although they have 256 levels, more or less, the output sure doesn’t step by single digits!

      I poked around at the various HAL parameters (fuzz, flat, etc) and discovered that nothing really helped: the input from the stick (at least as passed through by the OS) really isn’t very pretty at all.

      But it works OK in absolute mode; more coming over the next couple of days…

  2. Your ability to hook up strange hardware to this system and make it work is a source of complete amazement. I’m extremely envious of your skill.

    By the way, today I grabbed a new-in-box specialized tube, 700×20, and put it in a wheel, and by the time I’d run the footpump 7 strokes, the tube had already split along a seam. sigh…

    1. hook up strange hardware to this system

      Thanks kindly, but I’m actually a flea on the shoulders of giants here; most of the heavy lifting for the Logitech gamepad is pretty well documented in the EMC wiki. After I get more power-on hours with the thing, I must add a note there, too.

      the tube had already split along a seam

      I just picked up some Schwalbe tubes to see how they fare. They’re supposed to be ever so stretchy and ever so airtight, which sounds like a Good Thing. We shall see…

Comments are closed.