QGamePad disconnect on Ubuntu



  • Re: QGamePad - Does not detect disconnection - Linux

    I have working away trying to make my Qt application deal with a gamepad disconnect, and have not succeeded after many hours of trying coding changes, web searching, etc.

    The basic problem appears to be that when my application starts, it makes an instance of QGamePadManager, and queries for the list of attached devices. That list never changes, even if I remove my gamepad, delete the object that contains the QGamePadManager, and create a new one. It seems like the evdev list never refreshes.

    This is crippling to my application, since I am trying to control a remotely operated underwater vehicle, and I need to detect a disconnection of the xbox controller that I am using for an operator interface. I can detect the disconnect by monitoring /dev/input/js0--if it disappears, my controller has disconnected--but I cannot figure out how to reconnect the device.

    Is there a way to explicitly get the QtGamePadManager to reread the list of connected devices? Is this component fatally flawed? This apparent bug has been reported for years, with no apparent action to fix it.


  • Lifetime Qt Champion

    Hi,

    What bug are you referring to ?




  • Lifetime Qt Champion

    When you connect and disconnect the gamepad, does its device name change ?



  • no. It stays /dev/input/js0. After I figured out that none of theQGamePadManager signals were emitted upon connect or disconnect, I began monitoring the existence of /dev/input/js0. When I disconnected the gamepad, and /dev/input/js0 went away, (after zeroing the thrusters on my vehicle...) I tried destroying and recreating my joystick component, which contained an instance of QGamePadManager. The list returned from QGamePadManager is identical to what was there before--but the QGamePad that I extract from it looks just like the one that I had before disconnection, and when I query it for axis positions, etc, I get zeroes.



  • @SGaist in the event that you meant the name reported by the QGamePad component--that comes back as "" (an empty QString) no matter what



  • @jhowland

    @jhowland said in QGamePad disconnect on Ubuntu:

    I have working away trying to make my Qt application deal with a gamepad disconnect, and have not succeeded after many hours of trying coding changes, web searching, etc.
    The basic problem appears to be that when my application starts, it makes an instance of QGamePadManager, and queries for the list of attached devices. That list never changes, even if I remove my gamepad, delete the object that contains the QGamePadManager, and create a new one. It seems like the evdev list never refreshes.
    This is crippling to my application, since I am trying to control a remotely operated underwater vehicle, and I need to detect a disconnection of the xbox controller that I am using for an operator interface. I can detect the disconnect by monitoring /dev/input/js0--if it disappears, my controller has disconnected--but I cannot figure out how to reconnect the device.
    Is there a way to explicitly get the QtGamePadManager to reread the list of connected devices? Is this component fatally flawed? This apparent bug has been reported for years, with no apparent action to fix it.

    what is the kind of this bug ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.