Sense Key for ASC/ASCQ Numbers

In SCSI Interface errors are recognized by concatenation of 3 numbers: SenseKey + ASC + ASCQ. asc/ascq pair description describes the meaning of all errors based on asc/ascq values. But not all asc/ascq pairs have meaning with all sense keys. How should I know which sense key will be returned with each asc/ascq pair?

Answers


ASC/ASCQ is not tied to Sense Key.

Sense key is your main error code. ASC and ASCQ is additional sense code and qualifier. It's a little tip for you to answer what is wrong in your I_T_L_Q nexus.

So to answer your question - there is no way to know which sense key will be returned with each ASC/ASCQ pair in general.

But there are some well known "Sense key" + ASC + ASCQ combinations, because most of the operating systems implement error handling only for small subset of errors. Unfortunately, you can find that subset only by inspecting source codes.

For example, in Mac OS X Darwin kernel you can look for ADDITIONAL_SENSE_CODE in IOSCSIArchitectureModelFamily. Here is an example from IOSCSIBlockCommands/IOSCSIBlockCommandsDevicePM.cpp, line 659:

// Check the sense key to see if it is an error group we know how to handle
if  ( ( ( senseBuffer.SENSE_KEY & kSENSE_KEY_Mask ) == kSENSE_KEY_NOT_READY ) || 
      ( ( senseBuffer.SENSE_KEY & kSENSE_KEY_Mask ) == kSENSE_KEY_MEDIUM_ERROR ) )
{

    // The SenseKey is an 02 ( Not Ready ) or 03 ( Medium Error ). Check to see
    // if we can do something about this

    if ( ( senseBuffer.ADDITIONAL_SENSE_CODE == 0x04 ) && 
         ( senseBuffer.ADDITIONAL_SENSE_CODE_QUALIFIER == 0x02 ) )
    {

        // Device requires a start command before we can tell if media is there
        if ( START_STOP_UNIT ( request, 0x00, 0x00, 0x00, 0x01, 0x00 ) == true )
        {

            STATUS_LOG ( ( "Sending START_STOP_UNIT.\n" ) );
            serviceResponse = SendCommand ( request, 0 );

        }

        STATUS_LOG ( ( "%s::drive NOT READY\n", getName ( ) ) );

        IOSleep ( 200 );
        continue;

    }

    else if ( ( senseBuffer.ADDITIONAL_SENSE_CODE == 0x3A ) && 
              ( senseBuffer.ADDITIONAL_SENSE_CODE_QUALIFIER == 0x00 ) )
    {

        STATUS_LOG ( ( "No Media.\n" ) );
        // No media is present, return false
        driveReady = true;
        mediaPresent = false;

    }

    else
    {

        STATUS_LOG ( ( "%s::drive NOT READY\n", getName ( ) ) );
        IOSleep ( 200 );
        continue;

    }

}

Used SK+ASC+ASCQ tupes:

  • 0x02/0x03, 0x04, 0x02 - NOT READY/MEDIUM ERROR, LOGICAL UNIT NOT READY, INITIALIZING COMMAND REQUIRED;
  • 0x02/0x03, 0x3A, 0x00 - NOT READY/MEDIUM ERROR, MEDIUM NOT PRESENT.

As you can see here ASC/ASCQ pair is used with either 0x02 or 0x03 Sense keys, and action to take is determined on ASC/ASCQ pair, so it doesn't really matter how ASC/ASCQ pairs are divided between Sense keys.


Need Your Help

appcombat_v7 and missing AndroidManifest.xml

android eclipse android-manifest

I just managed to successfully install Eclipse and even set up an AVD.

Efficient 3D block rendering with Libgdx

java performance 3d libgdx culling

To start with,I am pretty new to 3D programming and libgdx.