Date: Fri, 26 Jun 2020 17:28:51 +0200 From: Jan Behrens <jbe-mlist@magnetkern.de> To: Hans Petter Selasky <hps@selasky.org> Cc: CeDeROM <CeDeROM@tlen.pl>, "freebsd-usb@FreeBSD.org" <freebsd-usb@freebsd.org> Subject: Re: USB reset fails when using a LimeSDR Mini on FreeBSD Message-ID: <20200626172851.872f3a08fa6e632666683230@magnetkern.de> In-Reply-To: <5c0729f9-9e98-52f7-a5cb-6c5dfd2287a3@selasky.org> References: <20200625121052.e9f7e7cbeb68fad264ec80a9@magnetkern.de> <CAM8r67DFFeFCHMh6mAxw=x2LKYnFGwasOLgceo-EQSMOvMHbeg@mail.gmail.com> <20200625200849.6af81489a80c2f97d4f89ee6@magnetkern.de> <CAM8r67AE1K9AK%2BaL4RCn6_BWajvzKO7K99bYZMdH0mr-HQdyGw@mail.gmail.com> <20200625224522.44d6584465cb6e20d17be320@magnetkern.de> <0ec3e5a3-7f31-d1cd-6862-6066c431aa80@selasky.org> <20200626135151.e5542cf97fad213c4ad661f2@magnetkern.de> <5c0729f9-9e98-52f7-a5cb-6c5dfd2287a3@selasky.org>
index | next in thread | previous in thread | raw e-mail
On Fri, 26 Jun 2020 14:47:13 +0200 Hans Petter Selasky <hps@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@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 Behrenshome | help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200626172851.872f3a08fa6e632666683230>
