I2C
From wiki.gp2x.org
There is an EEPROM of some description on the I2C bus at (i2c) address 0x0050
Some of it's contents are as follows:
at 0x0000 there are 32 hexadecimal ASCII characters, eg. an md5sum or similar. eg. A92803393C5E7ACA2EDDCF2747233F26 (faked)
at 0x0020 there are 24 ascii characters that represent the string shown on the 'Info' screen. eg. 20051114GP2XV10100000051 (real)
at 0x0048 the LCD setting is stored as a single byte, from 0x00 to 0x0D (ie. 0->13) representing the 1-14 range on the LCD settings screen.
See also:
http://en.wikipedia.org/wiki/I2C
How to read the serial number
#include <stdio.h> #include <sys/types.h> #include <sys/stat.h> #include <fcntl.h> #include <unistd.h> #include <linux/i2c.h> #include <linux/i2c-dev.h> #define EEPROM_ADDR 0x0050 int main(int argc, char **argv) { struct i2c_rdwr_ioctl_data data; struct i2c_msg msg; int i; char buffer[25]; // open the i2c device int fd = open("/dev/i2c-0", O_RDWR); data.msgs = &msg; data.nmsgs = 1; msg.addr = EEPROM_ADDR; msg.flags = 0; // for write msg.len = 2; msg.buf = "\0\40"; // == 32 in octal // set the address to 0x0020 ioctl(fd, I2C_RDWR, &data); // now read 1 byte at a time msg.flags = 1; // for read msg.len = 1; for (i = 0; i < 24; i++) { msg.buf = buffer + i; ioctl(fd, I2C_RDWR, &data); } buffer[i] = '\0'; // all done close(fd); printf("got serial number: %s\n", buffer); return 0; }