diff --git a/comedi_calibrate/comedi_calibrate.c b/comedi_calibrate/comedi_calibrate.c index f4e537f..373eccb 100644 --- a/comedi_calibrate/comedi_calibrate.c +++ b/comedi_calibrate/comedi_calibrate.c @@ -124,7 +124,7 @@ int main(int argc, char *argv[]) fn = "/dev/comedi0"; while (1) { - c = getopt_long(argc, argv, "f:vq", options, &index); + c = getopt_long(argc, argv, "fs:vq", options, &index); if (c == -1)break; switch (c) { case 0: diff --git a/comedi_calibrate/save_cal.c b/comedi_calibrate/save_cal.c index 3df0987..f2959ec 100644 --- a/comedi_calibrate/save_cal.c +++ b/comedi_calibrate/save_cal.c @@ -103,7 +103,7 @@ int write_calibration_perl_hash( FILE *file, comedi_t *dev, fprintf( file, ",\n" ); } fprintf( file, "\t],\n" - "};\n"); + "}\n"); return 0; } @@ -118,21 +118,21 @@ int write_calibration_file( calibration_setup_t *setup, saved_calibration_t sett struct stat file_stats; comedi_t *dev = setup->dev; - if( fstat( comedi_fileno( dev ), &file_stats ) < 0 ) - { - fprintf( stderr, "failed to get file stats of comedi device file\n" ); - return -1; - } - - snprintf( command, sizeof( command ), "install -d %s", save_dir ); - if( system( command ) ) - { - fprintf( stderr, "failed to create directory %s\n", save_dir ); - return -1; - } - if( setup->cal_save_file_path == NULL ) { + if( fstat( comedi_fileno( dev ), &file_stats ) < 0 ) + { + fprintf( stderr, "failed to get file stats of comedi device file\n" ); + return -1; + } + + snprintf( command, sizeof( command ), "install -d %s", save_dir ); + if( system( command ) ) + { + fprintf( stderr, "failed to create directory %s\n", save_dir ); + return -1; + } + asprintf( &setup->cal_save_file_path, "%s/%s_0x%lx", save_dir, comedi_get_board_name( dev ), ( unsigned long ) file_stats.st_ino );