Yes, i’m the owner of a samsung s4 intl, gt-19505, and as probably anyone using cyanogenmod 13 nightly build, my phone suffered cellular network issues. This is how i fixed it.
The phone started to have cellular network issues few months ago, basically it was losing network, calling was hard cause very commonly it was saying “no sim card” and similar things.
After a fast investigation the issue was clear: as cyanogenmod advances, it build the OS over recent android kernel and drivers, but it cannot distribute some drivers on samsung devices cause of license issues, and this is true for the modem driver too. So, basically, if you continue to upgrade to latest cyanogenmod, your kernel and drivers start to be old and out of sync with the system.
If you have this issue on your s4, and you do a fast search online, you will end to different how to and posts about resolving by using odin and flashing the “modem.bin” file, or, if you search more, to flash both modem.bin and NON-HLOS.bin file too.
First of all, i cannot use odin, it’s closed software and my religion deny me to use it, but, more importantly, it doesn’t run on linux, and here where i am i have only chromeos and linux devuan, and i cannot install a windows virtual machine just for that.
So, as many of you may bet, the solution is as simple as using heimdall instead of odin: you win!
There are also a couple of posts in the wild describing how to do this fix with heimdall, but sadly i found on my own skin that… the proposed fix doesn’t work. Or better, it works, the connection is effectively fixed, but it cause two more bugs:
- You cannot “search cellular networks” and set a specific network manually.
- no audio at all. no seriously, no audio, never, niet, no, zero. A totally mute phone.
So, how to solve it completely?
The same thing we said about modem.bin is true also for the rest of kernel and drivers, so, if we update only modem.bin and eventually also NON-HLOS.bin, we have only partially updated it, but it isn’t enough.
So, i will explain here how to totally solve the whole issue.
FIRST WARNING: this procedure can brick your phone. If you proceed with it, you will do it under your sole resposability.
SECOND WARNING: this procedure will NOT overwrite your system or data partitions, so, you will not need to restore a backup if all goes well. Note the “if”. do a backup, NOW.
3RD WARNING: do this procedure if you know what you do. If your cat will die cause of it, it’s up to you to take responsability.
I use Devuan GNU/Linux, so, all commands will be related to the install and use of heimdall under Devuan GNU/Linux. If you use it, great!. If you don’t use it, you should. If you don’t want to use it, fuck yourself, you should know how to install and use it in your distro, don’t blame me for that.
So, said that, we can proceed. First of all, we need heimdall installed. To install it, just do:
# apt-get install heimdall
Of course you need to do that as root. No, i will not use sudo. Real nerds don’t use sudo. Real men get a root shell with su.
We will have many files to flash in the phone, but where to get them? Easy enough, there is an amazing web site distributing all stock android images for samsung phones (so, also for s4), we just need to get the most updated for our phone.
Go to http://www.sammobile.com , register an account, and you can search for firmwares by phone model: use galaxy s4 and choose gt-19505, then choose the one that better match your actual firmware version, you can see it by select in the configuration menu of your phone the “about” menu and looking for “baseband” version: you will have to match the first two characters, in my case they were XX, and my phone is italian, so, i choose this firmware:
This firmware is the whole system, so, you will have to download a 1.5 gigabyte file, but you will use only drivers and kernel from it, not the whole system.
The file you will download is “firmware_version.zip” file, in my case is:
you can open the zip as usual:
$ unzip I9505XXUHOJ2_I9505TIMHOJ1_TIM.zip
This will extract a “.tar.md5” file. It’s just a normal tar file, so, you can extract it by using the “tar” command:
$ tar I9505XXUHOJ2_I9505TIMHOJ1_I9505XXUHOJ2_HOME.tar.md5
now you will have several files. It’s time to flash them.
Switch off your phone, then press volume down, home button and switch on it: you will go in “download mode” after confirming you really want it by pressing volume up when asked.
Now plug your phone usb on your pc, and then use heimdall:
$ heimdall flash --SBL2 sbl2.mbn --SBL3 sbl3.mbn --RPM rpm.mbn --TZ tz.mbn --MDM modem.bin --APNHLOS NON-HLOS.bin --ABOOT aboot.mbn --no-reboot
wait to get the prompt back, and the most dangerous part is done. Now you can just unplug the phone, and then switch off it by long pressing the on/off button, then switch it on and boot into android.
You will maybe see a little warning when the phone starts, something like “seandroid disabled”. Just don’t care about it, it’s cause you are not using your stock kernel, but it doesn’t cause any issue.
Now you should have audio working well and also the phone immediatly find the cellular network and register to it. Only a minor bug remain to fix, when you try to set a different cellular network by searching all network available, you get an error searching for networks and the list remain blank.
To fix that you will need to use a root enabled editor, and open the file /system/build.prop.
Inside this file, search for this string:
Change it to:
This line in the build.prop determine how many elements to parse in the answer from the modem when you search for networks. I don’t really know why in cyanogenmod is set to 6, but it’s wrong and it doesn’t work. Setting it to 4 fix the issue and after a reboot you will have your network search fully working as you expect.
And that’s all, happy hacking with your fully working cyanogenmod 13 on your s4.
10 July 2016 at 07:15
Hi. It looks very good, your article.
You used the XXUHOJ2 firmware. What is about XXUHPA1? Isn’t it newer? Or does it contain wrong modem files?
13 July 2016 at 16:36
XXUHPA1 should be ok too, i used OJ2 just cause it was from the same operator i’m using and anyway it was recent, but as lons as you use a recent one it should work
24 September 2016 at 10:29
This was most helpful. One question: why didn’t you flash sbl1?
25 September 2016 at 00:48
just cause there was no need to do it, i followed the approach to flash one thing, boot and see if the issue was fixed, when it was, there was no need to flash anything else :)