All pastes #355123 Raw Edit

smooth_penguin

public c v1 · immutable
·published 2007-02-14 09:37 UTC
rendered paste body
/* * Program to control switching of my monitor using 'i810switch crt' command * and a microswitch , controlled through the parallel port. * 									-sp */ #include <stdio.h>#include <unistd.h>#include <asm/io.h>#define BASEPORT 0x378int main(){	if(ioperm(BASEPORT, 3, 1)) {	  exit(1);		}		onLoop();	  }      onLoop(){  system("i810switch crt on");  printf("crt is now on\n");   while(1){ 	 if(inb(BASEPORT +1) == 255){     usleep(1000000);     offLoop();  	}  } }  offLoop(){ system("i810switch crt off"); printf("crt is now off\n");  while(1){ if(inb(BASEPORT + 1) == 255){ 	usleep(1000000); 	onLoop();  } }  }