diff --git a/src/hddtemp_scsi/get_scsi_temp.c b/src/hddtemp_scsi/get_scsi_temp.c index a935d3f..12271b3 100644 --- a/src/hddtemp_scsi/get_scsi_temp.c +++ b/src/hddtemp_scsi/get_scsi_temp.c @@ -110,6 +110,28 @@ int nwipe_get_scsi_temperature( nwipe_context_t* c ) if( scsi_get_temperature( dsk ) == GETTEMP_SUCCESS ) { c->temp1_input = dsk->value; + if( c->temp1_max == NO_TEMPERATURE_DATA ) + { + c->temp1_max = c->temp1_input; + } + else + { + if( c->temp1_input > c->temp1_max ) + { + c->temp1_max = c->temp1_input; + } + } + if( c->temp1_min == NO_TEMPERATURE_DATA ) + { + c->temp1_min = c->temp1_input; + } + else + { + if( c->temp1_input < c->temp1_min ) + { + c->temp1_min = c->temp1_input; + } + } } else { diff --git a/src/hddtemp_scsi/scsi.c b/src/hddtemp_scsi/scsi.c index 1308595..ab00ad6 100644 --- a/src/hddtemp_scsi/scsi.c +++ b/src/hddtemp_scsi/scsi.c @@ -99,11 +99,27 @@ int scsi_get_temperature(struct disk *dsk) { return GETTEMP_ERROR; } - dsk->value = buffer[9]; + if( (int)buffer[7] == 2 ) /* PARAMETER LENGTH */ + { + dsk->value = buffer[9]; + } + else + { + snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, _("parameter length unexpected: %d"), (int)buffer[7] ); + return GETTEMP_UNKNOWN; + } dsk->refvalue = buffer[15]; + if( (int)buffer[13] == 2 ) /* PARAMETER LENGTH */ + { + dsk->refvalue = buffer[15]; + } + else + { + snprintf(dsk->errormsg, MAX_ERRORMSG_SIZE, _("parameter ref length unexpected: %d"), (int)buffer[13] ); + return GETTEMP_UNKNOWN; + } return GETTEMP_SUCCESS; } else { return GETTEMP_NOSENSOR; } } - diff --git a/src/temperature.c b/src/temperature.c index b0e1e08..6bc8db4 100644 --- a/src/temperature.c +++ b/src/temperature.c @@ -291,7 +291,16 @@ void nwipe_update_temperature( nwipe_context_t* c ) { if( c->templ_has_scsitemp_data == 1 ) { - nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: get temperature for %s", c->device_name ); + if( nwipe_options.verbose ) + { + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_crit %dC", c->device_name, c->temp1_crit ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_highest %dC", c->device_name, c->temp1_highest ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_input %dC", c->device_name, c->temp1_input ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_lcrit %dC", c->device_name, c->temp1_lcrit ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_lowest %dC", c->device_name, c->temp1_lowest ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_max %dC", c->device_name, c->temp1_max ); + nwipe_log( NWIPE_LOG_NOTICE, "hddtemp: %s temp1_min %dC", c->device_name, c->temp1_min ); + } if( nwipe_get_scsi_temperature( c ) != 0 ) { nwipe_log( NWIPE_LOG_ERROR, "get_scsi_temperature error" );