home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / sys / sun / misc / 5821 < prev    next >
Encoding:
Text File  |  1992-12-12  |  1.6 KB  |  52 lines

  1. Xref: sparky comp.sys.sun.misc:5821 comp.sys.sun.hardware:6197
  2. Newsgroups: comp.sys.sun.misc,comp.sys.sun.hardware
  3. Path: sparky!uunet!spool.mu.edu!yale.edu!yale!gumby!destroyer!cs.ubc.ca!alberta!cpsc.ucalgary.ca!aycock
  4. From: aycock@pogo.cuc.ab.ca (John Aycock)
  5. Subject: Re: num-lock LED stays on
  6. In-Reply-To: mills@ccu.umanitoba.ca's message of Fri, 11 Dec 1992 03:37:38 GMT
  7. Message-ID: <AYCOCK.92Dec11205837@pogo.pogo.cuc.ab.ca>
  8. Sender: news@cpsc.ucalgary.ca (News Manager)
  9. Organization: UUCP, University of Calgary
  10. References: <ByqsEq.L0K@jabba.ess.harris.com> <1fo8liINNdvt@moe.ksu.ksu.edu>
  11.     <Bz2sqr.4Hr@ccu.umanitoba.ca>
  12. Date: Sat, 12 Dec 1992 03:58:37 GMT
  13. Lines: 37
  14.  
  15. This is what I use to fix the locked keyboards with the numlock light on.
  16. It's worked every time for me sofar.  (WARNING: watch out if you're using
  17. it remotely!  Sometimes the user the keyboard locked on isn't logged out
  18. when it becomes unstuck.)  Standard disclaimer applies on the code.  Our
  19. guess is that there's a race condition when the X server exits that causes
  20. this, but we haven't been able to nail it down.  If anyone has had more
  21. luck on this I'd like to hear from you.
  22.  
  23. BTW, you don't need to be root to run this.
  24. :ja
  25.  
  26. --
  27. #include <stdio.h>
  28. #include <fcntl.h>
  29.  
  30. #include <sys/types.h>
  31. #include <sundev/kbio.h>
  32. #include <sundev/kbd.h>
  33.  
  34. main()
  35. {
  36.     int cmd = 1;
  37.     int fd = open("/dev/kbd", O_RDWR);
  38.     if (fd < 0) {
  39.         perror("open");
  40.         exit(1);
  41.     }
  42.     if (ioctl(fd, KIOCSDIRECT, &cmd) < 0) {
  43.         perror("ioctl(KIOCSDIRECT)");
  44.         exit(1);
  45.     }
  46.     exit(0);
  47. }
  48. --
  49.  
  50.   //\|_||\|    John D. Aycock        aycock@cpsc.ucalgary.ca
  51. \/ \/| || |    (403) 285-8727        aycock@pogo.cuc.ab.ca
  52.