[Gambas-user] gb.joystick (and Where is my gbh3?)

Cedron Dawg cedron at exede.net
Mon Feb 25 19:35:53 CET 2019


In my original testing, instead of going to the "/dev/input/by-id" directory,  I tried opening the "/dev/input/event##" files directly in a loop.  There are two problems with this approach.  First, without doing a directory read, I have no way of know the number to scan.  Not a big deal, just pick a big number, but that's sloppy.  Second, and this is significant, only the joystick/gamepad devices were successfully opened.

My preference would be to have a specific gamepad/joystick component.  I think this would be easier for newbies to find and use rather than having to find a subset of a more generic model.  The function call names could also then be more descriptive.

I've started looking at gb.* component code.   Besides Tobi's c_joystick.c program, are there any component modules Gambas/C that you feel would be particularly good for me to study?

Between you, me, and Tobi, and perhaps anybody else, where do we go from here?

===================================================

If it's more generic, and it's the offical way of dealing with inputs 
libevdev seems a better choice.

I think then that the best solution is doing a "gb.input" (or something 
like that) component with:

- A part written in C that implements all needed utilities functions 
based on libevdev.

- A part written in Gambas that implements the actual public interface 
in a clean, easy and beautiful way. This interface will make the 
difference between a joystick, a keyboard, a mouse, etc. so that the 
user does not have to handle the evdev way of seeing devices.

Note: yes, a component can have both a C and a gambas part.

Regards,

-- 
Benoît Minisini

----[ Gambas mailing-list is hosted by https://www.hostsharing.net ]----


More information about the User mailing list