/*Spiros Ioannou (sivann at theseas.ntua.gr) */ #include #include #include #include #include #include main() { int fd; int i=1; int c; if((fd = open("/dev/kbd", 0)) == -1) { fprintf(stderr, "Cant open device\n"); exit(2); } printf("\nKeyboard control, Spiros Ioannou 1995\n"); printf("Choices\n"); printf("0\texit\n"); printf("1\tclick on\n"); printf("2\tclick off\n"); printf("3\tbell on (very annoying!!)\n"); printf("4\tbell off\n"); printf("5\tKeyboard Reset (as if power-up)\n"); printf("\n------------------------------------------\nYour Choice:"); switch (c=(getchar() - '0')){ case 1 : c=KBD_CMD_CLICK; break; case 2 : c=KBD_CMD_NOCLICK; break; case 3 : c=KBD_CMD_BELL; break; case 4 : c=KBD_CMD_NOBELL; break; case 5 : c=KBD_CMD_RESET; break; default: exit(0); } if (ioctl(fd, KIOCCMD, &c)==-1) perror("ioctl"); close(fd); }