diff options
author | Christopher N. Hesse <raymanfx@gmail.com> | 2017-05-25 17:39:18 +0200 |
---|---|---|
committer | Christopher N. Hesse <raymanfx@gmail.com> | 2017-05-25 17:46:35 +0200 |
commit | b0d8610bdb05e3e754f9572c2cef0673cb5bc562 (patch) | |
tree | 1d6f34717c95e39081d7dc677422cd13ef45a94c | |
parent | b1d4bcbaddfdb0337cfb55cbd3edb79f30380f27 (diff) | |
download | android_hardware_samsung-b0d8610bdb05e3e754f9572c2cef0673cb5bc562.tar.gz android_hardware_samsung-b0d8610bdb05e3e754f9572c2cef0673cb5bc562.tar.bz2 android_hardware_samsung-b0d8610bdb05e3e754f9572c2cef0673cb5bc562.zip |
modemloader: Add support for recent devices
* Try to read the hardware revision from the
bootloader before parsing /proc/cpuinfo
* Set more properties to catch all recent device
needs as well
* Introduce a property to let other services (cbd)
know they can start
Change-Id: I50d8ec37921ec2559bdd7fe852d830f10fe1c12e
-rw-r--r-- | modemloader/modemloader.c | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/modemloader/modemloader.c b/modemloader/modemloader.c index e661e8b..f19e1af 100644 --- a/modemloader/modemloader.c +++ b/modemloader/modemloader.c @@ -1,6 +1,6 @@ /* * Copyright (C) 2008 The Android Open Source Project - * Copyright (C) 2015 Christopher N. Hesse <raymanfx@gmail.com> + * Copyright (C) 2015-2017 Christopher N. Hesse <raymanfx@gmail.com> * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -84,12 +84,28 @@ done: int main(void) { - unsigned int revision = 0; - char ro_revision[PROP_VALUE_MAX]; + unsigned int revision; + char hardware_revision[PROP_VALUE_MAX]; + const char *properties[] = {"hw.revision", "ro.cbd.dt_revision", "ril.cbd.dt_revision"}; - parse_hardware_revision(&revision); - snprintf(ro_revision, PROP_VALUE_MAX, "%d", revision); - property_set("hw.revision", ro_revision); + // try to read the revision from the kernel cmdline + revision = property_get_int32("ro.boot.hw_rev", 0); + + // if the property was not exported, try to parse /proc/cpuinfo + if (revision == 0) { + parse_hardware_revision(&revision); + } + + snprintf(hardware_revision, PROP_VALUE_MAX, "%d", revision); + + // set all the properties + const int array_length = sizeof(properties) / sizeof(properties[0]); + for (int i = 0; i < array_length; i++) { + property_set(properties[i], hardware_revision); + } + + // indicate that we are done + property_set("ro.modemloader.done", "1"); return 0; } |