-
Notifications
You must be signed in to change notification settings - Fork 55
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
mp4 files cannot be played directly, need to be copied first. #108
Comments
Can you make a wireshark usb dump ? |
I'll look into wireshark. For now, I've attached umtprd debug logs showing the process of navigating to the folder where the file is located, then double clicking on the file to open it with Windows Media Player. (note that this logging is with #112 applied, so it'll look slightly different than what you're used to) I also tried without debug logs, in case the problem is related to logging, or because enabling debug logs also disables compiler optimizations, but it behaves the same with and without logs/debug mode. These logs are from a Raspberry Pi Zero 2 W, not the Raspberry Pi Zero W that I originally tried. |
Here's a Wireshark capture. Not sure I did it right, since it seems a bit short. |
For what's worth, I also tried using gadgetfs instead of functionfs, which behaved the same when trying to play a file, but caused the Pi to go into an infinite loop and become unresponsive when stopping umtrpd. |
Also, to make sure the problem isn't with Windows or Media Player I copied the same test video to my Pixel 5, and verified that Windows/Media Player could play the file just fine when accessing the file using MTP from the Pixel 5. |
I am interested by a wireshark dump with the Pixel 5 too. Anyway this is for sure related to the Setup Request 0x64 MTP_REQ_CANCEL operation sent by the PC (probably the URB_FUNCTION_ABORT_PIPE in the wireshark capture). This seems to kill the whole stack and i am really not sure how to handle this properly ... |
Here's a capture of the Pixel 5. Started Wireshark, then enabled the "File transfer / Android Auto" USB mode, then opened the "Pixel 5" device in Windows and played the test file. |
That request doesn't happen until Media Player has already been spinning for 30 seconds or so though, so that can't be the reason why it doesn't start playback. |
Correction: it might be the MTP_CANCEL_REQ that is the problem, however it doesn't seem like it is caused by the URB_FUNCTION_ABORT_PIPE from the host, since I don't see that ...ABORT_PIPE until it already hangs. I looked in to this some more, and it appears the problem is that this call to write_usb blocks forever. I tried enabling CONFIG_USB_NON_BLOCKING_WRITE but that didn't help (it still blocks on the call to Edit: I also tried rewriting the do/while inside of write_usb to poll and then write one byte at a time, but that doesn't work at all, it writes one byte, then blocks on the second byte despite |
Found a fix: 1e6936a Not sure if this is the right solution, and note that there are several other places that do |
Same issue : |
Another one : |
This one is interesting : |
Those other issues all seem to talk about kernel crashes/segfaults, which I'm not seeing. I'm just seeing that (this is using kernel 6.6.51 in case that matters) |
can you try to cancel a big file transfer (from and to the device) ? |
Copying a large file from Windows to the device I noticed the following:
Copying a large file from the device to Windows:
If I remove the |
ok ! |
It looks like it is device dependent. I just tried this on a Rock Pi 4C+ running Armbian with kernel 6.1.63, and removing the However, also on the Rock Pi 4C+, I could only get it to work if I connect the device to the PC as a USB2 device. When using it as a USB3 device, mtprd starts up seemingly fine and there are no errors in umtprd's debug log or dmesg, but the PC complains about "USB device not recognized", while USB Device Tree Viewer says there's a port malfunction. Unrelated to this, but I also found that Windows apparently caches the product name of the device based on the serial number. Once it has seen device with a serial number 'S' and name 'N', any subsequent device that uses serial number 'S' will be shown with name 'N' in Explorer, even if a different name is used in strings/0x409/product. Right-clicking on the device and selecting 'properties' shows both the cached name 'N' and the actual name from the product string. |
Doing a blocking read (even with count=0) when handling a cancel request from the host ends up blocking both the read in the request handler as well as a write in the thread that's being cancelled, blocking both threads indefinitely. Removing the read appears to fix the problem. Fixes viveris#108
I set this up on a Raspberry Pi Zero W and pointed it at a folder full of mp4 files. The files show up on the attached Windows 10 PC, and Windows by default opens them with Media Player, however they won't play (Media Player just shows the progress spinner animation forever).
If I copy (using drag&drop) them to the Windows hard drive first, the files can be played from there.
The text was updated successfully, but these errors were encountered: