LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices


Reply
  Search this Thread
Old 05-04-2019, 05:22 PM   #1
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,772
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
howto mount android MTP as /media/...


Can someone offer a recipe so that my Android devices 'mount' at /media instead of (or in addition to) /run/user/... /mtp:host=...

2nd (related) question
Every time I connect my device, (usb cable) I get different 'mtp:host=' details. Is there some way to control, manage, or manipulate this?
I'd use predictable details, detect connection, then create a link into /media.
 
Old 05-04-2019, 07:18 PM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
arch wiki
https://wiki.archlinux.org/index.php...nsfer_Protocol

got commands you can play with as you sort out your situation. should help/
 
1 members found this post helpful.
Old 05-04-2019, 08:38 PM   #3
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,772

Original Poster
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Re: your signature statments/quotes:

"A government big enough to give you everything you want,
is strong enough to take everything you have."
-- Thomas Jefferson
3rd President, Jan 20, 1777 to Jan 20, 1781

Thanks, again, for the reply to my [b]mtp:host=???" post.

Soldier on,
~~~ 0;-Dan
 
Old 05-04-2019, 08:52 PM   #4
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,772

Original Poster
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Quote:
Originally Posted by BW-userx View Post
arch wiki
https://wiki.archlinux.org/index.php...nsfer_Protocol

got commands you can play with as you sort out your situation. should help.
As I read the contents of the page(s) you referenced, it appears that they tell me how to get MTP
support if I don't have it already.

I'm running Linux Mint 19.1 Cinnamon Desktop. Out of the box my Android tablet and phone connected using the MTP protocol giving me:
Code:
prompt$  sudo ls   /run/user/{someUID}/gvfs/mtp:host=*

/run/user/{someUID}/gvfs/mtp:host=%5Busb%3A001%2C014%5D/
where the host=gibberish corresponds to the details reported using lsusb for my connected device.

What I want is the magic words so that I might have access to something like:
Code:
prompt$  ls -FC /media/{username}/*

.....     myDevice/     .....
I'm fine if the entry in /media is some sort of link over to the entry in /run/user.
I simply don't want to hunt down my Android device every time that I tether it via USB.

Thanks in advance,
~~~ 0;-Dan
 
Old 05-04-2019, 08:58 PM   #5
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,117
Blog Entries: 21

Rep: Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474Reputation: 3474
Don't know for sure if this will help in Linux Mint or not.

https://unix.stackexchange.com/quest...ther-than-medi

Being as you might be dealing with udev rules that may be included with mtp mount.

Edit: I use
Code:
 cp <file> <file.bk>
so any changes I make. I have a original fallback.

My search term : link

Last edited by rokytnji; 05-04-2019 at 09:06 PM.
 
1 members found this post helpful.
Old 05-06-2019, 01:16 PM   #6
SaintDanBert
Senior Member
 
Registered: Jan 2009
Location: "North Shore" Louisiana USA
Distribution: Mint-20.1 with Cinnamon
Posts: 1,772

Original Poster
Blog Entries: 3

Rep: Reputation: 108Reputation: 108
Quote:
Originally Posted by rokytnji View Post
Don't know for sure if this will help in Linux Mint or not.

https://unix.stackexchange.com/quest...ther-than-medi
Thanks for this link. It sheds some light into the dark maze of device creation and mounting.
I'll continue to seek more light, 'cuz I'm really in the dark about this issue.

Quote:
Originally Posted by rokytnji View Post
Being as you might be dealing with udev rules that may be included with mtp mount.

Edit: I use
Code:
 cp <file> <file.bk>
so any changes I make. I have a original fallback.
Could not agree more. However, *.bk is often the result of various editors acting on a file.
In addition it might hide the original file type details. I've adopted the style

{filename}.{filetype}-ORIGINAL
This preserves the original name and tells me that it is a copy at some starting point.
I also use

{filename}.{filetype}-DISTRO
to indicate that the file is as delivered with the distribution or from a package repository.

If there are some set of config files or similar that I'm going to tinker with often,
I'll create a CVS {because I know this) or Subversion(so I can learn this) environment
to manage the changes and enable roll-back.

Quote:
Originally Posted by rokytnji View Post
My search term : link
Thanks for this second reference.
~~~ 0;-Dan

Last edited by SaintDanBert; 05-06-2019 at 01:21 PM. Reason: added content
 
Old 05-08-2019, 11:38 PM   #7
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by SaintDanBert View Post
I'm fine if the entry in /media is some sort of link over to the entry in /run/user.
I simply don't want to hunt down my Android device every time that I tether it via USB.
in any case, I'd let the mechanism in place just do its thing.

then,

question:
is it always mounted to the same location, or does the name of the folder differ?

if the former:
simply create a symlink to that location in a location that you're comfortable with.

if the latter:
assuming a udev rule, i believe they can be expanded (consist of more than 1 line). so after the mechanism did its thing, add a line that a) deletes any old symlinks, then b) creates a new one in a location that you're comfortable with.

http://hackaday.com/2009/09/18/how-to-write-udev-rules/
 
1 members found this post helpful.
Old 05-12-2019, 09:34 AM   #8
teckk
LQ Guru
 
Registered: Oct 2004
Distribution: Arch
Posts: 5,138
Blog Entries: 6

Rep: Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827Reputation: 1827
My 2 cents.

Quote:
Can someone offer a recipe so that my Android devices 'mount' at /media instead
simple-mtpfs is the best thing I've found for mtp devices.
https://github.com/phatina/simple-mt...s-0.3.0.tar.gz
https://github.com/phatina/simple-mtpfs/

If it's not in your repo.

Then make a little script that mounts it where you want it every time. Example:
Code:
#! /usr/bin/env bash

#Script for simple-mtpfs

PS3=$'\nSelect an option.: '

#mount directory
dir="/media/myphone"
					
while :; do
    clear
    options=('Quit' 'List Devices' 'Mount' 'Umount')
	select opt in "${options[@]}"; do
        case "$opt" in
            Quit) clear; exit
            ;;

            'List Devices') simple-mtpfs -l
            ;;
            
            Mount) simple-mtpfs "$dir"; echo "Mounted to "$dir"" 
            ;;

            Umount) fusermount -u "$dir"; echo "Unmounted" 
            ;;
        esac
    done
done
Plug it in, mount it, do something, unmount it. On Android devices past around 5 or so, you'll need to give permission in the little pop up window on the device when you try to mount it.

Otherwise mtp devices are obnoxious.

Edit: Formatting was off somehow.

Last edited by teckk; 05-12-2019 at 09:41 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
KDE Applications 18.12.0 has rewritten MTP device support. Does it solve any previous MTP problems? Nille_kungen Slackware 6 10-15-2018 11:04 AM
[SOLVED] Debian 8 + Xfce, Thunar mount MTP (Android) device HMW Debian 17 03-11-2017 05:46 PM
How to support MTP-Responder (Media Transfer Protocol) on an embedded linux? thehadar Linux - Embedded & Single-board computer 5 03-15-2013 12:20 AM
On slack-current: /usr/bin/mtp-getfile -> /tmp/package-libmtp/usr/bin/mtp-connect ? LuckyCyborg Slackware 3 05-03-2010 01:13 PM
MTP - Media Transfer Protocol. Any word on it? TravisOSF Linux - Hardware 2 01-21-2007 12:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 03:36 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration