Code Monkey home page Code Monkey logo

modempatcher's Introduction

Modem Patcher

Band 77 patcher for the OnePlus 9 and 9 Pro.

What and why?

OnePlus has band 77 disabled on the OnePlus 9 and 9 Pro. The original way to enable band 77 used QPST. QPST only seems to work on OxygenOS, and requires Windows. If you don't use OOS, or don't use Windows, this script can patch the modem file with the necessary changes.

Requirements

  1. OnePlus 9 or 9 Pro (tested on 9 Pro on Android 13 with lineageOS)
  2. Unlocked bootloader
  3. Python 3
  4. Android platform-tools (adb and fastboot)

How to use

Warning Bootloop risk!! On the latest version of LineageOS, my device bootloops after flashing the custom modem. It will only be fixed after erasing the device (flashing stock modem will not fix)! Please be careful, and always have a backup on hand.

  • First, we need to dump our modem file. Boot into bootloader (adb reboot bootloader), and run fastboot getvar current-slot. Take note of this.
  • If not rooted, temporarily boot TWRP (fastboot boot TWRP.img in bootloader). Commands are the same in TWRP, or not. We need to find what partition the modem is on.
  • Run adb shell (su after if not using TWRP), then run ls -lath /dev/block/by-name. Find the modem for your current slot, and take note of it.
  • Run these commands in order (replace sde9 with the partition if it's different):
    • [TIP] You may need to change /tmp to /storage/emulated/0 if you're having issues.
dd if=/dev/block/sde9 of=/tmp/modem.bin bs=2048
exit
adb pull /tmp/modem.bin
adb pull /tmp/modem.bin modem.bin.bak
  • We can now patch the modem.bin with the script. Run git clone https://github.com/itsnebulalol/modempatcher
  • To go into the directory, run cd modempatcher
  • Now, we can run python3 main.py -p /path/to/modem.bin
    • [TIP] Add -l or -L for Android 11, and maybe Android 12. Neither are tested.
  • Boot into bootloader, and fastboot flash --slot=all modem modem.bin

Having issues?

This script may not be perfect, and may not work on every device. Before, we pulled the modem image a second time so we have a backup. You can run fastboot flash --slot=all modem modem.bin.bak in bootloader to flash the backup.

Lost the backup? Add the -u flag to the script to unpatch the modem.bin, and you can flash it again.

Credits

modempatcher's People

Contributors

itsnebulalol avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

modempatcher's Issues

LOS bootloop issue tracker

I noticed the last commit you added a warning about bootlooping on LineageOS even after flashing back stock. It got me interested. Did you relock your bootloader to only boot LOS signed releases? If not, did you try reflashing LOS over your install, they ship international firmware so it should replace all those partitions. This means you have to flash your modifications back after every update unless you start building your own LOS with your modifications included.

I'm wondering if the modem partition somehow got corrupted. Would you be willing to keep this open and provide more details about which specific models you've tested on? (like model number, not just target name: e.g. LE2125 vs LE2127) It's unlikely this will cause a corruption on modemst/persist partitions but it's a good idea to back those up before doing any of this kind of work. I flashed the wrong phone's modem to mine early on and it broke 5G until I restored my backups (not even MSMtool could fix this).

I can point you at the firmware dumps done by LuK for the international 9/9pro models and me for the T-Mobile Oneplus 9 pro models if you need a clean source of modem partitions:

Possibly related: I'd also pay special attention to the oplusstanvbk.img partition as these can change band preferences and it appears to enable/disable carrier aggregation on NR-SA, I had to switch back to T-Mobile firmware because they don't ship these aggregations for international firmware and I want to be able to connect to N71+N41 at the same time for instance.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.