libusb and non-root access problem
Hans Petter Selasky
hps at selasky.org
Sat Sep 13 14:00:48 UTC 2014
On 09/13/14 14:04, Lundberg, Johannes wrote:
> Hi
>
> I tried now for hours but no luck with this.. I have a special usb device
> to which I connect with libusb. Everything works find as root but I can
> seem to be able to access with normal user no matter how I configure devfs.
>
> I changed both conf and rules and even set myself as owner and group and
> 777 permission to /dev/ugen* /dev/usb and /dev/usb/* but no luck...
>
> I can connect to the device and claim interface but then it fails at the
> first libusb_control_transfer with error -4
>
> I have done this before without problems. I am running the newest
> 11-CURRENT snapshot so could there be any bug that causes this or has
> anything changed in configurations?
>
> Grateful for any advice...
> --
> Johannes Lundberg
>
Hi,
You only need to "chmod /dev/usb/X.Y.0" .
Some control transfers are always restricted to root user:
/*
* Avoid requests that would damage the bus integrity:
*/
if (((req->bmRequestType == UT_WRITE_DEVICE) &&
(req->bRequest == UR_SET_ADDRESS)) ||
((req->bmRequestType == UT_WRITE_DEVICE) &&
(req->bRequest == UR_SET_CONFIG)) ||
((req->bmRequestType == UT_WRITE_INTERFACE) &&
(req->bRequest == UR_SET_INTERFACE))) {
/*
* These requests can be useful for testing USB drivers.
*/
error = priv_check(curthread, PRIV_DRIVER);
if (error) {
return (error);
}
}
You need to use their libusb counterpart to avoid problems!
--HPS
More information about the freebsd-usb
mailing list