Doesn't park here:

ehm:/home/folkert# ./park /dev/hda
head not parked 4c

ehm:/home/folkert# hdparm -i /dev/hda

/dev/hda:

 Model=IC25N060ATMR04-0, FwRev=MO3OAD5A, SerialNo=MRG357K3KKN0XH
 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=4
 BuffType=DualPortCache, BuffSize=7884kB, MaxMultSect=16, MultSect=16
 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=117210240
 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}
 PIO modes:  pio0 pio1 pio2 pio3 pio4
 DMA modes:  mdma0 mdma1 mdma2
 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5
 AdvancedPM=yes: mode=0x80 (128) WriteCache=enabled
 Drive conforms to: ATA/ATAPI-6 T13 1410D revision 3a:

 * signifies the current active mode

[   38.772050] hda: max request size: 1024KiB
[   38.792458] hda: 117210240 sectors (60011 MB) w/7884KiB Cache, 
CHS=16383/255/63, UDMA(100)

> > > #include <stdio.h>
> > > #include <unistd.h>
> > > #include <fcntl.h>
> > > #include <string.h>
> > > #include <sys/ioctl.h>
> > > #include <linux/hdreg.h>
> > >
> > > int main(int argc, char *argv[])
> > > {
> > >   unsigned char buf[8];
> > >   int fd;
> > >
> > >   if (argc < 2) {
> > >           printf("%s <dev>\n", argv[0]);
> > >           return 1;
> > >   }
> > >
> > >   fd = open(argv[1], O_RDONLY);
> > >   if (fd == -1) {
> > >           perror("open");
> > >           return 1;
> > >   }
> > >
> > >   memset(buf, 0, sizeof(buf));
> > >   buf[0] = 0xe1;
> > >   buf[1] = 0x44;
> > >   buf[3] = 0x4c;
> > >   buf[4] = 0x4e;
> > >   buf[5] = 0x55;
> > >
> > >   if (ioctl(fd, HDIO_DRIVE_TASK, buf)) {
> > >           perror("ioctl");
> > >           return 1;
> > >   }
> > >
> > >   if (buf[3] == 0xc4)
> > >           printf("head parked\n");
> > >   else
> > >           printf("head not parked %x\n", buf[3]);
> > >
> > >   close(fd);
> > >   return 0;
> > > }


Folkert van Heusden

-- 
Auto te koop, zie: http://www.vanheusden.com/daihatsu.php
Op zoek naar een IT of Finance baan? Mail me voor de mogelijkheden.
--------------------------------------------------------------------
 UNIX admin? Then give MultiTail (http://vanheusden.com/multitail/) 
 a try, it brings monitoring logfiles to a different level! See     
 http://vanheusden.com/multitail/features.html for a feature-list.  
--------------------------------------------------------------------
Phone: +31-6-41278122, PGP-key: 1F28D8AE
Get your PGP/GPG key signed at www.biglumber.com!

Attachment: signature.asc
Description: Digital signature

Reply via email to