#include <stdio.h>
#define FACT_NAME "/dev/mtdblock3"
int main(void)
{
int fd;
int ret;
char mac[6]={0};
char buf[16]={0};
int i;
fd = open(FACT_NAME, O_RDWR, 0666);
if (fd < 0)
{
printf("open file error\n");
return -1;
}
lseek(fd, 40, SEEK_SET);
ret = read(fd, mac, 6);
// for(i=0; i<6; i++)
// printf("%x\n", mac[i]);
sprintf(buf, "%02hhX:%02hhX:%02hhX:%02hhX:%02hhX:%02hhX", mac[0], mac[1], mac[2], mac[3], mac[4], mac[5] );
printf("--> %s\n", buf);
close(fd);
return ret;
}