Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 26 Jun 2020 13:51:51 +0200
From:      Jan Behrens <jbe-mlist@magnetkern.de>
To:        Hans Petter Selasky <hps@selasky.org>, CeDeROM <CeDeROM@tlen.pl>
Cc:        "freebsd-usb@FreeBSD.org" <freebsd-usb@freebsd.org>
Subject:   Re: USB reset fails when using a LimeSDR Mini on FreeBSD
Message-ID:  <20200626135151.e5542cf97fad213c4ad661f2@magnetkern.de>
In-Reply-To: <0ec3e5a3-7f31-d1cd-6862-6066c431aa80@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>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 26 Jun 2020 10:58:20 +0200
Hans Petter Selasky <hps@selasky.org> wrote:

> USB_ERR_IOERROR:

Where did you get this error code from? I checked the error code
returned in my case by modifying the source of the Lime Suite:

{
    int status = libusb_reset_device(dev_handle);
    fprintf(stderr, "DEBUG status: %i\n", status);
    if (libusb_reset_device(dev_handle)!=0)
        return ReportError(-1, "USB reset failed", libusb_strerror(libusb_error(r)));
}

I got:
DEBUG status: -99

Checking with libusb source, this seems to be LIBUSB_ERROR_OTHER:

https://github.com/libusb/libusb/blob/e782eeb2514266f6738e242cdcb18e3ae1ed06fa/libusb/libusb.h#L1098

I figured out this error might (amongst other reasons) also be raised
when there is an EACCES system error.

As my /dev/usb/2.2.* devices were all owned by my user (using chown)
and their ownership was not reset during testing, I tested what happens
if I run the library calls with root privileges.

I made the discovery that running the library as root works just fine!

So maybe the problem is that calling libusb_reset_device attempts to
recreate the /dev entries and has insufficient privileges? (Even though
access rights for the individual files are granted.)

Adding the entries Tomek (CeDeROM) proposed for granting privileges to
the operator group (and being member of the group) didn't help either.

> 
> This error code is carefully chosen to indicate that the USB device did 
> not respond at all to the USB set address command, which is mandatory to 
> implement. Likely the USB firmware on the device is not up and running, 
> or there is a timing issue or bug in the firmware.
> 
> --HPS

Nonetheless, there might be timing issues. In addition to the error
returned by libusb_reset_device, I get a lot of:

LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter
LIBUSB_FUNCTION: libusb10_handle_events_sub enter
LIBUSB_FUNCTION: libusb_handle_events_timeout_completed enter
LIBUSB_FUNCTION: libusb10_handle_events_sub enter
[...]

See also my original post on the myriadrf.org Forum, with a full error
output:

https://discourse.myriadrf.org/t/limesdr-mini-with-freebsd/6230


Regards,
Jan Behrens




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