usinf identical JoyStick hardware boards and loadusr

More
30 Nov 2021 13:59 - 30 Nov 2021 15:02 #228008 by ikkuh
Having two DragonRise USB joystick adapters to add some buttons to LinuxCNC.

Lots of troubles to get them both working at the same time. Documentation  mentions that when two devices have the same name adding a :0 or :1 would make them work.
But I can't get it to work at all. There is always just one pins.input.0 I expected that there would be another as pins.input.1

hal file

  loadusr -W hal_input -KRAL 14.0-1.2:0 -n Dragon:0 -d
  loadusr  -W hal_input -KRAL 14.0-1.3.1:1 -n Dragon:1 -d

LinuxCNC startup message

note: name is 'DragonRise Inc.   Generic   USB  Joystick  '
note: name is 'DragonRise Inc.   Generic   USB  Joystick  '
[QTvcp][INFO]  postgui commands: None (qtvcp:399)
[QTvcp][INFO]  Preference path: /home/cnc/linuxcnc/configs/qt/qtdragon.pref (qtvcp:378)
HAL: ERROR: duplicate component name 'hal_input'
Traceback (most recent call last):
  File "/usr/bin/hal_input", line 215, in <module>
    h = component("hal_input")
hal.error: Invalid argument


less /proc/bus/input/devices

I: Bus=0003 Vendor=0079 Product=0006 Version=0110
N: Name="DragonRise Inc.   Generic   USB  Joystick  "
P: Phys=usb-0000:00:14.0-1.2/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.2/1-1.2:1.0/0003:0079:0006.000D/input/input26
U: Uniq=
H: Handlers=event13 js0
B: PROP=0
B: EV=20001b
B: KEY=fff00000000 0 0 0 0
B: ABS=3002f
B: MSC=10
B: FF=107030000 0

I: Bus=0003 Vendor=0079 Product=0006 Version=0110
N: Name="DragonRise Inc.   Generic   USB  Joystick  "
P: Phys=usb-0000:00:14.0-1.3.1/input0
S: Sysfs=/devices/pci0000:00/0000:00:14.0/usb1/1-1/1-1.3/1-1.3.1/1-1.3.1:1.0/0003:0079:0006.000E/input/input27
U: Uniq=
H: Handlers=event14 js1
B: PROP=0
B: EV=20001b
B: KEY=fff00000000 0 0 0 0
B: ABS=3002f
B: MSC=10
B: FF=107030000 0


linuxcnc.org/docs/html/man/man1/hal_inpu...NPUT%20SPECIFICATION
When several devices are identified by the same string, add ":N" where N is the index of the desired device. For example, if Mouse matches input3 and input10, then Mouse and Mouse:0 select input3. Specifying mouse:1 selects input10.


Another attempt:
hal file

  loadusr -W hal_input -KRAL  -n Dragon:0 -d
  loadusr  -W hal_input -KRAL  -n Dragon:1 -d

LinuxCNC startup messages

note: name is 'DragonRise Inc.   Generic   USB  Joystick  '
buttons.hal:8: Pin 'input.0.btn-thumb2' does not exist
HAL: ERROR: duplicate component name 'hal_input'
Traceback (most recent call last):
  File "/usr/bin/hal_input", line 215, in <module>
    h = component("hal_input")
hal.error: Invalid argument
Shutting down and cleaning up LinuxCNC...


 

Last edit: 30 Nov 2021 15:02 by ikkuh.

Please Log in or Create an account to join the conversation.

More
30 Nov 2021 14:16 #228019 by andypugh
You can only "loadusr" the component once.

If hal_input supports multiple joysticks (and it might) then you would need to specify both in the same loadusr command. Something like:

loadusr -W hal_input -KRAL -n Dragon:0 -n Dragon:1 -d

It might take some experimentation to see what works.

Please Log in or Create an account to join the conversation.

More
30 Nov 2021 15:00 #228026 by ikkuh

You can only "loadusr" the component once.

If hal_input supports multiple joysticks (and it might) then you would need to specify both in the same loadusr command. Something like:

loadusr -W hal_input -KRAL -n Dragon:0 -n Dragon:1 -d

It might take some experimentation to see what works.
 

Thanks, but as soon as I use the -n and name the component the pins.input.0 disapears. As soon as I remove the -n the pins show up again (for a single instance of the component).

Maybe the joystick thingy doesn't support two or more joysticks.

Please Log in or Create an account to join the conversation.

More
30 Nov 2021 15:09 #228028 by ikkuh
Should work if dev consists of more then one component.

master/src/hal/user_comps/hal_input.py

fds = [dev.device.fileno() for dev in d]
try:
while 1:
select.select(fds, , , .01)
for i in d:
i.update()
w.drive()

Please Log in or Create an account to join the conversation.

More
01 Dec 2021 11:43 #228114 by andypugh
I am not clear if you need one, two or zero -n commands.

I can't really test, as I don't have even one joypad.

Can you follow the logic of the argument parsing well enough to add some "print" statements to see what it is seeing?

Please Log in or Create an account to join the conversation.

More
01 Dec 2021 11:48 #228115 by ikkuh

I am not clear if you need one, two or zero -n commands.

I can't really test, as I don't have even one joypad.

Can you follow the logic of the argument parsing well enough to add some "print" statements to see what it is seeing?
 

Been trying to find out what is happening and why the multiple cards can not be selected. Kinda debugging with print statements I guess. Spend already a lot of time on this, have to do some proper work now. If I find out anything I will post it here.

The cards are very cheap, I paid 10 euro's for 15 inputs. www.amazon.com/s?k=arcade+usb+encoder&sp...cade+usb%2Caps%2C243
Nice cheap way to add hardware buttons to a LinuxCNC installation.

Please Log in or Create an account to join the conversation.

Time to create page: 0.076 seconds
Powered by Kunena Forum