-/*
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
+ *
* ata_id - reads product/serial number from ATA drives
*
* Copyright (C) 2005-2008 Kay Sievers <kay.sievers@vrfy.org>
#include <linux/types.h>
#include <linux/hdreg.h>
#include <linux/fs.h>
+#include <linux/cdrom.h>
#include <arpa/inet.h>
#include "libudev.h"
goto fail;
}
+ /*
+ * do not confuse optical drive firmware with ATA commands
+ * some drives are reported to blank CD-RWs
+ */
+ if (ioctl(fd, CDROM_GET_CAPABILITY, NULL) >= 0) {
+ errno = EIO;
+ ret = -1;
+ goto fail;
+ }
+
/* So, it's a block device. Let's make sure the ioctls work */
if ((ret = ioctl(fd, BLKGETSIZE64, &size)) < 0)
goto fail;
wwwn <<= 16;
wwwn |= *((uint16_t *) identify + 111);
printf("ID_WWN=0x%llx\n", (unsigned long long int) wwwn);
+ /* ATA devices have no vendor extension */
+ printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn);
}
} else {
if (serial[0] != '\0')