Gambas -> USB -> DragonRise USB Joystick -> Use

Post

Posted
Rating:
#1 (In Topic #1145)
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
I have used the DragonRise USB Encoder for several LinuxCNC projects so I know it works well with Linux.

I would like to use it with the Raspberry Pi and possibly with a laptop to provide joystick input and/or 12 button inputs for different uses.

When plugged into the USB port it can be found via terminal…

Code

~$ less /proc/bus/input/devices

It will return something like

Code

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

My question is… how do I read this so that I can use the inputs for something?
This method should work for other joysticks too… just the name would change.

With all the people building games… I'm sure someone figured it out already.

Thanks,
Jerry
Online now: No Back to the top

Post

Posted
Rating:
#2
Avatar
Regular
thatbruce is in the usergroup ‘Regular’
 Well I suppose the first thing is, given you have an "input" device, then what does it do (aka what does it input)? If you press, move or click it or turn it upside down or … It's hard to tell but the xorg stuff may give some info on the device when things happen. I don't really know, the last joystick I had was a frozen orange juice.
b

Online now: No Back to the top

Post

Posted
Rating:
#3
Regular
vuott is in the usergroup ‘Regular’
 In my opinion "js0" is interesting.
Is "/dev/input/js0" file-device present ?

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#4
Guru
BruceSteers is in the usergroup ‘Guru’
The gambas IDE does not support joysticks
 :roll:

there has been talk about joysticks on other more relevant forum topics but the IDE does not have any joystick features.
Online now: No Back to the top

Post

Posted
Rating:
#5
Regular
vuott is in the usergroup ‘Regular’
:? A loophole is always possible.

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top

Post

Posted
Rating:
#6
Guru
BruceSteers is in the usergroup ‘Guru’

vuott said

:? A loophole is always possible.

Haha , yep that's true :)
Online now: No Back to the top

Post

Posted
Rating:
#7
Avatar
Regular
Askjerry is in the usergroup ‘Regular’
I find it hard to believe that nobody has any kind of library to allow the use of a joystick… I mean… they are incredibly useful for input.  :shock:

Wait… I just found this… Gambas One - Gambas ONE

I'm going to download that and see if I can figure it out.

Jerry
Online now: No Back to the top

Post

Posted
Rating:
#8
Regular
vuott is in the usergroup ‘Regular’

Askjerry said

Wait… I just found this… Gambas One - Gambas ONE

I'm going to download that and see if I can figure it out.
Jerry,
Joystick.Class, of that code you found, handles exactly the file-device that I had asked you to look at:
   Gambas One - Gambas ONE

However, you need to check in the folder, which contains it, whether it is a protected file-device (as is likely).
If so, you will have to remove the protection with a few lines similar to these:

Code (gambas)

  1. ...etc...
  2.  
  3.  
  4.  pw = InputBox("Enter your system password...")
  5.  
  6.  Shell "echo " & pw & " | sudo -S chmod 444 /dev/input/js0" Wait
  7.  
  8.  ...etc...

Europaeus sum !

<COLOR color="#FF8000">Amare memorentes atque deflentes ad mortem silenter labimur.</COLOR>
Online now: No Back to the top
1 guest and 0 members have just viewed this.