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

Questions and info about the Gambas IDE itself and not what you are making with it.
(not bug reports)
Post Reply
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

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

Post by Askjerry »

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: Select all

~$ less /proc/bus/input/devices
It will return something like

Code: Select all

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
User avatar
thatbruce
Posts: 168
Joined: Saturday 4th September 2021 11:29pm

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by thatbruce »

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
Have you ever noticed that software is never advertised using the adjective "spreadable".
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by vuott »

In my opinion "js0" is interesting.
Is "/dev/input/js0" file-device present ?
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by BruceSteers »

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.
If at first you don't succeed , try doing something differently.
BruceS
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by vuott »

:? A loophole is always possible.
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
User avatar
BruceSteers
Posts: 1578
Joined: Thursday 23rd July 2020 5:20pm
Location: Isle of Wight
Contact:

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by BruceSteers »

vuott wrote: Monday 27th November 2023 3:10pm :? A loophole is always possible.
Haha , yep that's true :)
If at first you don't succeed , try doing something differently.
BruceS
User avatar
Askjerry
Posts: 64
Joined: Saturday 18th August 2018 9:06pm
Location: Kyle, Texas, USA
Contact:

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by Askjerry »

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... https://forum.gambas.one/viewtopic.php?p=5475

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

Jerry
vuott
Posts: 263
Joined: Wednesday 5th April 2017 6:07pm
Location: European Union

Re: Gambas -> USB -> DragonRise USB Joystick -> Use

Post by vuott »

Askjerry wrote: Wednesday 29th November 2023 12:03amWait... I just found this... https://forum.gambas.one/viewtopic.php?p=5475

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:
https://forum.gambas.one/viewtopic.php?p=7805#p7805

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:
...etc...

 Dim pw as String

 pw = InputBox("Enter your system password...")

 Shell "echo " & pw & " | sudo -S chmod 444 /dev/input/js0" Wait

 ...etc...
Europaeus sum !

Amare memorentes atque deflentes ad mortem silenter labimur.
Post Reply