#perform identify command echo "" echo "performing identify command" buffersize 512 setreadpio gettime seti $starttime = $time ata28cmd 0 0 0 0 0 0xa0 0xec # check if command failed seti $command_failed = 0 gosub check_command_status if $command_failed = 1 echo "Command failed!" endif gosub show_sense_data gosub show_sense_buffer gosub show_ata_return_status gosub show_passthrough_cmd_status echo "refreshing status" getstatus gosub show_sense_data gosub show_sense_buffer gosub show_ata_return_status gosub show_passthrough_cmd_status #perform no-op command echo "" echo "" echo "performing no-op command" buffersize 512 setreadpio gettime seti $starttime = $time ata28cmd 0 0 0 0 0 0xa0 0x0 # check if command failed seti $command_failed = 0 gosub check_command_status if $command_failed = 1 echo "Command failed!" endif gosub show_sense_data gosub show_sense_buffer gosub show_ata_return_status gosub show_passthrough_cmd_status echo "refreshing status" buffersize 0 getstatus gosub show_sense_data gosub show_sense_buffer gosub show_ata_return_status gosub show_passthrough_cmd_status previousscript end subroutine check_command_status seti $error_bit = $ata_return_status & 1 seti $command_failed = 0 if $error_bit != 0 seti $command_failed = 1 elseif $command_status != 0 seti $command_failed = 1 elseif $io_sense_key > 1 seti $command_failed = 1 # usb attached ata devices will normally give this code, so don't count it as failed if $io_sense_key = 4 if $io_asc = 0 if $io_ascq = 0 seti $command_failed = 0 endif endif endif endif endsubroutine subroutine show_sense_data if $direct_mode = 0 hex echo "sense_key=0x" $io_sense_key " asc=0x" $io_asc " ascq=0x" $io_ascq decimal endif endsubroutine subroutine show_passthrough_cmd_status if $direct_mode = 0 echo "status=" $io_status " masked_status=" $io_masked_status " msg_status=" $io_msg_status echo "sb_len_wr=" $io_sb_len_wr " host_status=" $io_host_status " driver_status=" $io_driver_status echo "resid=" $io_resid " duration=" $io_duration " info=" $io_info endif endsubroutine subroutine show_sense_buffer if $direct_mode = 0 echo "Sense buffer:" printsensebuffer 0 $io_sb_len_wr endif endsubroutine subroutine show_ata_return_status hex echo "error=0x" $ata_return_error " count=0x" $ata_return_count " lba=0x" $ata_return_lba " device=0x" $ata_return_device " status=0x" $ata_return_status " altstatus=0x" $ata_alternate_status echo "command_status= 0x" $command_status echo "data_transferred= 0x" $data_transferred decimal endsubroutine