Let's play with the XHC-HB04 driver:
http://linuxcnc.org/docs/2.8/html/man/man1/xhc-hb04.1.html
In one Terminal session:
http://linuxcnc.org/docs/2.8/html/man/man1/xhc-hb04.1.html
In one Terminal session:
muzzer@LinuxCNC:~$ halrun
halcmd: loadusr -W xhc-hb04 -H
(-W means to wait for the component to start up; -H means to specify HAL mode)
Then we see..
halcmd: xhc-hb04: waiting for XHC-HB04 device
xhc-hb04: found XHC-HB04 device
xhc-hb04: found XHC-HB04 device
In a second Terminal window:
muzzer@LinuxCNC:~$ watch -n0.1 halcmd show pin xhc-hb04
the "-n0.1" option updates every 100ms. I don't see any mention of it in the docs but spotted it half way down in this forum thread. This is typical of LinuxCNC learning - you can't say it isn't documented somewhere but unless you are psychic or lucky, these options can pass you by.
This splurges out a list of the pins that have been created by the component (device?). This is encouraging.
This splurges out a list of the pins that have been created by the component (device?). This is encouraging.
But hold up, there's half the information missing, like the actual buttons. Of course, it needs to know where the config file is though - this tells it which buttons the pendant has. It's part of the std distribution and is kept at /usr/share/linuxcnc/hallib/xhc-hb04-layout2.cfg
So let's try again. The command line is getting a bit painful to type, especially if you fuck it up:
So let's try again. The command line is getting a bit painful to type, especially if you fuck it up:
muzzer@LinuxCNC:~$ halrun
halcmd: loadusr -W xhc-hb04 -H -I /usr/share/linuxcnc/hallib/xhc-hb04-layout2.cfg
halcmd: loadusr -W xhc-hb04 -H -I /usr/share/linuxcnc/hallib/xhc-hb04-layout2.cfg
The -I option allows you to specify the path to the layout config file. The 18 button pendant is defined as "layout 2". Here's the content of the pendant layout file, xhc-hb04-layout2.cfg:
[XHC-HB04]
BUTTON=01:button-goto-zero
BUTTON=02:button-start-pause
BUTTON=03:button-rewind
BUTTON=04:button-probe-z
BUTTON=05:button-macro-3
BUTTON=06:button-half
BUTTON=07:button-zero
BUTTON=08:button-safe-z
BUTTON=09:button-home
BUTTON=0A:button-macro-1
BUTTON=0B:button-macro-2
BUTTON=0C:button-spindle
BUTTON=0D:button-step
BUTTON=0E:button-mode
BUTTON=0F:button-macro-6
BUTTON=10:button-macro-7
BUTTON=16:button-stop
BUTTON=17:button-reset
That's better. Now I can see all the buttons as well as all the pins:
So "all" I would have to do now is connect them up to my machine by rewriting the .hal file I've spent ages playing with. Bollocks.
Note that there are groups of 5 of some functions. For instance, pressing the "half" button will change the state of both xhc-hb04.button-half and xhc-hb04.button-half-x if the selector switch is set to the "x" position (the signal status changes in real time, subject to the update rate of 100ms here). Those x, y, z & a flavours are described as "synthesised" buttons, as they are formed by logical combination of the "half" button and the selector switch.
NB: An alternative command would be "halcmd show pin xhc-hb04", which takes a snapshot, rather than a live view. Somewhat better for copying and editing, perhaps. Like this:
muzzer@LinuxCNC:~$ halcmd show pin xhc-hb04
Component Pins:
Owner Type Dir Value Name
4 float IN 0 xhc-hb04.a.pos-absolute
4 float IN 0 xhc-hb04.a.pos-relative
4 bit OUT FALSE xhc-hb04.button-goto-zero
4 bit OUT FALSE xhc-hb04.button-goto-zero-a
4 bit OUT FALSE xhc-hb04.button-goto-zero-x
4 bit OUT FALSE xhc-hb04.button-goto-zero-y
4 bit OUT FALSE xhc-hb04.button-goto-zero-z
4 bit OUT FALSE xhc-hb04.button-half
4 bit OUT FALSE xhc-hb04.button-half-a
4 bit OUT FALSE xhc-hb04.button-half-x
4 bit OUT FALSE xhc-hb04.button-half-y
4 bit OUT FALSE xhc-hb04.button-half-z
4 bit OUT FALSE xhc-hb04.button-home
4 bit OUT FALSE xhc-hb04.button-macro-1
4 bit OUT FALSE xhc-hb04.button-macro-2
4 bit OUT FALSE xhc-hb04.button-macro-3
4 bit OUT FALSE xhc-hb04.button-macro-6
4 bit OUT FALSE xhc-hb04.button-macro-7
4 bit OUT FALSE xhc-hb04.button-mode
4 bit OUT FALSE xhc-hb04.button-probe-z
4 bit OUT FALSE xhc-hb04.button-reset
4 bit OUT FALSE xhc-hb04.button-rewind
4 bit OUT FALSE xhc-hb04.button-safe-z
4 bit OUT FALSE xhc-hb04.button-spindle
4 bit OUT FALSE xhc-hb04.button-start-pause
4 bit OUT FALSE xhc-hb04.button-step
4 bit OUT FALSE xhc-hb04.button-stop
4 bit OUT FALSE xhc-hb04.button-zero
4 bit OUT FALSE xhc-hb04.button-zero-a
4 bit OUT FALSE xhc-hb04.button-zero-x
4 bit OUT FALSE xhc-hb04.button-zero-y
4 bit OUT FALSE xhc-hb04.button-zero-z
4 bit OUT TRUE xhc-hb04.connected
4 float IN 0 xhc-hb04.feed-override
4 float IN 0 xhc-hb04.feed-value
4 bit IN FALSE xhc-hb04.inch-icon
4 s32 OUT 0 xhc-hb04.jog.counts
4 s32 OUT 0 xhc-hb04.jog.counts-neg
4 bit OUT FALSE xhc-hb04.jog.enable-a
4 bit OUT FALSE xhc-hb04.jog.enable-feed-override
4 bit OUT TRUE xhc-hb04.jog.enable-off
4 bit OUT FALSE xhc-hb04.jog.enable-spindle-override
4 bit OUT FALSE xhc-hb04.jog.enable-x
4 bit OUT FALSE xhc-hb04.jog.enable-y
4 bit OUT FALSE xhc-hb04.jog.enable-z
4 float OUT 0 xhc-hb04.jog.increment
4 float IN 0 xhc-hb04.jog.max-velocity
4 bit OUT FALSE xhc-hb04.jog.minus-a
4 bit OUT FALSE xhc-hb04.jog.minus-x
4 bit OUT FALSE xhc-hb04.jog.minus-y
4 bit OUT FALSE xhc-hb04.jog.minus-z
4 bit OUT FALSE xhc-hb04.jog.plus-a
4 bit OUT FALSE xhc-hb04.jog.plus-x
4 bit OUT FALSE xhc-hb04.jog.plus-y
4 bit OUT FALSE xhc-hb04.jog.plus-z
4 float OUT 0.001 xhc-hb04.jog.scale
4 float OUT 0 xhc-hb04.jog.velocity
4 bit OUT FALSE xhc-hb04.require_pendant
4 bit OUT TRUE xhc-hb04.sleeping
4 float IN 0 xhc-hb04.spindle-override
4 float IN 0 xhc-hb04.spindle-rps
4 s32 OUT 1 xhc-hb04.stepsize
4 bit IN FALSE xhc-hb04.stepsize-down
4 bit IN FALSE xhc-hb04.stepsize-up
4 float IN 0 xhc-hb04.x.pos-absolute
4 float IN 0 xhc-hb04.x.pos-relative
4 float IN 0 xhc-hb04.y.pos-absolute
4 float IN 0 xhc-hb04.y.pos-relative
4 float IN 0 xhc-hb04.z.pos-absolute
4 float IN 0 xhc-hb04.z.pos-relative
Owner Type Dir Value Name
4 float IN 0 xhc-hb04.a.pos-absolute
4 float IN 0 xhc-hb04.a.pos-relative
4 bit OUT FALSE xhc-hb04.button-goto-zero
4 bit OUT FALSE xhc-hb04.button-goto-zero-a
4 bit OUT FALSE xhc-hb04.button-goto-zero-x
4 bit OUT FALSE xhc-hb04.button-goto-zero-y
4 bit OUT FALSE xhc-hb04.button-goto-zero-z
4 bit OUT FALSE xhc-hb04.button-half
4 bit OUT FALSE xhc-hb04.button-half-a
4 bit OUT FALSE xhc-hb04.button-half-x
4 bit OUT FALSE xhc-hb04.button-half-y
4 bit OUT FALSE xhc-hb04.button-half-z
4 bit OUT FALSE xhc-hb04.button-home
4 bit OUT FALSE xhc-hb04.button-macro-1
4 bit OUT FALSE xhc-hb04.button-macro-2
4 bit OUT FALSE xhc-hb04.button-macro-3
4 bit OUT FALSE xhc-hb04.button-macro-6
4 bit OUT FALSE xhc-hb04.button-macro-7
4 bit OUT FALSE xhc-hb04.button-mode
4 bit OUT FALSE xhc-hb04.button-probe-z
4 bit OUT FALSE xhc-hb04.button-reset
4 bit OUT FALSE xhc-hb04.button-rewind
4 bit OUT FALSE xhc-hb04.button-safe-z
4 bit OUT FALSE xhc-hb04.button-spindle
4 bit OUT FALSE xhc-hb04.button-start-pause
4 bit OUT FALSE xhc-hb04.button-step
4 bit OUT FALSE xhc-hb04.button-stop
4 bit OUT FALSE xhc-hb04.button-zero
4 bit OUT FALSE xhc-hb04.button-zero-a
4 bit OUT FALSE xhc-hb04.button-zero-x
4 bit OUT FALSE xhc-hb04.button-zero-y
4 bit OUT FALSE xhc-hb04.button-zero-z
4 bit OUT TRUE xhc-hb04.connected
4 float IN 0 xhc-hb04.feed-override
4 float IN 0 xhc-hb04.feed-value
4 bit IN FALSE xhc-hb04.inch-icon
4 s32 OUT 0 xhc-hb04.jog.counts
4 s32 OUT 0 xhc-hb04.jog.counts-neg
4 bit OUT FALSE xhc-hb04.jog.enable-a
4 bit OUT FALSE xhc-hb04.jog.enable-feed-override
4 bit OUT TRUE xhc-hb04.jog.enable-off
4 bit OUT FALSE xhc-hb04.jog.enable-spindle-override
4 bit OUT FALSE xhc-hb04.jog.enable-x
4 bit OUT FALSE xhc-hb04.jog.enable-y
4 bit OUT FALSE xhc-hb04.jog.enable-z
4 float OUT 0 xhc-hb04.jog.increment
4 float IN 0 xhc-hb04.jog.max-velocity
4 bit OUT FALSE xhc-hb04.jog.minus-a
4 bit OUT FALSE xhc-hb04.jog.minus-x
4 bit OUT FALSE xhc-hb04.jog.minus-y
4 bit OUT FALSE xhc-hb04.jog.minus-z
4 bit OUT FALSE xhc-hb04.jog.plus-a
4 bit OUT FALSE xhc-hb04.jog.plus-x
4 bit OUT FALSE xhc-hb04.jog.plus-y
4 bit OUT FALSE xhc-hb04.jog.plus-z
4 float OUT 0.001 xhc-hb04.jog.scale
4 float OUT 0 xhc-hb04.jog.velocity
4 bit OUT FALSE xhc-hb04.require_pendant
4 bit OUT TRUE xhc-hb04.sleeping
4 float IN 0 xhc-hb04.spindle-override
4 float IN 0 xhc-hb04.spindle-rps
4 s32 OUT 1 xhc-hb04.stepsize
4 bit IN FALSE xhc-hb04.stepsize-down
4 bit IN FALSE xhc-hb04.stepsize-up
4 float IN 0 xhc-hb04.x.pos-absolute
4 float IN 0 xhc-hb04.x.pos-relative
4 float IN 0 xhc-hb04.y.pos-absolute
4 float IN 0 xhc-hb04.y.pos-relative
4 float IN 0 xhc-hb04.z.pos-absolute
4 float IN 0 xhc-hb04.z.pos-relative
Took a while to work out how to do that. But I don't plan to be using this pendant and driver anyway....
No comments:
Post a Comment