/*
* test_input.c -- read all the ports specified in hex on the command line
* p.s. you have to be root
*/
#ifndef __i386__
# error "This program can't compile or run on non-intel computers"
#else
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <asm/io.h>
#define DATA 0x378
int main(int argc, char **argv)
{
unsigned int i,n;
setuid(0); /* if we're setuid, do it really */
n = DATA + 1;
printf("n = %03x \n",n);
if (ioperm(n,1,1)) {perror("ioperm()"); exit(1);}
printf("received status = %02x \n",inb(n));
printf("%02x: %02x\n",n,inb(n));
printf("%03x: %d\n",n,inb(n));
return 0;
}
#endif /* __i386__ */
|