pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/devel/SDL Instead of naming USB joysticks by device na...
details: https://anonhg.NetBSD.org/pkgsrc/rev/259a7793881a
branches: trunk
changeset: 646251:259a7793881a
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Fri Feb 06 01:27:25 2015 +0000
description:
Instead of naming USB joysticks by device name ("/dev/uhid3"), try to give
it a more helpful name ("Logitech Cordless RumblePad 2 @ /dev/uhid3")
diffstat:
devel/SDL/distinfo | 4 +-
devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c | 43 ++++++++++++-
2 files changed, 43 insertions(+), 4 deletions(-)
diffs (75 lines):
diff -r 79df4eed0815 -r 259a7793881a devel/SDL/distinfo
--- a/devel/SDL/distinfo Fri Feb 06 01:24:48 2015 +0000
+++ b/devel/SDL/distinfo Fri Feb 06 01:27:25 2015 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.73 2015/02/05 08:57:53 wiz Exp $
+$NetBSD: distinfo,v 1.74 2015/02/06 01:27:25 jmcneill Exp $
SHA1 (SDL-1.2.15.tar.gz) = 0c5f193ced810b0d7ce3ab06d808cbb5eef03a2c
RMD160 (SDL-1.2.15.tar.gz) = d4802a090cb4a24eeb0c8ce5690802f596d394c3
@@ -6,7 +6,7 @@
SHA1 (patch-aa) = 00fb7a85caf8fc9f08298d0a07a4587757fdffb0
SHA1 (patch-ac) = 8b2dddff9ad449b19b35ef364e2d960e46284563
SHA1 (patch-src_audio_sun_SDL__sunaudio.c) = 4b492b40d39e6444037dfda55766e4a149cc6c30
-SHA1 (patch-src_joystick_bsd_SDL__sysjoystick.c) = 67ce00658aa5cf43d86748955520a16e62afd074
+SHA1 (patch-src_joystick_bsd_SDL__sysjoystick.c) = 62add37324a9c164dbc9281d59089dc445fde3e9
SHA1 (patch-src_video_quartz_SDL__QuartzVideo.h) = 19d952bade06dbd646e94f42139c38436969b1a8
SHA1 (patch-src_video_wscons_SDL__wsconsevents.c) = 1c874c46edb325907eda3bfa7580c788294f6d21
SHA1 (patch-src_video_wscons_SDL__wsconsevents__c.h) = 97206e2aca0b620005217d9d07ad1177516cac92
diff -r 79df4eed0815 -r 259a7793881a devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c
--- a/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c Fri Feb 06 01:24:48 2015 +0000
+++ b/devel/SDL/patches/patch-src_joystick_bsd_SDL__sysjoystick.c Fri Feb 06 01:27:25 2015 +0000
@@ -1,4 +1,4 @@
-$NetBSD: patch-src_joystick_bsd_SDL__sysjoystick.c,v 1.2 2015/02/04 23:51:26 jmcneill Exp $
+$NetBSD: patch-src_joystick_bsd_SDL__sysjoystick.c,v 1.3 2015/02/06 01:27:25 jmcneill Exp $
--- src/joystick/bsd/SDL_sysjoystick.c.orig 2012-01-19 06:30:06.000000000 +0000
+++ src/joystick/bsd/SDL_sysjoystick.c
@@ -25,7 +25,46 @@
#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)
+@@ -314,6 +316,38 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
+ #endif
+ rep->rid = -1; /* XXX */
+ }
++#if defined(__NetBSD__)
++ usb_device_descriptor_t udd;
++ struct usb_string_desc usd;
++ if (ioctl(fd, USB_GET_DEVICE_DESC, &udd) == -1)
++ goto desc_failed;
++
++ /* Get default language */
++ usd.usd_string_index = USB_LANGUAGE_TABLE;
++ usd.usd_language_id = 0;
++ if (ioctl(fd, USB_GET_STRING_DESC, &usd) == -1 || usd.usd_desc.bLength < 4) {
++ usd.usd_language_id = 0;
++ } else {
++ usd.usd_language_id = UGETW(usd.usd_desc.bString[0]);
++ }
++
++ usd.usd_string_index = udd.iProduct;
++ if (ioctl(fd, USB_GET_STRING_DESC, &usd) == 0) {
++ char str[128];
++ char *new_name = NULL;
++ int i;
++ for (i = 0; i < (usd.usd_desc.bLength >> 1) - 1 && i < sizeof(str) - 1; i++) {
++ str[i] = UGETW(usd.usd_desc.bString[i]);
++ }
++ str[i] = '\0';
++ asprintf(&new_name, "%s @ %s", str, path);
++ if (new_name != NULL) {
++ free(joydevnames[joy->index]);
++ joydevnames[joy->index] = new_name;
++ }
++ }
++desc_failed:
++#endif
+ if (report_alloc(rep, hw->repdesc, REPORT_INPUT) < 0) {
+ goto usberr;
+ }
+@@ -386,6 +420,11 @@ SDL_SYS_JoystickOpen(SDL_Joystick *joy)
if (hw->axis_map[i] > 0)
hw->axis_map[i] = joy->naxes++;
Home |
Main Index |
Thread Index |
Old Index