shithub: choc

Download patch

ref: a8a7ea27319ababa65d7753cc1aec3f37e955d4b
parent: c88aa553db9d97d1da182dba05e69cfbd7c8511f
author: Jonathan Dowland <jon+github@alcopop.org>
date: Mon Jun 27 13:13:23 EDT 2016

setup: Fixes for SFC30 on Linux systems

The SFC30 joystick presents different names depending on mode (two
bluetooth modes and one USB) and platform (different names for the
same modes on Linux and OS X).  Use glob-matching to catch them all.

Bizzarely, with bluetooth mode on Linux the gamepad presents 16 buttons.
Add another joystick_config_t element so that it is detected properly in
this situation.

--- a/src/setup/joystick.c
+++ b/src/setup/joystick.c
@@ -454,19 +454,27 @@
         nes30_pro_controller,
     },
 
-    // 8Bitdo SFC30 SNES replica controller in bluetooth controller mode
-    // (hold R + Start on power on)
+    // 8Bitdo SFC30 SNES replica controller
+    // in default mode and in controller mode (Start+R)
+    // the latter suffixes "Joystick" to the name
     // http://www.8bitdo.com/sfc30/
     {
-        "8Bitdo SFC30 GamePad Joystick",
+        "8Bitdo SFC30 GamePad*",
         4, 16, 1,
         sfc30_controller,
     },
 
+    // As above, but as detected on RHEL Linux (odd extra axes)
+    {
+        "8Bitdo SFC30 GamePad*",
+        6, 16, 1,
+        sfc30_controller,
+    },
+
     // SNES30 colour variation of the above
     // http://www.8bitdo.com/snes30/
     {
-        "8Bitdo SNES30 GamePad Joystick",
+        "8Bitdo SNES30 GamePad*",
         4, 16, 1,
         sfc30_controller,
     },
@@ -474,9 +482,12 @@
     // 8Bitdo SFC30 SNES replica controller in USB controller mode
     // tested with firmware V2.68 (Beta); latest stable V2.65 doesn't work on
     // OS X in USB controller mode
+    // Names seen so far:
+    //     'SFC30 Joystick' (OS X)
+    //     'SFC30              SFC30 Joystick' (Fedora 24; RHEL7)
     // XXX: there is probably a SNES30 variant of this too
     {
-        "SFC30 Joystick",
+        "SFC30 *",
         4, 12, 1,
         sfc30_controller,
     },