-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PIO USB Host Example programs can crash on device unplug #8
Comments
@rppicomidi When i connect midi device (multifx) directly into port it has no issue, but when using hub it has problem when disconnect or remove from hub port, so i trying with flashdisk since i dont have another midi device, and it works for detect plug and removed it in hub port, maybe it because flashdisk msc and not being enumerate by midih_open? my case when using hub its need to remove entire hub to stop midi device crashing, maybe the problem is hub_addr and hub_port not being configured for tracking? adding hub configuration for enumeration tuh_midi_mount_cb maybe its help for clean up midih_close / tuh_midi_umount_cb later for detect spesific midi device removed from hub port. by the way pio_usb_host_add_port can be used to add another physical usb host, the behavior its start indexing by 1 from any port, it my recent option for connecting 2 device without hub. |
@fikryfadh I believe I have figured out what is going wrong with MIDI that does not happen with MSC. MIDI continuously polls the IN endpoint. The MSC driver does not. During unplug, I observe the IN endpoint transfer poll failing (which it should; the device is not there), and then the hub event transfer fails. The hub event interrupt endpoint needs to send back the unplug event successfully or the hub driver won't be able to detect the unplug event. It is not clear why the hub transfer fails. I should have mentioned that I am doing my testing with the usb_midi_host driver directly; so the lower layer driver fails before this one gets a chance to. |
It is not clear to me why the hub IN transfer immediately after the failed transfer from the unplugged device also fails. However, the following work-around (patch to TinyUSB) makes the problem go away on my system. Consider this a hack for now. I will file an issue on the TinyUSB website.
|
The previous fix is not reliable. Needs more investigation. |
I pushed a fix to the usb_midi_host driver. Now the fix is reliable. I have filed issue hathach/tinyusb#2971 to the TinyUSB project. |
For the EZ_USB_MIDI_HOST_PIO_example programs, both C++ and Arduino, the example programs will lock up most of the time on USB device unplug when used with a powered hub. The code seems to crash in the Pico PIO USB library. The issue needs investigation, but the behavior make is seem that the hub does not notice the device has been unplugged.
I do not observe the same issue with the same Pico W and USB hub hardware with the pico-usb-host-msc-demo project. Perhaps there is a bug in the usb_midi_host driver.
The text was updated successfully, but these errors were encountered: