Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 72890086 authored by Steve Kondik's avatar Steve Kondik Committed by Ricardo Cerqueira
Browse files

init: Properly detect hardware revision

 * get_hardware_name was returning early if the hardware type was set on
   the command line, and not proceeding to parse it from /proc/cpuinfo
 * Fix it so that it always parses ro.revision :)

Change-Id: Ib5d31d536066fc6829db756cb6e5f003a05bf440
parent f619c672
Loading
Loading
Loading
Loading
+14 −15
Original line number Diff line number Diff line
@@ -396,10 +396,6 @@ void get_hardware_name(char *hardware, unsigned int *revision)
    int fd, n;
    char *x, *hw, *rev;

    /* Hardware string was provided on kernel command line */
    if (hardware[0])
        return;

    fd = open("/proc/cpuinfo", O_RDONLY);
    if (fd < 0) return;

@@ -411,6 +407,8 @@ void get_hardware_name(char *hardware, unsigned int *revision)
    hw = strstr(data, "\nHardware");
    rev = strstr(data, "\nRevision");

    /* Hardware string was provided on kernel command line */
    if (!hardware[0]) {
        if (hw) {
            x = strstr(hw, ": ");
            if (x) {
@@ -425,6 +423,7 @@ void get_hardware_name(char *hardware, unsigned int *revision)
                hardware[n] = 0;
            }
        }
    }

    if (rev) {
        x = strstr(rev, ": ");