USB reset fails when using a LimeSDR Mini on FreeBSD
jbe-mlist at magnetkern.de
Thu Jul 2 08:35:32 UTC 2020
On Sat, 27 Jun 2020 18:04:20 +0200
Gary Jennejohn <gljennjohn at gmail.com> wrote:
> On Sat, 27 Jun 2020 17:53:01 +0200
> Tomasz CEDRO <tomek at cedro.info> wrote:
> > [...]
> Lookig at the libusb code, libusb_reset_device() only returns an error if
> resetting the device fails.
Unfortunately it returns -99 (LIBUSB_ERROR_OTHER), which is not very
> Resetting the device requires making ioctl() calls into the kernel.
> ioctl() calls pretty much always require root permissions.
> Gary Jennejohn
I compared the behavior under FreeBSD to GNU/Linux. I could meanwhile
confirm that under Linux, the device is reset, even if the executing
user is not root. Kernel log using Linux is as follows:
[1264819.538395] usb 2-1.1: reset high-speed USB device number 54 using ehci-pci
UID was definitely not 0, as stated in my other e-mail:
DEBUG: Executing libusb_reset_device() [UID=1000, effective UID=1000]
DEBUG: libusb_reset_device() executed successfully.
Thus Linux definitely behaves differently here. My question is: Can
and/or should FreeBSD be fixed to allow libusb_reset_device() as a user
or should a driver library be fixed to not use that call.
This issue may also affect other device drivers that run in userspace
and might not be limited to the issues with the LimeSDR Mini. The
documentation (man page) and return value of libusb_reset_device() does
not reflect its (deviant) behavior under FreeBSD (compared to Linux).
More information about the freebsd-usb