Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 2 Jul 2020 10:35:23 +0200
From:      Jan Behrens <jbe-mlist@magnetkern.de>
To:        "freebsd-usb@FreeBSD.org" <freebsd-usb@freebsd.org>
Subject:   Re: USB reset fails when using a LimeSDR Mini on FreeBSD
Message-ID:  <20200702103523.adb0566bcc7b6e354905a8a5@magnetkern.de>
In-Reply-To: <20200627180420.4b8012fb@ernst.home>
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> <20200626172851.872f3a08fa6e632666683230@magnetkern.de> <CAM8r67AF%2BfGiqBr9A0863Za_zR-fG1FxGfNAqEvvafW=wTRmyQ@mail.gmail.com> <20200627144419.f14371695d9b62ea99106c4a@magnetkern.de> <CAM8r67DTKdj0%2BhkOegjBj-ywzWFq2CnS2sQed0mibSUeGp6HSQ@mail.gmail.com> <20200627173604.7f7b7777140e66dbad812fc7@magnetkern.de> <CAM8r67DqZzje=JnrT_R3d6Uo_NxjvGsvpydd1NOTrJHU2jHzQA@mail.gmail.com> <20200627180420.4b8012fb@ernst.home>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, 27 Jun 2020 18:04:20 +0200
Gary Jennejohn <gljennjohn@gmail.com> wrote:

> On Sat, 27 Jun 2020 17:53:01 +0200
> Tomasz CEDRO <tomek@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
verbose.

> 
> 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).

Kind regards,
Jan Behrens



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20200702103523.adb0566bcc7b6e354905a8a5>