summaryrefslogtreecommitdiff
path: root/extras/ata_id
diff options
context:
space:
mode:
authorDavid Zeuthen <davidz@redhat.com>2011-08-31 10:00:11 -0400
committerKay Sievers <kay.sievers@vrfy.org>2011-09-01 21:15:29 +0200
commitb93b46e4b70ee6e7c95f8589bd1da93e3d17d44d (patch)
tree45e392d77716832ab6323ba527c658328881f1f9 /extras/ata_id
parent4fd394c34b1950ba897ef9ce92b14d2fe2a8dba8 (diff)
ata_id: Check for Compact Flash card
Automounters may need information like this to e.g. allow unprivileged applications to mount filesystems from a CF card but not from other ATA devices. See https://bugzilla.redhat.com/show_bug.cgi?id=734191 Signed-off-by: David Zeuthen <davidz@redhat.com>
Diffstat (limited to 'extras/ata_id')
-rw-r--r--extras/ata_id/ata_id.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/extras/ata_id/ata_id.c b/extras/ata_id/ata_id.c
index 1e93fde4bf..cadadfc27f 100644
--- a/extras/ata_id/ata_id.c
+++ b/extras/ata_id/ata_id.c
@@ -448,6 +448,7 @@ int main(int argc, char *argv[])
struct udev *udev;
struct hd_driveid id;
uint8_t identify[512];
+ uint16_t *identify_words;
char model[41];
char model_enc[256];
char serial[21];
@@ -541,6 +542,7 @@ int main(int argc, char *argv[])
goto close;
}
}
+ identify_words = (uint16_t *) identify;
memcpy (model, id.model, 40);
model[40] = '\0';
@@ -700,6 +702,15 @@ int main(int argc, char *argv[])
/* ATA devices have no vendor extension */
printf("ID_WWN_WITH_EXTENSION=0x%llx\n", (unsigned long long int) wwwn);
}
+
+ /* from Linux's include/linux/ata.h */
+ if (identify_words[0] == 0x848a || identify_words[0] == 0x844a) {
+ printf("ID_ATA_CFA=1\n");
+ } else {
+ if ((identify_words[83] & 0xc004) == 0x4004) {
+ printf("ID_ATA_CFA=1\n");
+ }
+ }
} else {
if (serial[0] != '\0')
printf("%s_%s\n", model, serial);