Linux ATA/IDE development
 help / color / mirror / Atom feed
From: "Martin K. Petersen" <martin.petersen@oracle.com>
To: Mark Lord <liml@rtr.ca>
Cc: linux-ide@vger.kernel.org
Subject: [PATCH] hdparm: Show form factor and media rotation rate
Date: Fri, 20 Feb 2009 20:01:25 -0500	[thread overview]
Message-ID: <yq1fxi8eh7e.fsf@sermon.lab.mkp.net> (raw)


Make hdparm display form factor and media rotation rate when using -I.

Surprisingly, I have a few devices that export these already.

diff -purN -X /home/mkp/bin/dontdiff hdparm-9.11.orig/identify.c hdparm-9.11/identify.c
--- hdparm-9.11.orig/identify.c	2009-01-27 12:48:41.000000000 -0500
+++ hdparm-9.11/identify.c	2009-02-20 19:56:12.000000000 -0500
@@ -96,6 +96,7 @@
 #define RM_STAT 		127 /* removable media status notification feature set support */
 #define SECU_STATUS		128 /* security status */
 #define CFA_PWR_MODE		160 /* CFA power mode 1 */
+#define FORM_FACTOR		168 /* device nominal form factor */
 #define START_MEDIA             176 /* media serial number */
 #define LENGTH_MEDIA            20  /* 20 words (40 bytes or characters)*/
 #define START_MANUF             196 /* media manufacturer I.D. */
@@ -103,6 +104,7 @@
 #define SCT_SUPP		206 /* SMART command transport (SCT) support */
 #define TRANSPORT_MAJOR		222 /* PATA vs. SATA etc.. */
 #define TRANSPORT_MINOR		223 /* minor revision number */
+#define NMRR			217 /* nominal media rotation rate */
 #define INTEGRITY		255 /* integrity word */
 
 /* bit definitions within the words */
@@ -897,6 +899,35 @@ void identify (__u16 *id_supplied)
 	}
 	putchar('\n');
 
+	/* Form factor */
+	if(val[FORM_FACTOR] > 0) {
+		printf("\tForm Factor: ");
+		switch(val[FORM_FACTOR]) {
+		case 1:
+			printf("5.25 inch");
+			break;
+		case 2:
+			printf("3.5 inch");
+			break;
+		case 3:
+			printf("2.5 inch");
+			break;
+		case 4:
+			printf("1.8 inch");
+			break;
+		default:
+			printf("unknown");
+			break;
+		}
+		printf("\n");
+	}
+
+	/* Spinning disk or solid state? */
+	if(val[NMRR] == 1)
+		printf("\tNominal Media Rotation Rate: Solid State Device\n");
+	else if(val[NMRR] > 0x401)
+		printf("\tNominal Media Rotation Rate: %u\n", val[NMRR]);
+
 	/* hw support of commands (capabilities) */
 	printf("Capabilities:\n");
 	printf("\t");

             reply	other threads:[~2009-02-21  1:01 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-21  1:01 Martin K. Petersen [this message]
2009-02-21 22:41 ` [PATCH] hdparm: Show form factor and media rotation rate Michael Tokarev
2009-02-23 16:14   ` Martin K. Petersen
2009-02-23 20:26     ` Mark Lord
2009-02-22  5:53 ` Mark Lord
2009-02-23 16:13   ` Martin K. Petersen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=yq1fxi8eh7e.fsf@sermon.lab.mkp.net \
    --to=martin.petersen@oracle.com \
    --cc=liml@rtr.ca \
    --cc=linux-ide@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox