RE: IBM HDAPS things are looking up (was: Re: [Hdaps-devel] Re: [ltp] IBM HDAPS Someone interested? (Accelerometer))

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jens,

	Thanks for this util. :-) It will make things easier for us and do part of
the Job we are looking for. I will post this  script in the hdaps.sf.net for
people if it's ok with you.

Thanks again,

.Alejandro

> > #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;
> > }

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux