Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 164557
b: refs/heads/master
c: b519c15
h: refs/heads/master
i:
  164555: fccef14
v: v3
  • Loading branch information
Frans Pop authored and Jiri Kosina committed Sep 21, 2009
1 parent 5718ef8 commit bcd7cdf
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 34 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cf83011d8faec99de51d6ba8879c0c61cf31e836
refs/heads/master: b519c15d4aacb3706bfff86ba316f9ed81b5032a
64 changes: 31 additions & 33 deletions trunk/Documentation/hwmon/hpfall.c
Original file line number Diff line number Diff line change
Expand Up @@ -57,45 +57,43 @@ void ignore_me(void)
{
protect(0);
set_led(0);

}

int main(int argc, char* argv[])
int main(int argc, char *argv[])
{
int fd, ret;
int fd, ret;

fd = open("/dev/freefall", O_RDONLY);
if (fd < 0) {
perror("open");
return EXIT_FAILURE;
}
fd = open("/dev/freefall", O_RDONLY);
if (fd < 0) {
perror("open");
return EXIT_FAILURE;
}

signal(SIGALRM, ignore_me);

for (;;) {
unsigned char count;

ret = read(fd, &count, sizeof(count));
alarm(0);
if ((ret == -1) && (errno == EINTR)) {
/* Alarm expired, time to unpark the heads */
continue;
}

if (ret != sizeof(count)) {
perror("read");
break;
}

protect(21);
set_led(1);
if (1 || on_ac() || lid_open()) {
alarm(2);
} else {
alarm(20);
}
}
for (;;) {
unsigned char count;

ret = read(fd, &count, sizeof(count));
alarm(0);
if ((ret == -1) && (errno == EINTR)) {
/* Alarm expired, time to unpark the heads */
continue;
}

if (ret != sizeof(count)) {
perror("read");
break;
}

protect(21);
set_led(1);
if (1 || on_ac() || lid_open())
alarm(2);
else
alarm(20);
}

close(fd);
return EXIT_SUCCESS;
close(fd);
return EXIT_SUCCESS;
}

0 comments on commit bcd7cdf

Please sign in to comment.