bustype detection with smartctl works (again?)

This commit is contained in:
Gerold Gruber
2023-10-06 00:45:44 +02:00
parent c6ff341f7e
commit f764c39390
2 changed files with 11 additions and 2 deletions

View File

@@ -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

View File

@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdint.h>
#include <ctype.h>
#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 )
{