Tuesday, October 4, 2016

Huawei P9 Lite: RIL up and running!

I was reviewing the out put from dmesg on stock when I saw "do_modem check" from init. This was nothing new, I had seen this before in the init scripts. Since it's not an external binary found in bin, xbin or sbin I figure this is an internal function that Huawei programmed in to init. Then I noticed something that I had not noticed before. After the "do_check_modem" dmesg said something like "do_check_modem success. Wake up modem". Then some process, "modem_sysboot_start" starts talking about /nvm:20/modem_nv/Nv.bin. So, I figure that init is loading some firmware into kernel space to start the modem. It seems that there must be a path that could be used to load this firmware. So I dug around in the kernel for a while and I finally found it. It was the simplest solution. All I had to do was write 1 to /sys/devices/platform/his_modem/modem_sysboot_start . Then the kernel driver uploaded it's firmware from default paths and kicked up the modem. Why Huawei built this into init instead of using a simple line in the init scripts, I do not know.

I've got some tweaking to do on the time of the initialization of the modem and the start of rild. Sometimes rild starts without it's prop entries and has to be restarted... I will probably be releasing an update soon..

Oh, and thanks to XePeleato, I ended up using his RIL class and it does work!