Late solving here, just posting in case it helps someone someday :)
I created a small python code to test if the joystick file exists and called it with loadusr -w joystickLoader
In my case, i got these three files:
joystickLoader:
#!/usr/bin/python
import hal
import os
# load the HAL file 'joystickOptions.hal'
res = os.spawnvp(os.P_WAIT, "halcmd", ['halcmd' , '-k', '-Q', '-f', 'joystickOptions.hal'])
joyFileExists = os.path.isfile('/dev/js0')
if joyFileExists == True:
print 'Joystick found! Initilizing...'
# load the HAL file 'joystickOptions.hal'
res = os.spawnvp(os.P_WAIT, "halcmd", ['halcmd' , '-k', '-Q', '-f', 'joystickOptions.hal'])
if not res:
res = os.spawnvp(os.P_WAIT, "halcmd", ['halcmd' ,"-f", "joystickSuccess.hal"])
if res:
print '**** TRY LOADER ERROR: try_sucess.hal file Error'
raise SystemExit, res
else:
print 'No joystick found'
exit()
joystickOptions.hal:
loadusr hal_input -KRAL 1
joystickSuccess.hal:
loadrt or2 count=2
loadrt mux4 count=2
addf or2.0 servo-thread
addf or2.1 servo-thread
addf mux4.0 servo-thread
# set the jog speed for the joypad again use numbers that make sense for your machine
setp mux4.0.in0 0 # this one must be 0 to prevent motion unless a button is pressed
setp mux4.0.in1 50
setp mux4.0.in2 300
setp mux4.0.in3 1800
# the following does the magic of setting the jog speeds
net remote-speed-slow or2.0.in0 input.0.btn-thumb2
net remote-speed-medium or2.1.in0 input.0.btn-thumb
net remote-speed-fast or2.0.in1 or2.1.in1 input.0.btn-joystick
net joy-speed-1 mux4.0.sel0 <= or2.0.out
net joy-speed-2 mux4.0.sel1 <= or2.1.out
net joy-speed-final halui.jog-speed <= mux4.0.out
net joy-x-jog halui.jog.0.analog <= input.0.abs-x-position
setp input.0.abs-y-scale -127.5
net joy-y-jog halui.jog.1.analog <= input.0.abs-y-position
addf mux4.1 servo-thread
setp mux4.1.in0 0
setp mux4.1.in1 -1
setp mux4.1.in2 1
setp mux4.1.in3 0
net joy-z-up mux4.1.sel0 <= input.0.btn-base
net joy-z-down mux4.1.sel1 <= input.0.btn-base2
net joy-z-jog halui.jog.2.analog <= mux4.1.out
Best Regards.
Paulo Sherring.