Fixed bug where a Logitech wireless keyboard with built-in mouse touchpad didn't get recongized as both devices.
authorSam Lantinga <slouken@libsdl.org>
Sat, 05 Oct 2013 21:15:55 -0700
changeset 778825355ecf10aa
parent 7787 e6f3e8fc96ea
child 7789 a18c12b02b69
Fixed bug where a Logitech wireless keyboard with built-in mouse touchpad didn't get recongized as both devices.
src/core/linux/SDL_udev.c
src/core/linux/SDL_udev.h
src/input/evdev/SDL_evdev.c
src/input/evdev/SDL_evdev.h
src/joystick/linux/SDL_sysjoystick.c
     1.1 --- a/src/core/linux/SDL_udev.c	Sat Oct 05 19:09:03 2013 -0700
     1.2 +++ b/src/core/linux/SDL_udev.c	Sat Oct 05 21:15:55 2013 -0700
     1.3 @@ -279,7 +279,7 @@
     1.4  {
     1.5      const char *subsystem;
     1.6      const char *val = NULL;
     1.7 -    SDL_UDEV_deviceclass devclass = 0;
     1.8 +    int devclass = 0;
     1.9      const char *path;
    1.10      SDL_UDEV_CallbackList *item;
    1.11      
    1.12 @@ -291,32 +291,26 @@
    1.13      subsystem = _this->udev_device_get_subsystem(dev);
    1.14      if (SDL_strcmp(subsystem, "sound") == 0) {
    1.15          devclass = SDL_UDEV_DEVICE_SOUND;
    1.16 -    }
    1.17 -    else if (SDL_strcmp(subsystem, "input") == 0) {
    1.18 +    } else if (SDL_strcmp(subsystem, "input") == 0) {
    1.19          val = _this->udev_device_get_property_value(dev, "ID_INPUT_JOYSTICK");
    1.20          if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
    1.21 -            devclass = SDL_UDEV_DEVICE_JOYSTICK;
    1.22 +            devclass |= SDL_UDEV_DEVICE_JOYSTICK;
    1.23          }
    1.24          
    1.25 -        if (devclass == 0) {
    1.26 -            val = _this->udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
    1.27 -            if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
    1.28 -                devclass = SDL_UDEV_DEVICE_MOUSE;
    1.29 -            }
    1.30 +        val = _this->udev_device_get_property_value(dev, "ID_INPUT_MOUSE");
    1.31 +        if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
    1.32 +            devclass |= SDL_UDEV_DEVICE_MOUSE;
    1.33          }
    1.34 -        
    1.35 -        if (devclass == 0) {
    1.36 -            val = _this->udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
    1.37 -            if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
    1.38 -                devclass = SDL_UDEV_DEVICE_KEYBOARD;
    1.39 -            }
    1.40 +
    1.41 +        val = _this->udev_device_get_property_value(dev, "ID_INPUT_KEYBOARD");
    1.42 +        if (val != NULL && SDL_strcmp(val, "1") == 0 ) {
    1.43 +            devclass |= SDL_UDEV_DEVICE_KEYBOARD;
    1.44          }
    1.45 -        
    1.46 +
    1.47          if (devclass == 0) {
    1.48              return;
    1.49          }
    1.50 -    }
    1.51 -    else {
    1.52 +    } else {
    1.53          return;
    1.54      }
    1.55      
    1.56 @@ -401,4 +395,4 @@
    1.57  }
    1.58  
    1.59  
    1.60 -#endif /* SDL_USE_LIBUDEV */
    1.61 \ No newline at end of file
    1.62 +#endif /* SDL_USE_LIBUDEV */
     2.1 --- a/src/core/linux/SDL_udev.h	Sat Oct 05 19:09:03 2013 -0700
     2.2 +++ b/src/core/linux/SDL_udev.h	Sat Oct 05 21:15:55 2013 -0700
     2.3 @@ -46,15 +46,16 @@
     2.4      SDL_UDEV_DEVICEREMOVED
     2.5  } SDL_UDEV_deviceevent;
     2.6  
     2.7 +/* A device can be any combination of these classes */
     2.8  typedef enum
     2.9  {
    2.10 -    SDL_UDEV_DEVICE_MOUSE = 0x0001,
    2.11 -    SDL_UDEV_DEVICE_KEYBOARD,
    2.12 -    SDL_UDEV_DEVICE_JOYSTICK,
    2.13 -    SDL_UDEV_DEVICE_SOUND
    2.14 +    SDL_UDEV_DEVICE_MOUSE       = 0x0001,
    2.15 +    SDL_UDEV_DEVICE_KEYBOARD    = 0x0002,
    2.16 +    SDL_UDEV_DEVICE_JOYSTICK    = 0x0004,
    2.17 +    SDL_UDEV_DEVICE_SOUND       = 0x0008
    2.18  } SDL_UDEV_deviceclass;
    2.19  
    2.20 -typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, SDL_UDEV_deviceclass udev_class, const char *devpath);
    2.21 +typedef void (*SDL_UDEV_Callback)(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
    2.22  
    2.23  typedef struct SDL_UDEV_CallbackList {
    2.24      SDL_UDEV_Callback callback;
    2.25 @@ -111,4 +112,4 @@
    2.26  
    2.27  #endif /* HAVE_LIBUDEV_H */
    2.28  
    2.29 -#endif /* _SDL_udev_h */
    2.30 \ No newline at end of file
    2.31 +#endif /* _SDL_udev_h */
     3.1 --- a/src/input/evdev/SDL_evdev.c	Sat Oct 05 19:09:03 2013 -0700
     3.2 +++ b/src/input/evdev/SDL_evdev.c	Sat Oct 05 21:15:55 2013 -0700
     3.3 @@ -62,8 +62,8 @@
     3.4  static int SDL_EVDEV_device_removed(const char *devpath);
     3.5  
     3.6  #if SDL_USE_LIBUDEV
     3.7 -static int SDL_EVDEV_device_added(const SDL_UDEV_deviceclass devclass, const char *devpath);
     3.8 -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, SDL_UDEV_deviceclass udev_class, const char *devpath);
     3.9 +static int SDL_EVDEV_device_added(const char *devpath);
    3.10 +void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
    3.11  #endif /* SDL_USE_LIBUDEV */
    3.12  
    3.13  static SDL_Scancode EVDEV_Keycodes[] = {
    3.14 @@ -403,7 +403,6 @@
    3.15          
    3.16          /* We need a physical terminal (not PTS) to be able to translate key code to symbols via the kernel tables */
    3.17          _this->console_fd = SDL_EVDEV_get_console_fd();
    3.18 -
    3.19      }
    3.20      
    3.21      _this->ref_count += 1;
    3.22 @@ -445,43 +444,28 @@
    3.23  }
    3.24  
    3.25  #if SDL_USE_LIBUDEV
    3.26 -void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, SDL_UDEV_deviceclass udev_class, const char *devpath)
    3.27 +void SDL_EVDEV_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
    3.28  {
    3.29 -    SDL_EVDEV_deviceclass devclass;
    3.30 -    
    3.31      if (devpath == NULL) {
    3.32          return;
    3.33      }
    3.34      
    3.35 -    switch( udev_class )
    3.36 -    {
    3.37 -        case SDL_UDEV_DEVICE_MOUSE:
    3.38 -            devclass = SDL_EVDEV_DEVICE_MOUSE;
    3.39 -            break;
    3.40 +    if (!(udev_class & (SDL_UDEV_DEVICE_MOUSE|SDL_UDEV_DEVICE_KEYBOARD))) {
    3.41 +        return;
    3.42 +    }
    3.43 +
    3.44 +    switch( udev_type ) {
    3.45 +    case SDL_UDEV_DEVICEADDED:
    3.46 +        SDL_EVDEV_device_added(devpath);
    3.47 +        break;
    3.48              
    3.49 -        case SDL_UDEV_DEVICE_KEYBOARD:
    3.50 -            devclass = SDL_EVDEV_DEVICE_KEYBOARD;
    3.51 -            break;
    3.52 +    case SDL_UDEV_DEVICEREMOVED:
    3.53 +        SDL_EVDEV_device_removed(devpath);
    3.54 +        break;
    3.55              
    3.56 -        default:
    3.57 -            return;
    3.58 +    default:
    3.59 +        break;
    3.60      }
    3.61 -    
    3.62 -    switch( udev_type )
    3.63 -    {
    3.64 -        case SDL_UDEV_DEVICEADDED:
    3.65 -            SDL_EVDEV_device_added(devclass, devpath);
    3.66 -            break;
    3.67 -            
    3.68 -        case SDL_UDEV_DEVICEREMOVED:
    3.69 -            SDL_EVDEV_device_removed(devpath);
    3.70 -            break;
    3.71 -            
    3.72 -        default:
    3.73 -            break;
    3.74 -            
    3.75 -    }
    3.76 -    
    3.77  }
    3.78  
    3.79  #endif /* SDL_USE_LIBUDEV */
    3.80 @@ -507,137 +491,114 @@
    3.81      SDL_UDEV_Poll();
    3.82  #endif
    3.83  
    3.84 +    mouse = SDL_GetMouse();
    3.85 +
    3.86      for (item = _this->first; item != NULL; item = item->next) {
    3.87          while ((len = read(item->fd, events, (sizeof events))) > 0) {
    3.88              len /= sizeof(events[0]);
    3.89              for (i = 0; i < len; ++i) {
    3.90 -                switch(item->devclass) {
    3.91 -                    case SDL_EVDEV_DEVICE_KEYBOARD:
    3.92 -                        switch (events[i].type) {
    3.93 -                        case EV_KEY:
    3.94 -                            scan_code = SDL_EVDEV_translate_keycode(events[i].code);
    3.95 -                            if (scan_code != SDL_SCANCODE_UNKNOWN) {
    3.96 -                                if (events[i].value == 0) {
    3.97 -                                    SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
    3.98 -                                }
    3.99 -                                else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */ ) {
   3.100 -                                    SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
   3.101 +                switch (events[i].type) {
   3.102 +                case EV_KEY:
   3.103 +                    if (events[i].code >= BTN_MOUSE && events[i].code < BTN_MOUSE + SDL_arraysize(EVDEV_MouseButtons)) {
   3.104 +                        mouse_button = events[i].code - BTN_MOUSE;
   3.105 +                        if (events[i].value == 0) {
   3.106 +                            SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]);
   3.107 +                        } else if (events[i].value == 1) {
   3.108 +                            SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]);
   3.109 +                        }
   3.110 +                        break;
   3.111 +                    }
   3.112 +
   3.113 +                    /* Probably keyboard */
   3.114 +                    scan_code = SDL_EVDEV_translate_keycode(events[i].code);
   3.115 +                    if (scan_code != SDL_SCANCODE_UNKNOWN) {
   3.116 +                        if (events[i].value == 0) {
   3.117 +                            SDL_SendKeyboardKey(SDL_RELEASED, scan_code);
   3.118 +                        } else if (events[i].value == 1 || events[i].value == 2 /* Key repeated */ ) {
   3.119 +                            SDL_SendKeyboardKey(SDL_PRESSED, scan_code);
   3.120  #ifdef SDL_INPUT_LINUXKD
   3.121 -                                    if (_this->console_fd >= 0) {
   3.122 -                                        kbe.kb_index = events[i].code;
   3.123 -                                        /* Convert the key to an UTF-8 char */
   3.124 -                                        /* Ref: http://www.linuxjournal.com/article/2783 */
   3.125 -                                        modstate = SDL_GetModState();
   3.126 -                                        kbe.kb_table = 0;
   3.127 -                                        
   3.128 -                                        /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */
   3.129 -                                        kbe.kb_table |= -( (modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
   3.130 -                                        kbe.kb_table |= -( (modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
   3.131 -                                        kbe.kb_table |= -( (modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
   3.132 -                                        kbe.kb_table |= -( (modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
   3.133 -                                        kbe.kb_table |= -( (modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
   3.134 -                                        kbe.kb_table |= -( (modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
   3.135 +                            if (_this->console_fd >= 0) {
   3.136 +                                kbe.kb_index = events[i].code;
   3.137 +                                /* Convert the key to an UTF-8 char */
   3.138 +                                /* Ref: http://www.linuxjournal.com/article/2783 */
   3.139 +                                modstate = SDL_GetModState();
   3.140 +                                kbe.kb_table = 0;
   3.141 +                                
   3.142 +                                /* Ref: http://graphics.stanford.edu/~seander/bithacks.html#ConditionalSetOrClearBitsWithoutBranching */
   3.143 +                                kbe.kb_table |= -( (modstate & KMOD_LCTRL) != 0) & (1 << KG_CTRLL | 1 << KG_CTRL);
   3.144 +                                kbe.kb_table |= -( (modstate & KMOD_RCTRL) != 0) & (1 << KG_CTRLR | 1 << KG_CTRL);
   3.145 +                                kbe.kb_table |= -( (modstate & KMOD_LSHIFT) != 0) & (1 << KG_SHIFTL | 1 << KG_SHIFT);
   3.146 +                                kbe.kb_table |= -( (modstate & KMOD_RSHIFT) != 0) & (1 << KG_SHIFTR | 1 << KG_SHIFT);
   3.147 +                                kbe.kb_table |= -( (modstate & KMOD_LALT) != 0) & (1 << KG_ALT);
   3.148 +                                kbe.kb_table |= -( (modstate & KMOD_RALT) != 0) & (1 << KG_ALTGR);
   3.149  
   3.150 -                                        if(ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && 
   3.151 -                                            ( (KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER) )) 
   3.152 -                                        {
   3.153 -                                            kval = KVAL(kbe.kb_value);
   3.154 -                                            
   3.155 -                                            /* While there's a KG_CAPSSHIFT symbol, it's not useful to build the table index with it
   3.156 -                                             * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table 
   3.157 -                                             * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale!
   3.158 -                                             */
   3.159 -                                            if ( modstate & KMOD_CAPS && isalpha(kval) ) {
   3.160 -                                                if ( isupper(kval) ) {
   3.161 -                                                    kval = tolower(kval);
   3.162 -                                                }
   3.163 -                                                else {
   3.164 -                                                    kval = toupper(kval);
   3.165 -                                                }
   3.166 -                                            }
   3.167 -                                             
   3.168 -                                            /* Convert to UTF-8 and send */
   3.169 -                                            end = SDL_UCS4ToUTF8( kval, keysym);
   3.170 -                                            *end = '\0';
   3.171 -                                            SDL_SendKeyboardText(keysym);
   3.172 +                                if (ioctl(_this->console_fd, KDGKBENT, (unsigned long)&kbe) == 0 && 
   3.173 +                                    ((KTYP(kbe.kb_value) == KT_LATIN) || (KTYP(kbe.kb_value) == KT_ASCII) || (KTYP(kbe.kb_value) == KT_LETTER))) 
   3.174 +                                {
   3.175 +                                    kval = KVAL(kbe.kb_value);
   3.176 +                                    
   3.177 +                                    /* While there's a KG_CAPSSHIFT symbol, it's not useful to build the table index with it
   3.178 +                                     * because 1 << KG_CAPSSHIFT overflows the 8 bits of kb_table 
   3.179 +                                     * So, we do the CAPS LOCK logic here. Note that isalpha depends on the locale!
   3.180 +                                     */
   3.181 +                                    if ( modstate & KMOD_CAPS && isalpha(kval) ) {
   3.182 +                                        if ( isupper(kval) ) {
   3.183 +                                            kval = tolower(kval);
   3.184 +                                        } else {
   3.185 +                                            kval = toupper(kval);
   3.186                                          }
   3.187                                      }
   3.188 -#endif    
   3.189 +                                     
   3.190 +                                    /* Convert to UTF-8 and send */
   3.191 +                                    end = SDL_UCS4ToUTF8( kval, keysym);
   3.192 +                                    *end = '\0';
   3.193 +                                    SDL_SendKeyboardText(keysym);
   3.194                                  }
   3.195                              }
   3.196 -                                break;
   3.197 -
   3.198 -                            default:
   3.199 -                                break;
   3.200 +#endif /* SDL_INPUT_LINUXKD */
   3.201                          }
   3.202 -                        break; /* SDL_EVDEV_DEVICE_KEYBOARD */
   3.203 -                        
   3.204 -                    case SDL_EVDEV_DEVICE_MOUSE:
   3.205 -                        mouse = SDL_GetMouse();
   3.206 -                        switch (events[i].type) {
   3.207 -                            case EV_KEY:
   3.208 -                                mouse_button = events[i].code - BTN_MOUSE;
   3.209 -                                if (mouse_button >= 0 && mouse_button < SDL_arraysize(EVDEV_MouseButtons)) {
   3.210 -                                    if (events[i].value == 0) {
   3.211 -                                        SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_RELEASED, EVDEV_MouseButtons[mouse_button]);
   3.212 -                                    }
   3.213 -                                    else if (events[i].value == 1) {
   3.214 -                                        SDL_SendMouseButton(mouse->focus, mouse->mouseID, SDL_PRESSED, EVDEV_MouseButtons[mouse_button]);
   3.215 -                                    } 
   3.216 -                                }
   3.217 -                                break;
   3.218 -                            case EV_ABS:
   3.219 -                                 switch(events[i].code) {
   3.220 -                                    case ABS_X:
   3.221 -                                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y);
   3.222 -                                        break;
   3.223 -                                    case ABS_Y:
   3.224 -                                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value);
   3.225 -                                        break;
   3.226 -                                    default:
   3.227 -                                        break;
   3.228 -                                 }
   3.229 -                                break;
   3.230 -                            case EV_REL:
   3.231 -                                switch(events[i].code) {
   3.232 -                                    case REL_X:
   3.233 -                                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0);
   3.234 -                                        break;
   3.235 -                                    case REL_Y:
   3.236 -                                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value);
   3.237 -                                        break;
   3.238 -                                    case REL_WHEEL:
   3.239 -                                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value);
   3.240 -                                        break;
   3.241 -                                    case REL_HWHEEL:
   3.242 -                                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0);
   3.243 -                                        break;
   3.244 -                                    default:
   3.245 -                                        break;
   3.246 -                                }
   3.247 -                                break;
   3.248 -                            default:
   3.249 -                                break;
   3.250 -                        }
   3.251 -                        break; /* SDL_EVDEV_DEVICE_MOUSE */                    
   3.252 -
   3.253 +                    }
   3.254 +                    break;
   3.255 +                case EV_ABS:
   3.256 +                    switch(events[i].code) {
   3.257 +                    case ABS_X:
   3.258 +                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, events[i].value, mouse->y);
   3.259 +                        break;
   3.260 +                    case ABS_Y:
   3.261 +                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_FALSE, mouse->x, events[i].value);
   3.262 +                        break;
   3.263                      default:
   3.264                          break;
   3.265 +                    }
   3.266 +                    break;
   3.267 +                case EV_REL:
   3.268 +                    switch(events[i].code) {
   3.269 +                    case REL_X:
   3.270 +                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, events[i].value, 0);
   3.271 +                        break;
   3.272 +                    case REL_Y:
   3.273 +                        SDL_SendMouseMotion(mouse->focus, mouse->mouseID, SDL_TRUE, 0, events[i].value);
   3.274 +                        break;
   3.275 +                    case REL_WHEEL:
   3.276 +                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, 0, events[i].value);
   3.277 +                        break;
   3.278 +                    case REL_HWHEEL:
   3.279 +                        SDL_SendMouseWheel(mouse->focus, mouse->mouseID, events[i].value, 0);
   3.280 +                        break;
   3.281 +                    default:
   3.282 +                        break;
   3.283 +                    }
   3.284 +                    break;
   3.285 +                case EV_SYN:
   3.286 +                    switch (events[i].code) {
   3.287 +                    case SYN_DROPPED:
   3.288 +                        SDL_EVDEV_sync_device(item);
   3.289 +                        break;
   3.290 +                    default:
   3.291 +                        break;
   3.292 +                    }
   3.293 +                    break;
   3.294                  }
   3.295 -                
   3.296 -                
   3.297 -                /* Handle events not specific to any type of device */
   3.298 -                switch (events[i].type) {
   3.299 -                    case EV_SYN:
   3.300 -                        switch (events[i].code) {
   3.301 -                        case SYN_DROPPED :
   3.302 -                            SDL_EVDEV_sync_device(item);
   3.303 -                            break;
   3.304 -                        default:
   3.305 -                            break;
   3.306 -                        }
   3.307 -                }
   3.308 -            
   3.309              }
   3.310          }    
   3.311      }
   3.312 @@ -665,7 +626,7 @@
   3.313  
   3.314  #if SDL_USE_LIBUDEV
   3.315  static int
   3.316 -SDL_EVDEV_device_added(const SDL_UDEV_deviceclass devclass, const char *devpath)
   3.317 +SDL_EVDEV_device_added(const char *devpath)
   3.318  {
   3.319      SDL_evdevlist_item *item;
   3.320  
   3.321 @@ -681,9 +642,6 @@
   3.322          return SDL_OutOfMemory();
   3.323      }
   3.324  
   3.325 -    item->devclass = devclass;
   3.326 -    
   3.327 -   
   3.328      item->fd = open(devpath, O_RDONLY, 0);
   3.329      if (item->fd < 0) {
   3.330          SDL_free(item);
     4.1 --- a/src/input/evdev/SDL_evdev.h	Sat Oct 05 19:09:03 2013 -0700
     4.2 +++ b/src/input/evdev/SDL_evdev.h	Sat Oct 05 21:15:55 2013 -0700
     4.3 @@ -29,17 +29,10 @@
     4.4  #include "SDL_events.h"
     4.5  #include <sys/stat.h>
     4.6  
     4.7 -typedef enum
     4.8 -{
     4.9 -    SDL_EVDEV_DEVICE_MOUSE = 0x0001,
    4.10 -    SDL_EVDEV_DEVICE_KEYBOARD
    4.11 -} SDL_EVDEV_deviceclass;
    4.12 -
    4.13  typedef struct SDL_evdevlist_item
    4.14  {
    4.15      char *path;
    4.16      int fd;
    4.17 -    SDL_EVDEV_deviceclass devclass;
    4.18      struct SDL_evdevlist_item *next;
    4.19  } SDL_evdevlist_item;
    4.20  
     5.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Sat Oct 05 19:09:03 2013 -0700
     5.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Sat Oct 05 21:15:55 2013 -0700
     5.3 @@ -57,7 +57,7 @@
     5.4  static int MaybeAddDevice(const char *path);
     5.5  #if SDL_USE_LIBUDEV
     5.6  static int MaybeRemoveDevice(const char *path);
     5.7 -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, SDL_UDEV_deviceclass udev_class, const char *devpath);
     5.8 +void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath);
     5.9  #endif /* SDL_USE_LIBUDEV */
    5.10  
    5.11  
    5.12 @@ -136,11 +136,11 @@
    5.13  }
    5.14  
    5.15  #if SDL_USE_LIBUDEV
    5.16 -void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, SDL_UDEV_deviceclass udev_class, const char *devpath)
    5.17 +void joystick_udev_callback(SDL_UDEV_deviceevent udev_type, int udev_class, const char *devpath)
    5.18  {
    5.19      int instance;
    5.20      
    5.21 -    if (devpath == NULL || udev_class != SDL_UDEV_DEVICE_JOYSTICK) {
    5.22 +    if (devpath == NULL || !(udev_class & SDL_UDEV_DEVICE_JOYSTICK)) {
    5.23          return;
    5.24      }
    5.25