From f764c39390b1fcdc454fb91bad3dd302a07b0019 Mon Sep 17 00:00:00 2001 From: Gerold Gruber Date: Fri, 6 Oct 2023 00:45:44 +0200 Subject: [PATCH] bustype detection with smartctl works (again?) --- src/conf.c | 2 +- src/device.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/conf.c b/src/conf.c index 929e1c2d..b171a855 100644 --- a/src/conf.c +++ b/src/conf.c @@ -57,7 +57,7 @@ int nwipe_conf_init() root = config_root_setting( &nwipe_cfg ); char nwipe_customers_initial_content[] = "\"Customer Name\";\"Contact Name\";\"Customer Address\";\"Contact Phone\"\n" - "\"Not Applicable\";\"Not Applicable\";\"Not Applicable\";\"Not Applicable\""; + "\"Not Applicable\";\"Not Applicable\";\"Not Applicable\";\"Not Applicable\"\n"; /* Read /etc/nwipe/nwipe.conf. If there is an error, determine whether * it's because it doesn't exist. If it doesn't exist create it and diff --git a/src/device.c b/src/device.c index d2262a7c..ed1ead9f 100644 --- a/src/device.c +++ b/src/device.c @@ -26,6 +26,7 @@ #include #include +#include #include "nwipe.h" #include "context.h" @@ -711,7 +712,7 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c /* If upper case alpha character, change to lower case */ if( result[idx] >= 'A' && result[idx] <= 'Z' ) { - result[idx] += 32; + result[idx] = tolower( result[idx] ); } idx++; @@ -775,6 +776,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c { /* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */ trim( &result[19] ); + for( idx = 19; result[idx]; idx++ ) + { + result[idx] = tolower( result[idx] ); + } if( strncmp( &result[19], "sas", 3 ) == 0 ) { @@ -787,6 +792,10 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c /* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */ trim( &result[16] ); + for( idx = 16; result[idx]; idx++ ) + { + result[idx] = tolower( result[idx] ); + } if( strncmp( &result[16], "sata", 4 ) == 0 ) {