Forum › Forums › General › Tips and Tricks › GUI to mount and unmount android devices
- This topic has 44 replies, 9 voices, and was last updated May 27-12:58 pm by PPC.
-
AuthorPosts
-
May 14, 2020 at 1:44 pm #35933Member
PPC
Hi everyone.
I patched together a small script that allows users to mount and unmount android devices (both tablets and phones).It’s available to test over at this link:
Quick instructions:
1- open a text editor
2- copy every single line from the webpage’s “RAW Paste Data” frame and paste it in the file editor.
3- save your file under the name android-mounter.sh
4- make this file executable (if using SpaceFM file manager, just right click the file > Properties > Permitions > check the first “Execute” field and press “OK”This is a beta, and still needs testing…
Any and all usefull feedback is appreciated!Technical note:
I usually create scripts using YAD as Graphics User Interface, but I’m using SpaceFM as this script’s interface!Intended use for this script – Add android devices mount/unmount to SpaceFM itself:
– fire up SpaceFM , click “Tools” menu, right click any existing option and choose “New” > “Command” > Choose any name (like “Mount Android Device”) > “Command” Tab > “Script” > paste the script’s contents there > Click “OK”.
You now have a new SpaceFM “tools” menu that allows you to mount or unmount android devices!May 14, 2020 at 1:57 pm #35934MemberModdIt
::Created a directory called Phone in my home directory
just installed jmtpfs and added to personal menu and a button to the menubar, command as below. mounts diverse phones and tablets.
prog “MountPhone” /usr/share/icons/papirus-antix/48×48/devices/pda.png jmtpfs /home/”myusrname”/Phone
Seems less effort to me
May 14, 2020 at 4:13 pm #35937Forum Admin
rokytnji
::Tried your 1st post instructions. Might have confused it with my Iview Android 4 inch cyberpad running Android 4.0.8
Not your fault really. I think this tablet pre-dates mtp protocol with Android 4.
Here is the feed back
My phone battery swelled up and broke the phone. One of those old S7 Edge ones. My wife will get me a Samsung A51 as a replacement phone with Android 10 on it later on.
It will be awhile till I receive it. She drags her feet sometimes when it comes to my stuff. Funny though. I would not have a umbilical cord/phone if not for her.Sometimes I drive a crooked road to get my mind straight.
Not all who Wander are Lost.
I'm not outa place. I'm from outer space.Linux Registered User # 475019
How to Search for AntiX solutions to your problemsMay 15, 2020 at 12:15 am #35942MemberModdIt
::Hi roki, seems you are a glutton for punishment, battery swelling and burning is a common samsung problem.
Personal experience with 2 phones owned by my daughter, we were lucky second case could have destroyed our home,
I ran outside with the phone and watched it burn. Warranty was refused.I will buy nothing more from that company, shitty update policy tops the cake.
I now have an xiaomi note 5, still getting updates after more than 2 years and three android versions.
Very good hardware, good prices.Use Net Guard GIT. No ads No more calling home to mommy, excellent battery life.
May 15, 2020 at 8:42 am #35954Forum AdminSamK
::@PPC
Manually entering the MTP command in SpaceFM is known to work so your approach is likely to be successful. From a personal point of view I prefer mechanisms that do not constrain the user to using a particular app i.e. SpaceFM in this case.@ModdIt
A creative way to basically issue the MTP command without using the terminal. Additionally it benefits from providing access via any file manager or CLI. The simplicity of this approach means there is no scope for feedback to the user of progress or issues.About 15(ish) months ago I created an app named Phone Shuttle with the intention of it being ready for antiX-19. I ran out of time so it was not made available.
Abstract from the help file
Summary:
Connecting is done via a menu selection.
After the phone is verified to be MTP capable:-
* A mountpoint is created in the user home directory,
* The phone file system is mounted on the mountpoint,
* Option automatically open a file manager of choice at the mountpoint,
* Option add an icon to the task bar tray.Disconnecting is done via the tray icon or menu selection.
After the phone is verified to be mounted:-
* The phone file system is unmounted from the mountpoint,
* The mountpoint is removed from the user home directory,
* The icon is removed from the task bar tray.Abstract ends
It has not been as extensively tested as I would like but has worked OK in all tests tried, even advising when a phone does not support MTP. I intend to restructure and rewrite much of the code but if there is sufficient interest I will submit it in its current form with the caveat I do not have much time to work on it currently so will change it later on.
May 15, 2020 at 9:24 am #35956MemberModdIt
::Hi SamK, before I put the button in the menubar I tested in the terminal to check for issues.
My guess is all my android users have mtp capable devices because no complaints at all came in
the last few months. even my most terrible user is happy.We already have an unmount button for pluggable devices in a full AntiX installation.
Just looked for the leanest meanest functionality.
I guess the way you intended is somewhat more comfortable, just would not change my approach.
Connecting Apple devices = another story.
May 15, 2020 at 10:04 am #35957Forum AdminSamK
::My guess is all my android users have mtp capable devices…
Probably modern phones are MTP capable but because antiX caters for users of modern and old technology it seems appropriate to incorporate a check for those that do not support MTP.
May 15, 2020 at 12:40 pm #35959MemberModdIt
::Just for the record and clarity:
As pre MTP phones are USB mass storage devices plugging in via USB will automount them if you set that in control center,
no app needed.Trying to mount a USB mass storage device via console and MTP will cause no damage, just fail with error message,
return to automount as above.Only other relevant Protokoll is PTP, mostly used for cameras, automounting works without issues if set that way in control
center.
no app neededNo constraints on applications in any of these cases, just use resources present in AntiX already.
May 16, 2020 at 4:00 am #35968MemberPPC
::Hi!
Thanks for the comments!
Final, not Beta version of the script is available at:How it works: Run the script. If there’s a android phone/tablet plugged in, it is mounted and it’s contents displayed in a new File Manager window/tab.
Clarifying some details:
1- I simplified the script- Moddit is right- no need to include the “unmount” button, users can unmount the android device as they would any other drive…
2- The script now just tries to automatically mount the android device and open it using the default file manager, if it finds none, then it will display a simplified warning, telling the user how to correctly connect a MTP enabled android device (note; a single android device at each time, because it only tries to mount the first detected device).
3- The script also checks if, after antiX tries to mount it, the android device asks the user to allow access. If that happens, a new warning pops up, asking the user to do just that (I need that to mount my more recent Android 10 phone, not my older 4.4.1 Tablet)
4- The script (even in the Beta version) DOES NOT open the mounted device on SpaceFM, it opens the android device mount point in the default file manager ( ROX by default SpaceFM in my particular case). It partly uses SpaceFM to display the main warning (instead of YAD). I suggested adding it to SpaceFM, because it’s where I had my command to mount my phone (but simply using “jmtpfs ~/android-device” does not work on my phone, because I have to “allow” access on it’s screen and then remount it- that’s what prompted me to write this more developed script)@ Moddit- I also have the script available in my toolbar. I added this line:
prog “Android Device Mounter” /usr/share/icons/papirus-antix/24×24/devices/phone.png ~/antiX-android-mounter.shP.
May 16, 2020 at 4:02 am #35969MemberPPC
::@PPC The forum marked this post as spam, unmarked & restored as requested, SamK
Hi!
Thanks for the comments!
Final, not Beta version of the script is available at:How it works: Run the script. If there’s a android phone/tablet plugged in, it is mounted and it’s contents displayed in a new File Manager window/tab.
Clarifying some details:
1- I simplified the script- Moddit is right- no need to include the “unmount” button, users can unmount the android device as they would any other drive…
2- The script now just tries to automatically mount the android device and open it using the default file manager, if it finds none, then it will display a simplified warning, telling the user how to correctly connect a MTP enabled android device (note; a single android device at each time, because it only tries to mount the first detected device).
3- The script also checks if, after antiX tries to mount it, the android device asks the user to allow access. If that happens, a new warning pops up, asking the user to do just that (I need that to mount my more recent Android 10 phone, not my older 4.4.1 Tablet)
4- The script (even in the Beta version) DOES NOT open the mounted device on SpaceFM, it opens the android device mount point in the default file manager ( ROX by default SpaceFM in my particular case).@ Moddit- I also have the script available in my toolbar. I added this line:
prog “Android Device Mounter” /usr/share/icons/papirus-antix/24×24/devices/phone.png ~/antiX-android-mounter.shP.
May 16, 2020 at 4:19 am #35970Forum AdminSamK
::As pre MTP phones are USB mass storage devices plugging in via USB will automount them if you set that in control center,
no app needed.Yep that is the way it is supposed to work, and does so in antiX-19. It does not work in antiX-17 (the version in which Phone Shuttle was drafted), hence the inclusion of a check for ‘phones that do not support MTP.
May 16, 2020 at 4:47 am #35978MemberPPC
::@Samk – Thanks for solving my previous posting problem!
I usually dislike (since I normally use computers very low on RAM) to use programs that stay memory resident. That said, if there’s any interest on the Dev team to include a version of this script I can:
– create a desktop file, to allow it to show up in the menu and also be easily inserted on the toolbar (using IceWM’s Toolbar Icon Manager) and
– easily add a yad tray icon, that can be used to unmount the device and delete the mount point (I never thought the mount point folder would bloat the user’s Home…)I also never thought of checking if the android device is pre MTP because, to be honest, I don’t know how to do that (I’m a completely self taught bash “coder”, I’ll have to look that up). There’s another reason- usually mobile devices don’t last as long as computers built some 20-10 years ago, that still keep working fine. Most mobile devices don’t last much more that 5-8 years. I would have thought that my android tablet, a Samsung runnning android 4.4.1 will probably be one of the older android devices still working, and it’s already MTP enabled. My reasoning is that, it that’s so, there won’t be many users that have mobile devices older than that, but I may have misjudged… If you care to share your script, I may try to incorporate the pre-MTP part… if there’s any use, since they automatically work on antiX 19 (could be useful for folks still using previous versions)…
I like that this current version of my script simply mounts and shows the contents of the android device, instantly (unless the user has to allow access on the device’s side- probably that should happen on android 10 devices, I only have my phone to test if that’s a new android security feature). No menus, nothing to select. just click and use!
The unmounting part may be more complex for non techie users (although very simple is using SpaceFM)- that may be used to just click the “eject usb device” icon on the toolbar…P.
May 16, 2020 at 6:53 am #35981MemberModdIt
::MTP was introduced end 2010 in Gingerbread Android 2.5. Play store has no support for this version since 2017,
For some phones I own no battery has been available for many years, partially due to the fact that android devices were not so popular way back. Those devices are functionally very limited, had and have disgusting battery life.
I would be extremely surprised to see one in regular usage, they are museum, collectors and film set devices these days.
unless the user has to allow access on the device’s side- probably that should happen on android 10 devices.
At least my android 6 Lenovo K3 Note needs confirmation to connect. Android standard is charge.
On 6,7,8,9 and 10 all our family phones must be unlocked and the connection method manually changed
to MTP.USB mode can be changed In developer options on some phones USB mode can be changed. Applies to my XIAOMI redmi Note devices, On MIUI keep tapping version until dev options are activated. For other devices net is your friend especially XDA Developers site.
Have fun, I have no further interest in this thread.
Lenovo no. No information on other devices.- This reply was modified 2 years, 11 months ago by ModdIt.
May 16, 2020 at 7:25 am #35983MemberPPC
::@Moddit:
My android 10 phone is “stranger” than my previous phone, that ran android 8, if I recall correctly.
Like all android devices I remember ever connecting to my computers, it automatically shows a “connected to usb cable” notification, when I plug it to my computer. The nice part is that the default setting is already something like “share files /android auto”. The bad part is that jmtpfs tries to mount my phone but fails, because a warning comes up on my phone’s screen (not a notification, a warning that obscures all the screen, with two buttons on the bottom, to select to allow or not allow file transfers over the USB cable…)
So, to manually mount my phone I had to run “jmtpfs [mountpoint]” , get an error on my computer, and the prompt to “allow” on my phone, select “allow” on my touch screen and then remount the phone, in order to access it from my computer…
WAYYYY more complicated than all my previous android devices…So, I wrote the script to avoid having to run a command, allow on my phone, and then run another command… For people that dislike using GUI’s for those tasks, the cli script I used, was this:
rm ~/.jmtpfs-output2.txt dir="$HOME/android-device" mkdir -p "$dir" jmtpfs -o auto_unmount "$dir" |& tee -a ~/.jmtpfs-output2.txt # if output includes "bad mount point" then user has to press "Allow" on device's screen and try to mount it again xdg-open "$dir" ##check if user has to "allow": check if output includes has the expected content: mount_check=$(cat ~/.jmtpfs-output2.txt | grep -c "bad mount point") echo $mount_check if [ "$mount_check" -eq "1" ]; then read -n 1 -s -r -p " Select Allow on you android device then press any key" && fusermount -u "$dir" && jmtpfs "$dir" && xdg-open "$dir" fiP.
May 16, 2020 at 8:16 am #35985Forum Admin
rokytnji
::Tablet I posted was not a phone though. File manager and parted -l won’t see it. So Android 4 has setting I am not aware of to turn off intrusion protection.
Tablet is not high on my priority list presently. Got a lot of irons in the fire for other projects.
Side note. Wife handles my phone contract. She as usual did not listen to me so I am getting a Samsung Galaxy S10e as a replacement for my S7 Edge that she also picked out for me. At least she listened when I said , ” No Iphone ”
Which she prefers. Looks like my Samsung S10e is a better spec phone than the A51 I picked out also. Not a glutton for punishment. I just go with the wife;s flow.
Web apps work out for me on my Samsung Edge , I figure the same on the S10e. Other side note: I will be unavailable next weekend. Leaving for San Antonio Tx to pick up another Harley Davidson Basket case motorcycle.
http://xlforum.net/forums/showthread.php?t=2076653
Here is it’s history
http://xlforum.net/forums/showthread.php?t=1996179
I am better fixing these things than fixing my linux installs, just my personal opinion.
Sometimes I drive a crooked road to get my mind straight.
Not all who Wander are Lost.
I'm not outa place. I'm from outer space.Linux Registered User # 475019
How to Search for AntiX solutions to your problems -
AuthorPosts
- You must be logged in to reply to this topic.