lib/sg_lib.c
int
sg_get_sense_key(const unsigned char * sensep, int sense_len)
{
    if ((NULL == sensep) || (sense_len < 2))
        return -1;
    switch (sensep[0] & 0x7f) {
    case 0x70:
    case 0x71:
        return (sense_len < 3) ? -1 : (sensep[2] & 0xf);
    case 0x72:
    case 0x73:
        return sensep[1] & 0xf;
    default:
        return -1;
    }
}
/* Get sense key from sense buffer. If successful returns a sense key value
 * between 0 and 15. If sense buffer cannot be decode, returns -1 . */
Get sense key from sense buffer. If successful returns a sense key value
between 0 and 15. If sense buffer cannot be decode, returns -1 .
Get sense key from sense buffer . If successful returns a sense key value between 0 and 15 . If sense buffer cannot be decode returns - 1 .
int
sg_get_sense_key(const unsigned char * sensep, int sense_len)
{
    if ((NULL == sensep) || (sense_len < 2))
        return -1;
    switch (sensep[0] & 0x7f) {
    case 0x70:
    case 0x71:
        return (sense_len < 3) ? -1 : (sensep[2] & 0xf);
    case 0x72:
    case 0x73:
        return sensep[1] & 0xf;
    default:
        return -1;
    }
}
int sg_get_sense_key ( const unsigned char * sensep , int sense_len ) { if ( ( NULL == sensep ) || ( sense_len < 2 ) ) return -1 ; switch ( sensep [ 0 ] & 0x7f ) { case 0x70 : case 0x71 : return ( sense_len < 3 ) ? -1 : ( sensep [ 2 ] & 0xf ) ; case 0x72 : case 0x73 : return sensep [ 1 ] & 0xf ; default : return -1 ; } }
Get sense key from sense buffer.
Get sense key from sense buffer .