Removed the "logical" Linux joystick code.
authorRyan C. Gordon
Mon, 10 Dec 2012 15:50:42 -0500
changeset 67280f8336c1f6d9
parent 6727 1b5280cd5885
child 6729 fdaeea9e7567
Removed the "logical" Linux joystick code.

It's been forcibly disabled since 2009, since the kernel apparently splits
these devices for us now, and apparently the code was crashing at the time
(see hg changeset 11c079bb52a8).

Also, it was a ton of messy #ifdefs in this file!
src/joystick/linux/SDL_sysjoystick.c
     1.1 --- a/src/joystick/linux/SDL_sysjoystick.c	Sun Dec 09 17:56:19 2012 -0800
     1.2 +++ b/src/joystick/linux/SDL_sysjoystick.c	Mon Dec 10 15:50:42 2012 -0500
     1.3 @@ -59,215 +59,6 @@
     1.4      "Saitek Saitek X45", 6, 1, 0}
     1.5  };
     1.6  
     1.7 -/* It looks like newer kernels have the logical mapping at the driver level */
     1.8 -#define NO_LOGICAL_JOYSTICKS
     1.9 -
    1.10 -#ifndef NO_LOGICAL_JOYSTICKS
    1.11 -
    1.12 -/*
    1.13 -   Some USB HIDs show up as a single joystick even though they actually
    1.14 -   control 2 or more joysticks.
    1.15 -*/
    1.16 -/*
    1.17 -   This code handles the MP-8800 (Quad) and MP-8866 (Dual), which can
    1.18 -   be identified by their transparent blue design. It's quite trivial
    1.19 -   to add other joysticks with similar quirky behavior.
    1.20 -   -id
    1.21 -*/
    1.22 -
    1.23 -struct joystick_logical_mapping
    1.24 -{
    1.25 -    int njoy;
    1.26 -    int nthing;
    1.27 -};
    1.28 -
    1.29 -/*
    1.30 -   {logical joy, logical axis},
    1.31 -   {logical joy, logical hat},
    1.32 -   {logical joy, logical ball},
    1.33 -   {logical joy, logical button}
    1.34 -*/
    1.35 -
    1.36 -static struct joystick_logical_mapping mp88xx_1_logical_axismap[] = {
    1.37 -    {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}
    1.38 -};
    1.39 -
    1.40 -static struct joystick_logical_mapping mp88xx_1_logical_buttonmap[] = {
    1.41 -    {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8},
    1.42 -    {0, 9}, {0, 10}, {0, 11}
    1.43 -};
    1.44 -
    1.45 -static struct joystick_logical_mapping mp88xx_2_logical_axismap[] = {
    1.46 -    {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {0, 3},
    1.47 -    {1, 2}, {1, 3}, {0, 4}, {0, 5}, {1, 4}, {1, 5}
    1.48 -};
    1.49 -
    1.50 -static struct joystick_logical_mapping mp88xx_2_logical_buttonmap[] = {
    1.51 -    {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8},
    1.52 -    {0, 9}, {0, 10}, {0, 11},
    1.53 -    {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8},
    1.54 -    {1, 9}, {1, 10}, {1, 11}
    1.55 -};
    1.56 -
    1.57 -static struct joystick_logical_mapping mp88xx_3_logical_axismap[] = {
    1.58 -    {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {0, 3},
    1.59 -    {1, 2}, {1, 3}, {2, 0}, {2, 1}, {2, 2}, {2, 3},
    1.60 -    {0, 4}, {0, 5}, {1, 4}, {1, 5}, {2, 4}, {2, 5}
    1.61 -};
    1.62 -
    1.63 -static struct joystick_logical_mapping mp88xx_3_logical_buttonmap[] = {
    1.64 -    {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8},
    1.65 -    {0, 9}, {0, 10}, {0, 11},
    1.66 -    {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8},
    1.67 -    {1, 9}, {1, 10}, {1, 11},
    1.68 -    {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {2, 8},
    1.69 -    {2, 9}, {2, 10}, {2, 11}
    1.70 -};
    1.71 -
    1.72 -static struct joystick_logical_mapping mp88xx_4_logical_axismap[] = {
    1.73 -    {0, 0}, {0, 1}, {0, 2}, {1, 0}, {1, 1}, {0, 3},
    1.74 -    {1, 2}, {1, 3}, {2, 0}, {2, 1}, {2, 2}, {2, 3},
    1.75 -    {3, 0}, {3, 1}, {3, 2}, {3, 3}, {0, 4}, {0, 5},
    1.76 -    {1, 4}, {1, 5}, {2, 4}, {2, 5}, {3, 4}, {3, 5}
    1.77 -};
    1.78 -
    1.79 -static struct joystick_logical_mapping mp88xx_4_logical_buttonmap[] = {
    1.80 -    {0, 0}, {0, 1}, {0, 2}, {0, 3}, {0, 4}, {0, 5}, {0, 6}, {0, 7}, {0, 8},
    1.81 -    {0, 9}, {0, 10}, {0, 11},
    1.82 -    {1, 0}, {1, 1}, {1, 2}, {1, 3}, {1, 4}, {1, 5}, {1, 6}, {1, 7}, {1, 8},
    1.83 -    {1, 9}, {1, 10}, {1, 11},
    1.84 -    {2, 0}, {2, 1}, {2, 2}, {2, 3}, {2, 4}, {2, 5}, {2, 6}, {2, 7}, {2, 8},
    1.85 -    {2, 9}, {2, 10}, {2, 11},
    1.86 -    {3, 0}, {3, 1}, {3, 2}, {3, 3}, {3, 4}, {3, 5}, {3, 6}, {3, 7}, {3, 8},
    1.87 -    {3, 9}, {3, 10}, {3, 11}
    1.88 -};
    1.89 -
    1.90 -struct joystick_logical_layout
    1.91 -{
    1.92 -    int naxes;
    1.93 -    int nhats;
    1.94 -    int nballs;
    1.95 -    int nbuttons;
    1.96 -};
    1.97 -
    1.98 -static struct joystick_logical_layout mp88xx_1_logical_layout[] = {
    1.99 -    {6, 0, 0, 12}
   1.100 -};
   1.101 -
   1.102 -static struct joystick_logical_layout mp88xx_2_logical_layout[] = {
   1.103 -    {6, 0, 0, 12},
   1.104 -    {6, 0, 0, 12}
   1.105 -};
   1.106 -
   1.107 -static struct joystick_logical_layout mp88xx_3_logical_layout[] = {
   1.108 -    {6, 0, 0, 12},
   1.109 -    {6, 0, 0, 12},
   1.110 -    {6, 0, 0, 12}
   1.111 -};
   1.112 -
   1.113 -static struct joystick_logical_layout mp88xx_4_logical_layout[] = {
   1.114 -    {6, 0, 0, 12},
   1.115 -    {6, 0, 0, 12},
   1.116 -    {6, 0, 0, 12},
   1.117 -    {6, 0, 0, 12}
   1.118 -};
   1.119 -
   1.120 -/*
   1.121 -   This array sets up a means of mapping a single physical joystick to
   1.122 -   multiple logical joysticks. (djm)
   1.123 -                                                                                
   1.124 -   njoys
   1.125 -        the number of logical joysticks
   1.126 -                                                                                
   1.127 -   layouts
   1.128 -        an array of layout structures, one to describe each logical joystick
   1.129 -                                                                                
   1.130 -   axes, hats, balls, buttons
   1.131 -        arrays that map a physical thingy to a logical thingy
   1.132 - */
   1.133 -struct joystick_logicalmap
   1.134 -{
   1.135 -    const char *name;
   1.136 -    int nbuttons;
   1.137 -    int njoys;
   1.138 -    struct joystick_logical_layout *layout;
   1.139 -    struct joystick_logical_mapping *axismap;
   1.140 -    struct joystick_logical_mapping *hatmap;
   1.141 -    struct joystick_logical_mapping *ballmap;
   1.142 -    struct joystick_logical_mapping *buttonmap;
   1.143 -};
   1.144 -
   1.145 -static struct joystick_logicalmap joystick_logicalmap[] = {
   1.146 -    {
   1.147 -     "WiseGroup.,Ltd MP-8866 Dual USB Joypad",
   1.148 -     12,
   1.149 -     1,
   1.150 -     mp88xx_1_logical_layout,
   1.151 -     mp88xx_1_logical_axismap,
   1.152 -     NULL,
   1.153 -     NULL,
   1.154 -     mp88xx_1_logical_buttonmap},
   1.155 -    {
   1.156 -     "WiseGroup.,Ltd MP-8866 Dual USB Joypad",
   1.157 -     24,
   1.158 -     2,
   1.159 -     mp88xx_2_logical_layout,
   1.160 -     mp88xx_2_logical_axismap,
   1.161 -     NULL,
   1.162 -     NULL,
   1.163 -     mp88xx_2_logical_buttonmap},
   1.164 -    {
   1.165 -     "WiseGroup.,Ltd MP-8800 Quad USB Joypad",
   1.166 -     12,
   1.167 -     1,
   1.168 -     mp88xx_1_logical_layout,
   1.169 -     mp88xx_1_logical_axismap,
   1.170 -     NULL,
   1.171 -     NULL,
   1.172 -     mp88xx_1_logical_buttonmap},
   1.173 -    {
   1.174 -     "WiseGroup.,Ltd MP-8800 Quad USB Joypad",
   1.175 -     24,
   1.176 -     2,
   1.177 -     mp88xx_2_logical_layout,
   1.178 -     mp88xx_2_logical_axismap,
   1.179 -     NULL,
   1.180 -     NULL,
   1.181 -     mp88xx_2_logical_buttonmap},
   1.182 -    {
   1.183 -     "WiseGroup.,Ltd MP-8800 Quad USB Joypad",
   1.184 -     36,
   1.185 -     3,
   1.186 -     mp88xx_3_logical_layout,
   1.187 -     mp88xx_3_logical_axismap,
   1.188 -     NULL,
   1.189 -     NULL,
   1.190 -     mp88xx_3_logical_buttonmap},
   1.191 -    {
   1.192 -     "WiseGroup.,Ltd MP-8800 Quad USB Joypad",
   1.193 -     48,
   1.194 -     4,
   1.195 -     mp88xx_4_logical_layout,
   1.196 -     mp88xx_4_logical_axismap,
   1.197 -     NULL,
   1.198 -     NULL,
   1.199 -     mp88xx_4_logical_buttonmap}
   1.200 -};
   1.201 -
   1.202 -/* find the head of a linked list, given a point in it
   1.203 - */
   1.204 -#define SDL_joylist_head(i, start)\
   1.205 -        for(i = start; SDL_joylist[i].fname == NULL;) i = SDL_joylist[i].prev;
   1.206 -
   1.207 -#define SDL_logical_joydecl(d) d
   1.208 -
   1.209 -
   1.210 -#else
   1.211 -
   1.212 -#define SDL_logical_joydecl(d)
   1.213 -
   1.214 -#endif /* USE_LOGICAL_JOYSTICKS */
   1.215 -
   1.216  /* The maximum number of joysticks we'll detect */
   1.217  #define MAX_JOYSTICKS	32
   1.218  
   1.219 @@ -275,94 +66,9 @@
   1.220  static struct
   1.221  {
   1.222      char *fname;
   1.223 -#ifndef NO_LOGICAL_JOYSTICKS
   1.224 -    SDL_Joystick *joy;
   1.225 -    struct joystick_logicalmap *map;
   1.226 -    int prev;
   1.227 -    int next;
   1.228 -    int logicalno;
   1.229 -#endif                          /* USE_LOGICAL_JOYSTICKS */
   1.230  } SDL_joylist[MAX_JOYSTICKS];
   1.231  
   1.232  
   1.233 -#ifndef NO_LOGICAL_JOYSTICKS
   1.234 -
   1.235 -static int
   1.236 -CountLogicalJoysticks(int max)
   1.237 -{
   1.238 -    register int i, j, k, ret, prev;
   1.239 -    const char *name;
   1.240 -    int nbuttons, fd;
   1.241 -    unsigned char n;
   1.242 -
   1.243 -    ret = 0;
   1.244 -
   1.245 -    for (i = 0; i < max; i++) {
   1.246 -        name = SDL_SYS_JoystickNameForDeviceIndex(i);
   1.247 -
   1.248 -        fd = open(SDL_joylist[i].fname, O_RDONLY, 0);
   1.249 -        if (fd >= 0) {
   1.250 -            if (ioctl(fd, JSIOCGBUTTONS, &n) < 0) {
   1.251 -                nbuttons = -1;
   1.252 -            } else {
   1.253 -                nbuttons = n;
   1.254 -            }
   1.255 -            close(fd);
   1.256 -        } else {
   1.257 -            nbuttons = -1;
   1.258 -        }
   1.259 -
   1.260 -        if (name) {
   1.261 -            for (j = 0; j < SDL_arraysize(joystick_logicalmap); j++) {
   1.262 -                if (!SDL_strcmp(name, joystick_logicalmap[j].name)
   1.263 -                    && (nbuttons == -1
   1.264 -                        || nbuttons == joystick_logicalmap[j].nbuttons)) {
   1.265 -                    prev = i;
   1.266 -                    SDL_joylist[prev].map = &(joystick_logicalmap[j]);
   1.267 -
   1.268 -                    for (k = 1; k < joystick_logicalmap[j].njoys; k++) {
   1.269 -                        SDL_joylist[prev].next = max + ret;
   1.270 -                        SDL_joylist[max + ret].prev = prev;
   1.271 -
   1.272 -                        prev = max + ret;
   1.273 -                        SDL_joylist[prev].logicalno = k;
   1.274 -                        SDL_joylist[prev].map = &(joystick_logicalmap[j]);
   1.275 -                        ret++;
   1.276 -                    }
   1.277 -
   1.278 -                    break;
   1.279 -                }
   1.280 -            }
   1.281 -        }
   1.282 -    }
   1.283 -
   1.284 -    return ret;
   1.285 -}
   1.286 -
   1.287 -static void
   1.288 -LogicalSuffix(int logicalno, char *namebuf, int len)
   1.289 -{
   1.290 -    register int slen;
   1.291 -    const static char suffixs[] =
   1.292 -        "01020304050607080910111213141516171819" "20212223242526272829303132";
   1.293 -    const char *suffix;
   1.294 -    slen = SDL_strlen(namebuf);
   1.295 -    suffix = NULL;
   1.296 -
   1.297 -    if (logicalno * 2 < sizeof(suffixs))
   1.298 -        suffix = suffixs + (logicalno * 2);
   1.299 -
   1.300 -    if (slen + 4 < len && suffix) {
   1.301 -        namebuf[slen++] = ' ';
   1.302 -        namebuf[slen++] = '#';
   1.303 -        namebuf[slen++] = suffix[0];
   1.304 -        namebuf[slen++] = suffix[1];
   1.305 -        namebuf[slen++] = 0;
   1.306 -    }
   1.307 -}
   1.308 -
   1.309 -#endif /* USE_LOGICAL_JOYSTICKS */
   1.310 -
   1.311  #if SDL_INPUT_LINUXEV
   1.312  #define test_bit(nr, addr) \
   1.313  	(((1UL << ((nr) % (sizeof(long) * 8))) & ((addr)[(nr) / (sizeof(long) * 8)])) != 0)
   1.314 @@ -499,9 +205,6 @@
   1.315              break;
   1.316  #endif
   1.317      }
   1.318 -#ifndef NO_LOGICAL_JOYSTICKS
   1.319 -    numjoysticks += CountLogicalJoysticks(numjoysticks);
   1.320 -#endif
   1.321  
   1.322      SDL_SYS_numjoysticks = numjoysticks;
   1.323      return (numjoysticks);
   1.324 @@ -528,11 +231,7 @@
   1.325      int fd;
   1.326      static char namebuf[128];
   1.327      const char *name;
   1.328 -    SDL_logical_joydecl(int oindex = device_index);
   1.329  
   1.330 -#ifndef NO_LOGICAL_JOYSTICKS
   1.331 -    SDL_joylist_head(device_index, device_index);
   1.332 -#endif
   1.333      name = NULL;
   1.334      fd = open(SDL_joylist[device_index].fname, O_RDONLY, 0);
   1.335      if (fd >= 0) {
   1.336 @@ -546,14 +245,6 @@
   1.337              name = namebuf;
   1.338          }
   1.339          close(fd);
   1.340 -
   1.341 -
   1.342 -#ifndef NO_LOGICAL_JOYSTICKS
   1.343 -        if (SDL_joylist[oindex].prev || SDL_joylist[oindex].next
   1.344 -            || device_index != oindex) {
   1.345 -            LogicalSuffix(SDL_joylist[oindex].logicalno, namebuf, 128);
   1.346 -        }
   1.347 -#endif
   1.348      }
   1.349      return name;
   1.350  }
   1.351 @@ -791,22 +482,6 @@
   1.352  
   1.353  #endif /* SDL_INPUT_LINUXEV */
   1.354  
   1.355 -#ifndef NO_LOGICAL_JOYSTICKS
   1.356 -static void
   1.357 -ConfigLogicalJoystick(SDL_Joystick * joystick)
   1.358 -{
   1.359 -    struct joystick_logical_layout *layout;
   1.360 -
   1.361 -    layout = SDL_joylist[joystick->instance_id].map->layout +
   1.362 -        SDL_joylist[joystick->instance_id].logicalno;
   1.363 -
   1.364 -    joystick->nbuttons = layout->nbuttons;
   1.365 -    joystick->nhats = layout->nhats;
   1.366 -    joystick->naxes = layout->naxes;
   1.367 -    joystick->nballs = layout->nballs;
   1.368 -}
   1.369 -#endif
   1.370 -
   1.371  
   1.372  /* Function to open a joystick for use.
   1.373     The joystick to open is specified by the index field of the joystick.
   1.374 @@ -818,30 +493,10 @@
   1.375  {
   1.376      int fd;
   1.377      char *fname;
   1.378 -    SDL_logical_joydecl(int realindex);
   1.379 -    SDL_logical_joydecl(SDL_Joystick * realjoy = NULL);
   1.380  
   1.381      /* Open the joystick and set the joystick file descriptor */
   1.382 -#ifndef NO_LOGICAL_JOYSTICKS
   1.383 -    if (SDL_joylist[joystick->instance_id].fname == NULL) {
   1.384 -        SDL_joylist_head(realindex, joystick->instance_id);
   1.385 -        realjoy = SDL_JoystickOpen(realindex);
   1.386 -
   1.387 -        if (realjoy == NULL)
   1.388 -            return (-1);
   1.389 -
   1.390 -        fd = realjoy->hwdata->fd;
   1.391 -        fname = realjoy->hwdata->fname;
   1.392 -
   1.393 -    } else {
   1.394 -        fd = open(SDL_joylist[joystick->instance_id].fname, O_RDONLY, 0);
   1.395 -        fname = SDL_joylist[joystick->instance_id].fname;
   1.396 -    }
   1.397 -    SDL_joylist[joystick->instance_id].joy = joystick;
   1.398 -#else
   1.399      fd = open(SDL_joylist[joystick->instance_id].fname, O_RDONLY, 0);
   1.400      fname = SDL_joylist[joystick->instance_id].fname;
   1.401 -#endif
   1.402  
   1.403      if (fd < 0) {
   1.404          SDL_SetError("Unable to open %s\n", SDL_joylist[joystick->instance_id]);
   1.405 @@ -863,11 +518,6 @@
   1.406      fcntl(fd, F_SETFL, O_NONBLOCK);
   1.407  
   1.408      /* Get the number of buttons and axes on the joystick */
   1.409 -#ifndef NO_LOGICAL_JOYSTICKS
   1.410 -    if (realjoy)
   1.411 -        ConfigLogicalJoystick(joystick);
   1.412 -    else
   1.413 -#endif
   1.414  #if SDL_INPUT_LINUXEV
   1.415      if (!EV_ConfigJoystick(joystick, fd))
   1.416  #endif
   1.417 @@ -882,86 +532,6 @@
   1.418      return SDL_TRUE;
   1.419  }
   1.420  
   1.421 -#ifndef NO_LOGICAL_JOYSTICKS
   1.422 -
   1.423 -static SDL_Joystick *
   1.424 -FindLogicalJoystick(SDL_Joystick * joystick,
   1.425 -                    struct joystick_logical_mapping *v)
   1.426 -{
   1.427 -    SDL_Joystick *logicaljoy;
   1.428 -    register int i;
   1.429 -
   1.430 -    i = joystick->instance_id;
   1.431 -    logicaljoy = NULL;
   1.432 -
   1.433 -    /* get the fake joystick that will receive the event
   1.434 -     */
   1.435 -    for (;;) {
   1.436 -
   1.437 -        if (SDL_joylist[i].logicalno == v->njoy) {
   1.438 -            logicaljoy = SDL_joylist[i].joy;
   1.439 -            break;
   1.440 -        }
   1.441 -
   1.442 -        if (SDL_joylist[i].next == 0)
   1.443 -            break;
   1.444 -
   1.445 -        i = SDL_joylist[i].next;
   1.446 -
   1.447 -    }
   1.448 -
   1.449 -    return logicaljoy;
   1.450 -}
   1.451 -
   1.452 -static int
   1.453 -LogicalJoystickButton(SDL_Joystick * joystick, Uint8 button, Uint8 state)
   1.454 -{
   1.455 -    struct joystick_logical_mapping *buttons;
   1.456 -    SDL_Joystick *logicaljoy = NULL;
   1.457 -
   1.458 -    /* if there's no map then this is just a regular joystick
   1.459 -     */
   1.460 -    if (SDL_joylist[joystick->instance_id].map == NULL)
   1.461 -        return 0;
   1.462 -
   1.463 -    /* get the logical joystick that will receive the event
   1.464 -     */
   1.465 -    buttons = SDL_joylist[joystick->instance_id].map->buttonmap + button;
   1.466 -    logicaljoy = FindLogicalJoystick(joystick, buttons);
   1.467 -
   1.468 -    if (logicaljoy == NULL)
   1.469 -        return 1;
   1.470 -
   1.471 -    SDL_PrivateJoystickButton(logicaljoy, buttons->nthing, state);
   1.472 -
   1.473 -    return 1;
   1.474 -}
   1.475 -
   1.476 -static int
   1.477 -LogicalJoystickAxis(SDL_Joystick * joystick, Uint8 axis, Sint16 value)
   1.478 -{
   1.479 -    struct joystick_logical_mapping *axes;
   1.480 -    SDL_Joystick *logicaljoy = NULL;
   1.481 -
   1.482 -    /* if there's no map then this is just a regular joystick
   1.483 -     */
   1.484 -    if (SDL_joylist[joystick->instance_id].map == NULL)
   1.485 -        return 0;
   1.486 -
   1.487 -    /* get the logical joystick that will receive the event
   1.488 -     */
   1.489 -    axes = SDL_joylist[joystick->instance_id].map->axismap + axis;
   1.490 -    logicaljoy = FindLogicalJoystick(joystick, axes);
   1.491 -
   1.492 -    if (logicaljoy == NULL)
   1.493 -        return 1;
   1.494 -
   1.495 -    SDL_PrivateJoystickAxis(logicaljoy, axes->nthing, value);
   1.496 -
   1.497 -    return 1;
   1.498 -}
   1.499 -#endif /* USE_LOGICAL_JOYSTICKS */
   1.500 -
   1.501  static __inline__ void
   1.502  HandleHat(SDL_Joystick * stick, Uint8 hat, int axis, int value)
   1.503  {
   1.504 @@ -971,8 +541,6 @@
   1.505          {SDL_HAT_LEFT, SDL_HAT_CENTERED, SDL_HAT_RIGHT},
   1.506          {SDL_HAT_LEFTDOWN, SDL_HAT_DOWN, SDL_HAT_RIGHTDOWN}
   1.507      };
   1.508 -    SDL_logical_joydecl(SDL_Joystick * logicaljoy = NULL);
   1.509 -    SDL_logical_joydecl(struct joystick_logical_mapping *hats = NULL);
   1.510  
   1.511      the_hat = &stick->hwdata->hats[hat];
   1.512      if (value < 0) {
   1.513 @@ -984,24 +552,6 @@
   1.514      }
   1.515      if (value != the_hat->axis[axis]) {
   1.516          the_hat->axis[axis] = value;
   1.517 -
   1.518 -#ifndef NO_LOGICAL_JOYSTICKS
   1.519 -        /* if there's no map then this is just a regular joystick
   1.520 -         */
   1.521 -        if (SDL_joylist[stick->instance_id].map != NULL) {
   1.522 -
   1.523 -            /* get the fake joystick that will receive the event
   1.524 -             */
   1.525 -            hats = SDL_joylist[stick->instance_id].map->hatmap + hat;
   1.526 -            logicaljoy = FindLogicalJoystick(stick, hats);
   1.527 -        }
   1.528 -
   1.529 -        if (logicaljoy) {
   1.530 -            stick = logicaljoy;
   1.531 -            hat = hats->nthing;
   1.532 -        }
   1.533 -#endif /* USE_LOGICAL_JOYSTICKS */
   1.534 -
   1.535          SDL_PrivateJoystickHat(stick, hat,
   1.536                                 position_map[the_hat->
   1.537                                              axis[1]][the_hat->axis[0]]);
   1.538 @@ -1026,28 +576,15 @@
   1.539      int i, len;
   1.540      Uint8 other_axis;
   1.541  
   1.542 -#ifndef NO_LOGICAL_JOYSTICKS
   1.543 -    if (SDL_joylist[joystick->instance_id].fname == NULL) {
   1.544 -        SDL_joylist_head(i, joystick->instance_id);
   1.545 -        JS_HandleEvents(SDL_joylist[i].joy);
   1.546 -        return;
   1.547 -    }
   1.548 -#endif
   1.549 -
   1.550      while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) {
   1.551          len /= sizeof(events[0]);
   1.552          for (i = 0; i < len; ++i) {
   1.553              switch (events[i].type & ~JS_EVENT_INIT) {
   1.554              case JS_EVENT_AXIS:
   1.555                  if (events[i].number < joystick->naxes) {
   1.556 -#ifndef NO_LOGICAL_JOYSTICKS
   1.557 -                    if (!LogicalJoystickAxis(joystick,
   1.558 -                                             events[i].number,
   1.559 -                                             events[i].value))
   1.560 -#endif
   1.561 -                        SDL_PrivateJoystickAxis(joystick,
   1.562 -                                                events[i].number,
   1.563 -                                                events[i].value);
   1.564 +                    SDL_PrivateJoystickAxis(joystick,
   1.565 +                                            events[i].number,
   1.566 +                                            events[i].value);
   1.567                      break;
   1.568                  }
   1.569                  events[i].number -= joystick->naxes;
   1.570 @@ -1066,13 +603,9 @@
   1.571                  }
   1.572                  break;
   1.573              case JS_EVENT_BUTTON:
   1.574 -#ifndef NO_LOGICAL_JOYSTICKS
   1.575 -                if (!LogicalJoystickButton(joystick,
   1.576 -                                           events[i].number, events[i].value))
   1.577 -#endif
   1.578 -                    SDL_PrivateJoystickButton(joystick,
   1.579 -                                              events[i].number,
   1.580 -                                              events[i].value);
   1.581 +                SDL_PrivateJoystickButton(joystick,
   1.582 +                                          events[i].number,
   1.583 +                                          events[i].value);
   1.584                  break;
   1.585              default:
   1.586                  /* ?? */
   1.587 @@ -1118,13 +651,6 @@
   1.588      int i, len;
   1.589      int code;
   1.590  
   1.591 -#ifndef NO_LOGICAL_JOYSTICKS
   1.592 -    if (SDL_joylist[joystick->instance_id].fname == NULL) {
   1.593 -        SDL_joylist_head(i, joystick->instance_id);
   1.594 -        return EV_HandleEvents(SDL_joylist[i].joy);
   1.595 -    }
   1.596 -#endif
   1.597 -
   1.598      while ((len = read(joystick->hwdata->fd, events, (sizeof events))) > 0) {
   1.599          len /= sizeof(events[0]);
   1.600          for (i = 0; i < len; ++i) {
   1.601 @@ -1133,16 +659,9 @@
   1.602              case EV_KEY:
   1.603                  if (code >= BTN_MISC) {
   1.604                      code -= BTN_MISC;
   1.605 -#ifndef NO_LOGICAL_JOYSTICKS
   1.606 -                    if (!LogicalJoystickButton(joystick,
   1.607 -                                               joystick->
   1.608 -                                               hwdata->key_map[code],
   1.609 -                                               events[i].value))
   1.610 -#endif
   1.611 -                        SDL_PrivateJoystickButton(joystick,
   1.612 -                                                  joystick->
   1.613 -                                                  hwdata->key_map[code],
   1.614 -                                                  events[i].value);
   1.615 +                    SDL_PrivateJoystickButton(joystick,
   1.616 +                                              joystick->hwdata->key_map[code],
   1.617 +                                              events[i].value);
   1.618                  }
   1.619                  break;
   1.620              case EV_ABS:
   1.621 @@ -1165,15 +684,9 @@
   1.622                  default:
   1.623                      events[i].value =
   1.624                          EV_AxisCorrect(joystick, code, events[i].value);
   1.625 -#ifndef NO_LOGICAL_JOYSTICKS
   1.626 -                    if (!LogicalJoystickAxis(joystick,
   1.627 -                                             joystick->hwdata->abs_map[code],
   1.628 -                                             events[i].value))
   1.629 -#endif
   1.630 -                        SDL_PrivateJoystickAxis(joystick,
   1.631 -                                                joystick->
   1.632 -                                                hwdata->abs_map[code],
   1.633 -                                                events[i].value);
   1.634 +                    SDL_PrivateJoystickAxis(joystick,
   1.635 +                                            joystick->hwdata->abs_map[code],
   1.636 +                                            events[i].value);
   1.637                      break;
   1.638                  }
   1.639                  break;
   1.640 @@ -1226,19 +739,8 @@
   1.641  void
   1.642  SDL_SYS_JoystickClose(SDL_Joystick * joystick)
   1.643  {
   1.644 -#ifndef NO_LOGICAL_JOYSTICKS
   1.645 -    register int i;
   1.646 -    if (SDL_joylist[joystick->instance_id].fname == NULL) {
   1.647 -        SDL_joylist_head(i, joystick->instance_id);
   1.648 -        SDL_JoystickClose(SDL_joylist[i].joy);
   1.649 -    }
   1.650 -#endif
   1.651 -
   1.652      if (joystick->hwdata) {
   1.653 -#ifndef NO_LOGICAL_JOYSTICKS
   1.654 -        if (SDL_joylist[joystick->instance_id].fname != NULL)
   1.655 -#endif
   1.656 -            close(joystick->hwdata->fd);
   1.657 +        close(joystick->hwdata->fd);
   1.658          if (joystick->hwdata->hats) {
   1.659              SDL_free(joystick->hwdata->hats);
   1.660          }