Hello, I can’t find a way to use the command line on my MTP device (Android phone), the file manager works fine, but I want to manage files from command line.
Thanks.
I’m using OpenSUSE 13.2 KDE.
Hi
Is the device rooted? You should be able to connect via adb, but what do you want to do? If just transfer files to and from, then it should connect via usbfs.
On 2015-06-29 21:26, masoko wrote:
>
> Hello, I can’t find a way to use the command line on my MTP device
> (Android phone), the file manager works fine, but I want to manage files
> from command line.
You need to find out about mtpfs:
https://en.wikipedia.org/wiki/Media_Transfer_Protocol#Linux_and_other_Unix-like_systems
+++—-—-—-—-—-—-—-—-—-—-
The mtpfs tool is a FUSE based file system allowing to mount MTP devices
under normal Unix filesystem hierarchy, allowing it to be accessible by
any program operating on file system. Directory listening, renaming,
deleting, getting file attributes, copying files back and forth, and
caching is supported. Similar tools with differing implementations and
licences are jMTPFS, go-mtpfs and simple-mtpfs.[19]
—-—-—-—-—-—-—-—-—-—-+±
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” (Minas Tirith))
The device is rooted, how can I connect it via usbfs?
Thanx in advance.
Hi
On the device is usb debugging enabled? I’m assuming since you can see folders etc on the device it’s already using it (usbfs). You can see via the mount command.
Again, you still not clear on what your wanting to do from the command line, just move files to and from the device, or are you wanting to run commands on the device?
If real commands then adb (http://developer.android.com/tools/help/adb.html) is one method, I use sshdroid on the device and connect over wireless…
If moving files then you should be able to browse the device storage…
mount |grep fuse
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
ls /run/user/1000/gvfs/mtp:host\=%5Busb%3A003%2C002%5D/
Internal Storage Micro SD Card
You mtp device will be different, you can then drill down into the storage as required (remember spaces are preceded by a \ else use tab completion)
On 2015-07-02 15:56, malcolmlewis wrote:
>
> masoko;2717744 Wrote:
>> The device is rooted, how can I connect it via usbfs?
>>
>> Thanx in advance.
> Hi
> On the device is usb debugging enabled? I’m assuming since you can see
> folders etc on the device it’s already using it (usbfs). You can see via
> the mount command.
I assume he wants what I want: access files on an MTP only device from the command line. Mount it, copy files, etc. I certainly can not mount it at all, it is MTP. It does not appear to the kernel as an storage device,
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.512062] usb 2-1: new high-speed USB device number 27 using ehci-pci
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.630378] usb 2-1: New USB device found, idVendor=8087, idProduct=0a15
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.630386] usb 2-1: New USB device strings: Mfr=2, Product=3, SerialNumber=4
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.630391] usb 2-1: Product: Android
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.630395] usb 2-1: Manufacturer: Android
<0.6> 2015-07-02 16:48:57 minas-tirith kernel - - - [241637.630399] usb 2-1: SerialNumber: L1…………
<1.6> 2015-07-02 16:48:58 minas-tirith mtp-probe - - - checking bus 2, device 27: "/sys/devices/pci0000:00/0000:00:1d.7/usb2/2-1"
<1.6> 2015-07-02 16:48:58 minas-tirith mtp-probe - - - bus: 2, device: 27 was an MTP device
See? No /dev/sdb/ to mount anywhere.
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” (Minas Tirith))
Hi
But it’s already mounted via gvfs. I can browse and move/copy files via the command line via it’s gvfs mount point in my example above by drilling down into /run/user/1000/gvfs/mtp:host…
On 2015-07-02 17:16, malcolmlewis wrote:
>> See? No /dev/sdb/ to mount anywhere.
>>
> Hi
> But it’s already mounted via gvfs. I can browse and move/copy files via
> the command line via it’s gvfs mount point in my example above by
> drilling down into /run/user/1000/gvfs/mtp:host…
Sure? Wait, I have to verify that.
…]
WOW! :-))
Now, I’m very surprised. I’m now copying files with Midnight Commander.
It goes slowly, 44kbps. But it goes.
It is also using a lot of CPU:
> top - 19:07:54 up 9 days, 20:20, 28 users, load average: 1.66, 0.79, 0.50
> Tasks: 287 total, 3 running, 284 sleeping, 0 stopped, 0 zombie
> %Cpu(s): 28.7 us, 14.3 sy, 0.0 ni, 55.7 id, 1.2 wa, 0.0 hi, 0.2 si, 0.0 st
> KiB Mem: 3957996 total, 1990064 used, 1967932 free, 76020 buffers
> KiB Swap: 6289412 total, 1037712 used, 5251700 free, 706404 cached
>
> PID USER PR NI VIRT RES SHR SWAP USED S %CPU %MEM TIME+ COMMAND
> 11242 cer 20 0 787748 7220 3248 0 7220 S 21.68 0.182 0:40.28 gvfsd-mtp
> 6336 cer 20 0 632636 6148 2536 132 6280 S 14.78 0.155 0:27.54 gvfsd-fuse
> 5623 root 20 0 194940 5720 5408 204 5924 S 14.45 0.145 1:35.35 systemd-journal
> 8256 cer 20 0 2273244 534480 28900 317464 851944 R 11.17 13.50 141:49.01 firefox
the journal is busy because “org.gtk.vfs.Daemon” is sending a ton of
debug messages as it goes. Somebody compiled gnome libraries with debug
enabled, and it dumps that lot into the log. With syslog I filter of
that, but systemd journal eats it all, and seems to have bad quality
teeth, too.
It is going at 9 kbps now…
Wow. I didn’t notice you had said this is possible.
I thought you were referring to mtpfs.
:-o
–
Cheers / Saludos,
Carlos E. R.
(from 13.1 x86_64 “Bottle” (Minas Tirith))
Thanks for your reply, I can’t figure out the mtp:host=%5Busb%3A003%2C002%5D/ part.
My lsusb shows this.
lsusb
** Bus 002 Device 006: ID 1004:61f9 LG Electronics, Inc. (THIS IS THE MTP DEVICE)**
Bus 002 Device 003: ID 3938:1031
Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 004: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller
Bus 001 Device 003: ID 064e:e25c Suyin Corp.
Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
And my dmesg:
1588.863855] usb 2-1.5: USB disconnect, device number 5
1589.067342] usb 2-1.5: new high-speed USB device number 6 using ehci-pci
1589.153151] usb 2-1.5: New USB device found, idVendor=1004, idProduct=61f9
1589.153166] usb 2-1.5: New USB device strings: Mfr=2, Product=3, SerialNumber=4
1589.153169] usb 2-1.5: Product: MT65xx Android Phone
1589.153171] usb 2-1.5: Manufacturer: MediaTek
1589.153174] usb 2-1.5: SerialNumber: 5S9LOR45E6BEEYVS
1599.124015] usb 2-1.5: usbfs: process 2748 (kio_mtp) did not claim interface 0 before use
1599.197272] usb 2-1.5: reset high-speed USB device number 6 using ehci-pci
1599.283317] usb 2-1.5: usbfs: process 2748 (kio_mtp) did not claim interface 0 before use
1599.357140] usb 2-1.5: reset high-speed USB device number 6 using ehci-pci
Hope that info can help.
Hi
Run the following command with the device plugged in and post the output (use the #<> for code tags in advanced editor).
mount | grep fuse
This is the ouput:
mount |grep fuse
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=100)
All I want is to copy/move/delete files using the command line.
Hi
On the phone in the options, is it set to usb debugging? Also have you tried a different usb port on the system?
It is set to usb debugging, should I shut it down?
Hi
I don’t think you need to reboot. What about a different USB port?
Still the same output, no matter the usb port, do I need to install some libs to make it work? I’m using KDE, and the other day I tried the same mtp device on Linux Mint Cinnamon (which is a port of Gnome, right?) and I had no problems copying files from the command line.
I’m lost…
sudo mtpfs -o allow_other /mnt/Android_Device
Unable to open ~/.mtpz-data for reading, MTPZ disabled.
Listing raw device(s)
Device 0 (VID=1004 and PID=61f9) is a LG Electronics Inc. Android phone (ID2).
Found 1 device(s):
LG Electronics Inc.: Android phone (ID2) (1004:61f9) @ bus 2, dev 8
Attempting to connect device 0
ignoring libusb_claim_interface() = -6PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
ignoring libusb_claim_interface() = -6LIBMTP PANIC: failed to open session on second attempt
Unable to open raw device 0