[Gambas-user] Gambas class to read a joystick

Benoit Minisini gambas at ...1...
Mon Mar 3 00:00:49 CET 2008


On dimanche 2 mars 2008, Rob wrote:
> Someone on linuxbasic.net asked for a way to read a joystick in
> Gambas.  I couldn't find anything in the SDL component for that
> purpose, so I wrote a minimal class that reads from the raw device,
> parses the data into something useful, and throws events.  I wrote a
> program to demonstrate it as well.
>
> To make it work, I had to EXEC ["cat", device] instead of just OPEN
> device FOR READ WATCH.  Gambas told me "System error: Invalid
> argument" every time the File_Read event fired and I tried to read
> from the file handle, even though the example makes it look like it
> works with device nodes.  

Having no joystick, I opened "/dev/input/mouse0" with FOR READ WATCH, the Read 
event is fired when I move the mouse, and I don't get such an error. So this 
is strange... Where do you get the error exactly?

-- 
Benoit Minisini




More information about the User mailing list