All pastes #261754 Raw Edit

C

public c v1 · immutable
#261754 ·published 2006-11-29 20:57 UTC
rendered paste body
#include <stdio.h>#include <stdlib.h>#include <linux/input.h>#include <fcntl.h>/*	this is a quick hack to catch the hx4700's power off key	*/int main (int argc, char *argv[]) {	FILE *f;	struct input_event e;	int fd;	if (!(f = fopen ("/dev/input/event0", "r"))) exit (1);	do {		if (fread (&e, sizeof(e), 1, f) != 1) continue;		if ((e.type == EV_KEY) && (e.code == KEY_POWER) && (e.value == 1))			system("apm -s");	} while (1);	fclose (f);	return 0;}