From owner-freebsd-hackers Fri Apr 14 9:53:12 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from techunix.technion.ac.il (techunix.technion.ac.il [132.68.1.28]) by hub.freebsd.org (Postfix) with ESMTP id 82D4B37BBE3 for ; Fri, 14 Apr 2000 09:53:06 -0700 (PDT) (envelope-from mellon@techunix.technion.ac.il) Received: by techunix.technion.ac.il (Postfix, from userid 14309) id 0E0D38669; Fri, 14 Apr 2000 19:52:54 +0300 (IDT) Message-ID: <20000414195253.41151@techunix.technion.ac.il> Date: Fri, 14 Apr 2000 19:52:53 +0300 From: Anatoly Vorobey To: Daniel O'Connor Cc: hackers@freebsd.org, imp@village.org Subject: Re: PC Keyboard Scancodes Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.88 Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I will see if I can try what Anatoly suggests.. :) Use this simple prog to cough up the scancodes: #include #include #include #include #include void die(char *str) { perror(str); exit(0); } int main(void) { int err, mode; struct termios term_saved, term; int i; char ch; err = tcgetattr(0,&term); if(err==-1) die("tcgetattr"); term_saved = term; cfmakeraw(&term); err = ioctl(0,KDGKBMODE, &mode); if(err==-1) die("getkbdmode"); else printf("current kb mode: %d\n", mode); err = ioctl(0,KDSKBMODE, K_RAW); if(err==-1) die("setkbmode"); else printf("K_RAW mode set\n"); printf("Press Esc to end.\n"); err = tcsetattr(0,TCSANOW,&term); /* set terminal to raw */ if(err==-1) die("tcsetattr"); for(i=0; i<1000; i++) { err=read(0,&ch,1); if(err!=1) break; printf("%d ",ch); fflush(stdout); if(ch==1) break; /* break on Escape */ } err = tcsetattr(0,TCSANOW,&term_saved); if(err==-1) die("tcsetattr"); err = ioctl(0,KDSKBMODE,mode); if(err==-1) die("setkbmode"); else printf("\nkb mode restored\n"); } -- Anatoly Vorobey, mellon@pobox.com http://pobox.com/~mellon/ "Angels can fly because they take themselves lightly" - G.K.Chesterton To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message