Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
en:c2_board_identification [2016/03/15 16:50] joy.cho created |
en:c2_board_identification [2016/03/16 11:31] (current) odroid [Ubuntu] |
||
---|---|---|---|
Line 1: | Line 1: | ||
=========Board Identification ======= | =========Board Identification ======= | ||
- | under process | + | To differentiate each C2 board, you can use 16-digit S/N or MAC that are written on C2 manufacturing line. |
- | ===== Background ===== | ||
- | |||
- | (TODO) | ||
===== Ubuntu ===== | ===== Ubuntu ===== | ||
+ | Your kernel version should be 3.14.29-35 or higher to get the full 16 digit of unique ID. | ||
+ | |||
+ | ==== Board Identification using usid ==== | ||
+ | Using the following node, you can get the 16-digit board ID. | ||
<code> | <code> | ||
Line 14: | Line 15: | ||
</code> | </code> | ||
- | ===== Android ===== | + | <code> |
+ | odroid@odroid64:~$ cat /sys/class/efuse/usid | ||
+ | HKC2123456789ABC | ||
+ | </code> | ||
+ | |||
+ | == Simple test example == | ||
<code> | <code> | ||
- | getprop ro.serialno | + | $ gcc -o get_usid get_usid.c |
</code> | </code> | ||
<code> | <code> | ||
- | getprop ro.boot.serialno | + | odroid@odroid64:~$ ./get_usid |
+ | S/N is 'HKC2123456789ABC' | ||
</code> | </code> | ||
+ | |||
+ | <file c get_usid.c> | ||
+ | |||
+ | #include <stdio.h> | ||
+ | #include <unistd.h> | ||
+ | #include <fcntl.h> | ||
+ | |||
+ | #define SYSFS_CLASS_USID "/sys/class/efuse/usid" | ||
+ | #define USID_LEN 16 | ||
+ | |||
+ | int main(int argc, char *argv[]) | ||
+ | { | ||
+ | int fd, len; | ||
+ | char buf[USID_LEN]; | ||
+ | |||
+ | fd = open(SYSFS_CLASS_USID, O_RDONLY); | ||
+ | if (fd < 0) | ||
+ | printf("Open error! \n"); | ||
+ | |||
+ | read(fd, buf, USID_LEN); | ||
+ | |||
+ | printf("S/N is '%s'\n", buf); | ||
+ | |||
+ | close(fd); | ||
+ | |||
+ | return 0; | ||
+ | } | ||
+ | |||
+ | </file> | ||
+ | |||
+ | ==== Board Identification using MAC ==== | ||
+ | Or the unique MAC can be used to define your board. | ||
<code> | <code> | ||
- | ip addr show | grep link/ether | + | odroid@odroid64:~$ ip add | grep link/ether |
+ | link/ether 00:12:34:56:78:9A brd ff:ff:ff:ff:ff:ff | ||
</code> | </code> | ||
+ | |||
+ | ==== S/N and MAC information on booting console ==== | ||
+ | If you need to confirm if the value that you read is right one, check booting log message on console. | ||
+ | |||
+ | <code> | ||
+ | U-Boot 2015.01-00076-gbeda694 (Mar 01 2016 - 10:35:37), Build: jenkins-s905_and8 | ||
+ | |||
+ | DRAM: 2 GiB | ||
+ | Relocation Offset is: 76f41000 | ||
+ | ------------------------------------------------------------------------------------- | ||
+ | * Welcome to Hardkernel's ODROID-C2 | ||
+ | ------------------------------------------------------------------------------------- | ||
+ | CPU : AMLogic S905 | ||
+ | S/N : HKC2123456789ABC | ||
+ | MAC : 00:12:34:56:78:9A | ||
+ | BID : HKC2123456 | ||
+ | ------------------------------------------------------------------------------------- | ||
+ | </code> | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ===== Android ===== | ||
+ | |||
+ | ==== Board Identification using usid ==== | ||
+ | On Android platform, you can use Property to get board ID with 'ro.serialno' or 'ro.boot.serialno'. | ||
+ | |||
+ | <code> | ||
+ | shell@odroidc2:/ $ getprop ro.serialno | ||
+ | HKC2123456789ABC | ||
+ | </code> | ||
+ | |||
+ | <code> | ||
+ | shell@odroidc2:/ $ getprop ro.boot.serialno | ||
+ | HKC2123456789ABC | ||
+ | </code> | ||
+ | |||
+ | The native property_get method from a java app using jni can be a general and easy way. | ||
+ | |||
+ | <file example> | ||
+ | #include <cutils/perperties.h> | ||
+ | |||
+ | void get_serialno(void) { | ||
+ | char serialno[16]; | ||
+ | | ||
+ | perperty_get("ro.serialno", serialno, ""); | ||
+ | // or | ||
+ | perperty_get("ro.bootserialno", serialno, ""); | ||
+ | ..... | ||
+ | } | ||
+ | </file> |