summaryrefslogtreecommitdiff
path: root/devel/SDL/patches
diff options
context:
space:
mode:
authorjmcneill <jmcneill@pkgsrc.org>2015-02-04 23:51:25 +0000
committerjmcneill <jmcneill@pkgsrc.org>2015-02-04 23:51:25 +0000
commit773f85f8ba96eac747feb5f269c1496709e5761a (patch)
tree84f6571ac60f9aa2668dfbcf8f9b396a49e14966 /devel/SDL/patches
parentf932a0ff17aeec90a2c1769e8e6c23b37fe5eeb4 (diff)
downloadpkgsrc-773f85f8ba96eac747feb5f269c1496709e5761a.tar.gz
Improvements in BSD USB joystick detection:
- Scan uhid0 through uhid63, instead of uhid0 through uhid3. - If a uhid reports no usable inputs, skip it. This way your keyboard and mouse don't show up as (unusable) joysticks.
Diffstat (limited to 'devel/SDL/patches')
-rw-r--r--devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c b/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c
index 0818e82077a..88395d2d674 100644
--- a/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c
+++ b/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c
@@ -1,7 +1,16 @@
-$NetBSD: patch-src_joystick_bsd_SDL__sysjoystick.c,v 1.1 2014/03/24 20:29:01 asau Exp $
+$NetBSD: patch-src_joystick_bsd_SDL__sysjoystick.c,v 1.2 2015/02/04 23:51:26 jmcneill Exp $
--- src/joystick/bsd/SDL_sysjoystick.c.orig 2012-01-19 06:30:06.000000000 +0000
+++ src/joystick/bsd/SDL_sysjoystick.c
+@@ -77,7 +77,7 @@
+ #include "../SDL_sysjoystick.h"
+ #include "../SDL_joystick_c.h"
+
+-#define MAX_UHID_JOYS 4
++#define MAX_UHID_JOYS 64
+ #define MAX_JOY_JOYS 2
+ #define MAX_JOYS (MAX_UHID_JOYS + MAX_JOY_JOYS)
+
@@ -148,9 +148,11 @@ static char *joydevnames[MAX_JOYS];
static int report_alloc(struct report *, struct report_desc *, int);
static void report_free(struct report *);
@@ -16,3 +25,15 @@ $NetBSD: patch-src_joystick_bsd_SDL__sysjoystick.c,v 1.1 2014/03/24 20:29:01 asa
#define REP_BUF_DATA(rep) ((rep)->buf->ugd_data)
#else
#define REP_BUF_DATA(rep) ((rep)->buf->data)
+@@ -386,6 +388,11 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
+ if (hw->axis_map[i] > 0)
+ hw->axis_map[i] = joy->naxes++;
+
++ if (joy->naxes == 0 && joy->nbuttons == 0 && joy->nhats == 0 && joy->nballs == 0) {
++ SDL_SetError("%s: Not a joystick, ignoring", hw->path);
++ goto usberr;
++ }
++
+ usbend:
+ /* The poll blocks the event thread. */
+ fcntl(fd, F_SETFL, O_NONBLOCK);