want to use ino_t to identify comedi device file instead of dev_t, which
authorFrank Mori Hess <fmhess@speakeasy.net>
Wed, 5 Feb 2003 04:18:29 +0000 (04:18 +0000)
committerFrank Mori Hess <fmhess@speakeasy.net>
Wed, 5 Feb 2003 04:18:29 +0000 (04:18 +0000)
always contains major/minor number of hard drive

comedi_calibrate/cb.c
comedi_calibrate/save_cal.c

index 9f8ef8a5f1bb61b2baff9d9d40401fd5919c7efc..0467b566026ada529f905554ae4bb2055e8686bf 100644 (file)
@@ -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 )
index edd8dd2d631e6d5b443e6b5445fc4e3b1702ad30..29ae984a76cb26eb8d9c566176591fbbbfc858b0 100644 (file)
@@ -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 )
        {