correctly return and use device type in scsi_inquiry

This commit is contained in:
Dietmar Maurer 2013-07-15 13:19:54 +02:00
parent f334aa3e6e
commit 09984754a0

View File

@ -1017,9 +1017,12 @@ sub scsi_inquiry {
}
my $res = {};
($res->{device}, $res->{removable}, $res->{venodor},
(my $byte0, my $byte1, $res->{vendor},
$res->{product}, $res->{revision}) = unpack("C C x6 A8 A16 A4", $buf);
$res->{removable} = $byte1 & 128 ? 1 : 0;
$res->{type} = $byte0 & 31;
return $res;
}
@ -1060,7 +1063,13 @@ sub print_drivedevice_full {
if($path =~ m/^iscsi\:\/\//){
$devicetype = 'generic';
} else {
$devicetype = 'block' if path_is_scsi($path);
if (my $info = path_is_scsi($path)) {
if ($info->{type} == 0) {
$devicetype = 'block';
} elsif ($info->{type} == 1) { # tape
$devicetype = 'generic';
}
}
}
}