hanwen / go-mtpfs

Mount MTP devices over FUSE
Other
680 stars 85 forks source link

Use GetPartialObject() in classic mode when possible #124

Open mcuelenaere opened 7 years ago

mcuelenaere commented 7 years ago

Some Android devices do not seem to implement the Android MTP extensions, yet still support GetPartialObject. Use it when the file size is less than MaxUint32 and when there aren't any pending writes to file being read.

NOTE: this works for me, though I am still hitting the fatal error got type 0 (CONTAINER_UNDEFINED) in response, want CONTAINER_RESPONSE.; closing connection bug from time to time; which I'm taking is unrelated to this change (as this is a high-level change and that bug is more lower-level related)

hanwen commented 7 years ago

code looks roughly OK. Can you confirm that this case has test coverage?

Did you fill in the Google CLA? (https://cla.developers.google.com/about/google-individual)

mcuelenaere commented 7 years ago

@hanwen what do you mean by test "coverage"? Whether it is handled by device_test.go? Like I said, the patch works for me, except some of the times I get the null packet issue (which should be unrelated to this change).

I have signed the Google CLA for a different project already, so yes.

hanwen commented 7 years ago

yes, if you insert a panic into your changed code, does device_test generate a panic? If yes, then it's OK.