Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (539)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (603)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  java.lang.ClassCastException: net.java.games.input.LinuxMouse  (Read 1432 times)
0 Members and 1 Guest are viewing this topic.
Offline jospr

Junior Newbie





« Posted 2008-04-09 12:52:45 »

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.<init>(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.<init>(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 <a href=http://www.home.unix-ag.org/simon/files/spacenavi.c>spacenavi.c</a> 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 <a href=http://www.home.unix-ag.org/simon/files/spacenavi.c>spacenavi.c</a> Program :

...
          case EV_REL:
          case EV_ABS:
            if (event.code <= REL_RZ)
              axes[event.code - REL_X] = event.value;
            break;
...


Offline endolf

JGO Coder


Medals: 7
Exp: 15 years


Current project release date: sometime in 3003


« Reply #1 - Posted 2008-04-09 23:32:07 »

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

Offline jospr

Junior Newbie





« Reply #2 - Posted 2008-04-10 08:20:00 »

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]$
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (32 views)
2014-12-15 09:26:44

Mr.CodeIt (23 views)
2014-12-14 19:50:38

BurntPizza (50 views)
2014-12-09 22:41:13

BurntPizza (84 views)
2014-12-08 04:46:31

JscottyBieshaar (45 views)
2014-12-05 12:39:02

SHC (59 views)
2014-12-03 16:27:13

CopyableCougar4 (57 views)
2014-11-29 21:32:03

toopeicgaming1999 (123 views)
2014-11-26 15:22:04

toopeicgaming1999 (114 views)
2014-11-26 15:20:36

toopeicgaming1999 (32 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!