Bedhedd's xperia 5 III lineageos project

After my adventure rooting jelly star, I wanted to do this for my Sony Xperia 5 III.

This time I wanted to do it in more of a blog style with replies as updates so that I can keep track of my research and what I did.

Also don’t feel like writing a guide

2 Likes

Started by reading the guide on the LineageOS wiki
https://wiki.lineageos.org/devices/pdx214/install/

basic requirement section

I bought and checked the model number, but let’s use adb to confirm. A quick internet search found me this command

I added the tag |release\| to get the android version and get the relevant sections

adb shell getprop | grep "model\|version.sdk\|manufacturer\|hardware\|platform\|revision\|release\|serialno\|product.name\|brand"

...
[ro.product.manufacturer]: [Sony]
...
[ro.semc.product.model]: [XQ-BQ72]
[ro.semc.product.name]: [Xperia 5 III]
...
[ro.soc.manufacturer]: [QTI]
[ro.soc.model]: [SM8350]
...
[ro.system_ext.build.version.release]: [13]
[ro.system_ext.build.version.release_or_codename]: [13]
[ro.system_ext.build.version.sdk]: [33]
...
[ro.vendor.build.version.release]: [11]
[ro.vendor.build.version.release_or_codename]: [11]
[ro.vendor.build.version.sdk]: [30]
[vendor.somc.syscore.product.name]: [pdx214]

Checking the correct firmware section

Based on the previous section, I have android 13, my model number matches, and my product name matches the page name

sidequest to figure out which region and which firmware I would need to backup and recover the phone in case I flash the incorrect firmware

I wanted to backup my phone, so a quick internet search directed me to
https://xdaforums.com/t/tool-xperifirm-xperia-firmware-downloader-v5-7-0.2834142/

to install it, I needed to follow the Linux instructions and find the fedora equivalent packages

After installing it on Fedora, I needed to figure out which region my phone is so that I have the right firmware. The CDA seems to be a unique identifier and corresponds with a given region


xperifirm has instructions to access the service menu by dialing *#*#7378423#*#*.

When I did that, I did not find a CDA, however I found the following:

Global-C2 - user

However, this did not match up with the info online

I decided to search this to see if there was any others who had a mapping.
This post suggests looking at the certificate within the settings
https://old.reddit.com/r/SonyXperia/comments/16yxgcx/just_bought_1v_what_is_the_global_c2_region/kcj6yd4/

Matching it with the table on xpericheck and using process of elimination with the reply, I determined I have the CDA of 23243628 and a custom taiwan version Customized TW

CDA Name Latest Version Avg Update Time Discovered
23278672 Customized HK 61.2.A.0.472A 37 days 1 year 2 months ago
23243628 Customized TW 61.2.A.0.472A 38 days 1 year 2 months ago
23243684 Customized SEA 61.2.A.0.472A 37 days 1 year 2 months ago
23248625 Customized CN 61.2.G.0.72A 46 days 1 year 3 months ago
23243642 Customized RU 61.1.A.1.149 12 days 2 years 11 months ago

While researching the firmware, I came across this page
https://xdaforums.com/t/how-to-enable-volte-and-5g-without-permanent-root-on-xperia-5-iii-and-1-iii.4551847/

I’ll need to come back and review it another time as I am out of time for now

3 Likes

Getting stuck with the unlocking the bootloader

These instructions worked and I was able to get my IMEI number for the unlock steps later

This also worked, as well as adb devices.

I had some issues with detecting fastboot, I enabled developer mode, usb debugging, and oem unlocking. However when I entered the bootloader, none of my fastboot commands worked.

When I ran lsusb, Sony Ericsson Mobile Communications AB XQ-BQ72 shows up when I have it booted up, but when I enter fastboot, the phone no longer shows up in fastboot.

intial attempts to figure out why fastboot was failing

Android file protocol

A quick search online I find this answer which gives me a hint
android - ADB stopping at <waiting for devices> - Stack Overflow

For me, I couldn’t even see my Android device in Windows 10 Device Manager until I went into Settings/General/Developer options and set Select USB Configuration to MTP (Media Transfer Protocol) instead of the default Charging Only, and also found a different USB cable that wasn’t a charging-only one. Then, as @sushanthkille indicated above, I still had to install an updated driver, but the way he describes via Device Manager didn’t work. For my LG G4, I had to go to https://www.lg.com/us/lgeai/Drivers/pages/mobile-drivers.html (found via googling for windows 10 LG G4 drivers) download the Windows driver, and install it manually. After all that, my G4 finally showed up in Windows 10.

Granted this answer has a different phone and is using windows, but the key point is MTP. I suspected that the configuration was set to something that isn’t MTP as when I tried to switch the usb controlled by setting, it wouldn’t let me change it to my pc

Sony’s documentation also has some references as well
My computer doesn't detect my Xperia device when connected through USB | Sony USA

filtering for my phone from the command `lsusb -v | nvim -`
...
Bus 001 Device 036: ID 0fce:520d Sony Ericsson Mobile Communications AB XQ-BQ72
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0fce Sony Ericsson Mobile Communications AB
  idProduct          0x520d XQ-BQ72
  bcdDevice            5.04
  iManufacturer           1 Sony
  iProduct                2 XQ-BQ72
  iSerial                 3 QV780DP49H
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x003e
    bNumInterfaces          2
    bConfigurationValue     1
    iConfiguration          4 mtp_adb
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              5 MTP
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x82  EP 2 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x001c  1x 28 bytes
        bInterval               6
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        1
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 [unknown]
      bInterfaceProtocol      1 
      iInterface              6 ADB Interface
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x83  EP 3 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
Binary Object Store Descriptor:
  bLength                 5
  bDescriptorType        15
  wTotalLength       0x0016
  bNumDeviceCaps          2
  USB 2.0 Extension Device Capability:
    bLength                 7
    bDescriptorType        16
    bDevCapabilityType      2
    bmAttributes   0x0000211e
      BESL Link Power Management (LPM) Supported
    BESL value      256 us 
    Deep BESL value     8192 us 
  SuperSpeed USB Device Capability:
    bLength                10
    bDescriptorType        16
    bDevCapabilityType      3
    bmAttributes         0x00
    wSpeedsSupported   0x000f
      Device can operate at Low Speed (1Mbps)
      Device can operate at Full Speed (12Mbps)
      Device can operate at High Speed (480Mbps)
      Device can operate at SuperSpeed (5Gbps)
    bFunctionalitySupport   1
      Lowest fully-functional device speed is Full Speed (12Mbps)
    bU1DevExitLat           0 micro seconds
    bU2DevExitLat           0 micro seconds
Device Status:     0x0000
  (Bus Powered)
...

A quick review of the output returns the relevant sections

...
    iConfiguration          4 mtp_adb
...
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           3
      bInterfaceClass         6 Imaging
      bInterfaceSubClass      1 Still Image Capture
      bInterfaceProtocol      1 Picture Transfer Protocol (PIMA 15470)
      iInterface              5 MTP
...

There’s some conflicting information because it shows up as MTP and PTP.

USB auto detect dropping the connection

Since it has been a while since I last worked on this project, I suspected that dust may have thrown this error. I cleaned it out and attempted to change the settings, but was unable to pick the correct setting

I experienced this error earlier. I cleaned the usb out.

the cable, blasted unihertz cable

Unfortunately neither solutions above worked and with no other options I tried a different cable and port. I swapped my unihertz cable and tried using another Sony Xperia cable from my 5 ii. While researching, I came across this post
https://old.reddit.com/r/GalaxyTab/comments/sgj0ug/usb_controlled_by_connected_device_wont_switch/huxlivc/

I had this issue with my tab s7, the problem ended up being the USB I was using. Try using the one that came with the tablet, or another in general. There are some that don’t seem to let the tablet “talk” to the pc correctly. When I used a different usb it was fine.

With nothing to lose I gave the cable another shot

This time the phone was detected with lsusb -v and fastboot. To make it easier to read and copy, I used the | nvim -, Later while researching I learned I can also use | less to achieve the same

lsusb -v | nvim -
...
Bus 003 Device 058: ID 0fce:0dde Sony Ericsson Mobile Communications AB Android
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.10
  bDeviceClass            0 [unknown]
  bDeviceSubClass         0 [unknown]
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0fce Sony Ericsson Mobile Communications AB
  idProduct          0x0dde Android
  bcdDevice            1.00
  iManufacturer           1 Google
  iProduct                2 Android
  iSerial                 3 QV780DP49H
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength       0x0020
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0x80
      (Bus Powered)
    MaxPower              100mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           2
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass     66 [unknown]
      bInterfaceProtocol      3 
      iInterface              4 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x01  EP 1 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               1

now I just need to update my udev rules and add a new entry for the sony. After some exhausting research, I had brave’s ai chatbot help me look for the needed commands.

These were the suggestions

brave's ai summary

In one of the searches it references this stackoverflow answer for the udev entry

so instead of the Motorola, it’s Sony

Bus 003 Device 058: ID 0fce:0dde Sony Ericsson Mobile Communications AB Android
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0fce", ATTRS{idProduct}=="0dde", MODE="0666", GROUP = "plugdev", 

Then I reloaded the rules using the following commands from a response to a udev guide

sudo udevadm control --reload-rules
sudo udevadm trigger 

I don’t think it worked because I still needed to use sudo for my later fastboot commands

adding myself to the plugdev users group

Finally just to be safe, I ran the command brave suggested for adding my user to the plugdev group. I couldn’t find a source for this one, but it looked similar to this for the plugdev user

    sudo groupadd adbusers and sudo usermod -a -G adbusers $(whoami)

Android-tools not working? solved - #3 by gruhlstein - Fedora Discussion

sudo usermod -aG plugdev your_username

I thought since my last adventure, I wouldn’t need to deal with adding a udev entry nor updating my user group permissions, but I guess it is expected when working in Linux

These steps were pretty straight forward once I got the fastboot resolved. One Caveat is that Sony’s website for oem unlocking has a bunch of warnings of voiding my warranty for installing a custom rom.

checking out flashing additional partitions

These steps were pretty straight forward with fastboot detected

fumbling with recovery

In this section I made some missed inputs and got stuck trying to figure out how to access fastboot again. I got into a boot loop because I decided to reboot rather than power off and boot to recovery.

A major misconception was that I thought I needed to be in the bootloader to run fastboot commands. Being in the fastbootd menu is what I needed.

trying to figure out why I couldn’t interact with the fastboot cli

Aside from the misconception of being in the wrong menu/bootmode, I also wasn’t sure if my device was getting detected. Just to be safe, I updated my /etc/udev/rules.d/51-android.rules to update the entry for fastboot

lsusb
...
Bus 001 Device 060: ID 18d1:4ee0 Google Inc. Nexus/Pixel Device (fastboot)
...

udev entry

# /etc/udev/rules.d/51-android.rules
#Google Inc. 
SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", TAG+="systemd", ENV{SYSTEMD_WANTS}="adb.service", GROUP = "plugdev"

Looking back I’m not sure if this actually changed it or not, but the combination of these got me a lineageos phone

after getting the device detected with sudo fastboot devices I redid this section to make sure I didn’t have the incorrect recovery.

verifying firmware partitions

These steps were pretty straight forward and I didn’t run into any issues

actually installing it

These steps were pretty straight forward and I didn’t run into any issues

Since I opted for microg, my push notifications haven’t worked. This guide worked

1 Like