mirror of
https://github.com/martijnvanbrummelen/nwipe.git
synced 2026-02-20 13:42:14 +00:00
Check smartctl for unresolved bus types SATA
For some controllers/drivers the readlink method of obtaining the bus type for GUI display does not work. If we haven't already resolved the bus type, we then also check smartctl for the transport protocol for SATA.
This commit is contained in:
13
src/device.c
13
src/device.c
@@ -633,6 +633,7 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c
|
||||
|
||||
strncpy( serialnumber, &result[15], 20 );
|
||||
}
|
||||
|
||||
if( *bus == 0 )
|
||||
{
|
||||
if( strstr( result, "Transport protocol:" ) != 0 )
|
||||
@@ -645,6 +646,18 @@ int nwipe_get_device_bus_type_and_serialno( char* device, nwipe_device_t* bus, c
|
||||
*bus = NWIPE_DEVICE_SAS;
|
||||
}
|
||||
}
|
||||
|
||||
if( strstr( result, "SATA Version is:" ) != 0 )
|
||||
{
|
||||
|
||||
/* strip any leading or trailing spaces and left justify, +4 is the length of "bus type:" */
|
||||
trim( &result[16] );
|
||||
|
||||
if( strncmp( &result[16], "SATA", 4 ) == 0 )
|
||||
{
|
||||
*bus = NWIPE_DEVICE_ATA;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user