Add additional info to status screen when blanking

This commit is contained in:
Andy Beverley
2013-09-07 00:19:37 +01:00
parent e2c4889fb3
commit 7ac6de9933
3 changed files with 21 additions and 8 deletions

View File

@@ -124,6 +124,8 @@ int check_device( nwipe_context_t*** c, PedDevice* dev, int dcount )
next_device->label = dev->model;
next_device->device_name = dev->path;
next_device->device_size = dev->length * dev->sector_size;
/* Attempt to get serial number of device. */
ioctl(next_device->device_fd, HDIO_GET_IDENTITY, &next_device->identity);
(*c)[dcount] = next_device;

View File

@@ -442,35 +442,39 @@ void nwipe_gui_select( int count, nwipe_context_t** c )
{
case NWIPE_SELECT_TRUE:
wprintw( main_window, " [wipe] %i. %s - %s (%lld bytes)", (i + offset + 1),
wprintw( main_window, " [wipe] %i. %s - %s %s (%lld bytes)", (i + offset + 1),
c[i+offset]->device_name,
c[i+offset]->label,
c[i+offset]->identity.serial_no,
c[i+offset]->device_size );
break;
case NWIPE_SELECT_FALSE:
/* Print an element that is not selected. */
wprintw( main_window, " [ ] %i. %s - %s (%lld bytes)", (i + offset +1),
wprintw( main_window, " [ ] %i. %s - %s %s (%lld bytes)", (i + offset +1),
c[i+offset]->device_name,
c[i+offset]->label,
c[i+offset]->identity.serial_no,
c[i+offset]->device_size );
break;
case NWIPE_SELECT_TRUE_PARENT:
/* This element will be wiped when its parent is wiped. */
wprintw( main_window, " [****] %i. %s - %s (%lld bytes)", (i + offset +1),
wprintw( main_window, " [****] %i. %s - %s %s (%lld bytes)", (i + offset +1),
c[i+offset]->device_name,
c[i+offset]->label,
c[i+offset]->identity.serial_no,
c[i+offset]->device_size );
break;
case NWIPE_SELECT_FALSE_CHILD:
/* We can't wipe this element because it has a child that is being wiped. */
wprintw( main_window, " [----] %i. %s - %s (%lld bytes)", (i + offset +1),
wprintw( main_window, " [----] %i. %s - %s %s (%lld bytes)", (i + offset +1),
c[i+offset]->device_name,
c[i+offset]->label,
c[i+offset]->identity.serial_no,
c[i+offset]->device_size );
break;
@@ -1849,7 +1853,16 @@ void *nwipe_gui_status( void *ptr )
for( i = offset ; i < offset + slots && i < count ; i++ )
{
/* Print the context label. */
mvwprintw( main_window, yy++, 2, "%s", c[i]->label );
if ( strlen(c[i]->identity.serial_no) )
{
mvwprintw( main_window, yy++, 2, "%s - %s (%s)", c[i]->device_name,
c[i]->label,
c[i]->identity.serial_no);
}
else {
mvwprintw( main_window, yy++, 2, "%s - %s", c[i]->device_name,
c[i]->label );
}
/* Check whether the child process is still running the wipe. */
if( c[i]->thread > 0 )

View File

@@ -287,9 +287,7 @@ int main( int argc, char** argv )
}
*/
/* Attempt to get serial number of device. */
ioctl(c2[i]->device_fd, HDIO_GET_IDENTITY, &c2[i]->identity);
/* Print serial number of device if it exists. */
if ( c2[i]->identity.serial_no ) {
nwipe_log( NWIPE_LOG_INFO, "Device %s has serial number %s", c2[i]->device_name, c2[i]->identity.serial_no);
}