764 shaares
94 liens privés
94 liens privés
gvfs-mtp
With lsusb you can get information about your device where Bus and Device numbers can be used with gvfs-mtp and device ID for creating of an udev rule.
Bus 002 Device 018: ID 04b7:88a9 Compal Electronics, Inc.
To see detected device with enabled MTP
Use gio mount:
gio mount -li | grep -e ^Volume -e activation_root
Volume(0): MT65xx Android Phone
activation_root=mtp://[usb:002,018]/
Use lsusb:
lsusb -v 2> /dev/null | grep -e Bus -e iInterface -e bInterfaceProtocol
...
Bus 002 Device 018: ID 04b7:88a9 Compal Electronics, Inc.
bInterfaceProtocol 0
iInterface 5 MTP
...
To mount all available connected MTP devices use inline script
gio mount -li | awk -F= '{if(index($2,"mtp") == 1)system("gio mount "$2)}'
To mount or dismount from a command with gvfs-mtp use Bus and Device numbers, e.g. to mount gio mount mtp://[usb:001,007]/ and to unmount gio mount -u mtp://[usb:001,007]/. The mounted device will be available in a directory that begins with mtp:host= and is located under /run/user/$UID/gvfs/.