You are not logged in.

#1 2023-01-13 07:45:08

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Automatic mounting of an MTP device

I can't understand the process of mounting an MTP device. (The Media Transfer Protocol post has been read.)
I'm using a homemade Linux build.
Compiled the libusb and libmtp libraries and installed them in the build.
Also installed Android udev rules list.
When I connect my Android phone in data transfer mode, it writes to the logs:

Jan 13 10:01:34 (none) user.info kernel: usb 1-3: new high-speed USB device number 6 using ehci-pci
Jan 13 10:01:35 (none) user.info kernel: usb 1-3: New USB device found, idVendor=05c6, idProduct=0001
Jan 13 10:01:35 (none) user.info kernel: usb 1-3: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Jan 13 10:01:35 (none) user.info kernel: usb 1-3: Product: Swift 2 Plus
Jan 13 10:01:35 (none) user.info kernel: usb 1-3: Manufacturer: Wileyfox
Jan 13 10:01:35 (none) user.info kernel: usb 1-3: SerialNumber: 1c42defa
Jan 13 10:01:35 (none) user.info mtp-probe: checking bus 1, device 6: "/sys/devices/pci0000:00/0000:00:0f.5/usb1/1-3"
Jan 13 10:01:35 (none) user.info mtp-probe: bus: 1, device: 6 was an MTP device

mtp-detect worked and recognized my phone.
But mtp-connect freezes when I call it

~ # mtp-connect 
libmtp version: 1.1.19

Device 0 (VID=05c6 and PID=0001) is UNKNOWN in libmtp v1.1.19.
Please report this VID/PID and the device model to the libmtp development team
Android device detected, assigning default bug flags

I tried to connect another phone - the situation is exactly the same.

~ # mtp-connect
libmtp version: 1.1.19

Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
Android device detected, assigning default bug flags

I have compiled mtpfs. Uncommented the line user_allow_other in the file /etc/fuse.conf. I started it and got a similar result - freezes:

~ # mtpfs -o allow_other ~/phone
Listing raw device(s)
Device 0 (VID=05c6 and PID=0001) is UNKNOWN in libmtp v1.1.19.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   05c6:0001 @ bus 1, dev 6
Attempting to connect device
Android device detected, assigning default bug flags

It's the same with another phone:

~ # mtpfs -o allow_other ~/phone
Listing raw device(s)
Device 0 (VID=18d1 and PID=4ee1) is a Google Inc Nexus/Pixel (MTP).
   Found 1 device(s):
   Google Inc: Nexus/Pixel (MTP) (18d1:4ee1) @ bus 1, dev 8
Attempting to connect device
Android device detected, assigning default bug flags

The only thing that helped was the aft-mtp-mount utility. She mounts the device, while I have to do it manually and without specifying which device needs to be mounted. aft-mtp-mount somehow understands it himself.

In fact, I need to do automatic mounting of the device when connecting it via USB. There is no graphical interface. Are there any suggestions what needs to be done? I'm sure I've missed something.

Last edited by alexanderzhirov (2023-01-13 07:57:03)

Offline

#2 2023-01-13 10:07:51

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

I mounted the device via mtpfs, but it took a huge amount of time. Captured the mounting process. It takes more than 10 minutes to mount and read the internal memory of the phone. I have indicated each step in the description of the video. What can cause such problems?

Offline

#3 2023-01-13 10:35:50

kermit63
Member
Registered: 2018-07-04
Posts: 271

Re: Automatic mounting of an MTP device

I had some success using jmtpfs and gvfs-mtp in the past (say about 6 years ago). IIRC, the file manager (thunar) was able to automount my android devices. It was slow, but definitely not 10 minutes. Probably in the range of 30-45 seconds.

Since then though, I just use kdeconnect to connect to android phones.


Never argue with an idiot, they will drag you down to their level and then beat you with experience.
It is better to light a candle than curse the darkness.
A journey of a thousand miles begins with a single step.

Offline

#4 2023-01-13 11:56:39

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

https://aur.archlinux.org/packages/simple-mtpfs has never failed me so far (unlike almost all other, more complete mtp"fs" implementations)
nb. that the device might require interaction to set it into mtp mode after attaching it and consider DLNA, SMB, FTP or anything else that's not MTP.

Offline

#5 2023-01-13 13:31:09

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

kermit63 wrote:

I had some success using jmtpfs and gvfs-mtp in the past (say about 6 years ago).

Yes, I understand that. But I have a GUI-less system. I just need to fasten the auto-mounting. I compiled jmtpfs, but it gives me errors:

~ # jmtpfs ~/mtp
Device 0 (VID=05c6 and PID=0001) is UNKNOWN in libmtp v1.1.19.
Please report this VID/PID and the device model to the libmtp development team
Android device detected, assigning default bug flags
terminate called after throwing an instance of 'std::runtime_error'
  what():  could not find any magic files!
Aborted
seth wrote:

https://aur.archlinux.org/packages/simple-mtpfs has never failed me so far (unlike almost all other, more complete mtp"fs" implementations)

But I can't build it for some reason...

[root@TS_chroot]~# git clone https://github.com/phatina/simple-mtpfs.git
Cloning into 'simple-mtpfs'...
remote: Enumerating objects: 696, done.
remote: Counting objects: 100% (50/50), done.
remote: Compressing objects: 100% (28/28), done.
remote: Total 696 (delta 24), reused 39 (delta 22), pack-reused 646
Receiving objects: 100% (696/696), 203.10 KiB | 0 bytes/s, done.
Resolving deltas: 100% (477/477), done.

[root@TS_chroot]~# cd simple-mtpfs/

[root@TS_chroot]~/simple-mtpfs# ./autogen.sh 
autoreconf: export WARNINGS=
autoreconf: Entering directory '.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
/usr/share/aclocal/gtk.m4:7: warning: underquoted definition of AM_PATH_GTK
/usr/share/aclocal/gtk.m4:7:   run info Automake 'Extending aclocal'
/usr/share/aclocal/gtk.m4:7:   or see http://www.gnu.org/software/automake/manual/automake.html#Extending-aclocal
aclocal: warning: couldn't open directory 'm4': No such file or directory
autoreconf: configure.ac: tracing
autoreconf: configure.ac: not using Libtool
autoreconf: configure.ac: not using Intltool
autoreconf: configure.ac: not using Gtkdoc
autoreconf: running: /usr/local/bin/autoconf --force
autoreconf: running: /usr/local/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:6: installing './install-sh'
configure.ac:6: installing './missing'
src/makefile.am: installing './depcomp'
autoreconf: './install-sh' is updated
autoreconf: Leaving directory '.'

[root@TS_chroot]~/simple-mtpfs# ./configure 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for g++... g++
checking whether the C++ compiler works... yes
checking for C++ compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C++... yes
checking whether g++ accepts -g... yes
checking for g++ option to enable C++11 features... -std=gnu++11
checking for style of include used by make... GNU
checking dependency style of g++ -std=gnu++11... gcc3
./configure: line 3823: syntax error near unexpected token `noext'
./configure: line 3823: `AX_CXX_COMPILE_STDCXX_17(noext)'

Last edited by alexanderzhirov (2023-01-13 13:32:09)

Offline

#6 2023-01-13 13:33:23

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

Don't build as root fcol and ideally use the AUR and makepkg, https://wiki.archlinux.org/title/Aur

Offline

#7 2023-01-13 14:01:26

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

seth wrote:

Don't build as root fcol and ideally use the AUR and makepkg, https://wiki.archlinux.org/title/Aur

After all, it turned out to compile simple-mtpfs. The autoconf-archive package was installed in /usr/local/share instead of /usr/share. I corrected the paths and compiled the utility without any problems.

I managed to mount my phone via simple-mtpfs:

~ # simple-mtpfs -l
1: Unknown vendor Unknown product
~ # simple-mtpfs --device 1 /media
~ # ls /media
Alarms             Android_8_install  Books              DCIM               Download           ksweb              Music              Pictures           Ringtones          TWRP
Android            bluetooth          CallRecordings     Documents          htdocs             Movies             Notifications      Podcasts           Telegram           VoiceRecorder

Everything seems to have worked out. Is it possible to automate mounting when the device is connected to a computer? After all, there must be some kind of trigger for mounting MTP devices?

Offline

#8 2023-01-13 14:08:43

d.ALT
Member
Registered: 2019-05-10
Posts: 951

Re: Automatic mounting of an MTP device

alexanderzhirov wrote:

Everything seems to have worked out. Is it possible to automate mounting when the device is connected to a computer? After all, there must be some kind of trigger for mounting MTP devices?

I don't know how it works (never used / configured it the manual way), but you could take advantge of udev 's trigger-on-action capability.


<49,17,III,I>    Fama di loro il mondo esser non lassa;
<50,17,III,I>    misericordia e giustizia li sdegna:
<51,17,III,I>    non ragioniam di lor, ma guarda e passa.

Offline

#9 2023-01-13 18:19:25

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

I found something similar. As far as I understand, it is necessary to create a file in /etc/udev/rules.d/ with settings that will work when connecting this kind of device. Are there any working examples for the correct configuration of an MTP device?

SUBSYSTEM=="usb", SYSFS{idVendor}=="05c6", ATTR{idProduct}=="0001"

ENV{ID_MODEL}=="Swift 2 Plus", ENV{ID_MODEL_ID}=="05c6", ACTION=="add", RUN+="/usr/bin/simple-mtpfs /root/mnt"
ENV{ID_MODEL}=="Swift 2 Plus", ENV{ID_MODEL_ID}=="05c6", ACTION=="remove", RUN+="/bin/umount /root/mnt"

Last edited by alexanderzhirov (2023-01-13 18:19:57)

Offline

#10 2023-01-13 19:44:01

progandy
Member
Registered: 2012-05-17
Posts: 5,271

Re: Automatic mounting of an MTP device

On a first look those rules look pretty good for a basic setup.
Here is an old project for a more complex mtp automount setup:
https://github.com/jmoggr/uma

Personally I have used shell aliases in the past for sshfs or mtp like this:

mtp-mount='mkdir -p ~/mtp && simple-mtpfs ~/mtp && cd ~/mtp'
mtp-umount='fusermount -u ~/mtp && rmdir ~/mtp'

Last edited by progandy (2023-01-13 19:53:29)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2023-01-14 13:22:35

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

progandy wrote:

On a first look those rules look pretty good for a basic setup.
Here is an old project for a more complex mtp automount setup:
https://github.com/jmoggr/uma

Personally I have used shell aliases in the past for sshfs or mtp like this:

mtp-mount='mkdir -p ~/mtp && simple-mtpfs ~/mtp && cd ~/mtp'
mtp-umount='fusermount -u ~/mtp && rmdir ~/mtp'

Thank you very much. I would like to understand how to make such an automatic mount myself.

I created a rules file /etc/udev/rules.d/50-phone.rules and filled it with this content:

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001"

ENV{ID_MODEL}=="Swift_2_Plus", ENV{ID_MODEL_ID}=="0001", ACTION=="add", RUN+="/usr/bin/simple-mtpfs /root/mnt"
ENV{ID_MODEL}=="Swift_2_Plus", ENV{ID_MODEL_ID}=="0001", ACTION=="remove", RUN+="/bin/umount /root/mnt"

When I connect the device, the rules do not work out.
Here is the information about the connected device:

~ # udevadm info -p "/sys/devices/pci0000:00/0000:00:0f.5/usb1/1-3"
P: /devices/pci0000:00/0000:00:0f.5/usb1/1-3
N: bus/usb/001/009
S: android
S: android3
S: libmtp-1-3
E: BUSNUM=001
E: DEVLINKS=/dev/android /dev/android3 /dev/libmtp-1-3
E: DEVNAME=/dev/bus/usb/001/009
E: DEVNUM=009
E: DEVPATH=/devices/pci0000:00/0000:00:0f.5/usb1/1-3
E: DEVTYPE=usb_device
E: DRIVER=usb
E: ID_BUS=usb
E: ID_MEDIA_PLAYER=1
E: ID_MODEL=Swift_2_Plus
E: ID_MODEL_ENC=Swift\x202\x20Plus
E: ID_MODEL_ID=0001
E: ID_MTP_DEVICE=1
E: ID_REVISION=0318
E: ID_SERIAL=Wileyfox_Swift_2_Plus_1c42defa
E: ID_SERIAL_SHORT=1c42defa
E: ID_USB_INTERFACES=:ffff00:
E: ID_VENDOR=Wileyfox
E: ID_VENDOR_ENC=Wileyfox
E: ID_VENDOR_ID=05c6
E: MAJOR=189
E: MINOR=8
E: PRODUCT=5c6/1/318
E: SUBSYSTEM=usb
E: TAGS=:uaccess:
E: TYPE=0/0/0
E: USEC_INITIALIZED=841869576
E: adb_user=yes

If I do it myself, everything works out:

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  225548    148180     77368  66% /
dev                     225560         0    225560   0% /dev
tmpfs                   246084        24    246060   0% /tmp
tmpfs                   246084         0    246084   0% /dev/shm

~ # /usr/bin/simple-mtpfs /root/mnt

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  225548    148180     77368  66% /
dev                     225560         0    225560   0% /dev
tmpfs                   246084        24    246060   0% /tmp
tmpfs                   246084         0    246084   0% /dev/shm
simple-mtpfs          24957508  23310500   1647008  93% /root/mnt

~ # ls /root/mnt
Alarms             bluetooth          DCIM               htdocs             Music              Podcasts           TWRP
Android            Books              Documents          ksweb              Notifications      Ringtones          VoiceRecorder
Android_8_install  CallRecordings     Download           Movies             Pictures           Telegram

~ # /bin/umount /root/mnt

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  225548    148180     77368  66% /
dev                     225560         0    225560   0% /dev
tmpfs                   246084        24    246060   0% /tmp
tmpfs                   246084         0    246084   0% /dev/shm

Maybe something else needs to be done?

UPD. More info

udevadm info -ap "/sys/devices/pci0000:00/0000:00:0f.5/usb1/1-3"

Udevadm info starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

  looking at device '/devices/pci0000:00/0000:00:0f.5/usb1/1-3':
    KERNEL=="1-3"
    SUBSYSTEM=="usb"
    DRIVER=="usb"
    ATTR{authorized}=="1"
    ATTR{avoid_reset_quirk}=="0"
    ATTR{bConfigurationValue}=="1"
    ATTR{bDeviceClass}=="00"
    ATTR{bDeviceProtocol}=="00"
    ATTR{bDeviceSubClass}=="00"
    ATTR{bMaxPacketSize0}=="64"
    ATTR{bMaxPower}=="500mA"
    ATTR{bNumConfigurations}=="1"
    ATTR{bNumInterfaces}==" 1"
    ATTR{bcdDevice}=="0318"
    ATTR{bmAttributes}=="80"
    ATTR{busnum}=="1"
    ATTR{configuration}==""
    ATTR{devnum}=="9"
    ATTR{devpath}=="3"
    ATTR{devspec}=="  (null)"
    ATTR{idProduct}=="0001"
    ATTR{idVendor}=="05c6"
    ATTR{ltm_capable}=="no"
    ATTR{manufacturer}=="Wileyfox"
    ATTR{maxchild}=="0"
    ATTR{product}=="Swift 2 Plus"
    ATTR{quirks}=="0x0"
    ATTR{removable}=="unknown"
    ATTR{serial}=="1c42defa"
    ATTR{speed}=="480"
    ATTR{urbnum}=="503"
    ATTR{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:0f.5/usb1':
    KERNELS=="usb1"
    SUBSYSTEMS=="usb"
    DRIVERS=="usb"
    ATTRS{authorized}=="1"
    ATTRS{authorized_default}=="1"
    ATTRS{avoid_reset_quirk}=="0"
    ATTRS{bConfigurationValue}=="1"
    ATTRS{bDeviceClass}=="09"
    ATTRS{bDeviceProtocol}=="00"
    ATTRS{bDeviceSubClass}=="00"
    ATTRS{bMaxPacketSize0}=="64"
    ATTRS{bMaxPower}=="0mA"
    ATTRS{bNumConfigurations}=="1"
    ATTRS{bNumInterfaces}==" 1"
    ATTRS{bcdDevice}=="0414"
    ATTRS{bmAttributes}=="e0"
    ATTRS{busnum}=="1"
    ATTRS{configuration}==""
    ATTRS{devnum}=="1"
    ATTRS{devpath}=="0"
    ATTRS{devspec}=="  (null)"
    ATTRS{idProduct}=="0002"
    ATTRS{idVendor}=="1d6b"
    ATTRS{interface_authorized_default}=="1"
    ATTRS{ltm_capable}=="no"
    ATTRS{manufacturer}=="Linux 4.14.70TS_SMP ehci_hcd"
    ATTRS{maxchild}=="4"
    ATTRS{product}=="EHCI Host Controller"
    ATTRS{quirks}=="0x0"
    ATTRS{removable}=="unknown"
    ATTRS{serial}=="0000:00:0f.5"
    ATTRS{speed}=="480"
    ATTRS{urbnum}=="195"
    ATTRS{version}==" 2.00"

  looking at parent device '/devices/pci0000:00/0000:00:0f.5':
    KERNELS=="0000:00:0f.5"
    SUBSYSTEMS=="pci"
    DRIVERS=="ehci-pci"
    ATTRS{broken_parity_status}=="0"
    ATTRS{class}=="0x0c0320"
    ATTRS{companion}==""
    ATTRS{consistent_dma_mask_bits}=="32"
    ATTRS{d3cold_allowed}=="1"
    ATTRS{device}=="0x2095"
    ATTRS{devspec}==""
    ATTRS{dma_mask_bits}=="32"
    ATTRS{driver_override}=="(null)"
    ATTRS{enable}=="1"
    ATTRS{irq}=="11"
    ATTRS{local_cpulist}=="0"
    ATTRS{local_cpus}=="1"
    ATTRS{msi_bus}=="1"
    ATTRS{revision}=="0x02"
    ATTRS{subsystem_device}=="0x0000"
    ATTRS{subsystem_vendor}=="0x0000"
    ATTRS{uframe_periodic_max}=="100"
    ATTRS{vendor}=="0x1022"

  looking at parent device '/devices/pci0000:00':
    KERNELS=="pci0000:00"
    SUBSYSTEMS==""
    DRIVERS==""

Last edited by alexanderzhirov (2023-01-14 13:26:22)

Offline

#12 2023-01-14 13:31:13

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

Does the rule fire at all? (replace the script w/ something that echos into a file)
In doubt less complicate?

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="add", RUN+="/usr/bin/simple-mtpfs /root/mnt"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="remove", RUN+="/bin/umount /root/mnt

Offline

#13 2023-01-14 15:37:54

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

seth wrote:

Does the rule fire at all? (replace the script w/ something that echos into a file)
In doubt less complicate?

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="add", RUN+="/usr/bin/simple-mtpfs /root/mnt"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="remove", RUN+="/bin/umount /root/mnt

Most likely, the script simply does not work. Do I need to do something extra? Maybe it needs to be registered somewhere?

Last edited by alexanderzhirov (2023-01-14 15:38:30)

Offline

#14 2023-01-14 15:44:01

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

What do you mean by "most likey"? Did you check?
Replace it w/

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="add", RUN+="/usr/bin/touch /tmp/mtp.add"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="remove", RUN+="/usr/bin/touch /tmp/mtp.remove

and see whether the files get created.

Offline

#15 2023-01-14 16:07:36

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

seth wrote:

What do you mean by "most likey"? Did you check?
Replace it w/

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="add", RUN+="/usr/bin/touch /tmp/mtp.add"
SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="remove", RUN+="/usr/bin/touch /tmp/mtp.remove

and see whether the files get created.

Yes, it worked now! I incorrectly used the parameter ATTR instead of ATTRS. For remove action idVendor and idProduct are not triggered. In my case, it was possible to mount and unmount in this way:

SUBSYSTEM=="usb", ATTRS{idVendor}=="05c6", ATTRS{idProduct}=="0001", ACTION=="add", RUN+="/usr/bin/simple-mtpfs /root/mnt"
SUBSYSTEM=="usb", ENV{ID_MODEL}=="Swift_2_Plus", ACTION=="remove", RUN+="/bin/umount /root/mnt"

UPD. I will continue to understand. I'll try to write a universal script, I'll share it, maybe it will also be useful to someone.

Last edited by alexanderzhirov (2023-01-14 16:30:40)

Offline

#16 2023-01-14 16:32:42

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

Before that you'll please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

Offline

#17 2023-01-14 16:50:15

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

seth wrote:

Before that you'll please always remember to mark resolved threads by editing your initial posts subject - so others will know that there's no task left, but maybe a solution to find.
Thanks.

I will not close the topic yet, since in the next couple of days (after the weekend) I will continue to refine this work and post the result here. And then it will be possible to draw a conclusion together and close the topic.

Thank you very much for your help!

Offline

#18 2023-01-17 06:31:50

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

I managed to implement the connection of MTP devices using a script with minor modifications:

diff --git a/etc/udev/rules.d/51-android.rules b/etc/udev/rules.d/51-android.rules
index 36f8644..d34caf5 100644
--- a/etc/udev/rules.d/51-android.rules
+++ b/etc/udev/rules.d/51-android.rules
@@ -9,11 +9,14 @@
 # https://github.com/M0Rf30/android-udev-rules
 
 # Skip testing for android devices if device is not add, or usb
-ACTION!="add", ACTION!="bind", GOTO="android_usb_rules_end"
+# ACTION!="add", ACTION!="bind", GOTO="android_usb_rules_end"
 SUBSYSTEM!="usb", GOTO="android_usb_rules_end"
 
 # Skip testing for unexpected devices like hubs, controllers or printers
 ATTR{bDeviceClass}=="09", GOTO="android_usb_rules_end"
+ENV{ID_MODEL}=="", GOTO="android_usb_rules_end"
+ENV{ID_MODEL}=="Mass_Storage_Device", GOTO="android_usb_rules_end"
+ENV{ID_MODEL}=="USB_DISK", GOTO="android_usb_rules_end"
 ENV{ID_MODEL}=="Controller", GOTO="android_usb_rules_end"
 ENV{ID_USB_INTERFACES}=="*:0701??:*", ENV{adb_adb}="yes", GOTO="android_usb_rules_end"
 
@@ -552,6 +555,8 @@ ATTR{idProduct}=="9011", SYMLINK+="android_adb"
 ATTR{idProduct}=="f003", SYMLINK+="android_adb"
 #   Yongnuo YN450m (identified in lsusb as Intex Aqua Fish & Jolla C Diagnostic Mode)
 ATTR{idProduct}=="9091", SYMLINK+="android_adb"
+#   Wileyfox Swift 2 Plus
+ATTR{idProduct}=="0001"
 GOTO="android_usb_rule_match"
 LABEL="not_Qualcomm"
 
@@ -825,6 +830,7 @@ ATTR{idVendor}=="11ca", ENV{adb_user}="yes"
 
 # Skip other vendor tests
 LABEL="android_usb_rule_match"
+RUN+="/etc/udev/scripts/mtp.sh"
 
 # Symlink shortcuts to reduce code in tests above
 ENV{adb_adbfast}=="yes", ENV{adb_adb}="yes", ENV{adb_fast}="yes"

And the mounting script turned out to be such /etc/udev/scripts/mtp.sh:

#! /bin/sh

. /etc/thinstation.env
. $TS_GLOBAL

currentDevice=$BASE_MOUNT_PATH/$USB_MOUNT_DIR/$ID_VENDOR\_$ID_MODEL

_mounted() {
    if [ -n "$(grep -oe "$1" /proc/mounts)" ]; then
        return 0
    else
        return 1
    fi
}

_mount() {
    logger "mount $ID_VENDOR"
    if [ -d $currentDevice ] && _mounted $currentDevice; then
        exit 1
    fi
    if [ ! -d $currentDevice ]; then
        mkdir $currentDevice
        if is_enabled "$USB_STORAGE_SYNC" && [ ! -n "$(echo $USB_MOUNT_OPTIONS | grep -e sync)" ]; then
            USB_MOUNT_OPTIONS=$USB_MOUNT_OPTIONS,sync
        fi
        /bin/simple-mtpfs -o $USB_MOUNT_OPTIONS $currentDevice
        if ! _mounted $currentDevice; then
            rm -r $currentDevice
        else
            logger "mounted $ID_VENDOR in $currentDevice"
        fi
    fi
}

_umount() {
    logger "unmount $ID_VENDOR"
    if [ -d $currentDevice ]; then
        while _mounted $currentDevice; do
            umount $currentDevice
        done
        logger "unmounted $ID_VENDOR in $currentDevice"
        rm -r $currentDevice
    fi
}

if [ -v $ACTION ]; then
    exit 0
fi

if [ $ACTION == "add" ]; then
    _mount
elif [ $ACTION == "remove" ]; then
    _umount
fi

exit 0

Offline

#19 2023-01-17 12:29:40

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

Faced with the problem of reading the mounted device via FreeRDP.
For some reason simple-mtpfs mounts the device with the wrong date, although the date on the PC corresponds to the current time.
I am trying to open the mounted device via FreeRDP, but errors appear (mount video).
If I mount the device using the utility aft-mtp-mount, then through FreeRDP I can open this device.
I have a suspicion that there are problems with using fuse inside simple-mtpfs (debug video).

debug log:

~ # simple-mtpfs -d /mnt/usbdevice/Wileyfox_Swift_2_Plus
FUSE library version: 2.9.2
nullpath_ok: 0
nopath: 0
utime_omit_ok: 0
unique: 1, opcode: INIT (26), nodeid: 0, insize: 56, pid: 0
INIT: 7.26
flags=0x001ffffb
max_readahead=0x00020000
   INIT: 7.19
   flags=0x00000011
   max_readahead=0x00020000
   max_write=0x00020000
   max_background=0
   congestion_threshold=0
   unique: 1, success, outsize: 40
unique: 2, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 16659
getattr /
   unique: 2, success, outsize: 120
unique: 3, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 16659
getattr /
   unique: 3, success, outsize: 120
unique: 4, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 16659
opendir flags: 0x18800 /
   opendir[0] flags: 0x18800 /
   unique: 4, success, outsize: 32
unique: 5, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 16659
readdir[0] from 0
   unique: 5, success, outsize: 760
unique: 6, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 16659
   unique: 6, success, outsize: 16
unique: 7, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
releasedir[0] flags: 0x0
   unique: 7, success, outsize: 16
unique: 8, opcode: GETATTR (3), nodeid: 1, insize: 56, pid: 16659
getattr /
   unique: 8, success, outsize: 120
unique: 9, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 16659
opendir flags: 0x8000 /
   opendir[0] flags: 0x8000 /
   unique: 9, success, outsize: 32
unique: 10, opcode: OPENDIR (27), nodeid: 1, insize: 48, pid: 16659
opendir flags: 0x18800 /
   opendir[0] flags: 0x18800 /
   unique: 10, success, outsize: 32
unique: 11, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 16659
readdir[0] from 0
   unique: 11, success, outsize: 760
unique: 12, opcode: READDIR (28), nodeid: 1, insize: 80, pid: 16659
   unique: 12, success, outsize: 16
unique: 13, opcode: RELEASEDIR (29), nodeid: 1, insize: 64, pid: 0
releasedir[0] flags: 0x0
   unique: 13, success, outsize: 16

P.S. FreeRDP and Messages logs don't throw any errors.

Last edited by alexanderzhirov (2023-01-17 12:43:34)

Offline

#20 2023-01-17 13:08:50

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

You need to first and foremost understand that MTP is *not* a filesystem.

The first video shows simple-mtpfs mounting the device w/ somewhat realistic timestamps inside a Wileyfox_Swift_2_Plus directory and later on the Wileyfox_Swift_2_Plus itself w/ a unix epoch timestamp (January 1st, 1977)
Also some cyrillic windows dialogs that say something in cyrillic.

Explain which timestamp exactly is the desired and which is the undesired one - and what kind of FreeRDP error you get.
Having a directrory w/ a unix epoch timestamp is in and by itself not supposed to be a problem - if you cannot access them through FreeRDP (or rather windows)
Also what a RDP running windows has anything to do w/ this at all (ie. what and how you're actually mounting there, eg. via SMB?)

Offline

#21 2023-01-17 13:47:45

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

seth wrote:

You need to first and foremost understand that MTP is *not* a filesystem.

The first video shows simple-mtpfs mounting the device w/ somewhat realistic timestamps inside a Wileyfox_Swift_2_Plus directory and later on the Wileyfox_Swift_2_Plus itself w/ a unix epoch timestamp (January 1st, 1977)
Also some cyrillic windows dialogs that say something in cyrillic.

Explain which timestamp exactly is the desired and which is the undesired one - and what kind of FreeRDP error you get.
Having a directrory w/ a unix epoch timestamp is in and by itself not supposed to be a problem - if you cannot access them through FreeRDP (or rather windows)
Also what a RDP running windows has anything to do w/ this at all (ie. what and how you're actually mounting there, eg. via SMB?)

Inside my client distribution there is a directory /mnt/usbdevice for mounting USB devices (including MTP devices already).
When connecting via FreeRDP to the server, I pass this key with the value /a:drive,USB,/mnt/usbdevice.
How it is mounted inside FreeRDP I cannot answer. But USB flash drives are read via FreeRDP inside this directory.

I agree that the date, most likely, has nothing to do with it. But debugging does not give any errors. FreeRDP also does not give errors in the logs (I checked).

And in the dialog box in Windows it says that I do not have access to the directory or do not have enough rights when accessing a network resource. At the same time, the directory becomes completely inaccessible, so I have to reconnect to FreeRDP. What is strange is that FreeRDP does not write any errors about the lack of access to a network resource.

FreeRDP is also run as root. I tried adding the -o allow_other flag when mounting MTP, but it had no effect.

At the same time, on the client itself, access and reading to the mounted device is carried out without problems.

Last edited by alexanderzhirov (2023-01-17 14:46:11)

Offline

#22 2023-01-17 13:57:17

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

it says that I do not have access to the directory or do not have enough rights when accessing a network resource

Please post the output of

ls -laR /mnt/usbdevice

when mounting the MTP device w/ simple-mptfs and aft-mtp-mount
If *all* permissions are exactly the same, it might be down to ACLs, but that's a problem we'll look at when we're facing it.

I agree that the date, most likely, has nothing to do with it.

Yup.

Edit: also see "man simple-mtpfs" for the various umask, uid, gid and allow_others options
Eg. my own script uses "-o allow_other"

Last edited by seth (2023-01-17 14:08:05)

Offline

#23 2023-01-17 14:51:48

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

Here are small fragments, for the most part they are all similar.
simple-mtpfs:

/mnt/usbdevice:
total 0
drwxr-xr-x    3 root     root            60 Jan 17 17:36 .
drwxr-xr-x    3 root     root            60 Jan 17 03:00 ..
drwxrwxr-x    2 root     root             0 Jan  1  1970 Wileyfox_Swift_2_Plus

/mnt/usbdevice/Wileyfox_Swift_2_Plus:
total 1
drwxrwxr-x    2 root     root             0 Apr 15  2020 Alarms
drwxrwxr-x    2 root     root             0 Oct 10  2020 Android
drwxrwxr-x    2 root     root             0 Apr 16  2020 Android_8_install
drwxrwxr-x    2 root     root             0 Mar 30  2022 bluetooth
drwxrwxr-x    2 root     root             0 Mar 15  2022 Books
drwxrwxr-x    2 root     root             0 Dec 20  2021 CallRecordings
drwxrwxr-x    2 root     root             0 Feb 14  2022 DCIM
drwxrwxr-x    2 root     root             0 Mar  7  2022 Documents
drwxrwxr-x    2 root     root             0 Jan 12 08:57 Download
drwxrwxr-x    2 root     root             0 Jan 12 08:32 htdocs
drwxrwxr-x    2 root     root             0 Apr 21  2022 ksweb
drwxrwxr-x    2 root     root             0 Mar 29  2022 Movies
drwxrwxr-x    2 root     root             0 Apr 10  2022 Music
drwxrwxr-x    2 root     root             0 Apr 15  2020 Notifications
drwxrwxr-x    2 root     root             0 Mar 12  2022 Pictures
drwxrwxr-x    2 root     root             0 Apr 15  2020 Podcasts
-rw-r--r--    1 root     root            36 Mar 12  2022 .profig.os
drwxrwxr-x    2 root     root             0 Apr 15  2020 Ringtones
drwxrwxr-x    2 root     root             0 Apr 21  2021 Telegram
drwxrwxr-x    2 root     root             0 Apr 15  2020 TWRP
drwxrwxr-x    2 root     root             0 May  3  2021 VoiceRecorder

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Alarms:
total 0

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android:
total 0
drwxrwxr-x    2 root     root             0 Nov 28 10:55 data
drwxrwxr-x    2 root     root             0 Sep  9 21:51 media
drwxrwxr-x    2 root     root             0 Feb 15  2022 obb

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data:
total 0
drwxrwxr-x    2 root     root             0 Nov 28 10:55 co.froute.session_chat
drwxrwxr-x    2 root     root             0 May 13  2022 com.alibaba.aliexpresshd
drwxrwxr-x    2 root     root             0 Mar  5  2022 com.android.email
drwxrwxr-x    2 root     root             0 Apr 17  2020 com.android.gallery3d
drwxrwxr-x    2 root     root             0 Apr 17  2020 com.android.providers.telephony
drwxrwxr-x    2 root     root             0 Apr 15  2020 com.android.vending
drwxrwxr-x    2 root     root             0 Sep  9 21:47 com.bifit.dvbank
drwxrwxr-x    2 root     root             0 Aug 20  2020 com.brave.browser
drwxrwxr-x    2 root     root             0 Apr 16  2020 com.fbreader
drwxrwxr-x    2 root     root             0 Mar  7  2022 com.google.android.apps.maps
drwxrwxr-x    2 root     root             0 Apr 15  2020 com.google.android.gms
drwxrwxr-x    2 root     root             0 Mar 17  2022 com.google.android.youtube
drwxrwxr-x    2 root     root             0 Mar 17  2022 com.instagram.android
drwxrwxr-x    2 root     root             0 Dec 10  2020 com.linkedin.android
drwxrwxr-x    2 root     root             0 Apr 16  2020 com.lonelycatgames.Xplore
drwxrwxr-x    2 root     root             0 Aug 12  2021 com.microsoft.rdc.androidx
drwxrwxr-x    2 root     root             0 Apr 17  2020 com.qualcomm.timeservice
drwxrwxr-x    2 root     root             0 Sep 11  2020 com.splendapps.voicerec
drwxrwxr-x    2 root     root             0 Apr 17  2020 com.svox.pico
drwxrwxr-x    2 root     root             0 Apr 15  2020 com.topjohnwu.magisk
drwxrwxr-x    2 root     root             0 Feb 23  2022 com.twitter.android
drwxrwxr-x    2 root     root             0 Apr 17  2020 me.twrp.twrpapp
drwxrwxr-x    2 root     root             0 Jun 23  2021 net.tandem
-rw-r--r--    1 root     root             0 Apr 15  2020 .nomedia
drwxrwxr-x    2 root     root             0 May  3  2020 org.geometerplus.fbreader.plugin.djvu
drwxrwxr-x    2 root     root             0 May 23  2021 org.lineageos.eleven
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.jelly
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.lockclock
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.black
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.blue
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.brown
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.cyan
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.green
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.orange
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.pink
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.purple
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.red
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.yellow
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.black
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.overlay.dark
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.snap
drwxrwxr-x    2 root     root             0 Apr 15  2020 org.lineageos.trebuchet
drwxrwxr-x    2 root     root             0 Apr 17  2020 org.lineageos.weather.provider
drwxrwxr-x    2 root     root             0 Nov 24 00:25 org.linphone
drwxrwxr-x    2 root     root             0 Aug  9  2021 org.mozilla.firefox
drwxrwxr-x    2 root     root             0 Feb  2  2021 org.telegram.messenger
drwxrwxr-x    2 root     root             0 Mar 17  2022 pyaterochka.app
drwxrwxr-x    2 root     root             0 Mar 21  2022 ru.bestprice.fixprice
drwxrwxr-x    2 root     root             0 Apr 30  2022 ru.budzdorov.client.android
drwxrwxr-x    2 root     root             0 Feb 15  2022 ru.dublgis.dgismobile
drwxrwxr-x    2 root     root             0 May 27  2021 ru.fourpda.client
drwxrwxr-x    2 root     root             0 Apr 13  2022 ru.labirint.android
drwxrwxr-x    2 root     root             0 Mar 17  2022 ru.mw
drwxrwxr-x    2 root     root             0 Mar 17  2022 ru.sberbankmobile
drwxrwxr-x    2 root     root             0 Mar 11  2022 ru.tander.magnit
drwxrwxr-x    2 root     root             0 Sep 29  2020 ru.yandex.translate

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/co.froute.session_chat:
total 0
drwxrwxr-x    2 root     root             0 Nov 28 10:55 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/co.froute.session_chat/files:
total 0
drwxrwxr-x    2 root     root             0 Nov 29 18:25 appdata

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/co.froute.session_chat/files/appdata:
total 759
-rw-r--r--    1 root     root        776783 Dec  1 17:27 co.froute.session_chat.log

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 cache
drwxrwxr-x    2 root     root             0 May 13  2022 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/cache:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 caches

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/cache/caches:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 wvcache
drwxrwxr-x    2 root     root             0 May 13  2022 wvimage

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/cache/caches/wvcache:
total 0

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/cache/caches/wvimage:
total 0

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 AVFSCache
drwxrwxr-x    2 root     root             0 Jan 17 12:37 .gs_fs0
drwxrwxr-x    2 root     root             0 Jan 17 12:38 logs

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 DAI
drwxrwxr-x    2 root     root             0 May 13  2022 mtop_apicache_

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/DAI:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 v2.sqlite.1

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/DAI/v2.sqlite.1:
total 329
-rw-r--r--    1 root     root          8192 May 13  2022 alivfs.sqlite
-rw-r--r--    1 root     root         32768 May 13  2022 alivfs.sqlite-shm
-rw-r--r--    1 root     root        295808 May 13  2022 alivfs.sqlite-wal

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_/files:
total 0
drwxrwxr-x    2 root     root             0 May 13  2022 v2.ols100.1

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_/files/v2.ols100.1:
total 0

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/.gs_fs0:
total 6
-rw-r--r--    1 root     root           101 Nov  4 04:52 .0
-rw-r--r--    1 root     root           106 Oct  1 15:19 .1
-rw-r--r--    1 root     root            55 Oct  5 12:07 .10
-rw-r--r--    1 root     root            49 Sep 29 12:24 .11
-rw-r--r--    1 root     root           119 Nov 16 08:46 .2
-rw-r--r--    1 root     root           112 Sep 29 08:42 .3
-rw-r--r--    1 root     root            78 Oct 17 16:14 .4
-rw-r--r--    1 root     root           103 Oct 12 06:24 .5
-rw-r--r--    1 root     root            57 Sep 24 23:37 .6
-rw-r--r--    1 root     root            72 Sep 28 18:29 .7
-rw-r--r--    1 root     root            99 Nov  3 08:58 .8
-rw-r--r--    1 root     root           109 Sep 24 22:20 .9

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.alibaba.aliexpresshd/files/logs:
total 396
-rw-r--r--    1 root     root        400460 Jan 12 17:30 com.alibaba.aliexpresshd_20230112.tlog
-rw-r--r--    1 root     root          4502 Jan 17 12:39 com.alibaba.aliexpresshd_20230117.tlog

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.android.email:
total 0
drwxrwxr-x    2 root     root             0 Mar  5  2022 cache

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.android.email/cache:
total 1
-rw-r--r--    1 root     root           664 Mar  5  2022 IMAPupsync776056551206164810.eml

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.android.gallery3d:
total 0
drwxrwxr-x    2 root     root             0 Apr 26  2020 cache

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Android/data/com.android.gallery3d/cache:
total 12905
-rw-r--r--    1 root     root           430 Mar 13  2022 bookmark.0
-rw-r--r--    1 root     root             4 Apr 26  2020 bookmark.1
-rw-r--r--    1 root     root          2432 Mar 13  2022 bookmark.idx
-rw-r--r--    1 root     root      13089905 Nov 27 01:44 imgcache.0
-rw-r--r--    1 root     root             4 Apr 17  2020 imgcache.1
-rw-r--r--    1 root     root        120032 Nov 27 01:44 imgcache.idx

aft-mtp-mount:

/mnt/usbdevice:
total 0
drwxr-xr-x    3 root     root            60 Jan 17 17:28 .
drwxr-xr-x    3 root     root            60 Jan 17 03:00 ..
drwxr-xr-x    1 root     root             0 Jan 17 17:28 Wileyfox_Swift_2_Plus

/mnt/usbdevice/Wileyfox_Swift_2_Plus:
total 0
drwxr-xr-x    1 root     root             0 Jan 17 17:28 .
drwxr-xr-x    3 root     root            60 Jan 17 17:28 ..
drwxr-xr-x    1 root     root             0 Jan 17 17:28 Внутренний общий накопитель

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель:
total 0
drwxr-xr-x    1 root     root             0 Jan 17 17:28 .
drwxr-xr-x    1 root     root             0 Jan 17 17:28 ..
drwxr-xr-x    1 root     root          4096 Apr 15  2020 Alarms
drwxr-xr-x    1 root     root          4096 Oct 10  2020 Android
drwxr-xr-x    1 root     root          4096 Apr 16  2020 Android_8_install
drwxr-xr-x    1 root     root          4096 Mar 30  2022 bluetooth
drwxr-xr-x    1 root     root          4096 Mar 15  2022 Books
drwxr-xr-x    1 root     root          4096 Dec 20  2021 CallRecordings
drwxr-xr-x    1 root     root          4096 Feb 14  2022 DCIM
drwxr-xr-x    1 root     root          4096 Mar  7  2022 Documents
drwxr-xr-x    1 root     root          4096 Jan 12 08:57 Download
drwxr-xr-x    1 root     root          4096 Jan 12 08:32 htdocs
drwxr-xr-x    1 root     root          4096 Apr 21  2022 ksweb
drwxr-xr-x    1 root     root          4096 Mar 29  2022 Movies
drwxr-xr-x    1 root     root          4096 Apr 10  2022 Music
drwxr-xr-x    1 root     root          4096 Apr 15  2020 Notifications
drwxr-xr-x    1 root     root          4096 Mar 12  2022 Pictures
drwxr-xr-x    1 root     root          4096 Apr 15  2020 Podcasts
-rw-r--r--    1 root     root            36 Mar 12  2022 .profig.os
drwxr-xr-x    1 root     root          4096 Apr 15  2020 Ringtones
drwxr-xr-x    1 root     root          4096 Apr 21  2021 Telegram
drwxr-xr-x    1 root     root          4096 Apr 15  2020 TWRP
drwxr-xr-x    1 root     root          4096 May  3  2021 VoiceRecorder

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Alarms:
total 0
drwxr-xr-x    1 root     root          4096 Apr 15  2020 .
drwxr-xr-x    1 root     root             0 Jan 17 17:28 ..

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android:
total 0
drwxr-xr-x    1 root     root          4096 Oct 10  2020 .
drwxr-xr-x    1 root     root             0 Jan 17 17:28 ..
drwxr-xr-x    1 root     root             0 Nov 28 10:55 data
drwxr-xr-x    1 root     root             0 Sep  9 21:51 media
drwxr-xr-x    1 root     root             0 Feb 15  2022 obb

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data:
total 0
drwxr-xr-x    1 root     root             0 Nov 28 10:55 .
drwxr-xr-x    1 root     root          4096 Oct 10  2020 ..
drwxr-xr-x    1 root     root             0 Nov 28 10:55 co.froute.session_chat
drwxr-xr-x    1 root     root             0 May 13  2022 com.alibaba.aliexpresshd
drwxr-xr-x    1 root     root             0 Mar  5  2022 com.android.email
drwxr-xr-x    1 root     root             0 Apr 17  2020 com.android.gallery3d
drwxr-xr-x    1 root     root             0 Apr 17  2020 com.android.providers.telephony
drwxr-xr-x    1 root     root          4096 Apr 15  2020 com.android.vending
drwxr-xr-x    1 root     root             0 Sep  9 21:47 com.bifit.dvbank
drwxr-xr-x    1 root     root          4096 Aug 20  2020 com.brave.browser
drwxr-xr-x    1 root     root          4096 Apr 16  2020 com.fbreader
drwxr-xr-x    1 root     root             0 Mar  7  2022 com.google.android.apps.maps
drwxr-xr-x    1 root     root          4096 Apr 15  2020 com.google.android.gms
drwxr-xr-x    1 root     root             0 Mar 17  2022 com.google.android.youtube
drwxr-xr-x    1 root     root             0 Mar 17  2022 com.instagram.android
drwxr-xr-x    1 root     root             0 Dec 10  2020 com.linkedin.android
drwxr-xr-x    1 root     root             0 Apr 16  2020 com.lonelycatgames.Xplore
drwxr-xr-x    1 root     root          4096 Aug 12  2021 com.microsoft.rdc.androidx
drwxr-xr-x    1 root     root          4096 Apr 17  2020 com.qualcomm.timeservice
drwxr-xr-x    1 root     root          4096 Sep 11  2020 com.splendapps.voicerec
drwxr-xr-x    1 root     root          4096 Apr 17  2020 com.svox.pico
drwxr-xr-x    1 root     root          4096 Apr 15  2020 com.topjohnwu.magisk
drwxr-xr-x    1 root     root             0 Feb 23  2022 com.twitter.android
drwxr-xr-x    1 root     root             0 Apr 17  2020 me.twrp.twrpapp
drwxr-xr-x    1 root     root             0 Jun 23  2021 net.tandem
-rw-r--r--    1 root     root             0 Apr 15  2020 .nomedia
drwxr-xr-x    1 root     root             0 May  3  2020 org.geometerplus.fbreader.plugin.djvu
drwxr-xr-x    1 root     root             0 May 23  2021 org.lineageos.eleven
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.jelly
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.lockclock
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.black
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.blue
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.brown
drwxr-xr-x    1 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.cyan
drwxr-xr-x    1 root     root             0 Apr 17  2020 org.lineageos.overlay.accent.green
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.orange
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.pink
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.purple
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.red
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.accent.yellow
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.overlay.black
drwxr-xr-x    1 root     root             0 Apr 17  2020 org.lineageos.overlay.dark
drwxr-xr-x    1 root     root          4096 Apr 17  2020 org.lineageos.snap
drwxr-xr-x    1 root     root          4096 Apr 15  2020 org.lineageos.trebuchet
drwxr-xr-x    1 root     root             0 Apr 17  2020 org.lineageos.weather.provider
drwxr-xr-x    1 root     root             0 Nov 24 00:25 org.linphone
drwxr-xr-x    1 root     root          4096 Aug  9  2021 org.mozilla.firefox
drwxr-xr-x    1 root     root          4096 Feb  2  2021 org.telegram.messenger
drwxr-xr-x    1 root     root             0 Mar 17  2022 pyaterochka.app
drwxr-xr-x    1 root     root             0 Mar 21  2022 ru.bestprice.fixprice
drwxr-xr-x    1 root     root             0 Apr 30  2022 ru.budzdorov.client.android
drwxr-xr-x    1 root     root             0 Feb 15  2022 ru.dublgis.dgismobile
drwxr-xr-x    1 root     root          4096 May 27  2021 ru.fourpda.client
drwxr-xr-x    1 root     root             0 Apr 13  2022 ru.labirint.android
drwxr-xr-x    1 root     root             0 Mar 17  2022 ru.mw
drwxr-xr-x    1 root     root             0 Mar 17  2022 ru.sberbankmobile
drwxr-xr-x    1 root     root             0 Mar 11  2022 ru.tander.magnit
drwxr-xr-x    1 root     root             0 Sep 29  2020 ru.yandex.translate

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/co.froute.session_chat:
total 0
drwxr-xr-x    1 root     root             0 Nov 28 10:55 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
drwxr-xr-x    1 root     root             0 Nov 28 10:55 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/co.froute.session_chat/files:
total 0
drwxr-xr-x    1 root     root             0 Nov 28 10:55 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
drwxr-xr-x    1 root     root             0 Nov 29 18:25 appdata

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/co.froute.session_chat/files/appdata:
total 0
drwxr-xr-x    1 root     root             0 Nov 29 18:25 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
-rw-r--r--    1 root     root        776783 Dec  1 17:27 co.froute.session_chat.log

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
drwxr-xr-x    1 root     root             0 May 13  2022 cache
drwxr-xr-x    1 root     root             0 May 13  2022 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/cache:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 caches

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/cache/caches:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 wvcache
drwxr-xr-x    1 root     root             0 May 13  2022 wvimage

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/cache/caches/wvcache:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/cache/caches/wvimage:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 AVFSCache
drwxr-xr-x    1 root     root             0 Jan 17 12:37 .gs_fs0
drwxr-xr-x    1 root     root             0 Jan 17 12:38 logs

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 DAI
drwxr-xr-x    1 root     root             0 May 13  2022 mtop_apicache_

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/DAI:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 v2.sqlite.1

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/DAI/v2.sqlite.1:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
-rw-r--r--    1 root     root          8192 May 13  2022 alivfs.sqlite
-rw-r--r--    1 root     root         32768 May 13  2022 alivfs.sqlite-shm
-rw-r--r--    1 root     root        295808 May 13  2022 alivfs.sqlite-wal

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 files

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_/files:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
drwxr-xr-x    1 root     root             0 May 13  2022 v2.ols100.1

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/AVFSCache/mtop_apicache_/files/v2.ols100.1:
total 0
drwxr-xr-x    1 root     root             0 May 13  2022 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/.gs_fs0:
total 0
drwxr-xr-x    1 root     root             0 Jan 17 12:37 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
-rw-r--r--    1 root     root           101 Nov  4 04:52 .0
-rw-r--r--    1 root     root           106 Oct  1 15:19 .1
-rw-r--r--    1 root     root            55 Oct  5 12:07 .10
-rw-r--r--    1 root     root            49 Sep 29 12:24 .11
-rw-r--r--    1 root     root           119 Nov 16 08:46 .2
-rw-r--r--    1 root     root           112 Sep 29 08:42 .3
-rw-r--r--    1 root     root            78 Oct 17 16:14 .4
-rw-r--r--    1 root     root           103 Oct 12 06:24 .5
-rw-r--r--    1 root     root            57 Sep 24 23:37 .6
-rw-r--r--    1 root     root            72 Sep 28 18:29 .7
-rw-r--r--    1 root     root            99 Nov  3 08:58 .8
-rw-r--r--    1 root     root           109 Sep 24 22:20 .9

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.alibaba.aliexpresshd/files/logs:
total 0
drwxr-xr-x    1 root     root             0 Jan 17 12:38 .
drwxr-xr-x    1 root     root             0 May 13  2022 ..
-rw-r--r--    1 root     root        400460 Jan 12 17:30 com.alibaba.aliexpresshd_20230112.tlog
-rw-r--r--    1 root     root          4502 Jan 17 12:39 com.alibaba.aliexpresshd_20230117.tlog

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.android.email:
total 0
drwxr-xr-x    1 root     root             0 Mar  5  2022 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
drwxr-xr-x    1 root     root             0 Mar  5  2022 cache

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.android.email/cache:
total 0
drwxr-xr-x    1 root     root             0 Mar  5  2022 .
drwxr-xr-x    1 root     root             0 Mar  5  2022 ..
-rw-r--r--    1 root     root           664 Mar  5  2022 IMAPupsync776056551206164810.eml

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.android.gallery3d:
total 0
drwxr-xr-x    1 root     root             0 Apr 17  2020 .
drwxr-xr-x    1 root     root             0 Nov 28 10:55 ..
drwxr-xr-x    1 root     root             0 Apr 26  2020 cache

/mnt/usbdevice/Wileyfox_Swift_2_Plus/Внутренний общий накопитель/Android/data/com.android.gallery3d/cache:
total 0
drwxr-xr-x    1 root     root             0 Apr 26  2020 .
drwxr-xr-x    1 root     root             0 Apr 17  2020 ..
-rw-r--r--    1 root     root           430 Mar 13  2022 bookmark.0
-rw-r--r--    1 root     root             4 Apr 26  2020 bookmark.1
-rw-r--r--    1 root     root          2432 Mar 13  2022 bookmark.idx
-rw-r--r--    1 root     root      13089905 Nov 27 01:44 imgcache.0
-rw-r--r--    1 root     root             4 Apr 17  2020 imgcache.1
-rw-r--r--    1 root     root        120032 Nov 27 01:44 imgcache.idx

Offline

#24 2023-01-17 15:09:40

seth
Member
Registered: 2012-09-03
Posts: 60,000

Re: Automatic mounting of an MTP device

Meh.
simple-mtpfs actually has g+w over aft-mtp-mount.
They seem to handle directory timestamps differently (both values are made up)

getfacl /mnt/usbdevice/Wileyfox_Swift_2_Plus

Offline

#25 2023-01-17 15:41:23

alexanderzhirov
Member
Registered: 2022-05-12
Posts: 39
Website

Re: Automatic mounting of an MTP device

~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  494512    152200    342312  31% /
dev                     494524         0    494524   0% /dev
tmpfs                   513668        24    513644   0% /tmp
tmpfs                   513668         0    513668   0% /dev/shm
simple-mtpfs          24957508  23587520   1369988  95% /mnt/usbdevice/Wileyfox_Swift_2_Plus

~ # getfacl /mnt/usbdevice/Wileyfox_Swift_2_Plus
getfacl: Removing leading '/' from absolute path names
# file: mnt/usbdevice/Wileyfox_Swift_2_Plus
# owner: root
# group: root
user::rwx
group::rwx
other::r-x
~ # df
Filesystem           1K-blocks      Used Available Use% Mounted on
rootfs                  494512    152220    342292  31% /
dev                     494524         0    494524   0% /dev
tmpfs                   513668        24    513644   0% /tmp
tmpfs                   513668         0    513668   0% /dev/shm
aft-mtp-mount         24956928  23587840   1369088  95% /mnt/usbdevice/Wileyfox_Swift_2_Plus

~ # getfacl /mnt/usbdevice/Wileyfox_Swift_2_Plus
getfacl: Removing leading '/' from absolute path names
# file: mnt/usbdevice/Wileyfox_Swift_2_Plus
# owner: root
# group: root
user::rwx
group::r-x
other::r-x

Offline

Board footer

Powered by FluxBB