Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Mon 12 Nov 2018, 16:21
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
Media Transfer Protocol MTP (SOLVED)
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 2 of 17 [250 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 15, 16, 17 Next
Author Message
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Mon 20 Jan 2014, 22:49    Post subject:  

well at least you dont play Pantera.. oh wait never mind... I almost got my car stolen and distroyed by a die hard fan. Friends son was very upset that someone made fun of the T shirt he had on. I stupidly asked why and after hearing the band ended up agreeing with the other party that they do not seem to have actual musical skill. My keys where taken and I heard my truck being over revved in the drive. He was glaring at me from drivers seat while resetting all my music stations on the radio to metal rock stations. Twisted Evil
Back to top
View user's profile Send private message 
tempestuous

Joined: 10 Jun 2005
Posts: 5472
Location: Australia

PostPosted: Mon 20 Jan 2014, 23:14    Post subject:  

01micko wrote:
the go-mtpfs process seems to keep running in the terminal, not like a usual mount (I am aware that it is not a usual mount) and it seems the only way to stop it is with CTRL+C.

OK, go-mtpfs is apparently a daemon process, so we need to let it run while freeing up the console with "&" ...
so the instructions should be -
Code:
cd /mnt
go-mtpfs MTPdevice &

Last edited by tempestuous on Sun 26 Jan 2014, 04:51; edited 1 time in total
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Mon 20 Jan 2014, 23:25    Post subject:  

and if you are angry my dad was a music producer and broadcaster, the Stories about him an wolfman Jack mostly are mostly untold, The kid safe versions where very out there, man.
My first musical instrument was given to me by Dolly Parton after she heard about my physical limitations figured out a type of flat steel stringed keyboard that I could use. And it sounded so cool when I played it. Until my mom force my dad to give it back when she found out how much the real model I got costs.
My mom did know how generous Dolly Parton is to everyone until later. Shocked
My dad was a backup DJ and he never sounded like his radio voice in person. What was cool is that our house was listed as a radio station and we got record demos almost daily. Wink
Back to top
View user's profile Send private message 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Tue 21 Jan 2014, 00:45    Post subject:  

I couldn't wait until I got home, so I got a VNC connection to my laptop and tested this. This works great! Thank you so much Tempestuous. I am going to start work on a script to automate the mounting and unmounting process when I get back.
Back to top
View user's profile Send private message Visit poster's website 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Tue 21 Jan 2014, 02:30    Post subject:  

OK, so my initial idea is that I could use udev rules to detect my Nexus 7 connection via USB, when it is detected then run a script that will mount the Nexus 7 via go-mtpfs. You will see in the code example that I changed the mount point and directory name to suit my own needs. The script works when called from the command line or double clicked in Thunar (ie. the Nexus 7 is mounted). The udev rule doesn't seem to detect the connection and/or run the script. I pulled the vendor id and product id from lsusb in the terminal and verified they are correct. I added the rule to the 88-puppy-autodetect.rules

udev rule:
Code:
ACTION=="add", SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", SYSFS{idProduct}=="4ee1", RUN+="/root/my-applications/bin/Nexus7-mount.sh"


mount script for Nexus 7:
Code:
#!/bin/bash
# Mount my Nexus 7
cd /mnt
go-mtpfs "Nexus 7" &


Even if I figure out this udev rule, this is not very universal and would require anybody doing this to customize the script to mount at an appropriate mount point and directory name for their device and change the udev rule to detect their device instead of a Nexus 7. That is assuming they have a device other than a Nexus 7. I will be back at my computer tomorrow, so I can work at this directly. Maybe I will make some progress. Thanks again Tempestuous.
Back to top
View user's profile Send private message Visit poster's website 
tempestuous

Joined: 10 Jun 2005
Posts: 5472
Location: Australia

PostPosted: Tue 21 Jan 2014, 03:18    Post subject:  

can8v wrote:
my initial idea is that I could use udev rules to detect my Nexus 7 connection via USB, when it is detected then run a script that will mount the Nexus 7 via go-mtpfs.

That's a very good idea, and I would like to help you ... but the inner workings of udev are "black magic" to me.

can8v wrote:
Even if I figure out this udev rule, this is not very universal and would require anybody doing this to customize the script ...
... and change the udev rule to detect their device instead of a Nexus 7

Let me say that, in principle, what you need is some form of udev rule which will identify any/all MTP devices which may be connected to Puppy, then launch the appropriate go-mtpfs commands.
What may assist you is the MTP udev rule from gnomad2, which I now attach. As you can see, it contains a long list of USB device ID's of known MTP devices.

But here's another idea you may like - what about a bash wrapper script which does the following:
- launches go-mtpfs
- launches ROX, to the directory specified by go-mtpfs (/root/MTP by my suggestion)
- the wrapper script determines when ROX is closed, then ...
- unmounts the device (with fusermount)
- displays a message - probably via gtkdialog, saying something like
"your MTP device has been unmounted, and is now safe to disconnect"

can8v wrote:
Code:
go-mtpfs "Nexus 7" &

BE CAREFUL ... the expression which follows "go-mtpfs" defines the directory where the (FUSE) mountpoint is located - so you have specified a Linux directory which includes a space - and that's problematic in Linux.
69-libmtp.rules.gz
Description 
gz

 Download 
Filename  69-libmtp.rules.gz 
Filesize  9.3 KB 
Downloaded  350 Time(s) 
Back to top
View user's profile Send private message 
gcmartin

Joined: 14 Oct 2005
Posts: 6730
Location: Earth

PostPosted: Tue 21 Jan 2014, 06:51    Post subject:  

Thanks everyone and especially @Tempestuous

This is great as PUPPY distro can now be smarter with this additional to the arcenal. This makes for a great opportunity to provide backup for Android information on Puppy, not to mention the read-write convenience.

Puppy, with the changes added over the last year along with the advances and OOTB functionality being provided by the 64bit developers has changed the positioning of what a PUP is capable of when any user boots to the desktop. And, its all OOTB if this can find its way into the Puppy build process, WOOF-CE and the PUP builders are aware of its availability.

1 year ago, few had smart-devices. Today, most of us have some kind of smart-device in close proximity.

This can assist transfer of program files/apps to the connected smart-devices; not to mention the potential development-test cycle for Android apps built on a PUP. All being done over the same wire charging the handheld device.

THANKS!!!

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engines or use DogPile
Back to top
View user's profile Send private message 
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Tue 21 Jan 2014, 10:12    Post subject:  

I will be driving to internet service just to download this.. Laughing no I m not kidding.
The cup of coffee from a giftcard is just bonus...
Back to top
View user's profile Send private message 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Tue 21 Jan 2014, 11:34    Post subject:  

tempestuous wrote:
can8v wrote:
my initial idea is that I could use udev rules to detect my Nexus 7 connection via USB, when it is detected then run a script that will mount the Nexus 7 via go-mtpfs.

That's a very good idea, and I would like to help you ... but the inner workings of udev are "black magic" to me.

can8v wrote:
Even if I figure out this udev rule, this is not very universal and would require anybody doing this to customize the script ...
... and change the udev rule to detect their device instead of a Nexus 7

Let me say that, in principle, what you need is some form of udev rule which will identify any/all MTP devices which may be connected to Puppy, then launch the appropriate go-mtpfs commands.
What may assist you is the MTP udev rule from gnomad2, which I now attach. As you can see, it contains a long list of USB device ID's of known MTP devices.

But here's another idea you may like - what about a bash wrapper script which does the following:
- launches go-mtpfs
- launches ROX, to the directory specified by go-mtpfs (/root/MTP by my suggestion)
- the wrapper script determines when ROX is closed, then ...
- unmounts the device (with fusermount)
- displays a message - probably via gtkdialog, saying something like
"your MTP device has been unmounted, and is now safe to disconnect"

can8v wrote:
Code:
go-mtpfs "Nexus 7" &

BE CAREFUL ... the expression which follows "go-mtpfs" defines the directory where the (FUSE) mountpoint is located - so you have specified a Linux directory which includes a space - and that's problematic in Linux.

You are right a space would certainly not be universally appropriate and could cause problems for some people.
I took a look at the udev rules you posted, I think you are correct in that making udev work universally could be a bit like black magic. Certainly not something I am going to grasp easily. I have another idea that I will explore that should prove much simpler. I will get to that later today and post back the results.
Back to top
View user's profile Send private message Visit poster's website 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Tue 21 Jan 2014, 15:40    Post subject: Mount and unmount scripts  

I have written the following simple scripts that will mount and unmount a MTP device connected via USB after installing the appropriate pet package that Tempestuous posted above.
I use custom actions in Thunar to setup right click menu entries that will mount the device or unmount the device. After mounting the script takes me right to the directory that the device is mounted to. Also I changed the directory to /mnt/MTPdevice (just my preference. If you like /root/MTP better you can change that easily in the script.
Read the comments for instructions.
Mount Script
Code:
#!/bin/bash
# Put this script in the /root/my-applications/bin directory and make it executable
# Change to mnt directory
cd /mnt
# Mount any detectable MTP device at /mnt/MTPdevice
go-mtpfs "MTPdevice" &
# Start your favorite file manager in the directory where the MTP device is mounted. You can comment out this line if you would rather navigate to this directory in the file manager window that is already open.
thunar /mnt/MTPdevice
# If you use Thunar for file management you can configure a custom action (Edit->Configure Custom Actions) for a right click menu option on the /mnt/MTPdevice directory that will issue the command  fusermount -u MTPdevice. This will give you a convenient right click option to unmount your device prior to disconnecting it from USB. I haven't used ROX in quite a long time, but there is likely a similar option for ROX users.
# Just an aside, if you do not have an MTP device connected when you call this script the file manager you called above will simply open with nothing mounted at the /mnt/MTPdevice directory. If you later connect an MTP device simply run this script again.
# I only have one MTP device and don't know what this would do if two or more were connected via USB when the script is executed.

Unmount Script
Code:
#!/bin/bash
# Put this script in the /root/my-applications/bin directory and make it executable
# changes directory to the mount point for the MTP device
cd /mnt
# unmounts the MTP device
fusermount -u MTPdevice
# 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.

If anybody has more than one MTP device I would love to know how this setup handles a situation where more than one MTP device is connected via USB when the script is run. Please test and report your results here. If anybody using ROX or other file managers can provide helpful hints for running these scripts from a right click menu within a file manager other than Thunar or some other quick and easy (gui) way of starting the scripts I am sure that would help many folks out, as well. I realize most Puppy users probably are not using Thunar.
I experimented with running the script prior to launching the filemanager, and this also worked, but I couldn't figure out how to get the file manager to open in a directory other than /mnt (or whatever the parent directory to the directory that the MTP device is mounted to, in my case /mnt). That would have been my preference over starting the script from a right click menu in the filemanager, but I couldn't live with the file manager always opening to /mnt even if I click a drive icon for the CD drive for example. Obviously I could set it to use thunar /mnt/sr0, but then it would always open to the directory. I could pass in a variable easily enough and use the variable to set the directory to open thunar to, but I couldn't figure out how to get the appropriate variable to pass into the script. Bottom line here is that I am obviously not quite satisfied with this solution, so there might be some improvements in the future, if somebody doesn't get to it before me.

**EDIT**
I borrowed a second Nexus 7 from my wife (no easy task prying it from her fingers mind you), then connected both MTP devices to USB ports and ran the scripts to mount them using gomtpfs. The results were kind of unpredictable. Neither device mounted to the mount point and the Pup Camera application kept popping up despite the fact the both devices were still clearly set to use MTP rather than PTP. No matter what I tried neither device would mount until the other was disconnected from the USB port. So I think that is a limitation of the gomtpfs library. The gomtpfs library is still more stable than libmtp, which I have tried in a couple of other distros. It didn't seem to matter if I was using Arch, Lubuntu or whatever, when using libmtp to mount my Nexus 7, I ran into occasional permission denied errors when trying to transfer files to or from the device, regardless of whether or not I had the appropriate permissions. It seemed a bit random when I would get the errors, but it didn't seem to matter which distro I used. It did however, work most of the time and sometimes I could try transferring the same file later and it would work fine. I don't have this issue with gomtpfs, so I am more than happy to have the limitation of only being able to mount one MTP device at a time.
Back to top
View user's profile Send private message Visit poster's website 
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Tue 21 Jan 2014, 21:03    Post subject:  

Hay its for the betterment of unknown persons on the intertubes, what was she thinking Laughing Tell her thanks from all the rest of the web for her help.
Back to top
View user's profile Send private message 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Tue 21 Jan 2014, 23:38    Post subject:  

Ted Dog wrote:
Hay its for the betterment of unknown persons on the intertubes, what was she thinking Laughing Tell her thanks from all the rest of the web for her help.

Ted dog, what are you talking about?
Back to top
View user's profile Send private message Visit poster's website 
Ted Dog


Joined: 13 Sep 2005
Posts: 4013
Location: Heart of Texas

PostPosted: Wed 22 Jan 2014, 00:09    Post subject:  

first line after edit. Wink
Back to top
View user's profile Send private message 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Wed 22 Jan 2014, 01:31    Post subject:  

@Ted Dog
Wow I was slow on the uptake there. Anyway she enjoys the puppy linux media server in our home, makes good use use of the puppy firewall, without even realizing it, and saves plenty of cash on her husband's OS and software, but hassles me when I need her tablet for six minutes of testing. In her defense however, she was reading a book on the very tablet that I needed, when I asked her for it and with much begging she finally relented and let me borrow it. She is definitely a keeper, besides she tolerates me spending countless hours pursuing my tech passions and weeks long backpacking trips. Not just any woman would go for that.
Back to top
View user's profile Send private message Visit poster's website 
can8v

Joined: 15 Jul 2006
Posts: 584
Location: Yuba City, CA

PostPosted: Wed 22 Jan 2014, 13:41    Post subject:  

I did quite a bit more testing on this and discovered that sometimes after the
Code:
fusermount -u MTPdevice

command the device is still mounted. I haven't been able to figure out why this is as it has only happened a couple of times. I modified my unmount script to inform the user of the mount status of the MTP device after the the unmount script runs, so that if it is still mounted they will be aware and hopefully not unplug the device. In any case simply running the script again seems to unmount the device. A little strange, but tolerable. Here is the new script. It will notify you of the mount status in the terminal if you are running the script from the terminal. If you are running the script outside the terminal then a gtk dialog will notify of the mount status after the script runs.

Code:
#!/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."
else
    MOUNT_STATUS="MTP device unmounted successfully."
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>'
gtkdialog --program MAIN_DIALOG
Back to top
View user's profile Send private message Visit poster's website 
Display posts from previous:   Sort by:   
Page 2 of 17 [250 Posts]   Goto page: Previous 1, 2, 3, 4, ..., 15, 16, 17 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0778s ][ Queries: 12 (0.0097s) ][ GZIP on ]