MTP automatic mounter (CLOSED)

Filemanagers, partitioning tools, etc.
Post Reply
Message
Author
can8v
Posts: 586
Joined: Sat 15 Jul 2006, 08:20
Location: Yuba City, CA
Contact:

MTP automatic mounter (CLOSED)

#1 Post by can8v »

***EDIT***
I have abandoned this project in favor of a completely different design. The new package is posted here: http://murga-linux.com/puppy/viewtopic. ... 455#756455
The PET package I posted in this thread does work and some might prefer it, but since I have abondoned it, I will not be supporting it, or coming out with any now feature releases or bug fixes (if there are any bugs). I have marked this thread, as CLOSED, Should somebody else wish to pursue further development on this project that would be fine by me, but a new thread should be opened.
***END EDIT***
This is a distro independent package (bash shell scripts) for auto mounting MTP devices, such as Android 4.x and up and many media players. You will need to install the go-mtpfs package from tempestuous available here:
http://murga-linux.com/puppy/viewtopic. ... 442#752416
These scripts make extensive use of notify-send, so libnotify is highly recommended. I suppose one could use this package without notifications, but you might run into some unexpected behavior that the notifications would explain to you and keep you from thinking there is a bug where there probably isn't. If you don't have/want notify-send I recommend launching the scripts from the command line, as some of the notifications also echo to the terminal.
I built this program because there is an issue with udev in some puppies (all versions of Saluki and Carolina and at least some versions of Fat Dog 64, and maybe others) that causes 01micko's excellent auto mounter to take 20-30 seconds to autodetect a connection to a MTP device. Since I use Carolina that is why all the notifications use notify-send. for ver. 0.2 I will try to automatically detect if notify-send is available and if it is not, then use GtkDialog instead. That is assuming we run into some folks using puppies that don't have notify-send and want to use this package.
Usage:
After installing Tempestuous' go-mtpfs package and this package, then you need to decide how you would like to launch the scripts.
I chose to make a custom action in Thunar file manager, this makes a right click context menu item. You can do this as follows.
Open Thunar -> Edit -> create custom action
the scripts will have been installed in the /root/my-applications/bin directory the mount script is mountMTP.sh and the unmount script is unmountMTP.sh
You can simply navigate to them in a file manager and open them, or you can create symlinks on your desktop, create menu entries, etc.
The important thing here is that after you mount a MTP device the first time there is a monitor script that will continuously monitor your USB ports waiting for the next time you plug it in and when you do it will recognize it as your MTP device and automount it. When you are done with it just unmount it using the unmount script. It is important that if you use the mount script to mount it or you auto-mount it that you use the unmountMTP.sh script to unmount it. If you mount from the terminal using go-mtpfs directly from the terminal then you will need to unmount directly from the terminal. That said if you like the command line, that is another option for using these scripts.
simply install the packages, plug in your device and at the command line type:
# mountMTP.sh

The automount magic needs the USB monitor to be started. it is in the /root/Startup directory and will start automatically every time you start your computer, but unless you just happened to restart your computer after you installed the package, you will need to manually start the monitor this time. You can start it at the command line by typing:
# dmesgParse.sh

or you can simply navigate to /root/Startup in your file manager and double click the file.

When you are ready to unmount your device just launch the unmountMTP.sh script by any method you like. at the command line it is
# unmountMTP.sh
That's it. Enjoy!
Report any bugs or suggestions here. I am plan at least one more version after this, maybe more, who knows.
[/img]
Attachments
Screenshot-2.jpg
An RCT6378W2 tablet automatically mounted to /root/RCT6378W2. The notification in the upper right corner requires notify-send (libnotify).
(37.38 KiB) Downloaded 820 times
CS-MTPmounter-i486.pet
(2.78 KiB) Downloaded 663 times
Last edited by can8v on Sun 09 Feb 2014, 02:50, edited 3 times in total.

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

#2 Post by Sylvander »

1. Followed your instructions as best I could....
Installed: CS-MTPmounter-i486.pet and go-mtpfs-20130628.pet

2. At times I was confused...
Things didn't seem to be going forward in a simple manner...
Had trouble when I tried to use your commands in a terminal.
But in the end...

3. It's all now working quite routinely... :D
i.e. Provided I use the dialog windows that automatically pop up when I connect the Samsung Galaxy tab-2 10.1 tablet.
As follows:
a. I plug in the tablet.

b. Two windows atomatically appear on the desktop: 1 for pupcamera; 1 for MTP Device.

c. I use "MTP Device" to mount the "Samsung GT-P5110 detected".

d. An Xfe window opens with 1 folder hierachy pane and 2 file panes displayed.
I can use this to navigate to "/mnt/MTPdevice/Tablet", and [further navigate and] display file content.

e. Then I can close Xfe, left-click on the small phone icon down at bottom right, and an "Unmount" dialog is displayed, asking if I'd like to unmount the GT-P5110.
I click "Yes", and a green message says it's "safe to disconnect", so I do that.

f. I can then plug the tablet in once again, and the sequence sucessfully begins anew.

4. I noticed that when attempting to use commands in a terminal [or open the .sh files], things didn't go well for me [I'm probably doing something wrong].
I noticed it being reported that "notify-send" couldn't be found.
How would I check if that's installed?
Attachments
00.jpg
(13.88 KiB) Downloaded 1482 times

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

Re: MTP automatic mounter

#3 Post by Sylvander »

can8v wrote:The automount magic needs the USB monitor to be started. it is in the /root/Startup directory and will start automatically every time you start your computer, but unless you just happened to restart your computer after you installed the package, you will need to manually start the monitor this time. You can start it at the command line by typing:
# dmesgParse.sh
a. Tried the command, and all I get is a red flashing underscore.
I've restarted a number of times since I installed the PET files.

b. Does the "automount magic" auto mount a tablet when you connect it?

c. What name does the "USB monitor" go by?
Do you see the necessary in the /root/Startup folder as per screenshot below?
Attachments
00.jpg
(32.4 KiB) Downloaded 1535 times

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

#4 Post by can8v »

Sylvander wrote:1. Followed your instructions as best I could....
Installed: CS-MTPmounter-i486.pet and go-mtpfs-20130628.pet

2. At times I was confused...
Things didn't seem to be going forward in a simple manner...
Had trouble when I tried to use your commands in a terminal.
But in the end...

3. It's all now working quite routinely... :D
i.e. Provided I use the dialog windows that automatically pop up when I connect the Samsung Galaxy tab-2 10.1 tablet.
As follows:
a. I plug in the tablet.

b. Two windows atomatically appear on the desktop: 1 for pupcamera; 1 for MTP Device.

c. I use "MTP Device" to mount the "Samsung GT-P5110 detected".

d. An Xfe window opens with 1 folder hierachy pane and 2 file panes displayed.
I can use this to navigate to "/mnt/MTPdevice/Tablet", and [further navigate and] display file content.

e. Then I can close Xfe, left-click on the small phone icon down at bottom right, and an "Unmount" dialog is displayed, asking if I'd like to unmount the GT-P5110.
I click "Yes", and a green message says it's "safe to disconnect", so I do that.

f. I can then plug the tablet in once again, and the sequence sucessfully begins anew.

4. I noticed that when attempting to use commands in a terminal [or open the .sh files], things didn't go well for me [I'm probably doing something wrong].
I noticed it being reported that "notify-send" couldn't be found.
How would I check if that's installed?
It seems you used 01micko's program to mount you Galaxy. my program would not mount anything to /mnt/MTPdevice. nor does it put a phone icon in the system tray or anywhere else. I am glad to see you go your device mounted though.

If you want to try the other package after you unmount your device
go to /root/my-applications/bin/ and open mountMTP.sh
This should open xfe with the contents of your tablet or phone or whatever MTP device you are trying to mount.When you are finished unmount by opening /root/my-applications/bin/unmountMTP.sh after that it should auto mount and open xfe with the contents of your device displayed every time you plug it in. just remember to unmount it by opening the unmountMTP.sh file prior to unplugging it otherwise you might have to reboot your computer before you can mount the device again.

If you finally have it worked out how to get your device working with 01micko's program, you might want to just stick with that though.

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

#5 Post by Sylvander »

1. "It seems you used 01micko's program to mount you Galaxy. my program would not mount anything to /mnt/MTPdevice. nor does it put a phone icon in the system tray or anywhere else."
a. That has me perplexed.
Before I started on your PET, I deleted the existing pupsave file, and restored a backup I'd made...I thought I'd made it prior to the install of micko's pet.
Perhaps I'd made it AFTER installing his pet.

2. "If you want to try the other package after you unmount your device
go to /root/my-applications/bin/ and open mountMTP.sh
This should open xfe with the contents of your tablet or phone or whatever MTP device you are trying to mount.
"
Did that, and it worked just fine.
See screenshot below, of folder system under "/mnt/USB2.0-Print_".

3. "When you are finished unmount by opening /root/my-applications/bin/unmountMTP.sh"
Ok, that worked.
/mnt/USB2.0-Print_ is now empty.
Closed all Xfe windows, and...
I've now unplugged the tablet.

4. "after that it should auto mount and open xfe with the contents of your device displayed every time you plug it in."
Plugged it back in [heard a sound from the tablet], but I don't see any reaction here in Puppy.
I ran Xfe, and /mnt/USB2.0-Print_ is empty as before.
Attachments
00.jpg
(67.23 KiB) Downloaded 1451 times

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

#6 Post by Sylvander »

1. Decided to do a check on my PupsaveHotBackup=precisesave.3fs.BKP-14.01.27-09.34.
Compare this with my post here date & time = Mon 27 Jan 2014, 05:49. [the final hotbackup made about 4 hrs after this!]
I say there that I made the hot-backup just prior to having a 2nd go with the new updated instructions.
Hence there should have been no trace of the 1st attempt in the hot-backup because I didn't save any session changes during that session, nor at shutdown.
And yet...
I must have made a later backup methinks.

2. Just now...
After I deleted the existing pupsave, and restored the hot-backup = precisesave.3fs.BKP-14.01.27-09.34 [using a 2nd Puppy = Slacko-5.5.91]...
And rebooted into Precise-5.6.1...
And connected the tablet...
Two windows auto-ran = "MTP Device" & "PupCamera".
That aught not to have happened.

3. Looks like traces of the [2nd?] install of micko's prog's are included in the precisesave.3fs.BKP-14.01.27-09.34.
Any idea what I aught to do about that?
Should I eliminate those prior to installing yours?
Or can both happily co-exist?

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

#7 Post by can8v »

@Sylvander
4. "after that it should auto mount and open xfe with the contents of your device displayed every time you plug it in."
Plugged it back in [heard a sound from the tablet], but I don't see any reaction here in Puppy.
I ran Xfe, and /mnt/USB2.0-Print_ is empty as before.
Have you rebooted your computer since you installed the package?
If not try opening this file /root/Startup/dmesgParse.sh
It might seem like nothing has happened, but you will have started a background process (because the file is in the /root/Startup folder it will start automatically when you start your computer), that monitors your USB ports. Then plug your device back in and it should automatically mount.

Also please advise which puppy you are using so far I gather you are using xfe, but that is all I know.
Also I would like to know if you get the notification in the upper right corner of your screen when you mount your device. It disappears automatically after a few seconds. If you are not sure what I am talking about have a look at the screen shots I attached to my first post in this thread.

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

#8 Post by Sylvander »

1. "Have you rebooted your computer since you installed the package?"
I've restored the PupsaveHotBackup file, so at this time your program is no longer installed
I was intending to re-install, but I'm beginning to wonder whether I aught not.

2. "...Then plug your device back in and it should automatically mount. "
a. Hmmm, I'm beginning to think I don't fancy it auto-mounting, if unmounting it is less than really simple.
I'd find myself with a mounted tablet having forgotten how to dismount it.

b. I like the way my "Precise-5.6.1" is working right now, where 2 windows auto-appear on the desktop [PupCamera & MTP], and I can choose which to use to mount the tablet by just clicking the mount button on the one of my choice.
Then with MTP, a little phone icon appears down at bottom right, and I can use that to dismount the tablet.

3. "please advise which puppy you are using"
Precise-5.6.1

4. "I would like to know if you get the notification in the upper right corner of your screen when you mount your device"
When your program was installed I didn't get that.
I could begin again, just as an exercise, and try to get that.
I'll probably begin doing that tomorrow morning.

5. "have a look at the screen shots I attached to my first post in this thread."
I've done that, and it got me thinking...
I wouldn't want auto-mount unless dismounting was really easy.
What about an icon created on the desktop once detected as connected [like the drive partitions], with something indicating that it's a tablet and its mounted, and the user just clicks that to dismount it?
And the icon disappears when the tablet is disconnected.

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

#9 Post by can8v »

What about an icon created on the desktop once detected as connected [like the drive partitions], with something indicating that it's a tablet and its mounted, and the user just clicks that to dismount it?
And the icon disappears when the tablet is disconnected.
That would be a nearly ideal solution and I did consider it when I was writing this program.

I personally love to be able to right click to get to my mount and unmount options, because it is fast even when the desktop is covered over with open programs. I realize however, that I am probably in the minority here. At any rate that is not the reason I didn't include a feature like that in the first version. The reason was all the choices puppy users have in selecting a window manager (ie. JWM, XFCE, LXDE, IceWM, etc.). I haven't even tried all of the various window managers myself, so I certainly don't know how to make those icons appear in each of them. I am especially fond of XFCE and it would be very easy to make that happen in XFCE, but I will need more time to figure out if I can make it work more universally. I will likely get the dialogs working for those that don't have notify-send, then work on some more universal and easier ways to launch the scripts. Those are the weak areas of the package right now.

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

#10 Post by can8v »

Ok here is a new version that has Desktop icons that work in XFCE and maybe LXDE and some others. I doubt it will work in JWM. For JWM you will likely still have to create your own links to the scripts, so that you can launch the applications from your choice of locations. Basically if you have a /root/Desktop folder where you place files and sym links and they appears on your desktop this version will make set up and use much smoother.
After the pet is installed you will have an "Add New MTP Device" icon on your desktop. Simply plug in your MTP enabled device and open the "Add New MTP Device" link from the desktop.
In about 1 second you will:
- have a notification telling you that your device is mounted and reminding you to unmount it before you unplug it.
- see that the "Add New MTP Device" has changed to a "Unmount [Your Device]" link (it will actually name your device ie. "Unmount Nexus_7"
- have a new file manager window open and displaying the contents of your devices.

As before, after the first time you manually mount your device in this way, it will automatically mount your device each time you plug it in.

Additionally I added a feature to the mount script to check if the USB monitor is running and if not then it starts it for you, so you don't have to start it manually. Everytime you start your computer it will start the monitor automatically so you could feasibly only have to click the "Add new MTP Device" link once per device (ie. once for your phone and once for your tablet).
Here is a screencast:
http://youtu.be/N-asaTKmnyo
Attachments
CS-MTP-Automounter-0-2.pet
Ver. 0.2
(2.89 KiB) Downloaded 587 times

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

#11 Post by Sylvander »

OK...
1. I installed your latest 0.2 version.
Seemed to install OK.

2. Plugged-in my tablet.
Saw nothing happening [e.g. no notification at top right on desktop], other than the usual 2 windows by micko's program.
Should I temporarily eliminate the install of micko's, or does it happily co-exist?

3. Found some [*MTP*] files as per sceenshot below.
The file in /root/Desktop doesn't appear on the desktop.
Can you tell me how to make it appear on the desktop?
My window manager is JWM.

4. If/when I "Open" "Add New MTP Device" and choose "Execute", I get an Xfe window that I can use to navigate to the [files on the] now mounted filesystem [under GT-P5110] of the tablet.
The file name then changes to "Unmount GT-P5110".
If I "Open2 that and "Execute", the filename toggles to "Add New MTP Device" once again.

5. I'll reboot without saving, to eliminate this installation, and re-do the installation at some future session, in line with any instructions given by yourself.
Attachments
00.jpg
(27.15 KiB) Downloaded 1388 times

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

#12 Post by can8v »

@Sylvander
Yes, JWM is not supported. In a day or two or three I should be at version 0.4 that version will include support for JWM/ROX pinboard, at that point it should work correctly on your system. Version 0.3 will be another feature release, but you can probably skip it as the features Wilmot work in JWM until 0.4 anyway.

Post Reply