Linux-Development-Sys Digest #424, Volume #8 Wed, 17 Jan 01 04:13:07 EST
Contents:
Re: Simple way to display an animation? (Kasper Dupont)
Re: PATH for cooperating executables? (Kasper Dupont)
Re: Symbol table storage. ("D. Stimits")
Re: how to turn on/off the 3 LEDs on the keyboard? (Kasper Dupont)
----------------------------------------------------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: Simple way to display an animation?
Date: Wed, 17 Jan 2001 08:23:23 +0000
This is a multi-part message in MIME format.
==============352605C4304F3893D614DA4
Content-Type: text/plain; charset=iso-8859-1
Content-Transfer-Encoding: 8bit
Michael Wimmer wrote:
>
> Hello!
>
> I hope my question isn�t OT, but i didn�t find another appropriate news
> group...
>
> I�ve got the following problem: I want to port a small app I wrote for
> my studies to Linux. It is a very basic 3d engine to display the
> physical behaviour of objects (for example tops). The only platform
> dependent code is the graphics code:
>
> I want to display a 256-color animation in a window with size width x
> height. The frame that should be displayed is stored in an array of
> bytes (char buffer[width*height]) and each entry ranging from 0 .. 255
> represents a color whose R,G,B values are given in a seperate array with
> (of course) 256 entries.
>
> Is there an easy way to program this without having to get into X too
> much? Is there any tutorial or basic information about programming
> graphical apps on the net? Or is there a lib that performs the above
> mentioned tasks (it should be open sourced?)
>
> Thank you very much for your help
>
> Regards
>
> Mike Wimmer
How much you have to get into X depends on how efficient
and portable the code has to be.
The easiest probably is to make something that only works
on true color displays. If it should work with 8 bit
displays you would have to use a private color map or do
with less than 256 colors.
For a true color display you can allocate 256 colors with
XAllocColor and store the pixel values in an array. When
the image has to be displayed you would have to convert
it from an array of chars to an array of either shorts
or longs. The converted array can be displayed with
XPutImage.
Using XDrawPoint would be easier but horribly inefficient.
On my system the documentation can be found in:
/usr/doc/XFree86-doc-3.3.3.1/X11/xlib.PS.gz
I have attached some code I once wrote, which more or
less does the same as you requested. I think you might be
able to use parts of it.
--
Kasper Dupont
==============352605C4304F3893D614DA4
Content-Type: text/plain; charset=iso-8859-1; name="X.c"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="X.c"
#include "emulator.h"
#include "post.h"
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#define BORDER_SIZE 4
static pid_t main_pid;
static Display *xdisplay = 0;
static Window xwindow = 0;
static int xscreen;
static GC xgc = 0;
static Colormap cmap;
static unsigned long colpix[64];
static WORD *buf1,*buf2;
#define PREFIX_PRESS 1
#define PREFIX_RELEASE 2
#define PREFIX_MPRESS 3
#define PREFIX_MRELEASE 4
static BYTE textmodepalette[17];
static BYTE red[256],green[256],blue[256];
static void default_textmode()
{
static BYTE defaulttextmodepalette[17]=
{0,1,2,3,4,5,20,7,56,57,58,59,60,61,62,63,0};
memcpy(textmodepalette,defaulttextmodepalette,17);
}
static void default_rgb()
{
int PCcols[64] = {0x000,0x00a,0x0a0,0x0aa,0xa00,0xa0a,0xa50,0xaaa,
0x005,0x00f,0x0a5,0x0af,0xa05,0xa0f,0xa55,0xaaf,
0x050,0x05a,0x0f0,0x0fa,0xa50,0xa5a,0xaf0,0xafa,
0x055,0x05f,0x0f5,0x0ff,0xa55,0xa5f,0xaf5,0xaff,
0x500,0x50a,0x5a0,0x5aa,0xf00,0xf0a,0xf50,0xfaa,
0x505,0x50f,0x5a5,0x5af,0xf05,0xf0f,0xf55,0xfaf,
0x550,0x55a,0x5f0,0x5fa,0xf50,0xf5a,0xff0,0xffa,
0x555,0x55f,0x5f5,0x5ff,0xf55,0xf5f,0xff5,0xfff};
int c;
for(c = 0 ; c < 255 ; c++) {
int x=PCcols[c&63];
red [c] = ((x&0xf00)>>8)*17;
green[c] = ((x&0x0f0)>>4)*17;
blue [c] = ((x&0x00f)>>0)*17;
}
}
static void mode13rgb()
{
int c;
default_rgb();
default_textmode();
for (c=0;c<16;++c) {
red [c]=red [textmodepalette[c]];
green[c]=green[textmodepalette[c]];
blue [c]=blue [textmodepalette[c]];
}
for (c=0;c<16;++c)
red[c+16]=green[c+16]=blue[c+16]=c*17;
/* FIXME: Farve palette */
for (c=32;c<256;++c)
red[c]=green[c]=blue[c]=0;
}
static inline void daemon_init()
{
int c;
/* �bn vindue p� default display. */
if((xdisplay = XOpenDisplay(""))
&& (xwindow = XCreateSimpleWindow (xdisplay, DefaultRootWindow(xdisplay),
50, 50,
640+2*BORDER_SIZE, 400+2*BORDER_SIZE,
2,0,0))) {
/* Vi vil h�re om museknapper, taster og exposure. */
XSelectInput(xdisplay, xwindow, ButtonPressMask | ButtonReleaseMask | KeyPressMask
| KeyReleaseMask | ExposureMask | ExposureMask);
/* Hiv vinduet forest. */
XMapRaised (xdisplay, xwindow);
/* S�t diverse X-ting op. */
xscreen = DefaultScreen (xdisplay);
xgc= XCreateGC (xdisplay, xwindow, 0, 0);
cmap = DefaultColormap (xdisplay,xscreen);
default_rgb();
default_textmode();
/* Alloker alle de farver, vi skal bruge. */
for(c = 0 ; c < 64 ; c++) {
XColor color;
color.red = red [c]*257;
color.green = green[c]*257;
color.blue = blue [c]*257;
XAllocColor(xdisplay,cmap, &color);
colpix[c] = color.pixel;
}
buf1=malloc(1024*1024*4);
buf2=malloc(1024*1024*4);
memset(buf1,0,65536);
return;
}
exit(1);
}
extern BYTE font16[256*16],font14[256*14],font8[256*8];
static BYTE font(BYTE tegn, int line)
{
return font16[((WORD)tegn)*16+line];
// return (line>8)?(tegn<<(line-8)):(tegn>>(8-line));
}
/** FIXME: Do this the right way **/
#define BLINK (*PTR(0xF000,0xEFFF))
/* Bl� lilla r�d gul gr�n tyrkis bl�
* 1 5 4 14 2 3 1
*/
BYTE mode13map1[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
0, 0, 0, 0, 8, 8, 8, 8, 7, 7, 7, 7,15,15,15,15,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
0,0,0,0,0,0,0,0};
BYTE mode13map2[256] = {
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,15,
0, 0, 0, 8, 0, 8, 8, 7, 8, 7, 7,15, 7,15,15,15,
1,1,5,5,5,5,4,4,4,4,14,14,14,14,2,2,2,2,3,3,3,3,1,1,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0};
static inline void daemon_loop(int keyboard_pipe,int screen_pipe)
{
int expose = 1;
XEvent xevent;
while (1) {
for ever {
fd_set rfds;
struct timeval tv;
int mx=screen_pipe;
FD_ZERO(&rfds);
FD_SET(screen_pipe, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 10000;
if (select(mx+1, &rfds, NULL, NULL, &tv)>0) {
BYTE buf;
assert(FD_ISSET(screen_pipe, &rfds));
switch (read(screen_pipe,&buf,1)) {
default:
printf("Unexpected returnvalue from read\n");
case 0:
exit(0);
case 1:
break;
}
} /* if (select) */ else {
int x,y;
if(XCheckWindowEvent(xdisplay,xwindow,ButtonPressMask | ButtonReleaseMask |
KeyPressMask | KeyReleaseMask | ExposureMask, &xevent)) {
BYTE buf[2]={0,xevent.xkey.keycode};
switch(xevent.type) {
case Expose:
expose=1;
case ButtonPress:
buf[0]=PREFIX_MPRESS;
/** FIXME **/
break;
case ButtonRelease:
buf[0]=PREFIX_MRELEASE;
/** FIXME **/
break;
case KeyRelease:
buf[0]=PREFIX_RELEASE;
/* Sometimes I am given a KeyRelease before key
* repetition, I don't want that to happen.
* I dislike the way I am doing this, but I
* don't know the right way to do this.
*/
if(XCheckWindowEvent(xdisplay,xwindow, KeyPressMask, &xevent)) {
/* If another keypress on the same button is already pending
* I assume the KeyRelease is a fake. I should perhaps check
* the timestamp as well. (Or find a better solution)
*/
assert(xevent.type==KeyPress);
if (xevent.xkey.keycode != buf[1])
write(keyboard_pipe,buf,2);
buf[1]=xevent.xkey.keycode;
buf[0]=PREFIX_PRESS;
}
write(keyboard_pipe,buf,2);
kill(main_pid,SIGCHLD);
// TEST(xevent.xkey.keycode+0);
break;
case KeyPress:
buf[0]=PREFIX_PRESS;
write(keyboard_pipe,buf,2);
kill(main_pid,SIGCHLD);
// TEST(xevent.xkey.keycode);
break;
}
} /* if(XCheckWindowEvent) */ else {
switch(*PTR(0x40,0x49)&0x7F) {
BYTE *src,*dst;
int i;
/*
case 0:
case 1:
src=(BYTE*)0xB8000;
dst=buf2;
for (i=0;i<1000;++i) {
dst[i*4 ] = lefthalf[src[2*i]];
dst[i*4+1] = src[2*i+1];
dst[i*4+2] = righthalf[src[2*i]];
dst[i*4+3] = src[2*i+1];
}
break;
*/
case 2:
case 3:
memcpy(buf2,(void*)(0xB8000),4000);
break;
case 7:
memcpy(buf2,(void*)(0xB0000),4000);
break;
case 0x13:
break;
default:
// TEST(*PTR(0x40,0x49)&0x7F);
for (i=0;i<2000;++i) buf2[i]=0x0720;
src = "Graphics mode is not supported";
dst = ((BYTE*)buf2)+1950;
while (*src) {
*dst=*src;
dst+=2;
src+=1;
}
break;
}
if ((*PTR(0x40,0x49)&0x7F)!=0x13) {
if (BLINK) {
int i;
for (i=0;i<2000;++i) buf2[i] &= 0x7FFF;
}
for (y=0;y<25;++y)
for (x=0;x<80;++x) {
int i=x+80*y;
WORD data=buf2[i];
if ((buf1[i]!=data)||expose) {
BYTE tegn=data;
BYTE attr=data>>8;
unsigned long fg,bg;
int yy;
fg=colpix[textmodepalette[attr&15]];
bg=colpix[textmodepalette[attr>>4]];
for (yy=0;yy<16;++yy) {
BYTE mask=font(tegn,yy);
int xx;
for (xx=0;xx<8;++xx) {
XSetForeground(xdisplay, xgc,
((mask<<xx)&0x80)?fg:bg);
XDrawPoint(xdisplay,xwindow,xgc,x*8+xx+BORDER_SIZE,y*16+yy+BORDER_SIZE);
}
}
}
}
expose=0;
} else {
#define BITS 32
#define SCALE 2
XImage img;
img.width=320*SCALE;
img.height=200*SCALE;
img.xoffset=0;
img.format=ZPixmap;
img.data=buf2;
img.byte_order=0;
img.bitmap_unit=0;
img.bitmap_bit_order=0;
img.bitmap_pad=0;
img.depth=24; /* 8 */
img.bytes_per_line=40*SCALE*BITS; /* 640 */
img.bits_per_pixel=32; /* 8 */
img.red_mask=255;
img.green_mask=255;
img.blue_mask=255;
XInitImage(&img);
switch (BITS) {
case 8:
{
BYTE conversion[256];
for (x=0;x<256;++x) {
BYTE R=DAC[x*3],G=DAC[x*3+1],B=DAC[x*3+2];
BYTE final=
((R&0x20)?4:0)|
((G&0x20)?2:0)|
((B&0x20)?1:0)|
((R&0x10)?32:0)|
((G&0x10)?16:0)|
((B&0x10)?8:0);
conversion[x]=colpix[final];
}
for (y=0;y<200*SCALE;++y)
for (x=0;x<320*SCALE;++x)
img.data[x+y*320*SCALE]=
conversion[*PTR(0xA000,(x/SCALE)+(y/SCALE)*320)];
}
break;
case 16:
{
XColor color;
WORD conversion[256];
for (x=0;x<256;++x) {
color.red =DAC[x*3 ]*1040;
color.green=DAC[x*3+1]*1040;
color.blue =DAC[x*3+2]*1040;
XAllocColor(xdisplay,cmap, &color);
conversion[x]=color.pixel;
}
for (y=0;y<200*SCALE;++y)
for (x=0;x<320*SCALE;++x)
((WORD*)img.data)[x+y*320*SCALE]=
conversion[*PTR(0xA000,(x/SCALE)+(y/SCALE)*320)];
}
break;
case 32:
{
XColor color;
LONG conversion[256];
for (x=0;x<256;++x) {
color.red =DAC[x*3 ]*1040;
color.green=DAC[x*3+1]*1040;
color.blue =DAC[x*3+2]*1040;
XAllocColor(xdisplay,cmap, &color);
conversion[x]=color.pixel;
}
for (y=0;y<200*SCALE;++y)
for (x=0;x<320*SCALE;++x)
((LONG*)img.data)[x+y*320*SCALE]=
conversion[*PTR(0xA000,(x/SCALE)+(y/SCALE)*320)];
}
break;
}
XPutImage(xdisplay,xwindow,xgc,&img,0,0,
BORDER_SIZE,BORDER_SIZE,
320*SCALE,200*SCALE);
expose=1;
}
XFlush(xdisplay);
{
WORD* t=buf2;
buf2=buf1;
buf1=t;
}
} /* if(XCheckWindowEvent) {...} else */
} /* if (select) {...} else */
} /* for ever */
} /* while (1) */
} /* daemon_loop */
BYTE linux_keys[256] = {
0,0,0,0,0,0,0,0,0,1,2,3,4,5,6,7,
8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,
24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,
40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,
56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,
72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,
88,199,200,201,203,204,205,207,208,209,210,211,156,157,0xE1,215,
53+128,56+128,70+128,91+128,92+128,93+128,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0};
/* ESC
* 1 - BackSpace
* Tab - ]
* Ctrl
* Enter
* A-'
* ` ~ 1/2
* Shift - Shift
*/
/* 55 national tast */
BYTE irix_keys[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 59,
1, 0, 0, 0, 0, 15, 41, 60, 0, 29, 42, 0, 58, 16, 2, 61,
0, 56, 44, 31, 30, 17, 3, 0, 0, 46, 45, 32, 18, 5, 4, 0,
0, 57, 47, 33, 20, 19, 6, 0, 0, 49, 48, 35, 34, 21, 7, 0,
0,184, 50, 36, 22, 8, 9, 0, 0, 51, 37, 23, 24, 11, 10, 0,
0, 52, 53, 38, 39, 25, 12, 68, 0, 0, 40, 0, 26, 13, 87, 0,
157, 54, 28, 27, 86, 0, 88, 70,208,203, 43,200,211,207, 14,210,
0, 79,205, 75, 71,209,199,201, 82, 83, 80, 76, 77, 72, 69,181,
0,156, 81, 0, 78, 73, 55, 0, 0, 0, 0, 0, 74, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
#define keyremap linux_keys
static int keyboard_fd,screen_fd;
static struct event child_event = { NULL,NULL };
static void child_event_handler(struct event * ev)
{
fd_set rfds;
struct timeval tv;
BYTE val;
static BYTE prefix=0;
child_event.func = NULL;
for ever {
int mx=keyboard_fd;
FD_ZERO(&rfds);
FD_SET(keyboard_fd, &rfds);
tv.tv_sec = 0;
tv.tv_usec = 1;
if (select(mx+1, &rfds, NULL, NULL, &tv)<1) return;
if (FD_ISSET(keyboard_fd, &rfds)) {
switch(read(keyboard_fd,&val,1)) {
default:
perror("Unexpected returnvalue from read");
exit(1);
case 0:
/* daemon is dead - main process shuts down */
exit(0);
case 1:
if (prefix) {
switch(prefix) {
default:
printf("X interface internal error\n");
break;
case 1:
// TEST("Press");
// TEST(val);
// TEST(keyremap[val]);
if (keyremap[val]) key_press(keyremap[val]);
else printf("Unknown X keycode %d\n",val);
break;
case 2:
// TEST("Release");
// TEST(val);
if (keyremap[val]) key_release(keyremap[val]);
break;
} /* switch(prefix) */
prefix=0;
} else {
prefix=val;
} /* else */
} /* switch(read(keyboard_fd,&val,1)) */
} /* if (FD_ISSET(keyboard_fd, &rfds)) */
} /* for ever */
} /* child_event_handler(struct event * ev) */
static void (*old_child_signal_handler)(int sig) = NULL;
static void child_signal_handler(int sig)
{
if ((old_child_signal_handler)&&
(old_child_signal_handler!=SIG_IGN)&&
(old_child_signal_handler!=SIG_DFL))
old_child_signal_handler(sig);
child_event.func = child_event_handler;
}
#define COLD_X_DAEMON COLD_ROM
INIT(COLD_X_DAEMON,"X")
{
int keyboard[2],screen[2];
main_pid=getpid();
if (pipe(keyboard)||pipe(screen)) {
perror("pipe");
exit(1);
}
switch(fork()) {
case 0:
{
/*** FIXME: What is the correct way to write this? ***/
int i=SIGRTMIN;
while (--i) signal(i,SIG_IGN);
}
close(keyboard[0]);
close(screen[1]);
daemon_init();
daemon_loop(keyboard[1],screen[0]);
case -1:
perror("fork");
exit(1);
default:
insert_event(&child_event);
old_child_signal_handler=signal(SIGCHLD,child_signal_handler);
keyboard_fd=keyboard[0];
screen_fd=screen[1];
close(keyboard[1]);
close(screen[0]);
}
}
==============352605C4304F3893D614DA4==
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: PATH for cooperating executables?
Date: Wed, 17 Jan 2001 08:32:34 +0000
Kaelin Colclasure wrote:
>
> I have an executable which needs to fork/exec a `helper' program that's
> part of the same package. Is there an idiomatic way to determine the
> path to the helper executable based on the parent process? Do people
> just examine argv[0] for this sort of thing? I'd prefer to not have to
> rely on the PATH environment if possible. [But I'd also prefer that the
> program/helper work if the user decides to try them out from the build
> tree, so capturing --exec-prefix at compile-time is not sufficient.]
>
> -- Kaelin
Often argv[0] does not contain the path but only the filename,
in such a case you would have to use the PATH environment or
current working directory to find the file. You should also
consider what would happen if some user tries to fool you by
lying about argv[0] or PATH. For some applications there could
be some security issues, in particular if setuid programs are
involved.
Another posibility is to use readlink on /proc/self/exe. To
the best of my knowledge that will always give you the full
path. But unfortunately that is not portable, it only works
on Linux.
--
Kasper Dupont
------------------------------
Date: Wed, 17 Jan 2001 01:34:53 -0700
From: "D. Stimits" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
Subject: Re: Symbol table storage.
Thaddeus L Olczyk wrote:
>
> I've compiled the KDE source ( in particular kdelibs ) and am now
> trying to single step through some of it.
> The problem is that even though I enable debugging, and even check
> makefile output (gcc/g++ always are called with the -g option ),
> there seems to be no debugging/symbol table information stored
> anywhere.
> I've also renamed strip so that it is not callled.
> I wonder if the symbol tables might not be stored in a seperate file,
> which does not get copied during the install process.
> Can anyone help?
> TIA
Does it avoid optimization as well? And I'd suggest to be really sure
strip isn't called, use gzip to compress and temporarily disable/rename
the function. Run nm on any libs to see what it thinks the symbols are.
Run ldconfig -p | less and see which libs of the name you have are
actually in your ld path. Symbols should be stored in the file with it,
not separately.
------------------------------
From: Kasper Dupont <[EMAIL PROTECTED]>
Subject: Re: how to turn on/off the 3 LEDs on the keyboard?
Date: Wed, 17 Jan 2001 08:37:07 +0000
Hackker Wong wrote:
>
> hi,
>
> do u know how to turn on/off the 3 LEDs (caps lock, num lock, scroll
> lock) on the keyboard? i want to control the LEDs in my program. is
> there any system call to do this? i found a function register_led() in
> /usr/src/linux/drivers/char/keyboard.c, but i don't know how to use it.
>
> pls help! thx a lot!
>
> --
> - By Hackker
> ****************************************************
> Mr. Hackker Wong,
> Y99 Student of Computer Science,
> The Chinese University of Hong Kong.
> ****************************************************
> -The World can't run without computer technicians-
On the virtual terminals you can use some ioctl's
KDGKBLED, KDSKBLED, KDGETLED, KDSETLED.
If your program runs under X you will have to do
something else.
What do you want to do, change only the light in the
leds or change also the function of the keyboard?
--
Kasper Dupont
------------------------------
** FOR YOUR REFERENCE **
The service address, to which questions about the list itself and requests
to be added to or deleted from it should be directed, is:
Internet: [EMAIL PROTECTED]
You can send mail to the entire list by posting to the
comp.os.linux.development.system newsgroup.
Linux may be obtained via one of these FTP sites:
ftp.funet.fi pub/Linux
tsx-11.mit.edu pub/linux
sunsite.unc.edu pub/Linux
End of Linux-Development-System Digest
******************************