users who have write access to /dev/usb* have full control of
any USB device attached to the system.

write access to /dev/usb* is not needed to discover the current USB
devices.  this diff reflects that.

this allows users with only read access to /dev/usb* to use most, if not
all libusb-using ports.  I would like to know of any libusb-using port
that actually needs write access to /dev/usb*, because it can probably
be fixed to not need that.

ok?

-- 
jake...@sdf.lonestar.org
SDF Public Access UNIX System - http://sdf.lonestar.org

Index: Makefile
===================================================================
RCS file: /cvs/ports/devel/libusb/Makefile,v
retrieving revision 1.18
diff -u -p Makefile
--- Makefile    26 Nov 2010 13:30:19 -0000      1.18
+++ Makefile    11 Jan 2011 07:52:17 -0000
@@ -3,7 +3,7 @@
 COMMENT=       USB access library
 
 DISTNAME=      libusb-0.1.12
-REVISION=      0
+REVISION=      1
 SHARED_LIBS=           usb     9.0 \
                        usbpp   10.0
 MODGNU_SHARED_LIBS=    usb     '-export-dynamic' \
Index: patches/patch-bsd_c
===================================================================
RCS file: /cvs/ports/devel/libusb/patches/patch-bsd_c,v
retrieving revision 1.8
diff -u -p patches/patch-bsd_c
--- patches/patch-bsd_c 26 Nov 2010 13:30:19 -0000      1.8
+++ patches/patch-bsd_c 11 Jan 2011 07:52:17 -0000
@@ -1,6 +1,6 @@
 $OpenBSD: patch-bsd_c,v 1.8 2010/11/26 13:30:19 ajacoutot Exp $
---- bsd.c.orig Sat Mar  4 03:52:46 2006
-+++ bsd.c      Thu Nov 25 18:54:05 2010
+--- bsd.c.orig Fri Mar  3 18:52:46 2006
++++ bsd.c      Mon Jan 10 23:31:57 2011
 @@ -361,7 +361,7 @@ int usb_bulk_read(usb_dev_handle *dev, int ep, char *b
  int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size,
                          int timeout)
@@ -76,6 +76,15 @@ $OpenBSD: patch-bsd_c,v 1.8 2010/11/26 13:30:19 ajacou
  }
  
  int usb_os_find_busses(struct usb_bus **busses)
+@@ -491,7 +483,7 @@ int usb_os_find_busses(struct usb_bus **busses)
+     struct usb_bus *bus;
+ 
+     snprintf(buf, sizeof(buf) - 1, "/dev/usb%d", controller);
+-    fd = open(buf, O_RDWR);
++    fd = open(buf, O_RDONLY);
+     if (fd < 0) {
+       if (usb_debug >= 2)
+         if (errno != ENXIO && errno != ENOENT)
 @@ -623,9 +615,21 @@ int usb_resetep(usb_dev_handle *dev, unsigned int ep)
  
  int usb_clear_halt(usb_dev_handle *dev, unsigned int ep)

Reply via email to