https://wiki.archlinux.org/title/Media_Transfer_Protocol
https://jeromebelleman.gitlab.io/posts/filesystems/gvfs/
Android File Transfer
android-file-transfer <===> program na stahnuti dat z mobilu Android
lsusb <===> napise napr Bus 001 Device 022: ID 0b**:***3 ASUSTek Computer, Inc. Zenfone GO (ZB500KL) (Debug, MTP mode)
lsusb -v -s 22 <===> napise detaily pro zarizeni 022 viz vyse
After installing android-file-transfer, while trying to mount any MTP device if you get the following error:
$ aft-mtp-mount /path/to/folder
connect failed: no MTP device found
then install the package: android-udev. This package contains per manufacturer/device udev rules for MTP devices, making it easier to use ADB or MTP.
mtp-files <===> vypise v CLI vsechny soubory z telefonu
mtp-filetree <===> vypise v CLI vsechny soubory z telefonu (tree)
mtp-tools <===> tools for communicating with Media Transfer Protocol (MTP) devices
mtp-folders <===> ??
mtp-detect <===> asi detekuje telefon
GVFS
GVFS for Accessing Files Over Any Protocol
gphoto2
gphoto2 --auto-detect <===> zjisti USB PTP Class
jmtpfs
## timto programem muzu pripojit Android jako dalsi disk v PC a prohlizet napr souborovym managerem:)
apt-get install jmtpfs <===> allows to mount MTP devices.
As an alternative, you can try go-mtpfs instead.
jmtpfs -l <===> List all available MTP devices.
Uses FUSE to mount your device's MTP structure into a POSIX filesystem, and fusermount to unmount the device.
1) install package name=jmtpfs
2) create <directory> as your mount point: $ mkdir -p <directory>
3) make sure you have write access to <directory>: $ sudo chown $USER:$USER <directory>
4) to mount your device: $ jmtpfs <directory/>
5) On some MTP devices: your screen must be unlocked in order to mount. However, you might get a (spurious) input/output error even if the screen is unlocked.
6) to unmount your device: $ fusermount -u <directory/>
##priklad pripojeni:
mkdir -p /tmp/android
ubuntu@latitude:~$ sudo chown $USER:$USER /tmp/android
ubuntu@latitude:~$ jmtpfs /tmp/android
##priklad odpojeni:
fusermount -u /tmp/android
jmtpfs is a FUSE and libmtp based filesystem for accessing MTP (Media Transfer Protocol)
devices. It was specifically designed for exchaning files between Linux (and Mac OS X)
systems and newer Android devices that support MTP but not USB Mass Storage.
The goal is to create a well-behaved filesystem, allowing tools like find(1) and rsync(1)
to work as expected. MTP file types are set automatically based on file type detection
using libmagic(3). Setting the file type is necessary for some Android applications, like
Gallery, to be able to find and use the files uploaded to the device.
USB mass storage
USB mass storage — also known as “USB mass storage device class,” USB MSC, or UMS — was the way older versions of Android exposed their storage to a computer. When you connected your Android device to your computer, you’d have to specifically tap a “Connect storage to PC” button to make the Android device’s storage accessible to the computer over USB mass storage. When disconnecting it from the computer, you’d have to tap a “Turn off USB storage” button.
USB mass storage is the standard protocol used by flash drives, external hard drives, SD cards, and other USB storage devices. The drive makes itself completely available to the computer, just as if it were an internal drive.
There were problems with the way this worked. Whatever device is accessing the storage needs exclusive access to it. When you connected the storage to the computer, it was disconnected from the Android operating system running on the device. Any files or apps stored on the SD card or USB storage would be unavailable when it was connected to the computer.
MTP – Media Device
MTP stands for “Media Transfer Protocol.” When Android uses this protocol, it appears to the computer as a “media device.” The media transfer protocol was widely promoted as a standardized protocol for transferring audio files to digital music players using Windows Media Player and similar applications. It was designed to allow other media player companies to compete with Apple’s iPod and iTunes.
This protocol works very differently from USB mass storage. Rather than exposing your Android device’s raw file system to Windows, MTP operates at the file level. Your Android device doesn’t expose its entire storage device to Windows. Instead, when you connect a device to your computer, the computer queries the device and the device responds with a list of files and directories it offers. The computer can download a file — it will request the file from the device, and the device will send the file over the connection. If a computer wants to upload a file, it sends the file to the device and the device chooses to save it. When you delete a file, your computer sends a signal to the device saying, “please delete this file,” and the device can delete it.
Android can choose the files it presents to you, and hide system files so you can’t see or modify them. If you attempt to delete or edit a file that can’t be modified, the device will refuse the request and you’ll see an error message.
Your computer doesn’t need exclusive access to the storage device, so there’s no need to connect the storage, disconnect it, or have separate partitions for different types of data. Android can also use ext4 or any other file system it wants — Windows doesn’t have to understand the file system, only Android does.
In practice, MTP functions a lot like USB mass storage. For example, an MTP device shows up in Windows Explorer so you can browse and transfer files. Linux also supports MTP devices via libmtp, which is generally included with popular desktop Linux distributions. MTP devices should appear on your Linux desktop’s file manager, too.
Apple’s Mac OS X is a holdout — it doesn’t include MTP support at all. Apple’s iPod, iPhone, and iPad use their own proprietary syncing protocol along with iTunes, so why would they want to support a competing protocol?
Google provides an Android File Transfer application for Mac OS X. This application is just a simple MTP client, so it will work for transferring files back and forth on a Mac. Google doesn’t provide this application for other operating system because they include MTP support.
Modern Androids do not use the traditional USB storage protocol for granting access to the phone storage, which is why you don't see a block device (/dev/sd*) appearing. They use a specific protocol called MTP which abstracts the underlying file system away from host (the benefit here is that you can continue using your phone/the phone's filesystem, while changing data via computer). For all intents and purposes, think of it as a network file system like SMB or NFS where you can access the files but don't have information on the actual storage the data lands on.
The downside of the matter is that MTP is a horrible protocol, with weird limitations (you can only access it from one single application and do single operations at a time, which often leads to conflicts should you use multiple applications providing MTP support).
MTP protocol implementations exist in various user space software you will want to read through which outlines various options for access.
Android doesn't support mounting your phone as a USB mass storage device anymore as of Android 4.x. It's all MTP now. Installing mtp-tools should make lsusb list your device. To mount your device as a drive you have to follow a few more steps.
PTP – Digital Camera
PTP stands for “Picture Transfer Protocol.” When Android uses this protocol, it appears to the computer as a digital camera.
MTP is actually based on PTP, but adds more features, or “extensions.” PTP works similarly to MTP, and is commonly used by digital cameras. Any software program that supports grabbing photos from a digital camera will support grabbing photos from an Android phone when you select the PTP mode. PTP was designed to be a standard protocol for communicating with digital cameras.
In this mode, your Android device will work with digital camera applications that support PTP but not MTP. Apple’s Mac OS X does support PTP, so you can use PTP mode to transfer photos from an Android device to a Mac over a USB connection without any special software.
If you have an older Android device, you may be forced to use USB mass storage. On a modern Android device, you have a choice between MTP and PTP — you should use MTP unless you have software that only supports PTP.
If your device has a removable SD card, you can remove the SD card and insert it directly into your computer’s SD card slot. The SD card will be available to your computer as a storage device, so you can access all the files on it, run file-recovery software, and do anything else you can’t do with MTP.