pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/devel/SDL Improvements in BSD USB joystick detection:



details:   https://anonhg.NetBSD.org/pkgsrc/rev/e79e8343d35d
branches:  trunk
changeset: 646156:e79e8343d35d
user:      jmcneill <jmcneill%pkgsrc.org@localhost>
date:      Wed Feb 04 23:51:25 2015 +0000

description:
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:

 devel/SDL/Makefile                                          |   4 +-
 devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c |  23 ++++++++++++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diffs (50 lines):

diff -r 2f7d04163861 -r e79e8343d35d devel/SDL/Makefile
--- a/devel/SDL/Makefile        Wed Feb 04 23:44:34 2015 +0000
+++ b/devel/SDL/Makefile        Wed Feb 04 23:51:25 2015 +0000
@@ -1,7 +1,7 @@
-# $NetBSD: Makefile,v 1.118 2015/01/28 17:14:47 jmcneill Exp $
+# $NetBSD: Makefile,v 1.119 2015/02/04 23:51:25 jmcneill Exp $
 
 DISTNAME=      SDL-1.2.15
-PKGREVISION=   13
+PKGREVISION=   14
 CATEGORIES=    devel games
 MASTER_SITES=  http://www.libsdl.org/release/
 
diff -r 2f7d04163861 -r e79e8343d35d devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c
--- a/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c       Wed Feb 04 23:44:34 2015 +0000
+++ b/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c       Wed Feb 04 23:51:25 2015 +0000
@@ -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 @@
  #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);



Home | Main Index | Thread Index | Old Index