SPARCstation Monitor

root@research.bdi.com Systems Research Supervisor gdtltr at brahms.udel.edu
Wed Jan 9 11:39:31 AEST 1991


   Just get a SPARC? Miss the blinking LED's on your old Sun-3?

   Try blink.c !

   Those keyboard lights never do anything anyway (except flash briefly
when you start X,) so why not put them to some use? This trivial hack is
known to work on a SPARC SLC w/SunOS 4.1 .

                                        Gary Duzan
                                        Time  Lord
                                    Third Regeneration




#include <fcntl.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sundev/kbd.h>
#include <sundev/kbio.h>

char ledtab[] =
{
        LED_CAPS_LOCK, LED_COMPOSE, LED_SCROLL_LOCK,
        LED_NUM_LOCK, LED_SCROLL_LOCK, LED_COMPOSE
};

main()
{
        int kbdfd,i;

        if((kbdfd=open("/dev/kbd", O_WRONLY)) < 0)
        {
        	perror("open");
        	abort();
        }

        while(1)
        {
        	for(i=0;i<6;i++)
        	{
        		if(ioctl(kbdfd, KIOCSLED, &ledtab[i]) < 0)
        		{
        			perror("ioctl");
        			abort();
        		}

        		usleep(100000);
        	}
        }
}
-- 
                            gdtltr at brahms.udel.edu
   _o_                      ----------------------                        _o_
 [|o o|]   Two CPU's are better than one; N CPU's would be real nice.   [|o o|]
  |_o_|           Disclaimer: I AM Brain Dead Innovations, Inc.          |_o_|



More information about the Alt.sources mailing list