Christos Zoulas <chris...@astron.com> wrote:

> Isn't there a way to reset it?

I tried various way to reset it without a reboot and never got it to a
working state.

The test is to get it stuck, then detach/reattach:
drvctl -u ugen0
drvctl -r -a usbdevif uhub1

On vanilla kernel, usbd_probe_and_attach() fails on
usbd_set_config_index() because of USBD_TIMEOUT.

When usbd_set_config_index() fail, I tried reccovery tactics before
calling usbd_set_config_index() again: reseting the port, resetting xhci
controller (calling xhci_hc_reset). It does not change anything.

I also tried changing uhub_rescan() which is called by drvctl -r so that
it uses the boot-time uhub_explore(), it does not change anyting either.

And finaly, I hacked usbd_set_config_index() so that USBD_TIMEOUT are
not fatal. Since I provide fake descriptors the function can proceed and
re-attach ugen0, but it is still in unresponsive state.

Now I have the feeling the fake descriptor patch is able to recover on
reboot, but that it is with the help of some state change by the BIOS.
It seems none of the initialization steps we do in NetBSD is enough.

I note the problem also happened in Linux and it seems it was tracked
down to story about a toggle bit, but unortunately, the library-level
workaround does not work on NetBSD, probably because our kernel USB
stack tries to do some extra thing to the device: 
https://github.com/nfc-tools/libnfc/issues/114


-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
m...@netbsd.org

Reply via email to