How To: Programatic USB Reset

Just wanted to post a procedure I found handy for resetting my LimeSDR Mini on macOS (there are similar methods in Linux, I just haven’t tested that). I found that when I bounced between different software (such as CubicSDR, LimeSuite, and PothosFlow, for example), the device wouldn’t always be released properly. One would get an error message similar to this:

USBDeviceOpen: another process has device opened for exclusive access

The effective fix was to physically remove the USB device and re-plug it into the computer. But I wanted to find a software-based solution to release the device. Here’s what I ended up getting to work on mac:

USB\ Prober.app/Contents/Resources/reenumerate -v 0x0403,0x601f
Verbose mode ON
Looking for vid: 0x403, pid: 0x601f
Found "LimeSDR Mini" @ 0x14600000
Calling USBDeviceReEnumerate
USBDeviceReEnumerate returns 0x00000000

The Vendor ID (vid) and Product ID (pid) are important to find here. The values here should vary with the normal LimeSDR. There are many ways to get this, like:

  • system_profiler SPUSBDataType | grep -A 10 -B 10 LimeSDR
  • Navigate to About this Mac > System Report > HW > USB > LimeSDR Mini

You will also notice that the USB Prober.app is needed. This doesn’t come with the mac by default, but can be downloaded from Apple

  • Search for and download the latest IOUSBFamily Log Release (e.g.
  • Mount the .dmg and navigate to the directory with IOUSB-XXXXXX-log.
  • DO NOT install. Just right click the package and “Show Package Contents”
  • Unzip the Archive.pax.gz; the file USBProber.app will be in /Archive/DevTools/Hardware
  • Move this file somewhere notable, like /usr/local/bin in your PATH

I originally attempted to get something to work via a quick program with pyusb (which uses libusb behind the scenes), but couldn’t get this working. I believe this has something to do with how other applications register use of the device. If anyone has any insight into how to get a more generic, platform-agnostic way to resetting the USB Device to work, that’d be a great next step to share with the community. In case anyone wants a reference to the API for libusb, here it is: http://libusb.sourceforge.net/api-1.0/group__libusb__dev.html

Hope this helps someone!

1 Like

Hi. Very interesting - I had looked for the same thing under Windows but did’t find anything. You mentioned Linux also - any tip about it?

You can do it via writing an USBDEVFS_RESET ioctl to the device in Linux. One quick program to do this is found at: http://www.roman10.net/2011/05/04/how-to-reset-usb-device-in-linux

Finding the correct USB device can be determined from dmesg output or looking for the appropriate vendor ID and/or product ID similar to grep 601f /sys/bus/usb/devices/*/idProduct for the LimeSDR Mini. Then you should be able to translate the numbers on the bus to the /sys/bus/usb/0XX/0YY path

Remember:
LimeSDR Mini: idVendor=0403, idProduct=601f
LimeSDR Normal: idVendor=1d50, idProduct=6108

I haven’t gotten around to testing it, but it also looks like roman has a method of doing this via libusb, which would be cross-platform compatible: http://www.roman10.net/2011/06/14/how-to-reset-usb-device-in-linuxusing-libusb/

Let me know if you’re able to get the libusb version working.