-
Notifications
You must be signed in to change notification settings - Fork 2
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
MTP (Media Transfer Protocol) #12
Comments
mtpmount works well as a standalone executable, with some caveats. dokan must be installed as prerequisite. Fortunately, dokan has .msi installers for both 32bit and 64bit (32bit installer cannot be used on 64bit system), and mtpmount has standalone executables (no install needed) for both 32bit and 64bit. Just run the dokan .msi, then download the mtpmount executable, and use it as in the mtpmount readme except that the pound sign must (apparently) be double-quoted in powershell:
After it's mounted as a drive letter that wrapper.py will be searching for, GPSIO works normally. After that, dismounting from the command line is interesting:
the terminal pauses for about 5 seconds here
So if this is the correct route to pursue, here are some key considerations:
|
If a stale device number is in the table returned by 'list available', then a subsequent mount command on that id will return something like this: Cannot establish connection to device. Is 5 really connected (and spelled correctly)? |
If an MTP device is already mounted (such as on subsequent call to the mount command), the 'list available' table will return something this: |-- Storage Internal Storage [ID #3] (is mounted) So, don't try to mount it again. |
Tried a hot-unplug; the device seems fine (at first glance) but Windows file navigator still has an entry for that drive letter - trying to eject it raises an error, but, the file system appears to still be there, fully cached? You can browse the j: drive in the file navigator and even edit a file (though I didn't try to save it). Then, I ran 'mtpmount unmount j:' - subsequent attempts to explore the folder in the windows file navigator show this popup: The next time you plug in a MTP device, the drive list is refreshed i.e. j: is removed from the list. Would be interesting to see if also gets refreshed after plugging in a Mass Storage device. |
Ok - so the mounting seems to go well (not sure if the above issues will be a real problem - it may be just as well to do the unmount command before returning from wrapper.py). BUT - viewing one of the gpx files on the mounted drive letter - it is all just binary goop - not xml. Looks like there might be an issue with the mount encoding or something like that... |
The binary goop issue was resolved by a restart. wrapper.py was able to proceed, and viewing a gpx file from the mounted drive, it was xml as expected. We could just call this a fluke, but, during research I saw a note somewhere that it's probably a good idea to restart after installing anything that futzes with the file system. So,
For the immediate term, you get the Unexpected disconnect error in the browser, which means the operator should do file browser transfer anyway, but, something more useful might be helpful (like a message that says 'the drive mounting process did not work - try restarting your system' or such. If it happens repeatedly, well, that's another issue... |
Probably a bug in dokany or mtpmount:
|
the same ghost files appear even if you mount it as a different drive letter. The ghost files have a file size (2kb or so) but when you edit them in vi they are empty. So it seems like a decent workaround may be to just check every file to make sure it starts with and ends with otherwise move on, BUT, the files that do appear when navigating to the MTP drive in Windows file browser, do NOT appear (or are empty) on the mounted drive. That's a problem. |
Not sure if this stackoverflow question has been linked to this issue yet: |
This was discovered as part of #10.
Several models are now MTP and more will be MTP in the future. So: let's get it going!
Googling and searching on stackoverflow hasn't turned up any brilliant leads yet as far as making MPT part of a turnkey installable solution. There is a tool for sale that mounts up MTP with drive letters in Windows: mtpdrive.com so maybe that's a lead, but the free version looks pretty limiting and is probably not turn-key installable as part of GPSIO anyway.
The closest seems to be: https://drautb.github.io/2015/07/27/the-perfect-exchange-mtp-with-python/ but it looks like this will require some work on PyMTP - looks like it's python 2, and it's not clear if libmtp is included or not.
The text was updated successfully, but these errors were encountered: