[CentOS] How to reset the USB subsystem?

Fri Jan 15 10:36:00 UTC 2021
Simon Matter <simon.matter at invoca.ch>

> On Fri, 15 Jan 2021 08:34:13 +0100
> "Simon Matter" <simon.matter at invoca.ch> wrote:
>
>> > On 01/14/2021 03:00 PM, Zsolt SZ wrote:
>> >> On Thu, Jan 14, 2021 at 5:22 PM Frank Bures <listfrank1 at gmail.com>
>> >> wrote:
>> >>> Is there a way how to reset the USB subsystem the same way one can
>> >>> restart
>> >>> networking or X without the necessity to reboot?
>> >> I am using Debian but the usbutils package has the usbreset
>> >> application which works great for me. I had issues with my DVB-C USB
>> >> receiver and usbreset did the task quite well.
>> >>
>> >> This one, there is RPM as well:
>> >>
>> >> http://ftp.rpmfind.net/linux/rpm2html/search.php?query=usbutils
>> >>
>> >> BR, Zsolt
>> >> _______________________________________________
>> >> CentOS mailing list
>> >> CentOS at centos.org
>> >> https://lists.centos.org/mailman/listinfo/centos
>> >
>> > I have usbutils for CentOS 7 installed but it does not seem to include
>> > usbreset??
>>
>> The packages in RHEL/CentOS 7/8 are too old.
>>
>> Simon
>>
>
> Fedora 33, usbutils-012-5.fc33.x86_64.
> [~]$ usbreset
> bash: usbreset: command not found
>
> BR, Bob

Okay, here we go:

$ wget https://github.com/gregkh/usbutils/raw/master/usbreset.c
--2021-01-15 11:33:30-- 
https://github.com/gregkh/usbutils/raw/master/usbreset.c
Resolving proxy (proxy)... 192.168.1.10
Connecting to proxy (proxy)|192.168.1.10|:8080... connected.
Proxy request sent, awaiting response... 302 Found
Location:
https://raw.githubusercontent.com/gregkh/usbutils/master/usbreset.c
[following]
--2021-01-15 11:33:30-- 
https://raw.githubusercontent.com/gregkh/usbutils/master/usbreset.c
Connecting to proxy (proxy)|192.168.1.10|:8080... connected.
Proxy request sent, awaiting response... 200 OK
Length: 4084 (4.0K) [text/plain]
Saving to: ‘usbreset.c’

100%[======================================>] 4,084       --.-K/s   in 0s

2021-01-15 11:33:30 (51.0 MB/s) - ‘usbreset.c’ saved [4084/4084]

$ gcc -o usbreset usbreset.c
$ ./usbreset
Usage:
  usbreset PPPP:VVVV - reset by product and vendor id
  usbreset BBB/DDD   - reset by bus and device number
  usbreset "Product" - reset by product name

Devices:
  Number 001/002  ID 04d9:1400
  Number 006/002  ID 090c:1000  Flash Drive FIT