hdparm: Show form factor and media rotation rate
PATCH 1/1 hdparm: Show form factor and media rotation rate
Make hdparm display form factor and media rotation rate when using -I.
Surprisingly, I have a few devices that export these already.
identify.c +31 -0
@@ -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" );
Quoted 1 line · Martin K. Petersen
Make hdparm display form factor and media rotation rate when using -I.
Ok, just a small (but I think very useful) nitpick:
[]
Quoted 4 lines
identify.c +4
-0+/* Form factor */ +if (val[FORM_FACTOR ] >0 ) { +printf ("\tForm Factor: " ); +switch (val[FORM_FACTOR ]) {
...
identify.c void identify (__u16 *id_supplied) · line 920
Quoted 5 lines
identify.c +5
-0+printf ("1.8 inch" ); +break ; +default : +printf ("unknown" ); +break ;
How about printing the actual (unrecognized) value here? Like this:
+ default:
+ printf("unknown (raw value = %d)", val[FORM_FACTOR]);
+ break;(with whatever %d needed)
Thanks!
/mjt
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Michael" == Michael Tokarev <[email protected]> writes:
Michael> How about printing the actual (unrecognized) value here? Like Michael> this:
Michael> + default:
Michael> + printf("unknown (raw value = %d)", val[FORM_FACTOR]);
Michael> + break;I'm ok with that. Mark?
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Quoted 10 lines · Martin K. Petersen
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Michael" == Michael Tokarev <[email protected]> writes:
Michael> How about printing the actual (unrecognized) value here? Like Michael> this:
Michael> + default: Michael> + printf("unknown (raw value = %d)", val[FORM_FACTOR]); Michael> + break;I'm ok with that. Mark?
..
Already done, except in hex.
Cheers
Quoted 3 lines · Martin K. Petersen
Make hdparm display form factor and media rotation rate when using -I.
Surprisingly, I have a few devices that export these already.
..
Peachy. I'll add it for hdparm-9.12, if you agree to the hdparm copyright (BSD style licensing).
Cheers
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Mark" == Mark Lord <[email protected]> writes:
Mark> Peachy. I'll add it for hdparm-9.12, if you agree to the hdparm Mark> copyright (BSD style licensing).
That's fine.
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering