The data type used for identifying key/butt press

look at my signature.

But yea, I am using 2.6.3 kernel. I have also had problems with the 2.6.1 kernel as well.

Can you give me a list of what you have plugged in, and what interfaces they use (ps2/usb/gameport etc), and also the output of this

whoami ; groups  ; ls -la /dev/input

Thanks

Endolf

Devices:
Mouse = Microsoft intelimouse - usb
Keyboard = PS2 (generic)
Joystick = Saitek X45 - usb


mspeth@fmp mspeth $ whoami ; groups ; ls -la /dev/input
mspeth
users wheel audio games
total 0
drwxr-xr-x    1 root     root            0 Jan  1  1970 .
drwxr-xr-x    1 root     root            0 Jan  1  1970 ..
crw-r--r--    1 root     root      13,   0 Jan  1  1970 js0
crw-r--r--    1 root     root      13,  63 Jan  1  1970 mice
crw-r--r--    1 root     root      13,  32 Jan  1  1970 mouse0

BTW, I can use the X45 in other games like BF1942 (using wine).

Thanks

Hi
Thanks, as root, can you do a chmod o+rw /dev/input/* and try again?, also, you don’t have the event system in your kernel (option CONFIG_INPUT_EVDEV in the .config file for your kernel)
or from the kernel config tool

Device Drivers -> Input device support -> Event interface

if it’s a module then you need to load it, i’ve built it in on my test machine, but have tried it as a module before.

HTH

Jeremy

Hey. Ok I recompiled the kernel with the event interface turned on.

Now the keyboard and mouse are getting read but the joystick is not I think (a window comes up for the joystick but nothing is in it).


mspeth@fmp coreAPI $ whoami ; groups ; ls -la /dev/input
mspeth
users wheel audio games
total 0
drwxr-xr-x    1 root     root            0 Jan  1  1970 .
drwxr-xr-x    1 root     root            0 Jan  1  1970 ..
crw-r--rw-    1 root     root      13,  64 Jan  1  1970 event0
crw-r--rw-    1 root     root      13,  65 Jan  1  1970 event1
crw-r--r--    1 root     root      13,  66 Jan  1  1970 event2
crw-r--r--    1 root     root      13,   0 Jan  1  1970 js0
crw-r--rw-    1 root     root      13,  63 Jan  1  1970 mice
crw-r--rw-    1 root     root      13,  32 Jan  1  1970 mouse0

What do u guys think?

Hi
I think that js0 and event2 are the joystick, and they are both read only. :slight_smile:

HTH

Endolf

Yep, thats it. Why do u need write access on those devices?

Hi
To send messages to the devices (like for force feedback and some of the other diagnositics/setup information) it needs to be writeable (else you can’t write the message :)). I think that some devices could be opened read only, queried, and then work out if I need write access, but for now it (and when I was developing it) having write access as well didn’t seem like an issue.
I did want to print an error message when it failed to open a devices, so that it was obvious where the error was, but some distributions include a whole list of device files regardless of wether they exist or not, jinput will try and open them, so you would always get error messages there that it couldn’t open the device, I might put this back in though.

Cheers

Endolf

@endolf: You asked my for some code regarding the topic of finding the right controller. Well lets have a look at this. It is currently used to find my gamepad.


private Controller getStick(Controller[] controllers) {
        for(int i=0;i<controllers.length;i++) {
            Controller.Type type = controllers[i].getType();
            if(type.equals(Controller.Type.GAMEPAD) ||
            type.equals(Controller.Type.STICK) ||
            type.equals(Controller.Type.UNKNOWN)) {
                return controllers[i];
            }
        }
        
        return null;
    }

This all looks logical until “type.equals(Controller.Type.UNKNOWN))”. The problem is that under Linux no device identifies itself as a gamepad or stick with the corresponding Controller.Type instance. If I leave the last check out the gamepad is not found in Linux (but this works in Windows :frowning: ).

Another bad thing: In another thread I have shown you that my PC speaker is now a Controller as well and is now recognized by this method. Very bad because I wanted a pad or joystick-like device :’(

This is the first thing I want to see corrected.

Regarding the primary problem of this thread (identify used Axis at runtime, save something into a config file, find the Axis which was described in the config file) I would propose generating something like a unique identifier. This identifier should include device name and manufacturer.
In Linux I think it would be a good idea to include the name of the device filename as well because this makes the identifier truly unique.

With that information it would be very easy what to save to a config file:

  • controller id
  • [subcontroller index]
  • axis index
  • extend value
  • game event

When the game is started and no controller is found with a corresponding identifier the game would know that it should be careful using another device because subcontroller and/or axis may not exist any more. Auto sensing them again would solve that easily.

Other platforms should be able to follow that to: In Windows you can use DirectInput’s device type and the order in which DInput gives you the device.

So what do you think about that?

Hi
I know it’s been a while since you posted this, but I am working on it. Currently I have some sigsegv’s under linux, which I think is due to my logitec keyboard which has two sub controllers, one for the main qwerty bit, and one for the mouse wheel, the volume controls etc etc, hopefully I can get this resolved soon and get back to you.

Cheers

Endolf

Ok
Issues 25 and 26 have been sorted now, and I can confirm I see the same thing, I will have a look at the code that guesses the device type at some point and see if I can get it playing nicely. Can you give me the output from

ant texttest

so that I can see what values your devices have and compare those with mine and see if I can come up with some new guessing rules.

Thanks

Endolf

Ok, I still want the output from that test, but I found a bug, and have updated CVS, the jinput bug can be tracked/modified from here.

Thanks

Endolf

[quote]1)
@endolf: You asked my for some code regarding the topic of finding the right controller. Well lets have a look at this. It is currently used to find my gamepad.

This all looks logical until “type.equals(Controller.Type.UNKNOWN))”. The problem is that under Linux no device identifies itself as a gamepad or stick with the corresponding Controller.Type instance. If I leave the last check out the gamepad is not found in Linux (but this works in Windows :frowning: ).
[/quote]
issue 27 should fix this.

[quote]Another bad thing: In another thread I have shown you that my PC speaker is now a Controller as well and is now recognized by this method. Very bad because I wanted a pad or joystick-like device :’(

This is the first thing I want to see corrected.
[/quote]
you should now be able to remove the UNKNOWN check from that list and get sticks and gamepads.

[quote]2)
Regarding the primary problem of this thread (identify used Axis at runtime, save something into a config file, find the Axis which was described in the config file) I would propose generating something like a unique identifier. This identifier should include device name and manufacturer. So what do you think about that?
[/quote]
Hows about the string from getName, and the order it appears in the controllers array. Then you can get the axis id and use those. The problem with this is that under linux especially (I don’t know about windows), if I boot my system, then plug in some devices, they appear in /dev/input in the order they were plugged in, however, on reboot, they appear in the order of the USB ports and allowing for USB hub drivers to load, so the order may be very different. Using any kind of index or native deviceID from jinput will cause this, the only thing you can be sure is the same is the name and type (for the same jinput binaries).

HTH

Endolf

it works! thank you!

Here the texttest output of the new plugins: (only gamepad and mouse)

Mega World
Type: gamepad
Axis Count: 18
Axis 0: X axis
Identifier: x
AxisType: Absolute Analog
Axis 1: Y axis
Identifier: y
AxisType: Absolute Analog
Axis 2: Button 0
Identifier: Button 0
AxisType: Absolute Digital
Axis 3: Button 1
Identifier: Button 1
AxisType: Absolute Digital
Axis 4: Button 2
Identifier: Button 2
AxisType: Absolute Digital
Axis 5: Button 3
Identifier: Button 3
AxisType: Absolute Digital
Axis 6: Button A
Identifier: Button A
AxisType: Absolute Digital
Axis 7: Button B
Identifier: Button B
AxisType: Absolute Digital
Axis 8: Button C
Identifier: Button C
AxisType: Absolute Digital
Axis 9: Button X
Identifier: Button X
AxisType: Absolute Digital
Axis 10: Button Y
Identifier: Button Y
AxisType: Absolute Digital
Axis 11: Button Z
Identifier: Button Z
AxisType: Absolute Digital
Axis 12: Thumb Left Button
Identifier: Thumb Left Button
AxisType: Absolute Digital
Axis 13: Thumb Right Button
Identifier: Thumb Right Button
AxisType: Absolute Digital
Axis 14: Second Thumb Left Button
Identifier: Second Thumb Left Button
AxisType: Absolute Digital
Axis 15: Second Thumb Right Button
Identifier: Second Thumb Right Button
AxisType: Absolute Digital
Axis 16: Select Button
Identifier: Select Button
AxisType: Absolute Digital
Axis 17: Uknown button
Identifier: Uknown button
AxisType: Absolute Digital

Microsoft Microsoft IntelliMouse® Optical
Type: mouse
Axis Count: 0

[quote]it works! thank you!
[/quote]
Your welcome. I’m glad your gamepad is found as one, it’s up to the driver what they call the buttons, my gamepad has it’s native button IDs different to your so it gets detected as a stick, however, the name of mine contains the text ‘Gamepad’. Can you guess how I got mine to be detected as a gamepad in the ‘guess what type of controller this is’ code? ;D

Endolf

No need to guess because I know how the Linux plugin guesses itself :slight_smile:

Sorry but I was curious of how the plugins actually work. Its a shame that you are forced to guess the device type that way.

I found my ‘PC speaker’ is incorrectly identified as a stick. Maybe thats because it has no axes. What about throwing away all zero-axis controllers?

What about overriding the kernel’s name scheme (at least for non-keyboards)?

Whenever you identify a certain type of axis you increase an id and name it: + id

This will have the following result:

.
.
.

Axis 16: Button 10
Identifier: Button 10
AxisType: Absolute Digital

Axis 17: Button 11
Identifier: Button 11
AxisType: Absolute Digital

[quote]I found my ‘PC speaker’ is incorrectly identified as a stick. Maybe thats because it has no axes. What about throwing away all zero-axis controllers?
[/quote]
what, no keyboards? :slight_smile:

Endolf

well Axis is used for keys and buttons. Maybe put this after getSupportedButtons() in LinuxDevice.guessType():



        // without any buttons this device is and should be reported as of
        // unknown type
        if(numButtons == 0) {
            // nothing is needed to be set, because guessType is already set to unknown
            return;
        }


– EDIT: had to use numButtons …

Hi
What I was going to do was either add a 0 check for each characteristic if statement, or add another one that sees if they are all 0, as I suspect that in the case of the speaker they are all 0 :slight_smile:

Endolf