USB reset fails when using a LimeSDR Mini on FreeBSD
Jan Behrens
jbe-mlist at magnetkern.de
Thu Jul 2 10:37:50 UTC 2020
On Thu, 2 Jul 2020 12:18:02 +0200
Hans Petter Selasky <hps at selasky.org> wrote:
> Hi Jan,
>
> On 2020-07-02 12:06, Jan Behrens wrote:
> > On Thu, 2 Jul 2020 11:23:32 +0200
> > Hans Petter Selasky <hps at selasky.org> wrote:
> >
> >> On 2020-07-02 11:15, Jan Behrens wrote:
> >>> On Thu, 2 Jul 2020 10:54:27 +0200
> >>> Hans Petter Selasky <hps at selasky.org> wrote:
> >>>
> >>>> On 2020-07-02 10:47, Jan Behrens wrote:
> >>>>> But wouldn't both drivers require access to the entries in /dev ?
> >>>>
> >>>> Yes, user-space drivers would require access to /dev, yes, but kernel
> >>>> drivers not, like mouse, keyboard, storage, network.
> >>>>
> >>>> [...]
>
> > I experienced that /dev/usb/2.2.0 and /dev/usb/2.2.1, 2.2.2, 2.2.3,
> > etc. get treated differently when I reset the LimeSDR Mini with
> > "usbconfig -u 2 -a 2 reset". The devices 2.2.1 and up are supposingly
> > re-created (and have their access rights reset), while the device 2.2.0
> > maintains any manually changed access rights.
> >
>
> Let me explain, now you are getting me into dirty details :-)
>
> This device is used for all of LibUSB interfaces and gives access to all
> endpoints:
>
> /dev/usb/X.Y.0
>
> These devices are legacy devices, which allow direct access to the
> endpoint via the shell. They are there to support the old user-space
> model FreeBSD had. And they are re-created when you reset/reconfigure a
> USB device. Actually you can "echo > /dev/usb/X.Y.N" to write directly
> to an endpoint from user-space. But don't do that unless it is a modem
> endpoint which support AT commands for example.
>
> /dev/usb/X.Y.[1..15]
Are these devices there only for legacy reasons? Or also for granting
access to devices via chown/chmod (or devfs.rules)? I see
that /dev/ugenX.Y are symlinks to /dev/usb/X.Y.0
I used chown user /dev/usb/2.2.* to get access through libusb (before I
set up devfs.rules).
>
> > Is it correct that 2.2.0 identifies the device as a whole?
>
> Yes, this is correct.
Then I suppose if you have access to /dev/ugenX.Y (i.e. /dev/usb/X.Y.
0), you should be allowed to reset a device.
>
> >>
> >> What do you think?
> >
> > I'm not sure if this is (from a semantic point of view) the best thing
> > to do. I would say you should only be able to reset a device if you
> > have been granted access to the device as a whole (including all
> > interfaces/subdevices/whatever), as the reset seems to affect all of
> > those.
> >
>
> In FreeBSD and LibUSB there is no such concept. Everything is oriented
> around interfaces. There is a function to claim an interface, but not
> the device itself. (man libusb_claim_interface)
That means in order to reset the device itself, I need to claim an
interface, e.g. interface 0? But above you said, 2.2.0 identifies the
device as a whole (and I noted it is symlinked by /dev/ugen2.2). So I'm
a bit confused now. Is /dev/usb/2.2.0 the whole device? Or the
interface 0 of the device? Or both... haha
> [...]
Regards,
Jan
More information about the freebsd-usb
mailing list