summaryrefslogtreecommitdiff
path: root/devel/libusb/patches/patch-ad
blob: af34c2fa8e00b5b616daed04a52e4de899a9f854 (plain)
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
$NetBSD: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $

===================================================================
RCS file: /cvsroot/libusb/libusb/bsd.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- bsd.c	2002/02/05 20:43:38	1.11
+++ bsd.c	2002/02/16 18:56:51	1.12
@@ -3,7 +3,7 @@
  *
  * Derived from Linux version by Richard Tobin.
  *
- * $Id: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $
+ * $Id: patch-ad,v 1.1 2002/03/03 15:20:10 veego Exp $
  * $Name:  $
  *
  * This library is covered by the LGPL, read LICENSE for details.
@@ -182,7 +182,12 @@
 #else
     snprintf(buf, sizeof(buf) - 1, "%s.%02d", dev->device->filename, ep);
 #endif
-    fd = open(buf, mode);
+    /* Try to open it O_RDWR first for those devices which have in and out
+     * endpoints with the same address (eg 0x02 and 0x82)
+     */
+    fd = open(buf, O_RDWR);
+    if (fd < 0 && errno == ENXIO)
+      fd = open(buf, mode);
     if (fd < 0)
       USB_ERROR_STR(fd, "can't open %s for bulk read: %s\n",
                     buf, strerror(errno));