Fixed the ROCCAT Tyon mouse showing up as a joystick on Windows
authorSam Lantinga <slouken@libsdl.org>
Wed, 05 Dec 2018 14:46:03 -0800
changeset 1245934266b6e578d
parent 12458 02b76226ee0f
child 12460 5d56e3a2a3e4
Fixed the ROCCAT Tyon mouse showing up as a joystick on Windows
src/joystick/SDL_joystick.c
src/joystick/linux/SDL_sysjoystick.c
     1.1 --- a/src/joystick/SDL_joystick.c	Wed Dec 05 16:55:59 2018 -0500
     1.2 +++ b/src/joystick/SDL_joystick.c	Wed Dec 05 14:46:03 2018 -0800
     1.3 @@ -1347,11 +1347,121 @@
     1.4  
     1.5  SDL_bool SDL_ShouldIgnoreJoystick(const char *name, SDL_JoystickGUID guid)
     1.6  {
     1.7 +    /* This list is taken from:
     1.8 +       https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
     1.9 +     */
    1.10 +    static Uint32 joystick_blacklist[] = {
    1.11 +        /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
    1.12 +        /* Microsoft Wireless Desktop - Comfort Edition */
    1.13 +        MAKE_VIDPID(0x045e, 0x009d),
    1.14 +
    1.15 +        /* Microsoft Microsoft® Digital Media Pro Keyboard */
    1.16 +        /* Microsoft Corp. Digital Media Pro Keyboard */
    1.17 +        MAKE_VIDPID(0x045e, 0x00b0),
    1.18 +
    1.19 +        /* Microsoft Microsoft® Digital Media Keyboard */
    1.20 +        /* Microsoft Corp. Digital Media Keyboard 1.0A */
    1.21 +        MAKE_VIDPID(0x045e, 0x00b4),
    1.22 +
    1.23 +        /* Microsoft Microsoft® Digital Media Keyboard 3000 */
    1.24 +        MAKE_VIDPID(0x045e, 0x0730),
    1.25 +
    1.26 +        /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
    1.27 +        /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
    1.28 +        /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
    1.29 +        /* Microsoft Wireless Mobile Mouse 1000 */
    1.30 +        /* Microsoft Wireless Desktop 3000 */
    1.31 +        MAKE_VIDPID(0x045e, 0x0745),
    1.32 +
    1.33 +        /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
    1.34 +        MAKE_VIDPID(0x045e, 0x0748),
    1.35 +
    1.36 +        /* Microsoft Corp. Wired Keyboard 600 */
    1.37 +        MAKE_VIDPID(0x045e, 0x0750),
    1.38 +
    1.39 +        /* Microsoft Corp. Sidewinder X4 keyboard */
    1.40 +        MAKE_VIDPID(0x045e, 0x0768),
    1.41 +
    1.42 +        /* Microsoft Corp. Arc Touch Mouse Transceiver */
    1.43 +        MAKE_VIDPID(0x045e, 0x0773),
    1.44 +
    1.45 +        /* Microsoft® 2.4GHz Transceiver v9.0 */
    1.46 +        /* Microsoft® Nano Transceiver v2.1 */
    1.47 +        /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
    1.48 +        MAKE_VIDPID(0x045e, 0x07a5),
    1.49 +
    1.50 +        /* Microsoft® Nano Transceiver v1.0 */
    1.51 +        /* Microsoft Wireless Keyboard 800 */
    1.52 +        MAKE_VIDPID(0x045e, 0x07b2),
    1.53 +
    1.54 +        /* Microsoft® Nano Transceiver v2.0 */
    1.55 +        MAKE_VIDPID(0x045e, 0x0800),
    1.56 +
    1.57 +        MAKE_VIDPID(0x046d, 0xc30a),  /* Logitech, Inc. iTouch Composite keboard */
    1.58 +
    1.59 +        MAKE_VIDPID(0x04d9, 0xa0df),  /* Tek Syndicate Mouse (E-Signal USB Gaming Mouse) */
    1.60 +
    1.61 +        /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
    1.62 +        MAKE_VIDPID(0x056a, 0x0010),  /* Wacom ET-0405 Graphire */
    1.63 +        MAKE_VIDPID(0x056a, 0x0011),  /* Wacom ET-0405A Graphire2 (4x5) */
    1.64 +        MAKE_VIDPID(0x056a, 0x0012),  /* Wacom ET-0507A Graphire2 (5x7) */
    1.65 +        MAKE_VIDPID(0x056a, 0x0013),  /* Wacom CTE-430 Graphire3 (4x5) */
    1.66 +        MAKE_VIDPID(0x056a, 0x0014),  /* Wacom CTE-630 Graphire3 (6x8) */
    1.67 +        MAKE_VIDPID(0x056a, 0x0015),  /* Wacom CTE-440 Graphire4 (4x5) */
    1.68 +        MAKE_VIDPID(0x056a, 0x0016),  /* Wacom CTE-640 Graphire4 (6x8) */
    1.69 +        MAKE_VIDPID(0x056a, 0x0017),  /* Wacom CTE-450 Bamboo Fun (4x5) */
    1.70 +        MAKE_VIDPID(0x056a, 0x0018),  /* Wacom CTE-650 Bamboo Fun 6x8 */
    1.71 +        MAKE_VIDPID(0x056a, 0x0019),  /* Wacom CTE-631 Bamboo One */
    1.72 +        MAKE_VIDPID(0x056a, 0x00d1),  /* Wacom Bamboo Pen and Touch CTH-460 */
    1.73 +        MAKE_VIDPID(0x056a, 0x030e),  /* Wacom Intuos Pen (S) CTL-480 */
    1.74 +
    1.75 +        MAKE_VIDPID(0x09da, 0x054f),  /* A4 Tech Co., G7 750 mouse */
    1.76 +        MAKE_VIDPID(0x09da, 0x1410),  /* A4 Tech Co., Ltd Bloody AL9 mouse */
    1.77 +        MAKE_VIDPID(0x09da, 0x3043),  /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
    1.78 +        MAKE_VIDPID(0x09da, 0x31b5),  /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
    1.79 +        MAKE_VIDPID(0x09da, 0x3997),  /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
    1.80 +        MAKE_VIDPID(0x09da, 0x3f8b),  /* A4 Tech Co., Ltd Bloody V8 mouse */
    1.81 +        MAKE_VIDPID(0x09da, 0x51f4),  /* Modecom MC-5006 Keyboard */
    1.82 +        MAKE_VIDPID(0x09da, 0x5589),  /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
    1.83 +        MAKE_VIDPID(0x09da, 0x7b22),  /* A4 Tech Co., Ltd Bloody V5 */
    1.84 +        MAKE_VIDPID(0x09da, 0x7f2d),  /* A4 Tech Co., Ltd Bloody R3 mouse */
    1.85 +        MAKE_VIDPID(0x09da, 0x8090),  /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
    1.86 +        MAKE_VIDPID(0x09da, 0x9033),  /* A4 Tech Co., X7 X-705K */
    1.87 +        MAKE_VIDPID(0x09da, 0x9066),  /* A4 Tech Co., Sharkoon Fireglider Optical */
    1.88 +        MAKE_VIDPID(0x09da, 0x9090),  /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
    1.89 +        MAKE_VIDPID(0x09da, 0x90c0),  /* A4 Tech Co., Ltd X7 G800V keyboard */
    1.90 +        MAKE_VIDPID(0x09da, 0xf012),  /* A4 Tech Co., Ltd Bloody V7 mouse */
    1.91 +        MAKE_VIDPID(0x09da, 0xf32a),  /* A4 Tech Co., Ltd Bloody B540 keyboard */
    1.92 +        MAKE_VIDPID(0x09da, 0xf613),  /* A4 Tech Co., Ltd Bloody V2 mouse */
    1.93 +        MAKE_VIDPID(0x09da, 0xf624),  /* A4 Tech Co., Ltd Bloody B120 Keyboard */
    1.94 +
    1.95 +        MAKE_VIDPID(0x1b1c, 0x1b3c),  /* Corsair Harpoon RGB gaming mouse */
    1.96 +
    1.97 +        MAKE_VIDPID(0x1d57, 0xad03),  /* [T3] 2.4GHz and IR Air Mouse Remote Control */
    1.98 +
    1.99 +        MAKE_VIDPID(0x1e7d, 0x2e4a),  /* Roccat Tyon Mouse */
   1.100 +
   1.101 +        MAKE_VIDPID(0x20a0, 0x422d),  /* Winkeyless.kr Keyboards */
   1.102 +
   1.103 +        MAKE_VIDPID(0x2516, 0x001f),  /* Cooler Master Storm Mizar Mouse */
   1.104 +        MAKE_VIDPID(0x2516, 0x0028),  /* Cooler Master Storm Alcor Mouse */
   1.105 +    };
   1.106 +
   1.107 +    unsigned int i;
   1.108 +    Uint32 id;
   1.109      Uint16 vendor;
   1.110      Uint16 product;
   1.111  
   1.112      SDL_GetJoystickGUIDInfo(guid, &vendor, &product, NULL);
   1.113  
   1.114 +    /* Check the joystick blacklist */
   1.115 +    id = MAKE_VIDPID(vendor, product);
   1.116 +    for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
   1.117 +        if (id == joystick_blacklist[i]) {
   1.118 +            return SDL_TRUE;
   1.119 +        }
   1.120 +    }
   1.121 +
   1.122      if (SDL_IsJoystickPS4(vendor, product) && SDL_IsPS4RemapperRunning()) {
   1.123          return SDL_TRUE;
   1.124      }
     2.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Wed Dec 05 16:55:59 2018 -0500
     2.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Wed Dec 05 14:46:03 2018 -0800
     2.3 @@ -87,100 +87,7 @@
     2.4  static int
     2.5  IsJoystick(int fd, char *namebuf, const size_t namebuflen, SDL_JoystickGUID *guid)
     2.6  {
     2.7 -    /* This list is taken from:
     2.8 -       https://raw.githubusercontent.com/denilsonsa/udev-joystick-blacklist/master/generate_rules.py
     2.9 -     */
    2.10 -    static Uint32 joystick_blacklist[] = {
    2.11 -        /* Microsoft Microsoft Wireless Optical Desktop® 2.10 */
    2.12 -        /* Microsoft Wireless Desktop - Comfort Edition */
    2.13 -        MAKE_VIDPID(0x045e, 0x009d),
    2.14 -
    2.15 -        /* Microsoft Microsoft® Digital Media Pro Keyboard */
    2.16 -        /* Microsoft Corp. Digital Media Pro Keyboard */
    2.17 -        MAKE_VIDPID(0x045e, 0x00b0),
    2.18 -
    2.19 -        /* Microsoft Microsoft® Digital Media Keyboard */
    2.20 -        /* Microsoft Corp. Digital Media Keyboard 1.0A */
    2.21 -        MAKE_VIDPID(0x045e, 0x00b4),
    2.22 -
    2.23 -        /* Microsoft Microsoft® Digital Media Keyboard 3000 */
    2.24 -        MAKE_VIDPID(0x045e, 0x0730),
    2.25 -
    2.26 -        /* Microsoft Microsoft® 2.4GHz Transceiver v6.0 */
    2.27 -        /* Microsoft Microsoft® 2.4GHz Transceiver v8.0 */
    2.28 -        /* Microsoft Corp. Nano Transceiver v1.0 for Bluetooth */
    2.29 -        /* Microsoft Wireless Mobile Mouse 1000 */
    2.30 -        /* Microsoft Wireless Desktop 3000 */
    2.31 -        MAKE_VIDPID(0x045e, 0x0745),
    2.32 -
    2.33 -        /* Microsoft® SideWinder(TM) 2.4GHz Transceiver */
    2.34 -        MAKE_VIDPID(0x045e, 0x0748),
    2.35 -
    2.36 -        /* Microsoft Corp. Wired Keyboard 600 */
    2.37 -        MAKE_VIDPID(0x045e, 0x0750),
    2.38 -
    2.39 -        /* Microsoft Corp. Sidewinder X4 keyboard */
    2.40 -        MAKE_VIDPID(0x045e, 0x0768),
    2.41 -
    2.42 -        /* Microsoft Corp. Arc Touch Mouse Transceiver */
    2.43 -        MAKE_VIDPID(0x045e, 0x0773),
    2.44 -
    2.45 -        /* Microsoft® 2.4GHz Transceiver v9.0 */
    2.46 -        /* Microsoft® Nano Transceiver v2.1 */
    2.47 -        /* Microsoft Sculpt Ergonomic Keyboard (5KV-00001) */
    2.48 -        MAKE_VIDPID(0x045e, 0x07a5),
    2.49 -
    2.50 -        /* Microsoft® Nano Transceiver v1.0 */
    2.51 -        /* Microsoft Wireless Keyboard 800 */
    2.52 -        MAKE_VIDPID(0x045e, 0x07b2),
    2.53 -
    2.54 -        /* Microsoft® Nano Transceiver v2.0 */
    2.55 -        MAKE_VIDPID(0x045e, 0x0800),
    2.56 -
    2.57 -        /* List of Wacom devices at: http://linuxwacom.sourceforge.net/wiki/index.php/Device_IDs */
    2.58 -        MAKE_VIDPID(0x056a, 0x0010),  /* Wacom ET-0405 Graphire */
    2.59 -        MAKE_VIDPID(0x056a, 0x0011),  /* Wacom ET-0405A Graphire2 (4x5) */
    2.60 -        MAKE_VIDPID(0x056a, 0x0012),  /* Wacom ET-0507A Graphire2 (5x7) */
    2.61 -        MAKE_VIDPID(0x056a, 0x0013),  /* Wacom CTE-430 Graphire3 (4x5) */
    2.62 -        MAKE_VIDPID(0x056a, 0x0014),  /* Wacom CTE-630 Graphire3 (6x8) */
    2.63 -        MAKE_VIDPID(0x056a, 0x0015),  /* Wacom CTE-440 Graphire4 (4x5) */
    2.64 -        MAKE_VIDPID(0x056a, 0x0016),  /* Wacom CTE-640 Graphire4 (6x8) */
    2.65 -        MAKE_VIDPID(0x056a, 0x0017),  /* Wacom CTE-450 Bamboo Fun (4x5) */
    2.66 -        MAKE_VIDPID(0x056a, 0x0016),  /* Wacom CTE-640 Graphire 4 6x8 */
    2.67 -        MAKE_VIDPID(0x056a, 0x0017),  /* Wacom CTE-450 Bamboo Fun 4x5 */
    2.68 -        MAKE_VIDPID(0x056a, 0x0018),  /* Wacom CTE-650 Bamboo Fun 6x8 */
    2.69 -        MAKE_VIDPID(0x056a, 0x0019),  /* Wacom CTE-631 Bamboo One */
    2.70 -        MAKE_VIDPID(0x056a, 0x00d1),  /* Wacom Bamboo Pen and Touch CTH-460 */
    2.71 -
    2.72 -        MAKE_VIDPID(0x09da, 0x054f),  /* A4 Tech Co., G7 750 mouse */
    2.73 -        MAKE_VIDPID(0x09da, 0x3043),  /* A4 Tech Co., Ltd Bloody R8A Gaming Mouse */
    2.74 -        MAKE_VIDPID(0x09da, 0x31b5),  /* A4 Tech Co., Ltd Bloody TL80 Terminator Laser Gaming Mouse */
    2.75 -        MAKE_VIDPID(0x09da, 0x3997),  /* A4 Tech Co., Ltd Bloody RT7 Terminator Wireless */
    2.76 -        MAKE_VIDPID(0x09da, 0x3f8b),  /* A4 Tech Co., Ltd Bloody V8 mouse */
    2.77 -        MAKE_VIDPID(0x09da, 0x51f4),  /* Modecom MC-5006 Keyboard */
    2.78 -        MAKE_VIDPID(0x09da, 0x5589),  /* A4 Tech Co., Ltd Terminator TL9 Laser Gaming Mouse */
    2.79 -        MAKE_VIDPID(0x09da, 0x7b22),  /* A4 Tech Co., Ltd Bloody V5 */
    2.80 -        MAKE_VIDPID(0x09da, 0x7f2d),  /* A4 Tech Co., Ltd Bloody R3 mouse */
    2.81 -        MAKE_VIDPID(0x09da, 0x8090),  /* A4 Tech Co., Ltd X-718BK Oscar Optical Gaming Mouse */
    2.82 -        MAKE_VIDPID(0x09da, 0x9066),  /* A4 Tech Co., Sharkoon Fireglider Optical */
    2.83 -        MAKE_VIDPID(0x09da, 0x9090),  /* A4 Tech Co., Ltd XL-730K / XL-750BK / XL-755BK Laser Mouse */
    2.84 -        MAKE_VIDPID(0x09da, 0x90c0),  /* A4 Tech Co., Ltd X7 G800V keyboard */
    2.85 -        MAKE_VIDPID(0x09da, 0xf012),  /* A4 Tech Co., Ltd Bloody V7 mouse */
    2.86 -        MAKE_VIDPID(0x09da, 0xf32a),  /* A4 Tech Co., Ltd Bloody B540 keyboard */
    2.87 -        MAKE_VIDPID(0x09da, 0xf613),  /* A4 Tech Co., Ltd Bloody V2 mouse */
    2.88 -        MAKE_VIDPID(0x09da, 0xf624),  /* A4 Tech Co., Ltd Bloody B120 Keyboard */
    2.89 -
    2.90 -        MAKE_VIDPID(0x1d57, 0xad03),  /* [T3] 2.4GHz and IR Air Mouse Remote Control */
    2.91 -
    2.92 -        MAKE_VIDPID(0x1e7d, 0x2e4a),  /* Roccat Tyon Mouse */
    2.93 -
    2.94 -        MAKE_VIDPID(0x20a0, 0x422d),  /* Winkeyless.kr Keyboards */
    2.95 -
    2.96 -        MAKE_VIDPID(0x2516, 0x001f),  /* Cooler Master Storm Mizar Mouse */
    2.97 -        MAKE_VIDPID(0x2516, 0x0028),  /* Cooler Master Storm Alcor Mouse */
    2.98 -    };
    2.99      struct input_id inpid;
   2.100 -    int i;
   2.101      Uint32 id;
   2.102      Uint16 *guid16 = (Uint16 *)guid->data;
   2.103  
   2.104 @@ -217,14 +124,6 @@
   2.105      }
   2.106  #endif
   2.107  
   2.108 -    /* Check the joystick blacklist */
   2.109 -    id = MAKE_VIDPID(inpid.vendor, inpid.product);
   2.110 -    for (i = 0; i < SDL_arraysize(joystick_blacklist); ++i) {
   2.111 -        if (id == joystick_blacklist[i]) {
   2.112 -            return 0;
   2.113 -        }
   2.114 -    }
   2.115 -
   2.116  #ifdef DEBUG_JOYSTICK
   2.117      printf("Joystick: %s, bustype = %d, vendor = 0x%.4x, product = 0x%.4x, version = %d\n", namebuf, inpid.bustype, inpid.vendor, inpid.product, inpid.version);
   2.118  #endif