From 3b6f0d81859fff20ae4e728fc2c4de18fa1a8b29 Mon Sep 17 00:00:00 2001
From: Ingo Ruhnke <grumbel@gmx.de>
Date: Sat, 11 Dec 2010 01:49:21 +0100
Subject: [PATCH] Add more dummy events to make not only the kernel, but also
 SDL happy (not a great fix, as some games might get confused)

---
 src/linux_uinput.cpp | 25 ++++++++++++++-----------
 1 file changed, 14 insertions(+), 11 deletions(-)

diff --git a/src/linux_uinput.cpp b/src/linux_uinput.cpp
index 2446b45..54a7c9f 100644
--- a/src/linux_uinput.cpp
+++ b/src/linux_uinput.cpp
@@ -199,18 +199,21 @@ LinuxUinput::finish()
       break;
 
     case kJoystickDevice:
-      if (!key_lst[BTN_JOYSTICK] &&
-          !key_lst[BTN_GAMEPAD] &&
-          !key_lst[BTN_TRIGGER_HAPPY] &&
-          
-          !abs_lst[ABS_THROTTLE] &&
-          !abs_lst[ABS_WHEEL] &&
-          !abs_lst[ABS_X])
+      // FIXME: the kernel and SDL have different rules for joystick
+      // detection, so this is more a hack then a proper solution
+      if (!key_lst[BTN_A])
       {
-        // using BTN_TRIGGER_HAPPY instead of more common BTN_JOYSTICK
-        // as it should end up as last joystick button instead of
-        // first
-        add_key(BTN_TRIGGER_HAPPY);
+        add_key(BTN_A);
+      }
+
+      if (!abs_lst[ABS_X])
+      {
+        add_abs(ABS_X, -1, 1, 0, 0);
+      }
+
+      if (!abs_lst[ABS_Y])
+      {
+        add_abs(ABS_Y, -1, 1, 0, 0);
       }
       break;
   }