# ATA
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{vendor}=="ATA", IMPORT{program}="ata_id --export $devnode"
+KERNEL=="sd*[!0-9]|sr*", ENV{ID_BUS}=="ata", ENV{ID_ATA_PERIPHERAL_DEVICE_TYPE}=="20", PROGRAM="scsi_id -u -g $devnode", \
+ SYMLINK+="disk/by-id/scsi-$result$env{.PART_SUFFIX}"
# ATAPI devices (SPC-3 or later)
KERNEL=="sd*[!0-9]|sr*", ENV{ID_SERIAL}!="?*", SUBSYSTEMS=="scsi", ATTRS{type}=="5", ATTRS{scsi_level}=="[6-9]*", IMPORT{program}="ata_id --export $devnode"
* non-zero with errno set.
*/
static int disk_identify(int fd,
- uint8_t out_identify[512]) {
+ uint8_t out_identify[512],
+ int *ret_peripheral_device_type) {
uint8_t inquiry_buf[36];
int peripheral_device_type, r;
if (all_nul_bytes)
return log_debug_errno(SYNTHETIC_ERRNO(EIO), "IDENTIFY data is all zeroes.");
+ if (ret_peripheral_device_type)
+ *ret_peripheral_device_type = peripheral_device_type;
+
return 0;
}
char model[41], model_enc[256], serial[21], revision[9];
_cleanup_close_ int fd = -EBADF;
uint16_t word;
- int r;
+ int r, peripheral_device_type = -1;
log_set_target(LOG_TARGET_AUTO);
udev_parse_config();
if (fd < 0)
return log_error_errno(errno, "Cannot open %s: %m", arg_device);
- if (disk_identify(fd, identify.byte) >= 0) {
+ if (disk_identify(fd, identify.byte, &peripheral_device_type) >= 0) {
/*
* fix up only the fields from the IDENTIFY data that we are going to
* use and copy it into the hd_driveid struct for convenience
if (IN_SET(identify.wyde[0], 0x848a, 0x844a) ||
(identify.wyde[83] & 0xc004) == 0x4004)
printf("ID_ATA_CFA=1\n");
+
+ if (peripheral_device_type >= 0)
+ printf("ID_ATA_PERIPHERAL_DEVICE_TYPE=%d\n", peripheral_device_type);
} else {
if (serial[0] != '\0')
printf("%s_%s\n", model, serial);