aboutsummaryrefslogtreecommitdiffstats
path: root/games/flightgear/files/patch-PLIB-3rdparty-joystick-jsBSD.cxx
blob: cc07a19221a704eaaa3942d72baed7ccb87c660d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
Import extra patch from x11-toolkits/plib

--- 3rdparty/joystick/jsBSD.cxx.orig    2018-05-30 23:47:01.351096000 +0200
+++ 3rdparty/joystick/jsBSD.cxx 2018-05-30 23:47:28.474434000 +0200
@@ -64,6 +64,7 @@
 #  else
 #    define HAVE_USBHID_H 1
 #    include <usbhid.h>
+#    include <dev/usb/usb_ioctl.h>
 #  endif
 }
 #endif
@@ -116,54 +117,12 @@
 static char *
 walkusbdev(int f, char *dev, char *out, int outlen)
 {
-  struct usb_device_info di;
-  int i, a;
-  char *cp;
-
-  for (a = 1; a < USB_MAX_DEVICES; a++) {
-    di.udi_addr = a;
-    if (ioctl(f, USB_DEVICEINFO, &di) != 0)
-      return NULL;
-    for (i = 0; i < USB_MAX_DEVNAMES; i++)
-      if (di.udi_devnames[i][0] &&
-          strcmp(di.udi_devnames[i], dev) == 0) {
-        cp = new char[strlen(di.udi_vendor) + strlen(di.udi_product) + 2];
-        strcpy(cp, di.udi_vendor);
-        strcat(cp, " ");
-        strcat(cp, di.udi_product);
-        strncpy(out, cp, outlen - 1);
-   out[outlen - 1] = 0;
-   delete cp;
-        return out;
-      }
-  }
   return NULL;
 }
 
 static int
 findusbdev(char *name, char *out, int outlen)
 {
-  int i, f;
-  char buf[50];
-  char *cp;
-  static int protection_warned = 0;
-
-  for (i = 0; i < 16; i++) {
-    sprintf(buf, "%s%d", USBDEV, i);
-    f = open(buf, O_RDONLY);
-    if (f >= 0) {
-      cp = walkusbdev(f, name, out, outlen);
-      close(f);
-      if (cp)
-        return 1;
-    } else if (errno == EACCES) {
-      if (!protection_warned) {
-        fprintf(stderr, "Can't open %s for read!\n",
-          buf);
-        protection_warned = 1;
-      }
-    }
-  }
   return 0;
 }