ata_id: Support SG_IO version 4 interface
This makes it possible to use /dev/bsg/* nodes for ata_id:
# /lib/udev/ata_id --export /dev/bsg/0\:0\:0\:0
ID_ATA=1
ID_TYPE=disk
ID_BUS=ata
ID_MODEL=INTEL_SSDSA2MH080G1GC
ID_MODEL_ENC=INTEL\x20SSDSA2MH080G1GC\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
ID_REVISION=
045C8802
[...]
This means that our cd-rom detection as per commit
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commit;h=
160b069c25690bfb0c785994c7c3710289179107
needs to be reworked since we can't just use the CDROM_GET_CAPABILITY
ioctl on a /dev/bsg node (which is a character device). We do this by
just sending the SCSI INQUIRY command and checking the type (CD-ROM's
are all type 0x05 and disks are type 0x00) before we issue the ATA
IDENTIFY command through the SCSI command ATA PASS_THROUGH (12).
(Yes, it's a bit perverse how we have to tunnel our ATA commands
through a SCSI command but that's how Linux currently work.)
We still support for SG_IO version 3 (we fail back if version 4 fails
with EINVAL) because testing reveals that some drivers (such as
mpt2sas) still only support version 3 on the block nodes.
Signed-off-by: David Zeuthen <davidz@redhat.com>