Commit b0d8610b authored by Christopher N. Hesse's avatar Christopher N. Hesse

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
parent b1d4bcba
/*
* 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;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment