USB reset fails when using a LimeSDR Mini on FreeBSD
Jan Behrens
jbe-mlist at magnetkern.de
Fri Jun 26 15:28:55 UTC 2020
On Fri, 26 Jun 2020 14:47:13 +0200
Hans Petter Selasky <hps at selasky.org> wrote:
> Hi,
>
> On 2020-06-26 13:51, Jan Behrens wrote:
> > I made the discovery that running the library as root works just fine!
>
> The libusb_reset_device() function needs root permissions! This is
> expected. There are specific checks in the kernel for this.
I might have misunderstood your earlier post:
On Thu, 25 Jun 2020 20:16:14 +0200
Hans Petter Selasky <hps at selasky.org> wrote:
> Unless the device requires it, libusb_reset_device(), will only
> re-enumerate the device. Beware that this only is allowed if you are
> running the application as root. Else libusb_reset_device() will be a
> no-operation.
>
> --HPS
Does this mean that depending on the device, it will either be a
no-operation or a re-enumeration, and in the latter case, root
privileges are required, otherwise not?
Or did you mean that if you are non-root, it will/should always be a
no-operation?
What I don't understand is that the Lime Suite SoapySDR module seems to
work fine on Linux and other operating systems but makes trouble with
FreeBSD. Is it a FreeBSD specific thing that libusb_reset_device()
fails if called as non-root?
> Can you run this app as root, and then change to non-root after
> libusb_reset_device() has been executed?
>
> --HPS
It's not really practical. I'd have to patch every program using the
module. But maybe libusb_reset_device() isn't necessary to call?
I could give recommendation to the Lime Suite developers to remove the
libusb_reset_device() call on FreeBSD systems if it is not neccessary.
However, I would like to understand why it is called and what's its
usual purpose, and if there are side effects when removing the call, or
whether the call should/could be replaced by a different call that
"only" requires device privileges. Also: Why does this work on Linux
but fails on FreeBSD? Is the API differently defined?
Sorry for my confusion, I'm really not experienced with USB programming.
Regards,
Jan Behrens
More information about the freebsd-usb
mailing list