00001 #include <string.h>
00002 #include <sys/types.h>
00003 #include <sys/stat.h>
00004 #include <fcntl.h>
00005 #include <sys/ioctl.h>
00006 #include <unistd.h>
00007
00008
00009 #include <asm/elphel/ext353.h>
00010
00011 #define STR_S 64
00012
00013 int main(int argc, char *argv[]) {
00014 int d;
00015 char mac[STR_S];
00016 char firmware[STR_S];
00017 int m = 0;
00018 int f = 0;
00019
00020 int a = 1;
00021 if(argc < 2)
00022 return -1;
00023 while(a < argc) {
00024 if(strcmp(argv[a], "-m") == 0) {
00025 memcpy(mac, argv[a + 1], STR_S);
00026 m = 1;
00027 a += 2;
00028 continue;
00029 }
00030 if(strcmp(argv[a], "-f") == 0) {
00031 memcpy(firmware, argv[a + 1], STR_S);
00032 f = 1;
00033 a += 2;
00034 continue;
00035 }
00036 a++;
00037 }
00038 d = open("/dev/ext353", O_RDWR);
00039
00040 if(m)
00041 ioctl(d, EXIF_IOC_MAC_SET, (void *)mac);
00042 if(f)
00043 ioctl(d, EXIF_IOC_FIRMWARE_SET, (void *)firmware);
00044 close(d);
00045 return 0;
00046 }