Programatically detect C2 vs C4

Post Reply
Sebas_Ledesma
Posts: 137
Joined: Thu Jun 08, 2017 2:49 am
languages_spoken: english
ODROIDs: c2
Has thanked: 13 times
Been thanked: 10 times
Contact:

Programatically detect C2 vs C4

Post by Sebas_Ledesma »

Hi:

There is an official way to detect if running on C2 or C4 (in a c program).
So far I'm using
system("uname -a > out.txt");
and detect if kernel it's 3.x or 4 / 5.

Thanks in advance.
Sebas

User avatar
tobetter
Posts: 6113
Joined: Mon Feb 25, 2013 10:55 am
languages_spoken: Korean, English
ODROIDs: Many
Location: Paju, South Korea
Has thanked: 281 times
Been thanked: 789 times
Contact:

Re: Programatically detect C2 vs C4

Post by tobetter »

You can check the output of /proc/cpuinfo or /proc/device-tree/model. The reason why I am not sharing the exact output is that it could be differ which kernel you use, stock or mainline or somethine else.
These users thanked the author tobetter for the post:
Sebas_Ledesma (Fri Oct 09, 2020 11:30 pm)

Sebas_Ledesma
Posts: 137
Joined: Thu Jun 08, 2017 2:49 am
languages_spoken: english
ODROIDs: c2
Has thanked: 13 times
Been thanked: 10 times
Contact:

Re: Programatically detect C2 vs C4

Post by Sebas_Ledesma »

Thanks!
I-ve forget to mention it: I'm using Ubutnu 20.04 / Kernel 4.9 in C4 and Ubuntu 18.04 / Kernel 3.16 in C2.

In C2 (Ubuntu 18.04 / Kernel 3.16)
cat /proc/device-tree/model
returns:
ODROID-C2

in C4 (Ubuntu 20.04 / Kernel 4.9):
cat /proc/device-tree/model
returns:
Hardkernel ODROID-C4

Sebas
These users thanked the author Sebas_Ledesma for the post:
odroid (Mon Oct 12, 2020 10:26 am)

Post Reply

Return to “General Topics”

Who is online

Users browsing this forum: No registered users and 0 guests