Re: Forcing re-enumeration of a chosen USB device from userspace?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Aug 08, 2024 at 08:39:21AM +0200, Michał Pecio wrote:
> Hi,
> 
> I have a buggy USB device which works fine if connected before booting
> Linux and also starts to work if I unbind and rebind the XHCI driver.
> 
> On the other hand, hot plugging the device with the driver already
> running usually results in invalid descriptors being returned and
> sometimes even if the descriptors are right, the device still doesn't
> function entirely normally. I suspect a race between initialization of
> its internal state and enumeration by the host, nothing I can fix.
> 
> Rebinding XHCI driver forces new enumeration of the device and reliably
> fixes all issues every time, but it has the obvious downside of also
> resetting everything else on this bus.
> 
> Can I have the same effect selectively, for one chosen device only?

You can reset the device by using the usbreset program, which is part of 
the usbutils package.  Some distributions (such as Ubuntu) include it 
whereas others (such as Fedora) don't.  But if you don't have it, you 
can get the source code from https://github.com/gregkh/usbutils/ and 
build it yourself.

If the reset causes some descriptors to change, the kernel will 
re-enumerate the device.

Alan Stern




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux