[vox-tech] more newbie questions

Ken Bloom vox-tech@lists.lugod.org
Thu, 18 Apr 2002 16:04:03 -0700


> --- ORIGINAL MESSAGE ---
> Date: Thu, 18 Apr 2002 01:44:44 -0700
> From: Joey Karalius <jwkaralius@ucdavis.edu>
> To: vox-tech@lists.lugod.org
> Subject: [vox-tech] more newbie questions
> 
> I have a few questions for the group:
> 
> 1) How do I get NUM-LOCK to stay on when re-booting (Linux, of course)? 
>   I thought it was only a BIOS thing but apparently not, since it stays 
> on when Windows boots up, but not Linux.

It boils down to `setleds +num` call, you can put it in your .profile or .login if you want
Mandrake has a service in /etc/init.d called numlock that turns numlock on for all of the 
virtual consoles at startup. The code for the `numlock start` part of the service is as 
follows:

#snippet from /etc/rc.d/init.d/numlock in mandrake 8.2
  start)
        gprintf "Starting numlock: "
        echo_success
        echo
        touch $SYSCONF_FILE

        for tty in /dev/tty[1-8]; do
                setleds -D +num < $tty
        done

        ;;
#end snippet

For x-window, it's a little more difficult. Somewhere, I found a script that simulates 
pressing the numlock key once. (If numlock is off and you use it, then numlock turns on. If 
numlock is on and you press it, then numlock turns off.) Because I use XDM, I just compiled 
the program, and then modified /etc/X11/xdm/Xsetup_0 to run the program, so numlock is on by 
default for everyone.

You could also execute it from your .xinitrc or your .xsession

//numlock.c
//compile using:
//gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock Numlock.c -lX11 -lXtst
#include <X11/extensions/XTest.h>
#include <X11/keysym.h>

int main(void) {
        Display* disp = XOpenDisplay( NULL );
        if( disp == NULL )
                return 1;
        XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock), True, CurrentTime );
        XTestFakeKeyEvent( disp, XKeysymToKeycode( disp, XK_Num_Lock), False, CurrentTime );
        XCloseDisplay( disp );
        return 0;
}
//end numlock.c


> 2) I bought a serial external modem, and I'm shopping for a cable. It 
> has the 25-pin connection on the back and I think I want to go with the 
> USB to serial cable, since I have a couple empty USB ports.  Is there 
> any reason I can't go with that setup?

I wish I knew stuff about USB. Maybe there will be something for me to learn about USB at 
sunday's installfest.