On 30/07/15(Thu) 12:18, Ludovic Coues wrote:
> Right now, an USB_REQUEST ioctl will fail with an EBADF error if done
> on a device opened as read-only. With this patch, the ioctl will fail
> only if the USB_REQUEST is a write request.

Do you need this to be able to use your usbdevs-like tool as a normal
use with the "w" bit on a /dev/usb node?

> Index: sys/dev/usb/usb.c
> ===================================================================
> RCS file: /cvs/src/sys/dev/usb/usb.c,v
> retrieving revision 1.107
> diff -u -p -r1.107 usb.c
> --- sys/dev/usb/usb.c 14 Mar 2015 03:38:50 -0000      1.107
> +++ sys/dev/usb/usb.c 26 Jul 2015 16:16:52 -0000
> @@ -618,7 +618,8 @@ usbioctl(dev_t devt, u_long cmd, caddr_t
>               usbd_status err;
>               int error = 0;
>  
> -             if (!(flag & FWRITE))
> +             if ((flag & FWRITE) == 0
> +                 && (ur->ucr_request.bmRequestType & UT_READ) == 0)
>                       return (EBADF);
>  
>               DPRINTF(("usbioctl: USB_REQUEST addr=%d len=%d\n", addr, len));

Reply via email to