java.lang.ClassCastException: net.java.games.input.LinuxMouse

Hello,

I want to use my spacemouse XT (RS 232) with JInput. I work on Linux and Eclipse Europa. I have made various tests, but in the end the following message appears when I execute the Java program :

`Loading: net.java.games.input.LinuxEnvironmentPlugin
Failed to open device (/dev/input/event1): Failed to open device /dev/input/event1 (13)

Failed to open device (/dev/input/event0): Failed to open device /dev/input/event0 (13)

java.lang.ClassCastException: net.java.games.input.LinuxMouse
at net.java.games.input.LinuxEnvironmentPlugin.enumerateControllers(LinuxEnvironmentPlugin.java:257)
at net.java.games.input.LinuxEnvironmentPlugin.(LinuxEnvironmentPlugin.java:113)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Constructor.java:494)
at java.lang.Class.newInstance0(Class.java:350)
at java.lang.Class.newInstance(Class.java:303)
at net.java.games.input.DefaultControllerEnvironment.getControllers(DefaultControllerEnvironment.java:157)
at TestJinput.(TestJinput.java:10)
at Lanceur.main(Lanceur.java:5)
`

My Java program :
`
//source : http://www.java-gaming.org/forums/index.php?topic=16866.0

import net.java.games.input.Controller;
import net.java.games.input.ControllerEnvironment;

public class TestJinput {
public TestJinput() {
ControllerEnvironment ce =
ControllerEnvironment.getDefaultEnvironment();
Controller[] ca = ce.getControllers();
}
}
`

My configuration :

`
[root@client ~]# modprobe magellan
[root@client ~]# inputattach -mag /dev/ttyS0

[toto@client ~]$ cat /proc/bus/input/devices

I: Bus=0013 Vendor=001a Product=0001 Version=0100
N: Name=“LogiCad3D Magellan / SpaceMouse”
P: Phys=ttyS0/serio0/input0
S: Sysfs=/class/input/input2
H: Handlers=event2 js0
B: EV=b
B: KEY=1ff 0 0 0 0 0 0 0 0
B: ABS=3f

[toto@client ~]$ ls -l /dev/input/
total 0
drwxr-xr-x 2 root root 120 avr 9 13:51 by-path/
crw------- 1 root root 13, 64 avr 9 2008 event0
crw------- 1 root root 13, 65 avr 9 2008 event1
crw------- 1 toto root 13, 66 avr 9 13:51 event2
crw------- 1 toto root 13, 0 avr 9 13:51 js0
crw-r–r-- 1 root root 13, 63 avr 9 2008 mice
crw-r–r-- 1 root root 13, 32 avr 9 2008 mouse0
crw------- 1 root root 13, 128 avr 9 2008 ts0
`

The test with the spacenavi.c Program :
`
[toto@client ~]$ ./spacenavi /dev/input/event2
found “LogiCad3D Magellan / SpaceMouse” on /dev/input/event2
Supported event types:
Event type 0x00 (Sync?)
Event type 0x01 (Keys or Buttons)
Event type 0x03 (Absolute Axes)
detected leds:

State: 19 -86 0 79 73 41 - off off
`

I had to add the following line in the spacenavi.c Program :
... case EV_REL: case EV_ABS: if (event.code <= REL_RZ) axes[event.code - REL_X] = event.value; break; ...

Hi

I’m away for the weekend, so I can’t look at this till tuesday, can you confirm you are using the latest build from jinput.dev.java.net?

Cheers

Endolf

Hi,

Yes, I think it is the latest version :

`
[toto@client disk]$ ls -l /usr/local/src/jinput_combined_dist_latest.zip
-rwxr-xr-x 1 root root 321321 avr 8 17:56 /usr/local/src/jinput_combined_dist_latest.zip*

[toto@client disk]$ ls -l /usr/local/jinput
total 519
-rw-r–r-- 1 root root 73728 déc 7 23:15 jinput-dx8.dll
-rw-r–r-- 1 root root 214605 déc 7 23:15 jinput.jar
-rw-r–r-- 1 root root 69632 déc 7 23:15 jinput-raw.dll
-rw-r–r-- 1 root root 21028 nov 13 21:33 jinput-test.jar
-rw-r–r-- 1 root root 69632 déc 7 23:15 jinput-wintab.dll
-rwxr-xr-x 1 root root 13179 avr 8 20:47 jutils.jar*
-rw-r–r-- 1 root root 11352 jan 9 21:00 libjinput-linux.so
-rw-r–r-- 1 root root 49016 oct 29 2006 libjinput-osx.jnilib
[toto@client disk]$
`