]> git.saurik.com Git - wxWidgets.git/commitdiff
Applied patch [ 1213066 ] correct device names for Joystick in Linux
authorJulian Smart <julian@anthemion.co.uk>
Thu, 2 Jun 2005 08:06:29 +0000 (08:06 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 2 Jun 2005 08:06:29 +0000 (08:06 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@34514 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/unix/joystick.cpp

index 0a32033ee32aad2cf472b190f297db1e44a2ef78..a9c434cbc15e3616a1a31cc76131ee03954dabd9 100644 (file)
@@ -183,10 +183,17 @@ wxJoystick::wxJoystick(int joystick)
 {
     wxString dev_name;
 
 {
     wxString dev_name;
 
-     // Assume it's the same device name on all Linux systems ...
+     // old /dev structure
     dev_name.Printf( wxT("/dev/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);
     m_device = open(dev_name.fn_str(), O_RDONLY);
 
     dev_name.Printf( wxT("/dev/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);
     m_device = open(dev_name.fn_str(), O_RDONLY);
 
+    // new /dev structure with "input" subdirectory
+    if (m_device == -1)
+    {
+        dev_name.Printf( wxT("/dev/input/js%d"), (joystick == wxJOYSTICK1) ? 0 : 1);
+        m_device = open(dev_name.fn_str(), O_RDONLY);             
+    }
+
     if (m_device != -1)
     {
         m_thread = new wxJoystickThread(m_device, m_joystick);
     if (m_device != -1)
     {
         m_thread = new wxJoystickThread(m_device, m_joystick);