Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android phone is not accessible in Odin [screenshots] #1781

Closed
elSolus opened this issue Aug 12, 2021 · 26 comments · Fixed by #1977
Closed

Android phone is not accessible in Odin [screenshots] #1781

elSolus opened this issue Aug 12, 2021 · 26 comments · Fixed by #1977
Labels
Status: Incomplete Requires more information to confirm or reproduce

Comments

@elSolus
Copy link
Contributor

elSolus commented Aug 12, 2021

What Happened

In the Odin release, Android phone connected via USB cable is not accessible. It connects and shows three options on the phone, none works.
Please refer to the screenshots below for comparison in Odin and Hera versions of the OS.
In Odin:
eOS6 Xiaomi

While it worked totally fine in Hera:
eOS5 1 7 Xiaomi

Expected Behavior

I should be able to access the entire phone as usual.

Steps to Reproduce

  1. Connect Android phone using USB.
  2. Select the "File transfer" option when prompted on the phone.
  3. Phone contents are not accessible.

Logs

Platform Information

OS: elementary OS 6 Odin
CPU: Intel i5 3330
Mobo: Intel DH61WW
RAM: 6GB
Phone: Redmi Note 10 running MIUI 12.0.4

@elSolus elSolus changed the title Android phone is not accessible in Odin [+screenshot] Android phone is not accessible in Odin [+screenshots] Aug 12, 2021
@elSolus elSolus changed the title Android phone is not accessible in Odin [+screenshots] Android phone is not accessible in Odin [screenshots] Aug 12, 2021
@cassidyjames
Copy link
Contributor

I'm unable to reproduce this here with a Pixel 3 or Pixel 5 on both Android 11 and the upcoming Android 12; plugging in prompts me on the phone, and I can choose "File transfer" to enable USB file transferring.

@cassidyjames cassidyjames added the Status: Incomplete Requires more information to confirm or reproduce label Aug 12, 2021
@elSolus
Copy link
Contributor Author

elSolus commented Aug 13, 2021

Well, very bad for me. The only difference between the two OS installations on my end is that Odin is on the new SSD while Hera is on an HDD. That's it. All the rest is the same (the system specs etc). Please guide me to test the same "from other angles" (if there are).

@rscm
Copy link

rscm commented Sep 4, 2021

Hi

It happened to me... the same thing with the same phone. Right now is working as it should be but I wanted to share my experience in case could help you.

the workaround was to access the phone through the terminal (/run/user/1000/gvfs/) [user id 1000]

the directory that is created now (working scenario) is:
/run/user/1000/gvfs/mtp:host=Xiaomi_Redmi_Note_10_b8e0a60d

previously with this device its hostname was (wasn't working):
/run/user/1000/gvfs/mtp:host=Xiaomi_SM6150-IDP__SN:CA5CFBFE_b8e0a60d

I really don't remember what I changed in the phone but looks like there's something about the device hostname that creates the problem... maybe the colon in it?
Because the system can access the files, is Files that can not read the directory

I found another bug with mount points, samba shares and devices but that isn't the issue here.


This logs are from now (working scenario)
syslog: connecting the phone

Sep  4 07:09:40 legion kernel: [ 1864.201491] usb 3-2: new high-speed USB device number 4 using xhci_hcd
Sep  4 07:09:40 legion kernel: [ 1864.356108] usb 3-2: New USB device found, idVendor=2717, idProduct=ff40, bcdDevice= 4.14
Sep  4 07:09:40 legion kernel: [ 1864.356120] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep  4 07:09:40 legion kernel: [ 1864.356124] usb 3-2: Product: Redmi Note 10
Sep  4 07:09:40 legion kernel: [ 1864.356127] usb 3-2: Manufacturer: Xiaomi
Sep  4 07:09:40 legion kernel: [ 1864.356130] usb 3-2: SerialNumber: b8e0a60d

syslog: opening Files

Sep  4 07:10:52 legion dbus-daemon[1108]: [session uid=1000 pid=1108] Successfully activated service 'org.freedesktop.thumbnails.Thumbnailer1'
Sep  4 07:10:52 legion dbus-daemon[1108]: [session uid=1000 pid=1108] Activating via systemd: service name='org.gtk.vfs.Metadata' unit='gvfs-metadata.service' requested by ':1.118' (uid=1000 pid=3450 comm="io.elementary.files ")
Sep  4 07:10:52 legion systemd[1081]: Starting Virtual filesystem metadata service...
Sep  4 07:10:52 legion dbus-daemon[1108]: [session uid=1000 pid=1108] Successfully activated service 'org.gtk.vfs.Metadata'
Sep  4 07:10:52 legion systemd[1081]: Started Virtual filesystem metadata service.
Sep  4 07:10:52 legion io.elementary.f[3450]: Directory.vala:686: Error reported by next_files_async: Se canceló la operación
Sep  4 07:10:59 legion gvfsd[3524]: Error 1: Get Storage information failed.

syslog: transfer activation in the phone

Sep  4 07:17:47 legion kernel: [ 2351.681099] usb 3-2: USB disconnect, device number 4
Sep  4 07:17:47 legion gvfsd[3524]: PTP: reading event an error 0x05 occurred
Sep  4 07:17:48 legion kernel: [ 2352.169271] usb 3-2: new high-speed USB device number 5 using xhci_hcd
Sep  4 07:17:48 legion kernel: [ 2352.324909] usb 3-2: New USB device found, idVendor=2717, idProduct=ff40, bcdDevice= 4.14
Sep  4 07:17:48 legion kernel: [ 2352.324921] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
Sep  4 07:17:48 legion kernel: [ 2352.324925] usb 3-2: Product: Redmi Note 10
Sep  4 07:17:48 legion kernel: [ 2352.324928] usb 3-2: Manufacturer: Xiaomi
Sep  4 07:17:48 legion kernel: [ 2352.324931] usb 3-2: SerialNumber: b8e0a60d
Sep  4 07:17:48 legion gvfsd[3524]: Device 0 (VID=2717 and PID=ff40) is a Xiaomi Mi-2s (id2) (MTP).
Sep  4 07:17:48 legion gvfsd[3524]: Android device detected, assigning default bug flags

dmesg

[ 1864.201491] usb 3-2: new high-speed USB device number 4 using xhci_hcd
[ 1864.356108] usb 3-2: New USB device found, idVendor=2717, idProduct=ff40, bcdDevice= 4.14
[ 1864.356120] usb 3-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 1864.356124] usb 3-2: Product: Redmi Note 10
[ 1864.356127] usb 3-2: Manufacturer: Xiaomi
[ 1864.356130] usb 3-2: SerialNumber: b8e0a60d

my system:
OS: elementary OS 6 Odin
Laptop: Lenovo Legion 5
CPU: AMD Ryzen 7 4800H
RAM: 16GB
Phone: Redmi Note 10 running Pixel Experience Plus 11.0 (20210821-1854-OFFICIAL)

@jeremypw
Copy link
Collaborator

jeremypw commented Sep 4, 2021

I could reproduce this issue on my Android phone using the current master code, but using PR #1752 I could successfully connect to the internal storage on the phone (once the USB connected device was set to "File Transfer" on the phone settings.)

@daaz40
Copy link

daaz40 commented Sep 5, 2021

Hello,
Same issue with Xaomi phone. Any fix?

image

dmesg
[ 127.719769] usb 1-2: USB disconnect, device number 6
[ 128.110008] usb 1-2: new high-speed USB device number 7 using xhci_hcd
[ 128.264335] usb 1-2: New USB device found, idVendor=2717, idProduct=ff40, bcdDevice= 4.14
[ 128.264346] usb 1-2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 128.264350] usb 1-2: Product: ATOLL-AB-IDP _SN:4B
[ 128.264353] usb 1-2: Manufacturer: Xiaomi
[ 128.264355] usb 1-2: SerialNumber: 32

journalctl
Sep 05 01:13:03 2464]: PTP: reading event an error 0x05 occurred
Sep 05 01:13:04 k gvfsd[2464]: Device 0 (VID=2717 and PID=ff40) is a Xiaomi Mi-2s (id2) (MTP).
Sep 05 01:13:04 k gvfsd[2464]: Android device detected, assigning default bug flags

mtp-detect
libmtp version: 1.1.17

Listing raw device(s)
Device 0 (VID=2717 and PID=ff40) is a Xiaomi Mi-2s (id2) (MTP).
Found 1 device(s):
Xiaomi: Mi-2s (id2) (MTP) (27:ff) @ bus 1, dev 13
Attempting to connect device(s)
error returned by libusb_claim_interface() = -6LIBMTP PANIC: Unable to initialize device
Unable to open raw device 0
OK.

@elSolus
Copy link
Contributor Author

elSolus commented Sep 5, 2021

@rscm what do you suggest I should do to fix? I didn't quite get you.

@rscm
Copy link

rscm commented Sep 5, 2021

@rscm what do you suggest I should do to fix? I didn't quite get you.

nothing, is pretty clear what I wrote

  • same phone
  • had the same problem
  • not anymore
  • noted the difference I saw (then v now)
  • plus, suggested a workaround if you need to access the files

@daaz40
Copy link

daaz40 commented Sep 5, 2021

thanks @rscm it took me while to understand workaround. Files are accessible via Terminal. Thanks!

@agrawalsourav98
Copy link

I am still facing this issue on elementary 6.1. I can access it using the terminal as suggested @rscm but again has limited usability as in, if you want to look at image thumbnails while copying only specific images from the phone.

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 8, 2022

@agrawalsourav98 Which folder path are you looking at when you access the phone through the terminal? If the phone mounts and creates a readable folder under /run then theoretically Files should show it. It works fine for me but maybe your phone has a different implementation of MTP or produces a weird address 🤷 Have you tried using the "Transfer photos" option (which uses the PTP protocol).?

MTP:
Screenshot from 2022-01-08 10 30 49

PTP (gphoto2):
Screenshot from 2022-01-08 10 28 03

@agrawalsourav98
Copy link

@jeremypw I have a oneplus 7 pro running android 11. I have previously used other mtp tools such as android file transfer and I was able to transfer files as usual. Also the mount point has no issues while using the terminal.

With MTP:
It mounted: /run/user/1000/gvfs/mtp:host=OnePlus_SM8150-MTP__SN%3A1680F756_2de29366
It looks for: mtp://OnePlus_SM8150-MTP__SN:1680/
From the terminal,
** (io.elementary.files:37793): WARNING **: 18:05:11.792: Directory.vala:694: Listing directory error: The specified location is not mounted, The specified location is not mounted mtp://OnePlus_SM8150-MTP__SN:1680/

With PTP:
It mounted: /run/user/1000/gvfs/gphoto2:host=OnePlus_SM8150-MTP__SN%3A1680F756_2de29366
It looks for: gphoto2://OnePlus_SM8150-MTP__SN:1680/
From the terminal,
** (io.elementary.files:37793): WARNING **: 18:09:04.190: Directory.vala:694: Listing directory error: The specified location is not mounted, The specified location is not mounted gphoto2://OnePlus_SM8150-MTP__SN:1680/

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 8, 2022

Maybe to do with the colon in the address being sought - I do not get that. I'll see if Files can be fixed to deal with that sort of address.

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 8, 2022

@agrawalsourav98 If you can, could you try out the linked PR to see whether it fixes the problem?

@o-alquimista
Copy link

o-alquimista commented Jan 9, 2022

@agrawalsourav98 If you can, could you try out the linked PR to see whether it fixes the problem?

I would like to try that fix over here, but I need to ask something about the build process. After I execute ninja install on that branch and perform the test, how do I revert to the stable version of Files?

@agrawalsourav98
Copy link

@o-alquimista Just don't use ninja install, Use only ninja , it will build locally and you can test locally by launching files from the build directory.

@agrawalsourav98
Copy link

@agrawalsourav98 If you can, could you try out the linked PR to see whether it fixes the problem?

No, its still the same, I think when mounting the device `%3A' should not be in the mount folder name. But also for some reason the mount location searched by files is cut short till 1680.

Results on current PR,
Files Mounted: '/run/user/1000/gvfs/mtp:host=OnePlus_SM8150-MTP__SN%3A1680F756_2de29366'
Files looking for: ** (io.elementary.files:50081): WARNING **: 07:23:37.291: Directory.vala:694: Listing directory error: The specified location is not mounted, The specified location is not mounted mtp://OnePlus_SM8150-MTP__SN:1680/

@o-alquimista
Copy link

o-alquimista commented Jan 9, 2022

The PR doesn't fix it.

The actual mtp mountpoint is this:

/run/user/1000/gvfs/mtp:host=HMD_Global_BENGAL-QRD__SN%3A55BE8205_Q020MA0100141500653

You can cd to it in the terminal and check that the directory is created with %3A in it.

But Files tries to access this (which doesn't exist):

/run/user/1000/gvfs/mtp:host=HMD_Global_BENGAL-QRD__SN:55BE8205_Q020MA0100141500653

Captura de tela de 2022-01-08 23 17 50

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 9, 2022

@agrawalsourav98 OK, thanks for trying. I cannot do anything about the path under /run - that is created by gvfs when it mounts the device. The error message you are getting indicates that Directory is trying to enumerate a path with an unescaped colon but if it got that far then it suggests the device was successfully mounted. I'll look further into it.

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 9, 2022

By the way, could you just make sure that all existing Files processes are killed before launching the PR locally? It is possible that it is still using the unmodified library.

@agrawalsourav98
Copy link

Yes, tried it with using pkill got the same results. If the underlying gvfs api has this bug, I think I can report the bug in gvfs. As it should handle semicolons properly while mounting locations. I will look into the gvfs issues to see if anyone has already created an issue for this.

Or would just skipping the colon escape in files make more sense?

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 9, 2022

The colon is usually a reserved character when escaping uris as it is needed for the protocol and possibly port so I think we need to special case MTP and PTP addresses and escape any colon that occurs after the one in the protocol - that is what the PR was doing except that I now see that it is being undone by Directory also processing the uri. So I will soon push a new version that leaves the special processing to Directory.

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 9, 2022

See https://gitlab.gnome.org/GNOME/gvfs/-/issues/338

@agrawalsourav98
Copy link

Yes, got it. So, the escaping is necessary on gvfs end to allow mounting of devices with special characters.

Cool, waiting to try the above mentioned fix!

@jeremypw
Copy link
Collaborator

jeremypw commented Jan 9, 2022

@agrawalsourav98 I've now updated #1977 so I'll be interested to hear whether it works for you. Tbh, the handling of various types of URI (including user input) in Files has become rather convoluted as various fixes and workarounds have been incorporated over the years and probably requires a rethink to see whether it can be simplified or at least made more intelligible.

@agrawalsourav98
Copy link

@agrawalsourav98 I've now updated #1977 so I'll be interested to hear whether it works for you. Tbh, the handling of various types of URI (including user input) in Files has become rather convoluted as various fixes and workarounds have been incorporated over the years and probably requires a rethink to see whether it can be simplified or at least made more intelligible.

Yep, that just fixed it. It just makes sense to escape the colon as the underlying gvfs explicitly does that.

I completely agree. There are a few things I face as well, like when I try to paste some stuff into the address bar, it automatically prefixes the current dir, it doesn't take into account if the path is absolute or relative. Maybe I will try to spare some free time to see if I can fix any. BTW when is this fix making the release?

@jeremypw
Copy link
Collaborator

The fix needs to be tested for regressions, reviewed and approved so it could be a while for it to get released. As it is relatively simple, hopefully it will not be too long. It will get into the unstable version earlier.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Incomplete Requires more information to confirm or reproduce
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants