-
Notifications
You must be signed in to change notification settings - Fork 5.2k
USB MIDI unplug + VL805 reset #6260
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
Comments
Duplicated by https://forums.raspberrypi.com/viewtopic.php?p=2235220 (now locked). |
@6by9 so should I post this on the raspberry/linux repo instead? To me it seems like the VL805 is cycling its VBUS, although I have not used an oscilloscope to verify this.. |
I've transferred it. It's more likely to a linux issue that a firmware issue (the firmware does nothing related to usb once kernel has started). |
Unless it's a VL805 firmware problem. |
It looks like the device in question is a full-size keyboard. Does it back-power VBus? An easy (but relatively inaccurate) way to tell is if you plug the keyboard into a powered Pi 4, let it enumerate, then unplug the USB-C port on the Pi. If you still have a red LED, then the keyboard is misbehaving. |
Ok, this was a genius suggestion! I removed the AKAI's PSU and I could just plug and unplug hundreds of times! Using another USB-powered keyboard yields the same. Thanks a lot! That still leaves the |
The answer is no: the |
You may be able to use an unpowered hub as an "insulator" |
@pelwell That's pragmatic, but otoh.. The VL805 itself is already a hub. And the Pi3B's hub doesn't suffer from this problem. |
The fact that some devices are tolerant of bad behaviour doesn't make the behaviour less bad. |
The USB specification states that the USB peripheral must not back power the USB host, so the Akai isn't compliant to the USB spec. On all Pis all the USB connectors connect the VBUS lines together. Any one USB peripheral that does dubious things to that supply rail is likely to affect all USB devices connected directly to the Pi. As for the 3B not having the same issue, you're likely down to exactly how quickly the protection circuits recover from being reverse powered to having to supply power to all the USB devices. |
Indeed, this backpowering behavior is against USB specifications. It's best to not let this issue go philosophical. I'll accept that some device manufacturers need to do their homework, but also that host manufacturers, if they have the budget (and the users), need to develop defensively. I'll leave it at that. For the Linux kernel it's more important to understand why it prints a thousand times the same messages for something as common as a broken pipe.. |
I've been testing for a few days and can conclude that the VL805 does not like USB MIDI devices getting unplugged. It may reset the entire USB bus. This means that mass storage devices are unmounted and then possibly remounted. If they contain your rootfs.. well then you can reboot. I've narrowed the issue down to systems with a VL805 on board. The Pi3 does not suffer from USB resets nor does the CM4 + CM4IO (I've unplugged 100's of times to confirm). The Pi4B is the easiest way to reproduce the problem. Since VL805 firmware is part of the Raspberry Pi firmware, I'm posting my issue here. I've also asked at https://forums.raspberrypi.com but there's no answer.
To reproduce
The issue is easy to reproduce.
journalctl -fk
Here you can clearly see that usb 2-2 (the usb stick) gets disconnected.. but I'm not touching it. I'm only touching the Akai usb plug. It happens already after a few unplugs.
pi@raspberrypi:~ $ journalctl -fk
jul 08 08:23:27 raspberrypi kernel: scsi host0: usb-storage 2-2:1.0
jul 08 08:23:28 raspberrypi kernel: scsi 0:0:0:0: Direct-Access Kingston DataTraveler 3.0 1100 PQ: 0 ANSI: 6
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: [sda] 60463659 512-byte logical blocks: (31.0 GB/28.8 GiB)
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: [sda] Write Protect is off
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
jul 08 08:23:28 raspberrypi kernel: sda: sda1
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
jul 08 08:23:28 raspberrypi kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
jul 08 08:23:29 raspberrypi kernel: exFAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
jul 08 08:24:06 raspberrypi kernel: usb 1-1.3: new full-speed USB device number 3 using xhci_hcd
jul 08 08:24:06 raspberrypi kernel: usb 1-1.3: New USB device found, idVendor=09e8, idProduct=0072, bcdDevice= 2.10
jul 08 08:24:06 raspberrypi kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
jul 08 08:24:06 raspberrypi kernel: usb 1-1.3: Product: Akai MPK25
jul 08 08:24:06 raspberrypi kernel: usb 1-1.3: Manufacturer: Akai
jul 08 08:24:06 raspberrypi kernel: usbcore: registered new interface driver snd-usb-audio
jul 08 08:24:07 raspberrypi kernel: usb 1-1.3: USB disconnect, device number 3
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: new full-speed USB device number 4 using xhci_hcd
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: New USB device found, idVendor=09e8, idProduct=0072, bcdDevice= 2.10
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: Product: Akai MPK25
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: Manufacturer: Akai
jul 08 08:24:08 raspberrypi kernel: usb 1-1.3: USB disconnect, device number 4
jul 08 08:24:09 raspberrypi kernel: usb 2-2: USB disconnect, device number 2
jul 08 08:24:09 raspberrypi kernel: sd 0:0:0:0: [sda] Synchronizing SCSI cache
jul 08 08:24:09 raspberrypi kernel: sd 0:0:0:0: [sda] Synchronize Cache(10) failed: Result: hostbyte=0x01 driverbyte=DRIVER_OK
jul 08 08:24:09 raspberrypi kernel: usb 2-2: new SuperSpeed USB device number 3 using xhci_hcd
jul 08 08:24:09 raspberrypi kernel: usb 2-2: New USB device found, idVendor=0951, idProduct=1666, bcdDevice=11.00
jul 08 08:24:09 raspberrypi kernel: usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
jul 08 08:24:09 raspberrypi kernel: usb 2-2: Product: DataTraveler 3.0
jul 08 08:24:09 raspberrypi kernel: usb 2-2: Manufacturer: Kingston
jul 08 08:24:09 raspberrypi kernel: usb 2-2: SerialNumber: 049226C3130421A019118XD1
jul 08 08:24:09 raspberrypi kernel: usb-storage 2-2:1.0: USB Mass Storage device detected
jul 08 08:24:09 raspberrypi kernel: scsi host0: usb-storage 2-2:1.0
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: new full-speed USB device number 5 using xhci_hcd
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: New USB device found, idVendor=09e8, idProduct=0072, bcdDevice= 2.10
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: Product: Akai MPK25
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: Manufacturer: Akai
jul 08 08:24:09 raspberrypi kernel: usb 1-1.3: USB disconnect, device number 5
jul 08 08:24:10 raspberrypi kernel: usb 2-2: USB disconnect, device number 3
jul 08 08:24:10 raspberrypi kernel: usb 1-1.3: new full-speed USB device number 6 using xhci_hcd
jul 08 08:24:10 raspberrypi kernel: usb 1-1.3: New USB device found, idVendor=09e8, idProduct=0072, bcdDevice= 2.10
jul 08 08:24:10 raspberrypi kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
jul 08 08:24:10 raspberrypi kernel: usb 1-1.3: Product: Akai MPK25
jul 08 08:24:10 raspberrypi kernel: usb 1-1.3: Manufacturer: Akai
jul 08 08:24:11 raspberrypi kernel: usb 2-2: new SuperSpeed USB device number 4 using xhci_hcd
jul 08 08:24:11 raspberrypi kernel: usb 2-2: New USB device found, idVendor=0951, idProduct=1666, bcdDevice=11.00
jul 08 08:24:11 raspberrypi kernel: usb 2-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
jul 08 08:24:11 raspberrypi kernel: usb 2-2: Product: DataTraveler 3.0
jul 08 08:24:11 raspberrypi kernel: usb 2-2: Manufacturer: Kingston
jul 08 08:24:11 raspberrypi kernel: usb 2-2: SerialNumber: 049226C3130421A019118XD1
jul 08 08:24:11 raspberrypi kernel: usb-storage 2-2:1.0: USB Mass Storage device detected
jul 08 08:24:11 raspberrypi kernel: scsi host0: usb-storage 2-2:1.0
jul 08 08:24:11 raspberrypi kernel: usb 1-1.3: USB disconnect, device number 6
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: new full-speed USB device number 7 using xhci_hcd
jul 08 08:24:12 raspberrypi kernel: scsi 0:0:0:0: Direct-Access Kingston DataTraveler 3.0 1100 PQ: 0 ANSI: 6
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: Attached scsi generic sg0 type 0
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: [sda] 60463659 512-byte logical blocks: (31.0 GB/28.8 GiB)
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: [sda] Write Protect is off
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: [sda] Mode Sense: 43 00 00 00
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
jul 08 08:24:12 raspberrypi kernel: sda: sda1
jul 08 08:24:12 raspberrypi kernel: sd 0:0:0:0: [sda] Attached SCSI removable disk
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: New USB device found, idVendor=09e8, idProduct=0072, bcdDevice= 2.10
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: New USB device strings: Mfr=1, Product=2, SerialNumber=0
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: Product: Akai MPK25
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: Manufacturer: Akai
jul 08 08:24:12 raspberrypi kernel: exFAT-fs (sda1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
jul 08 08:24:12 raspberrypi kernel: usb 1-1.3: USB disconnect, device number 7
Expected behaviour
I expected that the PI4B would just disconnect the USB MIDI device alone.
Actual behaviour
It disconnects two USB devices, including the mass storage device.
System
pi@raspberrypi:~ $ cat /proc/cpuinfo |grep Model
Model : Raspberry Pi 4 Model B Rev 1.4
cat /etc/rpi-issue
Raspberry Pi reference 2024-03-15
Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, f19ee211ddafcae300827f953d143de92a5c6624, stage2
vcgencmd version
May 24 2024 15:30:04
Copyright (c) 2012 Broadcom
version 4942b7633c0ff1af1ee95a51a33b56a9dae47529 (clean) (release) (start)
uname -a
Linux raspberrypi 6.6.31+rpt-rpi-v8 raspberrypi/firmware#1 SMP PREEMPT Debian 1:6.6.31-1+rpt1 (2024-05-29) aarch64 GNU/Linux
Logs
If applicable, add the relevant output from
dmesg
or similar.TODO: journalctl -fk log
Additional context
Unplugging other devices such as usb mice, or a USB stick hundreds of times yield no such trouble. Tested this on the same Pi4B system and on several CM4 boards that have VL805's.
There are different, but related problems, as well. At one point an I2S based alsa device was unreachable. If that's the case, it may also be there's a dangerous bug in one of the kernel modules.. which means i'll have to post this in the kernel repo as well.
Additionally, if you monitor incoming midi data with the standard alsa tool
amidi
:amidi -d -phw:3,0,0
then you'll see hundreds, even thousands of
urb status -32
messages flying around injournalctl -fk
(ordmesg
)even up to the point of the kernel message buffer getting flooded over and over. this does not sound healthy.
needless to say, this is a bog standard pi4b and a bog standard raspberry os lite bookworm.
The text was updated successfully, but these errors were encountered: