Menu

#1511 Superspeed MTP getfile failed for a 500-byte file

GIT version
pending
None
1
2016-07-14
2016-02-01
Mark Kuo
No

Google Pixel C (VID=18d1 and PID=5203) supports USB3.0 USB device mode, hence it supports MTP over USB 3.0.

However, using the latest git version libmtp, a 500-byte data copy from device will fail. Attached full debug of mtp-getfile.

It seems like the ptp_usb_getdata() in libusb1-glue.c does not take Superspeed into account. It is still using PTP_USB_BULK_HS_MAX_PACKET_LEN_READ in some if statements for zero reads. The max packet length is 1024 in Superspeed so this could be where this error come from.

If I added the following code in front of ptp_usb_getdata() in libusb1-glue.c:

  • unsigned MAX_READ = PTP_USB_BULK_HS_MAX_PACKET_LEN_READ;
  • if ((ptp_usb->bcdusb & 0xFF00) == 0x0300)
  • MAX_READ = PTP_USB_BULK_SS_MAX_PACKET_LEN_READ;

and then replace all occurrences of PTP_USB_BULK_HS_MAX_PACKET_LEN_READ in that function with MAX_READ, then the 500-byte file copy will work.

I haven't done many tests so far with this fix yet. But I think this is a bug so filing this ticket for tracking.

Thanks.

1 Attachments

Discussion

  • Marcus Meissner

    Marcus Meissner - 2016-02-05
    • status: open --> pending
    • assigned_to: Marcus Meissner
     
  • Marcus Meissner

    Marcus Meissner - 2016-02-05

    hmm, we should use the maximum packetsize we already use in getpacket.

    can you try attached patch?

     
  • Mark Kuo

    Mark Kuo - 2016-07-14

    Sorry for late reply. I haven't logged in since then :P
    I saw you have merged the fix in libopenusb1-glue.c which takes ptp_usb->inep_maxpacket.
    Tried with libmtp 1.1.10 and it works. Thanks.

     

Anonymous
Anonymous

Add attachments
Cancel