Java-Gaming.org    
Featured games (79)
games approved by the League of Dukes
Games in Showcase (477)
Games in Android Showcase (107)
games submitted by our members
Games in WIP (536)
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  
  JInput ERROR : Failed to poll device: Failed to get device key states (9)  (Read 4625 times)
0 Members and 1 Guest are viewing this topic.
Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Posted 2009-06-20 16:28:51 »

Hello!

My computer has "twin usb joysticks", thats two gamepads on one usb2 connector.
I keep receiving the following error from JInput.

Failed to poll device: Failed to get device key states (9)

Im on a demo run with "ReadAllEvents" source.
My Gamepad 1 stops being operative with JInput usually when polling all components.

everything works about 3 sec or to 30 sec then the gamepad 1 fails permanently and i need to restart my JInput program.

//----

Thanks,,
Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Reply #1 - Posted 2009-06-20 19:00:02 »

 Cool

I have no school history for Java or computers.
Im planning to use JOGL + JNLPAPPLETLAUNCHER + JINPUT with my Java game projects to amuse my friends.

The JOGL is the only library i ever added with Java,
the JOGL comes as a Netbeans plugin so it has always have been very easy to add to Netbeans.

Now when i have an attempt to add JINPUT to JOGL Applet, i need help.
Could someone please inform me how to add both JINPUT and JOGL to JNLPAPPLETLAUNCHER Applet.

I have two problems ->

(1) I seem not to have permission to use JINPUT from my JNLPLauncher ??
(2) I dont know how to set java.library.path when there is JOGL included on Netbeans 6.5.1 project, i only
receive jinput not on java.library.path. I think that JOGL takes the library.path, how to set one path for both.

I have Linux Ubuntu 9.04 OS + Netbeans 6.5.1 + JOGL Plugin + JInput.

//----

Thanks,,
Offline bienator

Senior Member




OutOfCoffeeException


« Reply #2 - Posted 2009-06-20 20:38:23 »

Hi,
Quote
I dont know how to set java.library.path when there is JOGL included on Netbeans 6.5.1 project
lets say you want to run your jinput/jogl project from within your IDE (not webstart).
-Just open the run configuration (the combo box on the toolbar on top of NetBeans) and choose 'Customize'.
-select the 'Run' item in the tree.
-Now you can enter additional vm arguments in the 'VM Arguments' textfield Wink
e.g -java.library.path="lib/jinput"

(you can add more run configurations to the same project just hit new and give them a name...)

Quote
Now when i have an attempt to add JINPUT to JOGL Applet, i need help.
I don't know if there is a public server or jnlp extension available which hosts jinput for you (maybe someone else can help here). In worst case you will have to host jinput on your own server.

lets say you are using a jogl project template from the OpenGL Pack and already successfully enabled webstart support in project properties.
-you should find a file called 'master-application.jnlp' in your project folder -> open it
-add     
1  
<jar href="jinput.jar"/>
somewhere between <resources> and </resources>
-add:
1  
2  
3  
4  
5  
6  
7  
8  
9  
  <resources os="Windows" arch="x86_64 x86">
    <nativelib href="jinput-windows-native.jar"/>
  </resources>
  <resources os="Linux" arch="i386 ia64 x84_64">
    <nativelib href="jinput-linux-native.jar"/>
  </resources>
  <resources os="Mac OS">
    <nativelib href="jinput-osx-native.jar"/>
  </resources>

somewhere after the </resources> tag which is already there by default.

after a rebuild your project should be ready for webstart/applet deployment, at least on java 6u10 or later.

hope that helps.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #3 - Posted 2009-06-20 23:43:36 »

The first question.

This sounds very much a linux/hardware issue to me, I don't have access to many devices, so I go on what the API suggests. You could try getting the JInput source and doing some extra debugging for us. Does the device work in X? I'm guessing you have turned off the auto enable features for the device in your x config?

What does the text test show?, does it show the right device(s) with the right features?

Endolf

Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Reply #4 - Posted 2009-06-21 09:37:07 »

Quote
The first question.

This sounds very much a linux/hardware issue to me, I don't have access to many devices, so I go on what the API suggests. You could try getting the JInput source and doing some extra debugging for us. Does the device work in X? I'm guessing you have turned off the auto enable features for the device in your x config?

What does the text test show?, does it show the right device(s) with the right features?

Endolf

Hei!

Right device names are for sure, i dont know for buttons, their a bit strange,
i dont have button1 button2 button3 and so on, i have BASE, PINKIE, THUMB, TOP, TRIGGER,
and for directions my stick has "x , y , z , rz".

I have graphics display on, on my Ubuntu 9.04 desktop, with OpenGL support.

Im not very experienced Linux dude, i dont know about "auto enable features".

//----

Thanks,,
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #5 - Posted 2009-06-21 10:48:57 »

Hi

Can you copy the output from text test for the relevant devices?, you mention that it's 2 gamepads, do both show up  right?

Endolf

Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Reply #6 - Posted 2009-06-21 11:32:49 »

Hi

Can you copy the output from text test for the relevant devices?, you mention that it's 2 gamepads, do both show up  right?

Endolf

Here you go!

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
128  
129  
130  
131  
132  
133  
134  
135  
136  
137  
138  
139  
140  
141  
142  
143  
144  
145  
146  
147  
148  
149  
150  
151  
152  
153  
154  
155  
156  
157  
158  
159  
160  
161  
162  
163  
164  
165  
166  
167  
168  
169  
170  
171  
172  
173  
174  
175  
176  
177  
178  
179  
180  
181  
182  
183  
184  
185  
186  
187  
188  
189  
190  
191  
192  
193  
194  
195  
196  
197  
198  
199  
200  
201  
202  
203  
204  
205  
206  
207  
208  
209  
210  
211  
212  
213  
214  
215  
216  
217  
218  
219  
220  
221  
222  
223  
224  
225  
226  
run:
Controller Env = net.java.games.input.DefaultControllerEnvironment@42e816
Loading: net.java.games.input.LinuxEnvironmentPlugin
Failed to open device (/dev/input/event9): Failed to open device /dev/input/event9 (13)

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

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

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

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

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)

Failed to open device (/dev/input/js1): Failed to get button map (22)

Failed to open device (/dev/input/js0): Failed to get button map (22)

Linux plugin claims to have found 5 controllers
A4Tech PS/2+USB Mouse
Type: Mouse
Component Count: 13
Component 0: Left
    Identifier: Left
    ComponentType: Absolute Digital
Component 1: Right
    Identifier: Right
    ComponentType: Absolute Digital
Component 2: Middle
    Identifier: Middle
    ComponentType: Absolute Digital
Component 3: Side
    Identifier: Side
    ComponentType: Absolute Digital
Component 4: Extra
    Identifier: Extra
    ComponentType: Absolute Digital
Component 5: Forward
    Identifier: Forward
    ComponentType: Absolute Digital
Component 6: Back
    Identifier: Back
    ComponentType: Absolute Digital
Component 7: Unknown
    Identifier: Unknown
    ComponentType: Absolute Digital
Component 8: x
    Identifier: x
    ComponentType: Relative Analog
Component 9: y
    Identifier: y
    ComponentType: Relative Analog
Component 10: slider
    Identifier: slider
    ComponentType: Relative Analog
Component 11: z
    Identifier: z
    ComponentType: Relative Analog
Component 12: slider
    Identifier: slider
    ComponentType: Relative Analog
---------------------------------
ImExPS/2 Generic Explorer Mouse
Type: Mouse
Component Count: 9
Component 0: Left
    Identifier: Left
    ComponentType: Absolute Digital
Component 1: Right
    Identifier: Right
    ComponentType: Absolute Digital
Component 2: Middle
    Identifier: Middle
    ComponentType: Absolute Digital
Component 3: Side
    Identifier: Side
    ComponentType: Absolute Digital
Component 4: Extra
    Identifier: Extra
    ComponentType: Absolute Digital
Component 5: x
    Identifier: x
    ComponentType: Relative Analog
Component 6: y
    Identifier: y
    ComponentType: Relative Analog
Component 7: slider
    Identifier: slider
    ComponentType: Relative Analog
Component 8: z
    Identifier: z
    ComponentType: Relative Analog
---------------------------------
Twin USB Joystick
Type: Stick
Component Count: 17
Component 0: Trigger
    Identifier: Trigger
    ComponentType: Absolute Digital
Component 1: Thumb
    Identifier: Thumb
    ComponentType: Absolute Digital
Component 2: Thumb 2
    Identifier: Thumb 2
    ComponentType: Absolute Digital
Component 3: Top
    Identifier: Top
    ComponentType: Absolute Digital
Component 4: Top 2
    Identifier: Top 2
    ComponentType: Absolute Digital
Component 5: Pinkie
    Identifier: Pinkie
    ComponentType: Absolute Digital
Component 6: Base
    Identifier: Base
    ComponentType: Absolute Digital
Component 7: Base 2
    Identifier: Base 2
    ComponentType: Absolute Digital
Component 8: Base 3
    Identifier: Base 3
    ComponentType: Absolute Digital
Component 9: Base 4
    Identifier: Base 4
    ComponentType: Absolute Digital
Component 10: Base 5
    Identifier: Base 5
    ComponentType: Absolute Digital
Component 11: Base 6
    Identifier: Base 6
    ComponentType: Absolute Digital
Component 12: x
    Identifier: x
    ComponentType: Absolute Analog
Component 13: y
    Identifier: y
    ComponentType: Absolute Analog
Component 14: z
    Identifier: z
    ComponentType: Absolute Analog
Component 15: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 16: pov
    Identifier: pov
    ComponentType: Absolute Digital
---------------------------------
Twin USB Joystick
Type: Stick
Component Count: 17
Component 0: Trigger
    Identifier: Trigger
    ComponentType: Absolute Digital
Component 1: Thumb
    Identifier: Thumb
    ComponentType: Absolute Digital
Component 2: Thumb 2
    Identifier: Thumb 2
    ComponentType: Absolute Digital
Component 3: Top
    Identifier: Top
    ComponentType: Absolute Digital
Component 4: Top 2
    Identifier: Top 2
    ComponentType: Absolute Digital
Component 5: Pinkie
    Identifier: Pinkie
    ComponentType: Absolute Digital
Component 6: Base
    Identifier: Base
    ComponentType: Absolute Digital
Component 7: Base 2
    Identifier: Base 2
    ComponentType: Absolute Digital
Component 8: Base 3
    Identifier: Base 3
    ComponentType: Absolute Digital
Component 9: Base 4
    Identifier: Base 4
    ComponentType: Absolute Digital
Component 10: Base 5
    Identifier: Base 5
    ComponentType: Absolute Digital
Component 11: Base 6
    Identifier: Base 6
    ComponentType: Absolute Digital
Component 12: x
    Identifier: x
    ComponentType: Absolute Analog
Component 13: y
    Identifier: y
    ComponentType: Absolute Analog
Component 14: z
    Identifier: z
    ComponentType: Absolute Analog
Component 15: rz
    Identifier: rz
    ComponentType: Absolute Analog
Component 16: pov
    Identifier: pov
    ComponentType: Absolute Digital
---------------------------------
Macintosh mouse button emulation
Type: Mouse
Component Count: 5
Component 0: Left
    Identifier: Left
    ComponentType: Absolute Digital
Component 1: Right
    Identifier: Right
    ComponentType: Absolute Digital
Component 2: Middle
    Identifier: Middle
    ComponentType: Absolute Digital
Component 3: x
    Identifier: x
    ComponentType: Relative Analog
Component 4: y
    Identifier: y
    ComponentType: Relative Analog
---------------------------------
BUILD SUCCESSFUL (total time: 0 seconds)


Everything is allways found Smiley
---
I now have modified the "readallevents",.
This next code still gives the error, but unlike on "readallevents"
i can still have succes with a use of both sticks. ( they both are found as a sticks,
even if they are gamepads )
 
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
 public void gamepads ( )
  {
        Controller[] controllers = ControllerEnvironment.getDefaultEnvironment().getControllers();

        for (int i = 0; i < controllers.length; i++)
            {
                    controllers[i].poll();
                    net.java.games.input.EventQueue queue = controllers[i].getEventQueue();

                    Event event = new Event();

                    while (queue.getNextEvent(event))
                    {
                        Component comp = event.getComponent();
                     
                        if ( ( controllers[i].getType()==Controller.Type.STICK ) && ( comp.getName()=="x") ) leri = event.getValue();
                        if ( ( controllers[i].getType()==Controller.Type.STICK ) && ( comp.getName()=="y") ) updo = -event.getValue();

                        System.out.println( comp.getName());
                        System.out.println( event.getValue());
                    }
          }
  }


//----

Thanks,,
Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Reply #7 - Posted 2009-07-05 07:34:17 »

Hello!

I still every 8th - 20th run on my applet, receive this Failed to get device key states (9).
My code is completely updated and completely different than previously.

Still, sometimes my second gamepad is not enabled, why is this ??
Is there a known bugs with JINPUT ??

my code ->

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
       Controller [] controller = new Controller [10];
-------------
        try
        {
            Controllers.create();
            for ( int aa=0; aa<10; ++aa )
                controller [aa] = Controllers.getController (aa);
        } catch(Exception e)
        {
            System.err.println("GamePad create fail.");
        }
-------------
    public void _GamePads ()
    {        
        if(controller[0]!=null)
        {
            leri  = -controller[0].getXAxisValue();
            leri2 = -controller[0].getRZAxisValue();
        }
        for ( int aa=1;aa<10; ++aa)
            if(controller[aa]!=null)
            {
                leri3 = -controller[aa].getXAxisValue();
                leri4 = -controller[aa].getRZAxisValue();
            }
    }
}
-------------
Controllers.destroy();


Is there any programming errors on my simple code ??

Hmpf, Do i have an hardware failure ?? or is this error common with JInput ??

//----

Thanks,,
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #8 - Posted 2009-07-05 12:36:05 »

when using applets with natives, do make sure you use the
1  
<param name="separate_jvm" value="true">

tag inside the applet tag, it avoids many problems that can happen with natives + same vm.
Offline NewOnJava

Junior Member




1970 born Java game hobbyer.


« Reply #9 - Posted 2009-07-05 13:34:21 »

when using applets with natives, do make sure you use the
1  
<param name="separate_jvm" value="true">

tag inside the applet tag, it avoids many problems that can happen with natives + same vm.

Hello!

Here is my current applet tag, is there anything i should add or remove ??

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
 <applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar, lzma.jar, kuvat.jar" codebase="." width="98%" height="98%">
 
    <!-- The following tags are mandatory -->
   
    <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
    <param name="al_title" value="Empty Screen">
   
    <!-- Main Applet Class -->
    <param name="al_main" value="test004.Main">
   
    <!-- logo to paint while loading, will be centered -->
    <param name="al_logo" value="appletlogo2.png">
   
    <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
    <param name="al_progressbar" value="appletprogress3.gif">
   
    <!-- List of Jars to add to classpath -->
    <param name="al_jars" value="IlmojeinPilotit_00001.jar lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, res.jar.lzma">
   
    <!-- signed windows natives jar in a jar -->
    <param name="al_windows" value="windows_natives.jar.lzma">
   
    <!-- signed linux natives jar in a jar -->
    <param name="al_linux" value="linux_natives.jar.lzma">
   
    <!-- signed mac osx natives jar in a jar -->
    <param name="al_mac" value="macosx_natives.jar.lzma">

    <!-- signed solaris natives jar in a jar -->
    <param name="al_solaris" value="solaris_natives.jar.lzma">
   
    <!-- Tags under here are optional -->
   
    <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
    <!-- <param name="al_version" value="0.1"> -->
   
    <!-- background color to paint with, defaults to white -->
    <!-- <param name="al_bgcolor" value="000000"> -->
   
    <!-- foreground color to paint with, defaults to black -->
    <!-- <param name="al_fgcolor" value="ffffff"> -->
   
    <!-- error color to paint with, defaults to red -->
    <!-- <param name="al_errorcolor" value="ff0000"> -->
   
    <!-- whether to run in debug mode -->
    <!-- <param name="al_debug" value="true"> -->  
   
    <!-- whether to prepend host to cache path - defaults to true -->
    <param name="al_prepend_host" value="false">    
    <param name="separate_jvm" value="true">
  </applet>


//----

Thanks,,
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 74
Projects: 15


★★★★★


« Reply #10 - Posted 2009-07-05 13:49:55 »

The applet tag looks fine.

However best to leave al_prepend_host parameter as true or commented out, unless you have a special need for it, only then change it to false.

btw does adding separate_jvm parameter fix the jinput issue?
Offline endolf

JGO Coder


Medals: 7


Current project release date: sometime in 3003


« Reply #11 - Posted 2009-07-05 16:57:11 »

Aaah, so it's not every run that it fails?, in that case, I would suspect that either a process has the event device file open (program didn't finish nicely), or the device driver is funny or something, but JInput shouldn't be behaving differently on different runs.

Endolf

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.

Riven (14 views)
2014-07-29 18:09:19

Riven (10 views)
2014-07-29 18:08:52

Dwinin (10 views)
2014-07-29 10:59:34

E.R. Fleming (28 views)
2014-07-29 03:07:13

E.R. Fleming (10 views)
2014-07-29 03:06:25

pw (40 views)
2014-07-24 01:59:36

Riven (39 views)
2014-07-23 21:16:32

Riven (27 views)
2014-07-23 21:07:15

Riven (28 views)
2014-07-23 20:56:16

ctomni231 (59 views)
2014-07-18 06:55:21
HotSpot Options
by dleskov
2014-07-08 03:59:08

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:58:24

Java and Game Development Tutorials
by SwordsMiner
2014-06-14 00:47:22

How do I start Java Game Development?
by ra4king
2014-05-17 11:13:37

HotSpot Options
by Roquen
2014-05-15 09:59:54

HotSpot Options
by Roquen
2014-05-06 15:03:10

Escape Analysis
by Roquen
2014-04-29 22:16:43

Experimental Toys
by Roquen
2014-04-28 13:24:22
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!