M0Rf30 / android-udev-rules

Android udev rules list aimed to be the most comprehensive on the net
GNU General Public License v3.0
1.18k stars 437 forks source link

Fairphone2 with Fairphone Open OS adb #243

Closed phu9Suop closed 1 year ago

phu9Suop commented 1 year ago

Hi At The times of android 7 this https://forum.fairphone.com/t/wanted-debian-stretch-udev-rule-for-fp-fairphone-2-with-openos-7-1-2-v19-02-1/48776/5?u=erich used to work Now since October we are at devuan chimaera (based on debian bullseye) and android 10 from 2022/10/05 (YYYY/MM/DD) and it does not work anymore dmesg | tail -6 shows

[119998.098264] usb 6-1: new high-speed USB device number 19 using ehci-pci
[119998.256043] usb 6-1: New USB device found, idVendor=2ae5, idProduct=f003, bcdDevice= 2.32
[119998.256050] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[119998.256053] usb 6-1: Product: FP2
[119998.256056] usb 6-1: Manufacturer: Fairphone
[119998.256059] usb 6-1: SerialNumber: xxxx

I tried to set up a udev rule but I failed. cat 51-android10_fairphone2.rules

  # Fairphone 2 with android 10
#SUBSYSTEM=="usb", ATTR{idVendor}=="2ae5", ATTR{idProduct}=="f003", ENV{adb_user}="yes"
SUBSYSTEM=="usb", ATTR{idVendor}=="2ae5", ATTR{idProduct}=="f003", MODE="0666", GROUP="plugdev", ENV{adb_user}="yes"

Your Help is welcome, I can test this for you

M0Rf30 commented 1 year ago

Sound strange to me. Can you confirm that you are displaying the usb ids with ADB enabled?

If it's the case this https://github.com/M0Rf30/android-udev-rules/tree/chore/fairphone-fp2 should fix. Can you test it?

JoesCat commented 1 year ago

I went looking for Fairphone F003 and found this: https://devicehunt.com/view/type/usb/vendor/2AE5/device/F003 Based on this webpage - it appears to be MTP, but no adb MTP = Media Transfer Protocol PTP = Photo Transfer Protocol

@phu9Suop - can you enable developer mode or debug mode on the phone before trying again. I do not know if you need to reboot the phone or turning it off/on again or anything. Hopefully, we see something with adb on it..... In fact, if you try different things, you might be able to see the various codes listed on the webpage.

JoesCat commented 1 year ago

@phu9Suop you mentioned: "Now since October we are at devuan chimaera" and referenced the other webpage. Out of curiosity, are you trying to debug/develop on the Fairphone? or are you just trying to access files on the phone? - just asking for more details...

JoesCat commented 1 year ago

developer mode:

    Go to Settings --> About phone
    Tap 10 times on the “Build number” field
    Congratulations, you’re a developer !

then

    Return to the settings menu --> Developer options
    Enable Android debug

Return to your computer and try again

phu9Suop commented 1 year ago

"Now since October we are at devuan chimaera" and referenced the other webpage. Out of curiosity, are you trying to debug/develop on the Fairphone? or are you just trying to access files on the phone? - just asking for more details...

Operating system updates both on the linux side and on the android side happen irregularly. To not spend the hours again getting back to where I was already, I try to get automated backup restore, just in case odd things happen. and adb install of apks which are on the PC.

did that 10 taps and develloper mode

[208813.027145] usb 6-1: new high-speed USB device number 25 using ehci-pci
[208813.184737] usb 6-1: New USB device found, idVendor=05c6, idProduct=901d, bcdDevice= 2.32
[208813.184741] usb 6-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[208813.184744] usb 6-1: Product: FP2
[208813.184747] usb 6-1: Manufacturer: Fairphone
[208813.184750] usb 6-1: SerialNumber: xxxxxxxx

now product id is 901d !

adb devices List of devices attached xxxxxxxxx device worx !

The developper mode got lost in the last fresh install. Thanks

JoesCat commented 1 year ago

hmmm.... someone is not paying attention to details :-/ Appears your phone changed idVendor values.

Take a look at this page here where it shows idVendor https://www.kernel.org/doc/Documentation/usb/gadget_printer.rst It reads....

.... This is the Vendor ID used in the device descriptor. The default is
the Netchip vendor id 0x0525. YOU MUST CHANGE TO YOUR OWN VENDOR ID
BEFORE RELEASING A PRODUCT.

Seems someone forgot to fill-in the correct values for your phone's updated code.

Looking at the problem here, when your phone is in 'normal' mode, the idVendor is 2ae5 but when you switch to developer mode, the idvendor switched to 05c6 Someone missed those details on patching, or making phone updates :-/

Glad you have your problem resolved. If you want to go another step further, if/when you switch your phone to normal mode, we don't want to be using 51-android-udev-rules. adb should stop working. What should be working then is another file named maybe 69-libmtp rules or maybe 60-libmtp rules. The majority of users basically want to connect their phone and transfer files, but not go as far as updating or patching the phone (with adb). I think you could try look in /usr/lib/udev/rules.d/ or /etc/rules.d/init.d/ for a file that looks like 6?-libmtp..... If it works for you, great. If it does not work for you, then you may want to consider asking about fixing the mtp library, it is located here: https://libmtp.sourceforge.net/

This way you should be covered as a normal user (60-libmtp rules), and also as an adb user (51-android rules).

JoesCat commented 1 year ago

Appears the Fairphone 2 is already covered for MTP, looking at about line 4153 here: https://sourceforge.net/p/libmtp/code/ci/HEAD/tree/src/music-players.h