whoozle / android-file-transfer-linux

Android File Transfer for Linux (and macOS!)
http://whoozle.github.io/android-file-transfer-linux/
GNU Lesser General Public License v2.1
1.46k stars 121 forks source link

When will write access be possible with android-file-transfer-linux ? #307

Open jehoshua7 opened 2 years ago

jehoshua7 commented 2 years ago

I've had to resort back to go-mtpfs , unfortunately.

The "read only" and other issues (aft kept crashing today) resulted in trying go-mtpfs again. After a bit of fiddling with connecting, it worked and I can once again transfer file TO the phone.

So, my question is, if go-mtpfs can write to a phone, why can't android-file-transfer-linux ??

Some of the issues I had this morning (besides not mounting) were the GUI displayed all the path names from the phone, multiple times. Sometimes even though there were files present in a path, they weren't visible (see https://github.com/whoozle/android-file-transfer-linux/issues/306 )

whoozle commented 2 years ago

Normally it should just work :)

try running aft-mtp-cli -v and post the lines starting with

extensions: microsoft.com: 1.0; android.com: 1.0;
supported op codes: GetDeviceInfo OpenSession CloseSession GetStorageIDs GetStorageInfo GetNumObjects GetObjectHandles 
...

I bet you have old Samsung phone, don't you? For some reason they removed google mtp code from it, and replaced it with half-working code. Maybe your phone does not support EditObject extension.

The reason why jmpts works - they are writing objects in full, so if you write something to the phone, it's always read to RAM first, then send in full.

jehoshua7 commented 2 years ago

Normally it should just work :)

try running aft-mtp-cli -v and post the lines starting with


extensions: microsoft.com: 1.0; android.com: 1.0;
supported op codes: GetDeviceInfo OpenSession CloseSession GetStorageIDs GetStorageInfo GetNumObjects GetObjectHandles 

aft-mtp-cli -v

creating device descriptor at /sys/bus/usb/devices/1-1.2.4 creating device descriptor at /sys/bus/usb/devices/1-1.6 creating device descriptor at /sys/bus/usb/devices/1-1.8 creating device descriptor at /sys/bus/usb/devices/2-1 creating device descriptor at /sys/bus/usb/devices/1-1.5 creating device descriptor at /sys/bus/usb/devices/1-1.2 creating device descriptor at /sys/bus/usb/devices/1-1.3 creating device descriptor at /sys/bus/usb/devices/1-1 probing device 046d:c31c error: Permission denied descriptor->TryOpen() failed probing device 0cf3:0036 error: Permission denied descriptor->TryOpen() failed probing device 0bda:0129 error: Permission denied descriptor->TryOpen() failed probing device 04e8:6860 capabilities = 0x000001fd page size = 4096

configurations: 1 interfaces: 1 Device usb interface: 0:0, index: 0, endpoints: 3 read control 80 06 0300 0000 languages[4]: 00000000: 04 03 09 04 ....

read control 80 06 03ee 0409 OSStringDescriptor[18]: 00000000: 12 03 4d 00 53 00 46 00 54 00 31 00 30 00 30 00 ..M.S.F.T.1.0.0. 00000010: 01 00 ..

vendor code: 0x01 read control c0 01 0000 0004 extended compat id os feature desctriptor[40]: 00000000: 28 00 00 00 00 01 04 00 01 00 00 00 00 00 00 00 (............... 00000010: 00 01 4d 54 50 00 00 00 00 00 00 00 00 00 00 00 ..MTP........... 00000020: 00 00 00 00 00 00 00 00 ........

your device may be locked or does not have any storage available

I bet you have old Samsung phone, don't you? For some reason they removed google mtp code from it, and replaced it with half-working code. Maybe your phone does not support EditObject extension.

The reason why jmpts works - they are writing objects in full, so if you write something to the phone, it's always read to RAM first, then send in full.

This is a Samsung S7, looks like that was Feb 2016. We have some old Samsung ones as well. On the mount I get

your device does not have android EditObject extension, mounting read-only

Thanks for explaining what jmpts does. Possibly because there are a number of permissions type errors, I would be better to use

sudo aft-mtp-cli -v ??

There is some discussion at https://github.com/whoozle/android-file-transfer-linux/issues/306 regarding the permissions issues. Possibly related. ?

jehoshua7 commented 2 years ago

Some extra info ..

mtp-detect

libmtp version: 1.1.18

Listing raw device(s) Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP). Found 1 device(s): Samsung: Galaxy models (MTP) (04e8:6860) @ bus 2, dev 3 Attempting to connect device(s) libusb_claim_interface() reports device is busy, likely in use by GVFS or KDE MTP device handling alreadyLIBMTP PANIC: Unable to initialize device Unable to open raw device 0 OK.

lsusb

Bus 001 Device 008: ID 0bda:0129 Realtek Semiconductor Corp. RTS5129 Card Reader Controller Bus 001 Device 009: ID 0cf3:0036 Qualcomm Atheros Communications AR9462 Bluetooth Bus 001 Device 005: ID 0c45:670b Microdia Integrated_Webcam_HD Bus 001 Device 004: ID 046d:c077 Logitech, Inc. M105 Optical Mouse Bus 001 Device 006: ID 046d:c31c Logitech, Inc. Keyboard K120 Bus 001 Device 003: ID 32e8:2406 ALOGIC ALOGIC USB Hub - UAFUUA Bus 001 Device 002: ID 8087:8000 Intel Corp. Integrated Rate Matching Hub Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 003 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub Bus 002 Device 003: ID 04e8:6860 Samsung Electronics Co., Ltd Galaxy A5 (MTP) Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

So, could the permissions issue be that the system has it connected already ? As a matter of practice and many experiences of using different tools over the years to connect a phone, I have found it is better to NOT respond to any system notification messages AFTER connecting the USB cable. T only respond to any phone prompts, which are usually of the format deny/allow.

jehoshua7 commented 2 years ago

More testing ..

So as it was a permissions problem, I ran the GUI and killed all users. The GUI then showed me the phone contents. I then exited the GUI and ran

mtp-detect

libmtp version: 1.1.18

Listing raw device(s) Device 0 (VID=04e8 and PID=6860) is a Samsung Galaxy models (MTP). Found 1 device(s): Samsung: Galaxy models (MTP) (04e8:6860) @ bus 2, dev 3 Attempting to connect device(s) LIBMTP PANIC: Could not open session! (Return code 8194) Try to reset the device. Unable to open raw device 0 OK.

Now the output is different and it looks like I'm now connected to the 'Phone'

aft-mtp-cli -v

creating device descriptor at /sys/bus/usb/devices/1-1.2.4 creating device descriptor at /sys/bus/usb/devices/1-1.6 creating device descriptor at /sys/bus/usb/devices/1-1.8 creating device descriptor at /sys/bus/usb/devices/2-1 creating device descriptor at /sys/bus/usb/devices/1-1.5 creating device descriptor at /sys/bus/usb/devices/1-1.2 creating device descriptor at /sys/bus/usb/devices/1-1.3 creating device descriptor at /sys/bus/usb/devices/1-1 probing device 046d:c31c error: Permission denied descriptor->TryOpen() failed probing device 0cf3:0036 error: Permission denied descriptor->TryOpen() failed probing device 0bda:0129 error: Permission denied descriptor->TryOpen() failed probing device 04e8:6860 capabilities = 0x000001fd page size = 4096

configurations: 1 interfaces: 1 Device usb interface: 0:0, index: 0, endpoints: 3 read control 80 06 0300 0000 languages[4]: 00000000: 04 03 09 04 ....

read control 80 06 03ee 0409 OSStringDescriptor[18]: 00000000: 12 03 4d 00 53 00 46 00 54 00 31 00 30 00 30 00 ..M.S.F.T.1.0.0. 00000010: 01 00 ..

vendor code: 0x01 read control c0 01 0000 0004 extended compat id os feature desctriptor[40]: 00000000: 28 00 00 00 00 01 04 00 01 00 00 00 00 00 00 00 (............... 00000010: 00 01 4d 54 50 00 00 00 00 00 00 00 00 00 00 00 ..MTP........... 00000020: 00 00 00 00 00 00 00 00 ........

selected storage 65537 SECZ9519043CHOHB Phone android file transfer for linux version v4.2-snapshot Samsung Electronics Co., Ltd. SM-G930F G930FXXS3ERHD extensions: microsoft.com: 1.0; microsoft.com/WMPPD: 11.0; microsoft.com/WMPPD: 10.0;samsung.com/kies:4.1;samsung.com/devicestatus:0; supported op codes: GetDeviceInfo OpenSession CloseSession GetStorageIDs GetStorageInfo GetNumObjects GetObjectHandles GetObjectInfo GetObject DeleteObject SendObjectInfo SendObject GetDevicePropDesc GetDevicePropValue SetDevicePropValue GetPartialObject GetObjectReferences SetObjectReferences GetObjectPropDesc GetObjectPropsSupported GetObjectPropValue SetObjectPropValue GetObjectPropList SetObjectPropList WMPMetadataRoundTrip WmpGetAcquiredContent GetThumb SelfTest SetObjectProtection ResetDevicePropValue MoveObject CopyObject GetInterdependentPropDesc SendObjectPropList 9501 9502 9503 9504 supported capture formats: supported image formats: _3gp b985 Mp3 Wma Wmv ExifJpeg Association AbstractAVPlaylist Undefined Flac b908 Gif Bmp Png Avi Mpeg Asf Mp4 UndefinedImage UndefinedVideo WplPlaylist M3uPlaylist AbstractAudioAlbum supported properties: BatteryLevel SynchronizationPartner DeviceFriendlyName SupportedFormatsOrdered PerceivedDeviceType DeviceIcon

Samsung Electronics Co., Ltd. SM-G930F / Galaxy S7 [93%]:Phone>

whoozle commented 1 year ago

Unfortunately, it's not possible to have proper partial writes with your mtp implementation. mtp-mount rewrites entire file from scratch each time, and it's creating O(N^2) load for hw.

Is it writing ok using Windows?