title: Pi Zero and Microsoft X-Box 360 pad : INFO: Failed to poll device: Failed to get device key states (9)
body: <p>I've an issue with a Microsoft X-Box 360 pad on a Raspberry PI zero. I've written a Java program to control servo's via a Microsoft X-Box 360 pad. I use the jinput library.
  The issue is that after around 10 seconds, sometimes earlier, something stops working and I cannot get any data from the pad anymore. To get data I need to restart he program, but then it fails again after a couple of seconds.
  When I stop the program I see:</p>
  <pre><code>Jan 03, 2022 5:58:15 PM net.java.games.input.ControllerEnvironment log
  INFO: Failed to poll device: Failed to get device key states (9)
  </code></pre>
  <p>When I try the code on windows, I've no problem.</p>
  <p>This is the code I use. I use version 2.0.9 of jinput.</p>
  <pre><code>import net.java.games.input.*;
  import org.apache.log4j.Level;
  import org.apache.log4j.Logger;
  import java.util.Arrays;
  import java.util.Optional;
  
      @Override
      public void run() {
          log.info(&quot;Start game controller service &quot;+gamepad.getName());
          Event event = new Event();
          while(isRunning){
              if(gamepad.poll()){
                  EventQueue eventQueue = gamepad.getEventQueue();
                  while(eventQueue.getNextEvent(event)){
                      processEvent(event);
                  }
                  log.debug(&quot;Poll data &quot;+gamepad.getComponent(Component.Identifier.Axis.X).getPollData());
              }
              else{
                  log.error(&quot;Controller in not longer valid&quot;);
              }
  
              try {
                  Thread.sleep(pollTime);
              } catch (InterruptedException e) {
                  e.printStackTrace();
              }
          }
  
          log.info(&quot;Gamecontroller stopped&quot;);
      }
  </code></pre>
  <p>Has anyone the same issue? And how was it solved?</p>