From 62d3635bc5d833edf7844494e4dda779d607dd8d Mon Sep 17 00:00:00 2001 From: Frank Mori Hess Date: Wed, 5 Feb 2003 04:18:29 +0000 Subject: [PATCH] want to use ino_t to identify comedi device file instead of dev_t, which always contains major/minor number of hard drive --- comedi_calibrate/cb.c | 18 +++++++++++++++++- comedi_calibrate/save_cal.c | 13 +++++++++---- 2 files changed, 26 insertions(+), 5 deletions(-) diff --git a/comedi_calibrate/cb.c b/comedi_calibrate/cb.c index 9f8ef8a..0467b56 100644 --- a/comedi_calibrate/cb.c +++ b/comedi_calibrate/cb.c @@ -755,6 +755,7 @@ int cal_cb_pci_64xx( calibration_setup_t *setup ) int cal_cb_pci_60xx( calibration_setup_t *setup ) { + saved_calibration_t saved_cals[1]; enum cal_knobs_60xx { DAC0_OFFSET = 0, @@ -779,7 +780,22 @@ int cal_cb_pci_60xx( calibration_setup_t *setup ) cal1( setup, OBS_5V_RANGE_10V_BIP_60XX, ADC_GAIN_FINE ); cal1_fine( setup, OBS_5V_RANGE_10V_BIP_60XX, ADC_GAIN_FINE ); - return 0; + saved_cals[ 0 ].subdevice = setup->ad_subdev; + saved_cals[ 0 ].caldacs_length = 0; + saved_cals[ 0 ].caldacs[ saved_cals[ 0 ].caldacs_length++ ] = + setup->caldacs[ ADC_OFFSET_FINE ]; + saved_cals[ 0 ].caldacs[ saved_cals[ 0 ].caldacs_length++ ] = + setup->caldacs[ ADC_OFFSET_COARSE ]; + saved_cals[ 0 ].caldacs[ saved_cals[ 0 ].caldacs_length++ ] = + setup->caldacs[ ADC_GAIN_COARSE ]; + saved_cals[ 0 ].caldacs[ saved_cals[ 0 ].caldacs_length++ ] = + setup->caldacs[ ADC_GAIN_FINE ]; + saved_cals[ 0 ].channels_length = 0; + saved_cals[ 0 ].ranges[ 0 ] = 0; + saved_cals[ 0 ].ranges_length = 1; + saved_cals[ 0 ].arefs_length = 0; + + return write_calibration_file( setup->dev, saved_cals, 1 ); } int cal_cb_pci_4020( calibration_setup_t *setup ) diff --git a/comedi_calibrate/save_cal.c b/comedi_calibrate/save_cal.c index edd8dd2..29ae984 100644 --- a/comedi_calibrate/save_cal.c +++ b/comedi_calibrate/save_cal.c @@ -68,7 +68,9 @@ void write_calibration_setting( FILE *file, saved_calibration_t setting ) fprintf( file, "%i,", setting.arefs[ i ] ); fprintf( file, "],\n" ); fprintf( file, "%s", indent ); - fprintf( file, "\tcaldacs => [\n" ); + fprintf( file, "\tcaldacs =>\n" ); + fprintf( file, "%s", indent ); + fprintf( file, "\t[\n" ); for( i = 0; i < setting.caldacs_length; i++ ) { write_caldac( file, setting.caldacs[ i ] ); @@ -88,8 +90,10 @@ int write_calibration_perl_hash( FILE *file, comedi_t *dev, int i; fprintf( file, "{\n" ); + fprintf( file, "\tdriver_name => \"%s\",\n", comedi_get_driver_name( dev ) ); fprintf( file, "\tboard_name => \"%s\",\n", comedi_get_board_name( dev ) ); - fprintf( file, "\tcalibrations => [\n" ); + fprintf( file, "\tcalibrations =>\n" + "\t[\n" ); for( i = 0; i < num_settings; i++ ) { write_calibration_setting( file, settings[ i ] ); @@ -124,8 +128,9 @@ int write_calibration_file( comedi_t *dev, saved_calibration_t settings[], return -1; } - snprintf( file_path, sizeof( file_path ), "%s/comedi_0x%lx", - save_dir, ( unsigned long ) file_stats.st_dev ); + snprintf( file_path, sizeof( file_path ), "%s/%s_0x%lx", + save_dir, comedi_get_board_name( dev ), + ( unsigned long ) file_stats.st_ino ); file = fopen( file_path, "w" ); if( file == NULL ) { -- 2.26.2