@@ -242,13 +242,13 @@ int main(int argc, char *argv[]) {
242242 int ssdflag = 0 ;
243243 char * serialvalue = NULL ;
244244 char * pcbvalue = NULL ;
245-
245+ char * outfilename = "eeprom.bin" ;
246246 int index ;
247247 int c ;
248248
249249 opterr = 0 ;
250250
251- while ((c = getopt (argc , argv , "gds:p:" )) != -1 )
251+ while ((c = getopt (argc , argv , "gds:p:o: " )) != -1 )
252252 switch (c )
253253 {
254254 case 'g' :
@@ -263,6 +263,9 @@ int main(int argc, char *argv[]) {
263263 case 'p' :
264264 pcbvalue = optarg ;
265265 break ;
266+ case 'o' :
267+ outfilename = optarg ;
268+ break ;
266269 case '?' :
267270 if (optopt == 'c' )
268271 fprintf (stderr , "Option -%c requires an argument.\n" , optopt );
@@ -279,17 +282,17 @@ int main(int argc, char *argv[]) {
279282 printf ("Build: %s %s\n" , __DATE__ , __TIME__ );
280283 printf ("Descriptor Version: %d %d\n" , 0 , 1 );
281284
282- printf ("gpu = %d, ssd = %d, module SN = %s pcb SN = %s\n" ,
283- gpuflag , ssdflag , serialvalue , pcbvalue );
285+ printf ("gpu = %d, ssd = %d, module SN = %s pcb SN = %s output file = %s \n" ,
286+ gpuflag , ssdflag , serialvalue , pcbvalue , outfilename );
284287
285288 if (gpuflag ) {
286289 if (pcbvalue ) {
287290 strncpy (gpu_cfg .pcba_serial .serial , pcbvalue , GPU_SERIAL_LEN );
288291 }
289- program_eeprom (serialvalue , (void * )& gpu_cfg , sizeof (gpu_cfg ), "gpueeprom.bin" );
292+ program_eeprom (serialvalue , (void * )& gpu_cfg , sizeof (gpu_cfg ), outfilename );
290293 }
291294
292295 if (ssdflag ) {
293- program_eeprom (serialvalue , (void * )& ssd_cfg , sizeof (ssd_cfg ), "ssdeeprom.bin" );
296+ program_eeprom (serialvalue , (void * )& ssd_cfg , sizeof (ssd_cfg ), outfilename );
294297 }
295298}
0 commit comments