Media Transfer Protocol MTP (SOLVED)

Using applications, configuring, problems
Message
Author
tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#31 Post by tempestuous »

can8v wrote:sometimes after the

Code: Select all

fusermount -u MTPdevice
command the device is still mounted.
Could the problem be that the go-mtpfs process is still running, and possibly remounting your device?
Earlier in this thread when I suggested using the "&" to background the process, I was actually a little worried about this.
I suggest you experiment by fully shutting down go-mtpfs before running the "fusermount -u" command.

There's another small potential problem I see -
can8v wrote:

Code: Select all

cd /mnt
go-mtpfs "MTPdevice" &
This will mount your device at /mnt/MTPdevice
... but does that directory need to be created, first ??

tempestuous
Posts: 5464
Joined: Fri 10 Jun 2005, 05:12
Location: Australia

#32 Post by tempestuous »

can8v wrote:I borrowed a second Nexus 7 from my wife, then connected both MTP devices to USB ports ...
...
and the Pup Camera application kept popping up ...
Yes, the guilty udev rule is /etc/udev/rules.d/88-puppy-autodetect.rules
specifically, this line -

Code: Select all

ACTION=="add", SUBSYSTEM=="usb", ENV{INTERFACE}=="6/1/*", RUN+="/usr/sbin/pupautodetect camera"
You could either comment out this line, or delete/shift this entire udev rule altogether.

can8v
Posts: 586
Joined: Sat 15 Jul 2006, 08:20
Location: Yuba City, CA
Contact:

#33 Post by can8v »

tempestuous wrote:
can8v wrote:sometimes after the

Code: Select all

fusermount -u MTPdevice
command the device is still mounted.
Could the problem be that the go-mtpfs process is still running, and possibly remounting your device?
Earlier in this thread when I suggested using the "&" to background the process, I was actually a little worried about this.
I suggest you experiment by fully shutting down go-mtpfs before running the "fusermount -u" command.

There's another small potential problem I see -
can8v wrote:

Code: Select all

cd /mnt
go-mtpfs "MTPdevice" &
This will mount your device at /mnt/MTPdevice
... but does that directory need to be created, first ??
Yes the directory needs to be created first. I should not have assumed people would realize to use the script without modification you would have to create this directory instead of /root/MTP. I am going to modify the script to look for the directory and create it if necessary and also change the unmount script to display a nicer splash message and hopefully have a 100% success rate, making the splash message nothing more than insurance.

gcmartin

#34 Post by gcmartin »

Can8v wrote: ... Yes the directory needs to be created first. I should not have assumed people would realize to use the script without modification you would have to create this directory instead of /root/MTP ...
I am wondering if what @Tempestuous shares was " is there anything already in /dev (or Linux) that can be/should be used?"

can8v
Posts: 586
Joined: Sat 15 Jul 2006, 08:20
Location: Yuba City, CA
Contact:

#35 Post by can8v »

Here is my working copy of my unmount script. It uses notify for the safe to eject MTP device message. I am now satisfied with the mount/unmount scripts and don't see any changes in the future, but you never know.

Code: Select all

#!/bin/bash
# Put this script in the /root/my-applications/bin directory and make it executable
# Change directory to the mount point for the MTP device.
# In Thunar make a custom right click action that will execute this script, so that you can unmount your MTP device at any time from the right click menu in Thunar.
# Edit->Configure Custom Actions THen on the command line enter this script unmountMTP.sh it should find it if you have it in the /root/my-applications/bin directory.
# A similar setup should be available in other filemanager such as ROX, though I don't use them, so I cannot advise on how to set them up.
cd /mnt
# unmounts the MTP device.
fusermount -u MTPdevice
# Detect if MTP device unmount was successful.
# Looking for an empty mount directory so we need an empty variable
FILE=""
#Specify the directory the device was mounted to.
DIR="/mnt/MTPdevice"
# look for empty MTP mount directory
if [ "$(ls -A $DIR)" ]; then
    MOUNT_STATUS="MTP Device is still mounted. Please unmount the device before removing it."
else
    MOUNT_STATUS="MTP device unmounted successfully. It is now safe to remove your MTP device"
fi
# echo the MOUNT_STATUS variable in case the script is being run from the terminal
echo $MOUNT_STATUS
# Use GTK Dialog in case the script is being run from outside the terminal
export MAIN_DIALOG='
 <vbox>
  <text>
    <label>'$MOUNT_STATUS'</label>
  </text>
 </vbox>'
notify-send -t 6000 -i usbpendrive_unmount "$MOUNT_STATUS" 
Thanks again to Tempestuous, for compiling go-mtpfs and turning me onto it.

Sylvander
Posts: 4416
Joined: Mon 15 Dec 2008, 11:06
Location: West Lothian, Scotland, UK

#36 Post by Sylvander »

I use xfe and ROX...
Plus...
I'm no Puppy/Linux expert.
Any chance of a PET file [to do the above] for me?

gcmartin

#37 Post by gcmartin »

Or should this somehow land in WOOF-CE for system building?

can8v
Posts: 586
Joined: Sat 15 Jul 2006, 08:20
Location: Yuba City, CA
Contact:

#38 Post by can8v »

@gcmartin I think it should.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#39 Post by 01micko »

Some interesting results with my wife's gear.. (mine's pretty cool too can8v :wink: )
  • Samsung Galaxy Note (1st version, jellybean)
    Samsung Galaxy Tab 3 (recent model, jellybean)
Here is my udev rules file (ref), including my Galaxy W (GT-I8150 - which lsusb id's as Galaxy S2!) and the Nexus 7:

Code: Select all

# MTP mode under ICS 4.0+ : automatic mount & umount when plugged (USB debug on & off)
ENV{ID_MODEL}=="Nexus_7", ENV{ID_MODEL_ID}=="4e41", ACTION=="add", RUN+="/usr/sbin/pupautodetect android-device"
ENV{ID_MODEL}=="GT-I8150", ENV{ID_MODEL_ID}=="6860", ACTION=="add", RUN+="/usr/sbin/pupautodetect android-device"
ENV{ID_MODEL}=="SAMSUNG_Android", ENV{ID_MODEL_ID}=="6860", ACTION=="add", RUN+="/usr/sbin/pupautodetect android-device"
Yes, yes, I hacked /usr/sbin/pupautodetect to run a different proggy (my script) when detected, which works nicely; more later on that.

Note that the Note and the Tab mount under the same rule.. sadly pupcamera pops up with those too, so there is possibly something in the Samsung ROM causing that (or perhaps its a jellybean thing). Neither my Nexus 7 (2012 - kit-kat 4.4.2) or my Galaxy W (CyanogenMod 9 [= ICS, 4.04], basically stock Android) pop up pupcamera.

dmesg output (you can see the same device ID but different serial number for Note [1st] and Tab) :

Code: Select all

[   29.281515] usb 2-3: new high-speed USB device number 2 using ehci-pci
[   29.407007] usb 2-3: New USB device found, idVendor=04e8, idProduct=6860
[   29.407021] usb 2-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[   29.407030] usb 2-3: Product: SAMSUNG_Android
[   29.407037] usb 2-3: Manufacturer: SAMSUNG
[   29.407042] usb 2-3: SerialNumber: 0019783c0e622f
[   77.219213] usb 2-3: USB disconnect, device number 2
[  134.629481] usb 2-3: new high-speed USB device number 3 using ehci-pci
[  134.755762] usb 2-3: New USB device found, idVendor=04e8, idProduct=6860
[  134.755776] usb 2-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[  134.755785] usb 2-3: Product: SAMSUNG_Android
[  134.755792] usb 2-3: Manufacturer: SAMSUNG
[  134.755798] usb 2-3: SerialNumber: 520004e442e9a000
[  137.731896] usb 2-3: USB disconnect, device number 3
[  137.987887] usb 2-3: new high-speed USB device number 4 using ehci-pci
[  138.113197] usb 2-3: New USB device found, idVendor=04e8, idProduct=6860
[  138.113210] usb 2-3: New USB device strings: Mfr=2, Product=3, SerialNumber=4
[  138.113218] usb 2-3: Product: SAMSUNG_Android
[  138.113225] usb 2-3: Manufacturer: SAMSUNG
[  138.113231] usb 2-3: SerialNumber: 520004e442e9a000
[  236.163979] usb 2-3: USB disconnect, device number 4
Still mount and unmount fine. Phone says "phone" in /mnt/MTPdevice, tablet says "tablet".. well "duh..!"

Now I just have to con the son into letting me test his Nexus 5 (Chrissy pressy).

:roll:
Puppy Linux Blog - contact me for access

gcmartin

#40 Post by gcmartin »

Reprinted above
Last edited by gcmartin on Sun 26 Jan 2014, 00:15, edited 2 times in total.

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#41 Post by 01micko »

gcmartin wrote:@01Micko: Did you test from Slacko64 or Slacko?
Both
gcmartin wrote:Another question for anyone
  • Has this advanced far enough along to be a PET?
Thanks in advance
Not yet.
Puppy Linux Blog - contact me for access

gcmartin

#42 Post by gcmartin »

Questions for @01Micko
  • Is your MTP generalized for any MTP device?
    ---->OR<----
  • Would it help if everyone who has a MTP device forward their IDs somewhere so that mounting could occur by deviceID?
  • Wondering too, what would happen at mount times when you mount, say, both of your wife's devices (namely the Note and the Tab), simultaneously?
I can't help as I have a NOTE as well. But rest of the community can forward deviceID, I'm sure.
Last edited by gcmartin on Sun 26 Jan 2014, 00:35, edited 2 times in total.

gcmartin

#43 Post by gcmartin »

Wondering
Would this addition mount older cell phones, say, Motorola RaZr, etc?

If so, this would eliminate the need for specialize Windows programs to transfer information.

Hummm???

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#44 Post by 01micko »

Should be able to auto generate specific rules for a device as it is plugged. So no need of stats.

It should work with most mtp based phones I guess, I don't know if its android specific. Maybe not.

Many older phones mount as mass storage anyway. Before I had GingerBread on the old sammy and it just appeared on the desktop as a usb device. Mounted easily.
Puppy Linux Blog - contact me for access

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#45 Post by smokey01 »

Thanks for this.

It works great on Slacko64.

I tried it in FatDog-611, not so good although it did work. A rule had to be created each time. It did not automatically detect the device. It didn't identify my Samsung Galaxy S4 but allowed me to transfer, play and view files nevertheless.

A much needed piece of software.

User avatar
Ted Dog
Posts: 3965
Joined: Wed 14 Sep 2005, 02:35
Location: Heart of Texas

#46 Post by Ted Dog »

smokey could you host this for whatever reason cant download this from Ts host.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#47 Post by smokey01 »

Have you tried right clicking and save file as.

Here they are: http://www.smokey01.com/software/system

gcmartin

#48 Post by gcmartin »

This would be interesting to see if an iPhone or iPad would mount in any distro which uses this protocol.
Anyone have an iPhone they are willing to attach to a PUP?

User avatar
Billtoo
Posts: 3720
Joined: Tue 07 Apr 2009, 13:47
Location: Ontario Canada

#49 Post by Billtoo »

smokey01 wrote:Thanks for this.

It works great on Slacko64.

I tried it in FatDog-611, not so good although it did work. A rule had to be created each time. It did not automatically detect the device. It didn't identify my Samsung Galaxy S4 but allowed me to transfer, play and view files nevertheless.

A much needed piece of software.
I tried the pets in Slacko64 and they work with my nexus 7.
Attachments
Screenshot_2014-01-25_232502.png
(5.48 KiB) Downloaded 851 times
Screenshot_2014-01-25_232522.png
(20.59 KiB) Downloaded 829 times

User avatar
01micko
Posts: 8741
Joined: Sat 11 Oct 2008, 13:39
Location: qld
Contact:

#50 Post by 01micko »

Ok

Many thanks to can8v for alpha testing, helping build the program really, and bringing this to our attention.

Here is revamped testing (usual warnings) version, prettied up the gui and tried to make it "smarter" [ :roll: ].

Known issues
  • doesn't work right in FatDog64
    works in carolina but takes 20 - 30 seconds for device to become available, it's a kernel thing I think
    pupcamera may pop up or even break. I have a work around in there to combat that but the udev rule for that needs fixing
    not tested, but likely will NOT work in wary, might work in racy, even quirky
    probably other bugs
The program groks dmesg for your device info and translates that to a udev rule for automount. A unique rule is needed for each device.. I hope I've taken the pain out of that. Some samsung devices use identical rules. Possibly the same with HTC, Sony etc. Doesn't work with iFone (different protocol), don't know about Windose Phone. There is a status icon for unmounting, not required but highly recommended. Make sure you get the right version!!! i486 for all normal pups and x86_64 for slacko64 and LHP. May even work in other OS if gtkdialog is installed.

Also .. get go-mtpfs from tempestuous' post . Again.. get the right architecture!

Sources for the status icon are attached too.

Have fun!

EDIT: New main package from here
Attachments
mtp_detect-0.6-exper-noarch.pet
Main program. REQUIRES go-mtpfs from tempestuous on page 1 of this thread
(3.87 KiB) Downloaded 426 times
mtpstatus-0.2-i486.pet
32 bit status icon, most users want this one for standard pups.
(3.68 KiB) Downloaded 416 times
mtpstatus-0.2-x86_64.pet
64 bit status icon
(3.16 KiB) Downloaded 382 times
mtpstatus-0.2-src.tar.bz2
source code
(1.53 KiB) Downloaded 355 times
Last edited by 01micko on Mon 27 Jan 2014, 00:00, edited 1 time in total.
Puppy Linux Blog - contact me for access

Post Reply