Professional Web Applications Themes

NumLoc "ON" at startup - Linux Setup, Configuration & Administration

RLF wrote: > I am going in circles and cannot figure out how I can get my NumLoc on at > startup. I use RH9 and XFree86 4.3.0-2 > I am not into kernel building ... there should be another simpler way(?) > to do this. > > Rolf Try looking in your BIOS, its usually there. HTH david (remove nospam in address) Registered Linux User 226449: Machine no. 164641 Everybody brings us happiness,some as they arrive,others as they leave....

  1. #1

    Default Re: NumLoc "ON" at startup

    RLF wrote:
    > I am going in circles and cannot figure out how I can get my NumLoc on at
    > startup. I use RH9 and XFree86 4.3.0-2
    > I am not into kernel building ... there should be another simpler way(?)
    > to do this.
    >
    > Rolf
    Try looking in your BIOS, its usually there.

    HTH david (remove nospam in address)

    Registered Linux User 226449: Machine no. 164641

    Everybody brings us happiness,some as they
    arrive,others as they leave.








    david walcroft Guest

  2. #2

    Default Re: NumLoc "ON" at startup

    david walcroft <reddwarfbigpond.nospam.net.au> wrote:
    >RLF wrote:
    >> I am going in circles and cannot figure out how I can get my NumLoc on at
    >> startup. I use RH9 and XFree86 4.3.0-2
    >> I am not into kernel building ... there should be another simpler way(?)
    >> to do this.
    >
    >Try looking in your BIOS, its usually there.
    I too would like to know how to set this, but on the text console
    as well as in X. Setting it in the BIOS does not last -- Linux turns it off
    soon after the kernel loads.

    --
    Lucius Chiaraviglio
    Approximate E-mail address: [email]luciusonechapter.net[/email]
    To get the exact address: ^^^ ^replace this with 'r'
    |||
    replace this with single digit meaning the same thing
    (Spambots of Doom, take that!).
    Lucius Chiaraviglio Guest

  3. #3

    Default Re: NumLoc "ON" at startup

    RLF wrote:
    > I am going in circles and cannot figure out how I can get my NumLoc on
    > at startup. I use RH9 and XFree86 4.3.0-2
    > I am not into kernel building ... there should be another simpler
    > way(?) to do this.
    >
    > Rolf
    Below is Mandrake's /etc/init.d/numlock. Double check file locations,
    word wrap, etc., but it ought to be adaptable to Red Hat.

    ---------<CUT HERE>---------
    #!/bin/sh
    #
    # Startup script for NumLock
    #
    # description: Locks NumLock key at init runlevel change
    # chkconfig: 345 85 15

    # Source function library.
    .. /etc/rc.d/init.d/functions

    # The following file make bash to relock the numlock key when
    logging
    # since login unlock it.
    SYSCONF_FILE=/var/lock/subsys/numlock
    #SYSCONF_FILE=/etc/sysconfig/numlock

    # See how we were called.
    case "$1" in
    start)
    gprintf "Starting numlock: "
    echo_success
    echo
    touch $SYSCONF_FILE

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

    ;;
    stop)
    gprintf "Disabling numlocks on ttys: "
    for tty in /dev/tty[1-8]; do
    setleds -D -num < $tty
    done
    echo_success
    echo
    rm -f $SYSCONF_FILE
    ;;
    status)
    # status NumLock
    # gprintf "dead status as reported is normal since NumLock doesn't
    need to daemonize\n"
    if [ -f $SYSCONF_FILE ]
    then
    gprintf "numlock is enabled\n"
    else
    gprintf "numlock is disabled\n"
    fi
    ;;
    restart)
    $0 stop
    $0 start
    ;;
    reload)
    gprintf "Reloading numlock: "
    $0 start
    echo
    ;;
    *)
    gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
    exit 1
    esac

    exit 0
    ---------<CUT HERE>---------
    AAW Guest

  4. #4

    Default Re: NumLoc "ON" at startup

    Am Fri, 25 Jul 2003 09:13:55 +0000 schrieb Lucius Chiaraviglio:
    > david walcroft <reddwarfbigpond.nospam.net.au> wrote:
    >>RLF wrote:
    >>> I am going in circles and cannot figure out how I can get my NumLoc on
    >>> at startup. I use RH9 and XFree86 4.3.0-2 I am not into kernel
    >>> building ... there should be another simpler way(?) to do this.
    >>
    >>Try looking in your BIOS, its usually there.
    >
    > I too would like to know how to set this, but on the text console
    > as well as in X. Setting it in the BIOS does not last -- Linux turns it
    > off soon after the kernel loads.
    Hi,

    here's an excellent tutorial on how to enable the numlock at the start of
    X: [url]http://sdb.suse.de/en/sdb/html/cg_x11numlock.html[/url]

    To have your numlock activated in the consoles too, just add the following
    piece of code at the end of your /etc/rc.d/rc.sysinit:

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



    Florian H. R. Guest

  5. #5

    Default Re: NumLoc "ON" at startup

    On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
    > RLF wrote:
    >
    >> I am going in circles and cannot figure out how I can get my NumLoc on
    >> at startup. I use RH9 and XFree86 4.3.0-2
    >> I am not into kernel building ... there should be another simpler
    >> way(?) to do this.
    >>
    >> Rolf
    >
    > Below is Mandrake's /etc/init.d/numlock. Double check file locations,
    > word wrap, etc., but it ought to be adaptable to Red Hat.
    >
    > ---------<CUT HERE>---------
    > #!/bin/sh
    > #
    > # Startup script for NumLock
    > #
    > # description: Locks NumLock key at init runlevel change
    > # chkconfig: 345 85 15
    >
    > # Source function library.
    > . /etc/rc.d/init.d/functions
    >
    > # The following file make bash to relock the numlock key when
    > logging
    > # since login unlock it.
    > SYSCONF_FILE=/var/lock/subsys/numlock
    > #SYSCONF_FILE=/etc/sysconfig/numlock
    >
    > # See how we were called.
    > case "$1" in
    > start)
    > gprintf "Starting numlock: "
    > echo_success
    > echo
    > touch $SYSCONF_FILE
    >
    > for tty in /dev/tty[1-8]; do
    > setleds -D +num < $tty
    > done
    >
    > ;;
    > stop)
    > gprintf "Disabling numlocks on ttys: "
    > for tty in /dev/tty[1-8]; do
    > setleds -D -num < $tty
    > done
    > echo_success
    > echo
    > rm -f $SYSCONF_FILE
    > ;;
    > status)
    > # status NumLock
    > # gprintf "dead status as reported is normal since NumLock doesn't
    > need to daemonize\n"
    > if [ -f $SYSCONF_FILE ]
    > then
    > gprintf "numlock is enabled\n"
    > else
    > gprintf "numlock is disabled\n"
    > fi
    > ;;
    > restart)
    > $0 stop
    > $0 start
    > ;;
    > reload)
    > gprintf "Reloading numlock: "
    > $0 start
    > echo
    > ;;
    > *)
    > gprintf "Usage: %s {start|stop|restart|reload|status}\n" "$0"
    > exit 1
    > esac
    >
    > exit 0
    > ---------<CUT HERE>---------

    Mandrake also has this file in /etc/profile.d/numlock.sh

    -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    # Linux-Mandrake configuration.
    # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been runned
    # This is needed as login reset the tty

    MY_TTY=`tty`
    case $MY_TTY in
    /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num < $MY_TTY;;
    esac
    -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    Bit Twister Guest

  6. #6

    Default Re: NumLoc "ON" at startup

    Am Fri, 25 Jul 2003 16:43:26 +0200 schrieb Florian H. R.:
    > Am Fri, 25 Jul 2003 09:13:55 +0000 schrieb Lucius Chiaraviglio:
    >
    >> david walcroft <reddwarfbigpond.nospam.net.au> wrote:
    >>>RLF wrote:
    >>>> I am going in circles and cannot figure out how I can get my NumLoc
    >>>> on at startup. I use RH9 and XFree86 4.3.0-2 I am not into kernel
    >>>> building ... there should be another simpler way(?) to do this.
    >>>
    >>>Try looking in your BIOS, its usually there.
    >>
    >> I too would like to know how to set this, but on the text console
    >> as well as in X. Setting it in the BIOS does not last -- Linux turns
    >> it off soon after the kernel loads.
    >
    > Hi,
    >
    > here's an excellent tutorial on how to enable the numlock at the start
    > of X: [url]http://sdb.suse.de/en/sdb/html/cg_x11numlock.html[/url]
    >
    > To have your numlock activated in the consoles too, just add the
    > following piece of code at the end of your /etc/rc.d/rc.sysinit:
    >
    > for tty in /dev/tty[1-9]* ;
    > do
    > setleds -D +num <$tty
    > done
    I forgot something:
    Just add the line "setnumlock" (w/o quotes) to your ~/.bashrc in RH9. This
    will execute your little program which you have compiled before (as
    described in the link above) after each login.
    Florian H. R. Guest

  7. #7

    Default Re: NumLoc "ON" at startup

    Bit Twister wrote:
    > On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
    >> RLF wrote:
    >>
    >>> I am going in circles and cannot figure out how I can get my NumLoc
    >>> on at startup. I use RH9 and XFree86 4.3.0-2
    >>> I am not into kernel building ... there should be another simpler
    >>> way(?) to do this.
    >>>
    >>> Rolf
    >>
    >> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
    >> word wrap, etc., but it ought to be adaptable to Red Hat.
    >>
    >> ---------<SNIP>---------
    >
    >
    > Mandrake also has this file in /etc/profile.d/numlock.sh
    >
    > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    > # Linux-Mandrake configuration.
    > # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been
    > # runned This is needed as login reset the tty
    >
    > MY_TTY=`tty`
    > case $MY_TTY in
    > /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num <
    > $MY_TTY;;
    > esac
    > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    Thanks for catching that, Bit Twister. I posted without double-checking
    my facts.

    Rolf, digging a little deeper, I see that both files are part of
    Mandrake's numlock rpm, which include several more files. I don't know
    enough about Red Hat's file structure to be sure about compatibility,
    but you might try rebuilding the Mandrake SRPM (try rpmfind.net to
    locate) for your system. OTOH, Florian H.R.'s suggestion would probably
    be quicker and easier.

    Good Luck,
    Arn

    AAW Guest

  8. #8

    Default Re: NumLoc "ON" at startup

    AAW wrote:
    > Bit Twister wrote:
    >
    >> On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
    >>> RLF wrote:
    >>>
    >>>> I am going in circles and cannot figure out how I can get my NumLoc
    >>>> on at startup. I use RH9 and XFree86 4.3.0-2
    >>>> I am not into kernel building ... there should be another simpler
    >>>> way(?) to do this.
    >>>>
    >>>> Rolf
    >>>
    >>> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
    >>> word wrap, etc., but it ought to be adaptable to Red Hat.
    >>>
    >>> ---------<SNIP>---------
    >>
    >>
    >> Mandrake also has this file in /etc/profile.d/numlock.sh
    >>
    >> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    >> # Linux-Mandrake configuration.
    >> # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been
    >> # runned This is needed as login reset the tty
    >>
    >> MY_TTY=`tty`
    >> case $MY_TTY in
    >> /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num <
    >> $MY_TTY;;
    >> esac
    >> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    >
    > Thanks for catching that, Bit Twister. I posted without double-checking
    > my facts.
    >
    > Rolf, digging a little deeper, I see that both files are part of
    > Mandrake's numlock rpm, which include several more files. I don't know
    > enough about Red Hat's file structure to be sure about compatibility,
    > but you might try rebuilding the Mandrake SRPM (try rpmfind.net to
    > locate) for your system. OTOH, Florian H.R.'s suggestion would probably
    > be quicker and easier.
    >
    > Good Luck,
    > Arn
    I am using KDE as my WM. It is configured in there. I understand that
    Numloc cannot be enabled at the login screen - apparently for security
    reasons.

    Doug.
    --
    Registered Linux user No. 277548.
    Linux: in a world without fences, who needs Gates?
    Doug Laidlaw Guest

  9. #9

    Default Re: NumLoc "ON" at startup

    "RLF" <rm.gerritsquicknet.nl> wrote:
    >I am going in circles and cannot figure out how I can get my NumLoc on at
    >startup. I use RH9 and XFree86 4.3.0-2
    >I am not into kernel building ... there should be another simpler way(?)
    >to do this.
    (Courtesy of e-mail from "staehle"):

    In "Linux Frequently Asked Questions with Answers" posted every week
    to comp.os.linux.misc, look up "7.20. How To Get NUM LOCK to Default to On."
    | Use the setleds program, for example (in /etc/rc.local or one of the
    | /etc/rc.d/* files) [. . .]

    (Somehow I managed to miss that section.) Here is my /etc/rc.d/init.d/numlock
    script (linked from /etc/rc.d/rc[1-5].d as S15numlock):

    [BEGIN SCRIPT]

    #!/bin/bash
    # Begin $rc_base/init.d/numlock
    # Turn on (or off) NumLock on a Linux From Scratch 4.1/Beyond Linux From
    # Scratch 1.0 system. This script does not address getty programs that
    # reset keyboard LEDs after a user logs out, because Linux From Scratch
    # getty does not do this by default.

    source /etc/sysconfig/rc
    source $rc_functions

    INITTY=/dev/tty[1-8]
    error_value=0

    case "$1" in
    start)
    echo "Setting NumLock LED on $INITTY..."

    for tty in $INITTY; do
    setleds -D +num < $tty
    error_value=$(($? || error_value))
    done
    ;;

    stop)
    echo "Clearing NumLock LED on $INITTY..."

    for tty in $INITTY; do
    setleds -D -num < $tty
    error_value=$(($? || error_value))
    done
    ;;

    status)
    echo "Managed virtual consoles: $INITTY"

    for tty in $INITTY; do
    echo "LED status for virtual console $tty:"
    setleds < $tty
    error_value=$(($? || error_value))
    done
    ;;

    *)
    echo "Usage: $0 {start|stop|status}"
    exit 1
    ;;
    esac

    if [ $error_value = 0 ]
    then
    print_status success
    else
    print_status failure
    fi

    # End $rc_base/init.d/numlock

    [END SCRIPT]

    The above script differs from what Bit Twister posted and does not require a
    /etc/profile.d/numlock.sh because Linux From Scratch 4.1 getty does not reset
    the LEDs after you log out.

    For X, I got a pointer to "man xset", but this only seems to work for
    the Scroll Lock key (and I tried toggling all 32 LED flags, plus the
    unnumbered "on"/"off" option). No error messages appeared -- just nothing
    whatsoever happened with any LED flag other than 3 or the unnumbered
    "on"/"off" option, both of which set or cleared only the Scroll Lock LED.
    (Why can't xset do something sensible and easy to use like setleds does?)
    What I ended up doing was to follow the link provided by Florian H. R. in
    this thread ([url]http://sdb.suse.de/en/sdb/html/cg_x11numlock.html[/url]), and edit the
    code to improve readability and insert the installation instructions as
    comments (copy posted here for your copy and paste convenience):

    [BEGIN PROGRAM]

    /* SuSe Linux AG setnumlock.c (originally numlock.c) to activate Numlock in X
    * ([url]http://sdb.suse.de/en/sdb/html/cg_x11numlock.html[/url])
    *
    * Compilation command:
    * gcc -I/usr/X11R6/include -L/usr/X11R6/lib -o setnumlock setnumlock.c \
    * -lX11 -lXtst
    */

    /* Copy the compiled program setnumlock from the current directory to
    * /usr/local/bin and make an entry in the file ~/.xinitrc.
    */

    #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 PROGRAM]

    Although I am not an expert programmer, this looks like it
    is faking a Num Lock key press and release. This is kind of a gross
    hack, but at least it is short, and it does work on my particular system
    (Linux From Scratch 4.1/Beyond Linux From Scratch 1.0, using XFree86
    4.3.0).

    --
    Lucius Chiaraviglio
    Approximate E-mail address: [email]luciusonechapter.net[/email]
    To get the exact address: ^^^ ^replace this with 'r'
    |||
    replace this with single digit meaning the same thing
    (Spambots of Doom, take that!).
    Lucius Chiaraviglio Guest

  10. #10

    Default Re: NumLoc "ON" at startup

    On Fri, 25 Jul 2003 15:02:08 +0000, Bit Twister wrote:
    > On Fri, 25 Jul 2003 09:15:15 -0500, AAW wrote:
    >> RLF wrote:
    >>
    >>> I am going in circles and cannot figure out how I can get my NumLoc on
    >>> at startup. I use RH9 and XFree86 4.3.0-2
    >>> I am not into kernel building ... there should be another simpler
    >>> way(?) to do this.
    >>>
    >>> Rolf
    >>
    >> Below is Mandrake's /etc/init.d/numlock. Double check file locations,
    >> word wrap, etc., but it ought to be adaptable to Red Hat.
    >>
    >> ---------<CUT HERE>---------
    >> #!/bin/sh
    >> #
    >> # Startup script for NumLock
    >> #
    >> # description: Locks NumLock key at init runlevel change
    >> # chkconfig: 345 85 15
    >>
    >> # Source function library.
    >> . /etc/rc.d/init.d/functions
    >>
    >> # The following file make bash to relock the numlock key when
    >> logging
    >> # since login unlock it.
    >> SYSCONF_FILE=/var/lock/subsys/numlock
    [snip]
    [snip]
    >> ---------<CUT HERE>---------
    >
    >
    > Mandrake also has this file in /etc/profile.d/numlock.sh
    >
    > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    > # Linux-Mandrake configuration.
    > # ReLock the NumLock key if /etc/rc.d/init.d/numlock has been runned
    > # This is needed as login reset the tty
    >
    > MY_TTY=`tty`
    > case $MY_TTY in
    > /dev/tty[0-9]*) [ -f /etc/sysconfig/numlock ] && setleds -D +num < $MY_TTY;;
    > esac
    > -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<----
    Well.... I got the startup script working
    You forgot to tell me that I should do a "chkconfig numlock" to get it
    started.
    Good thing too, now I know how things work with the script-stuff...cool.

    Now the numloc goes off again when I start X (Gnome).
    When I logout of X, the numlock comes ON again.

    I did not do anything special with the 2nd script (Linux-Mandrake config).
    Does that has an activation like "chkconfig" too ?
    Is it part of another script ?

    Note, that I changed the path of /etc/sysconfig/numlock to
    /var/lock/subsys/numlock to match my file locations.

    Do I miss something ?

    Rolf







    R@LF Guest

Similar Threads

  1. CFINPUT type="radio" w/ "value" requires "label"
    By Iceborer in forum Macromedia ColdFusion
    Replies: 2
    Last Post: February 21st, 06:16 PM
  2. Fix the "color profile" error message during startup
    By Eric_Schwartz@adobeforums.com in forum Adobe Indesign Windows
    Replies: 0
    Last Post: June 9th, 05:54 PM
  3. create a cd-rom startup "icon-picture" from a bitmap (MAC)
    By Dandy webforumsuser@macromedia.com in forum Macromedia Director Basics
    Replies: 3
    Last Post: February 6th, 09:00 AM
  4. "wamcom" mozilla 1.3.1 dialing up every startup
    By Torge Anders in forum Mac Networking
    Replies: 0
    Last Post: October 1st, 11:26 AM
  5. "Start" "Program" "Menu" list is empty
    By Pete in forum Windows XP/2000/ME
    Replies: 2
    Last Post: July 10th, 10:42 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139