Menu

#1071 Photo corrupted when downloading from android phone via mtp

Last release
closed
None
1
2014-08-24
2014-06-14
Yves-Alexis
No

Hi,

I own a android phone, a Sony Xperia Z1 Compact (0fce:01a7). Trying to download pictures from USB gives corrupted files:

  • cairo-based readers can't open them with: Error interpreting JPEG image (Application transferred too few scanlines)
  • feh/display shows them up to few blocks at the end (see attached file)

If the file is on the external sdcard, I can mount it just fine using UMS (or removing the sdcard and putting in on the computer) and transfer the file, which is correct (see attached file), so the camera correctly took the picture and it fails at transfer time.

I've tried transferring videos and they seem to play fine, but that doesn't mean much.

Unfortunately, I can't test on a Windows computer so there's still the possibility the bug lies in the phone firmware, I'll try to find a way to test and {con,in}firm that.

Attached are two files: ums.jpg transferred using USB mass storage, and mtp.jpg, using mtp-getfile (same thing happens with gvfs-mtp). You can see that filelengths are not the same and the MTP size is not correct:

corsac@scapa: mtp-getfile 12974 mtp.JPG
Unable to open ~/.mtpz-data for reading, MTPZ disabled.libmtp version: 1.1.6

Device 0 (VID=0fce and PID=01a7) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
Android device detected, assigning default bug flags
Getting file/track 12974 to local file mtp.JPG
Progress: 3140200 of 3140200 (100%)
corsac@scapa: =ls -l mtp.JPG ums.JPG
-rwxr----- 1 corsac corsac 3015156 juin 14 15:50 mtp.JPG
-rw-r--r-- 1 corsac corsac 3140184 juin 14 15:47 ums.JPG

Also note that mtp-files shows:

File ID: 12974
Filename: DSC_0001.JPG
File size 3140184 (0x00000000002FEA58) bytes
Parent ID: 12973
Storage ID: 0x00020001
Filetype: JPEG file

and you can note discrepancies between the various size:

  • UMS/mtp-files have 3140184
  • mtp-getfile wants to downloads 3140200
  • final size is 3015156

If you need more information, please ask.

2 Attachments

Discussion

  • Yves-Alexis

    Yves-Alexis - 2014-06-14

    And I've just tried with git HEAD (I had to remove some use_mtpz variables which leaded to unresolved symbols):

    corsac@scapa: examples/mtp-connect --getfile 12974 mtp.JPG
    libmtp version: 1.1.6

    Device 0 (VID=0fce and PID=01a7) is UNKNOWN.
    Please report this VID/PID and the device model to the libmtp development team
    Android device detected, assigning default bug flags
    Get file 12974
    Getting 12974 to mtp.JPG
    Unknown options: mtp.JPG 200 (100%)
    corsac@scapa: =ls -l mtp.JPG
    -rwxr----- 1 corsac corsac 3015156 juin 14 17:10 mtp.JPG

    Note the “Unknown options” (??) and the wrong filesize.

     
  • Yves-Alexis

    Yves-Alexis - 2014-06-14

    Something important I forgot to mention is that I'm using Debian sid.

    This evening I got a libmtp package update with the following changelog:

    libmtp (1.1.6-51-g1a2669c~ds0-2) unstable; urgency=medium

    [ David Bremner ]

    • Disable async buffering (Closes: #745888).

    -- Alessio Treglia alessio@debian.org Sat, 14 Jun 2014 11:15:23 +0100

    Looking at https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745888 it sure looks related, so I did a quick try.

    Opening the file directly (using a gvfs compatible image viewer like gthumb or ristretto) still doesn't work (and shows a "libmtp error: Unknown error, but maybe that's expected, I don't know), but doing a copy/paste from file manager to a local folder and opening from there did work. And now the file is:

    -rwxr----- 1 corsac corsac 3140184 juin 14 22:24 DSC_0001.JPG

    So it sure looks like async buffering doesn't work here.

     
  • Linus Walleij

    Linus Walleij - 2014-08-24
    • status: open --> closed
    • assigned_to: Linus Walleij
     
  • Linus Walleij

    Linus Walleij - 2014-08-24

    Fixed by patch reverting the buffered transfers, came from Debian.

     

Anonymous
Anonymous

Add attachments
Cancel





MongoDB Logo MongoDB