[comp.windows.x] Ncd keyboard num-lock

qfhca81@memqa.uucp (Henry Melton) (02/12/91)

I am currently using an NCD X-terminal with their RT-101 keyboard.  This
keyboard has the NUM-LOCK key on the upper left of the keypad, where the DEC
style "gold-key" is.  I have re-defined the NUM-LOCK key to generate the 
correct escape sequence for the DEC applications.  However, it still lights the
num-lock light and performs the num-lock function, and when lit, does not 
generate the escape sequence.  

How can I completely get rid of this num-lock activity?

-- 
Henry Melton  qfhca81@memrqa.sps.mot.com 
{slow}  qfhca81@memqa   ..!cs.utexas.edu!execu!sequoia!memqa!qfhca81
{home}  henry@hutto     ..!emx.utexas.edu!hutto!henry

gstiehl@pixel.convex.com (Greg Stiehl) (02/13/91)

In article <18034@memqa.uucp>, qfhca81@memqa.uucp (Henry Melton) writes:
> I am currently using an NCD X-terminal with their RT-101 keyboard.  This
> keyboard has the NUM-LOCK key on the upper left of the keypad, where the DEC
> style "gold-key" is.  I have re-defined the NUM-LOCK key to generate the 
> correct escape sequence for the DEC applications.  However, it still lights the
> num-lock light and performs the num-lock function, and when lit, does not 
> generate the escape sequence.  
>
> How can I completely get rid of this num-lock activity?

From the xmodmap man page:

     One of the more irritating differences between keyboards is
     the location of the Control and Shift Lock keys.  A common
     use of xmodmap is to swap these two keys as follows:

          !
          ! Swap Caps_Lock and Control_L
          !
          remove Lock = Caps_Lock
          remove Control = Control_L
          keysym Control_L = Caps_Lock
          keysym Caps_Lock = Control_L
          add Lock = Caps_Lock
          add Control = Control_L

From a xmodmap -pm of my office mates NCD:

	shift       Shift_L (0x12)
	lock        Caps_Lock (0x11)
	control     Control_L (0x14)
	mod1        Alt_L (0x19)
	mod2
	mod3
	mod4
	mod5        Num_Lock (0x76)

I would try giving this to xmodmap:

	remove mod5 = Num_Lock
	keysym Num_Lock = "gold-key escape sequence"

Defining something else to be the "Num_Lock" is left as an exercize to
the reader (I've always wanted to say that :-)

-greg.

----------
Greg Stiehl (gstiehl@convex.com)
Graphics Sofware
Convex Computer Corp.

qfhca81@memqa.uucp (Henry Melton) (02/13/91)

In article <1991Feb12.193608.27897@convex.com>, gstiehl@pixel.convex.com (Greg Stiehl) writes:
> In article <18034@memqa.uucp>, qfhca81@memqa.uucp (Henry Melton) writes:
>> I am currently using an NCD X-terminal with their RT-101 keyboard.  This
>> keyboard has the NUM-LOCK key on the upper left of the keypad, where the DEC
>> style "gold-key" is.  I have re-defined the NUM-LOCK key to generate the 
>> correct escape sequence for the DEC applications.  However, it still lights the
>> num-lock light and performs the num-lock function, and when lit, does not 
>> generate the escape sequence.  
>>
>> How can I completely get rid of this num-lock activity?
> 
> From a xmodmap -pm of my office mates NCD:
> 
> 	shift       Shift_L (0x12)
> 	lock        Caps_Lock (0x11)
> 	control     Control_L (0x14)
> 	mod1        Alt_L (0x19)
> 	mod2
> 	mod3
> 	mod4
> 	mod5        Num_Lock (0x76)
> 
> I would try giving this to xmodmap:
> 
> 	remove mod5 = Num_Lock
> 	keysym Num_Lock = "gold-key escape sequence"
> 
I agree that it _ought_ to work, but it doesn't.  What you suggest is a 
variant of what I had tried before, but after applying your version, and
removing mod5, .eg,
shift       Shift_L (0x12),  Shift_R (0x59)
lock        Caps_Lock (0x11)
control     Control_L (0x14),  Control_R (0x58)
mod1        Alt_L (0x19),  Alt_R (0x39)
mod2
mod3
mod4
mod5

I STILL see the num-lock light toggle and the escape sequence only generated
every other time.
:-(

-- 
Henry Melton  qfhca81@memrqa.sps.mot.com 
{slow}  qfhca81@memqa   ..!cs.utexas.edu!execu!sequoia!memqa!qfhca81
{home}  henry@hutto     ..!emx.utexas.edu!hutto!henry

young@hamavnet (02/14/91)

In article <18034@memqa.uucp>, qfhca81@memqa.uucp (Henry Melton) writes:
> I am currently using an NCD X-terminal with their RT-101 keyboard.  This
> keyboard has the NUM-LOCK key on the upper left of the keypad, where the DEC
> style "gold-key" is.  I have re-defined the NUM-LOCK key to generate the 
> correct escape sequence for the DEC applications.  However, it still lights the
> num-lock light and performs the num-lock function, and when lit, does not 
> generate the escape sequence.  
> 
> How can I completely get rid of this num-lock activity?
> 
> -- 
> Henry Melton  qfhca81@memrqa.sps.mot.com 
> {slow}  qfhca81@memqa   ..!cs.utexas.edu!execu!sequoia!memqa!qfhca81
> {home}  henry@hutto     ..!emx.utexas.edu!hutto!henry

If you are running on a Motorola system try:

/usr/bin/X11/xmodmap -display $DISPLAY /usr/local/X11/examples/ncd/
xmodmap/ncd101.vt220

Moreover, you will want to look at the above file to tell you what it has done
as well as the manual page on xmodmap.


-- 
Brian A. Young       | young@hamavnet.com               | Who gives a rip!
Engineering Services | mcdapps!mcdhwd!briany            | 
Avnet Computer       | fax: 213 280 3944                |

ekberg@asl.dl.nec.COM (Tom Ekberg) (02/15/91)

 > I STILL see the num-lock light toggle and the escape sequence only generated
 > every other time.

I don't know about the xmodmap hacks, but turning off the num lock light is
trivial: just go into the main setup window and alter the user preferences to
have led3 do something else.

  -- tom, ekberg@aslss02.asl.dl.nec.com (x3503)

bsteinke@dsd.es.com (Bruce Steinke) (02/15/91)

In article <52027@cornell.UUCP>, parmelee@wayback.cs.cornell.edu (Larry Parmelee) writes:
> On the NCD keyboards, I don't believe you can use either of the lock
> keys as general purpose keys, due to the hardware design.

 [deleted stuff...] 

> -Larry Parmelee
> parmelee@cs.cornell.edu

I use an NCD, and I have no trouble redefining the Caps Lock key.

I use xev to determine the keycode, 17 on my system, an then put a line
in my .keymodrc which I execute using xmodmap. For example, the line in
.keymodrc is:

	keycode 17 = KP_F1

	xmodmap .keymodrc

Using xev again, I verify that the Caps Lock key generates a key press and
release (on the same stroke) and the LED does NOT come on. Also, the system
sees the key as keypad function key 1 (PF1 for those VT100 users).

-Bruce
-- 
  Bruce F. Steinke                  | "And the road goes ever on..."
  bsteinke@dsd.es.com               |  Bilbo Baggins
  Evans & Sutherland Computer Corp. |
  Salt Lake City, Utah              |  No moss under these feet!

dc@ncd.COM (Dave Cornelius) (02/15/91)

>From: parmelee@wayback.cs.cornell.edu (Larry Parmelee)
>Newsgroups: comp.windows.x
>Message-ID: <52027@cornell.UUCP>
>Date: 14 Feb 91 15:08:17 GMT
>References: <18034@memqa.uucp> <1991Feb12.193608.27897@convex.com> <18285@memqa.uucp>
>Sender: nobody@cornell.UUCP

>On the NCD keyboards, I don't believe you can use either of the lock
>keys as general purpose keys, due to the hardware design.

Incorrect.  There are no restrictions (other than the setup key)
regarding assignment of keysyms or attachments as modifiers.
All the translation is done in software.

>To see what I mean, use "xev", position the cursor in it's window, then
>try a few keypresses of the num lock key, and compare the events seen with 
>those seen when some other "ordinary" key is pressed.
>
>Generally, when you type an "A" (or any other key on the keyboard),
>two events should be seen: a "keypress" event when you first push
>the key down, followed by a "keyrelease" event when you let go of the
>key.  The exact timing of these events relative to the actual physical
>actions occuring vary with different hardware designs, in particular,
>key "auto repeat" can be handled in several different ways, "Shift"
>keys (like "shift", "control", "meta", "hyper", etc) may have special
>behaviour, "Lock" keys...

You're describing the default behaviour of the locking modifiers.
Via xmodmap, the modifiers can be changed.

>Most of the NCD keys generate both a keypress and keyrelease event,
>but the num lock (and I believe the caps lock) are "special" (broken :-)
>and generate only one event for each for each actual physical press/
>release cycle.  Apparently by design, the hardware contains a toggle that
>keeps track of wheither the last event generated by the press/release
>of a lock key was either a "keypress" or "keyrelease" event, and generates
>the other type of event when the key is pressed/released again.

The locking modifiers toggle press and release by design.  They are
special, as you note, but this operation is not broken.  Again, all
this happens to be in software on the NCD, but that's really academic.

>I suspect NCD was forced to use this design in order to have the nifty
>"caps Lock" and "Num Lock" LEDs on the keyboard.

Wrong again.  The LED functionality is completely under software control.
The setup menus (and remote configuration) allow you to change the
meaning of each LED.  Later releases of the NCD server generalize this
ad nauseum, allowing you to have *all* the LEDs act as NetActivity,
or whatever your peccadilloes stipulate.

>Attempts to redefine the NCD lock keys are probably doomed to fail,
>unless the new key is supposed to have a similar locking type of
>function.

RTFM on xmodmap :-)
-----------
Dave Cornelius				Network Computing Devices
					350 North Bernardo Ave
dc@ncd.com   -or-			Mountain View, CA, 94043
{uunet,mips}!lupine!dc			415-694-0675

qfhca81@memqa.uucp (Henry Melton) (02/15/91)

Thanks Bruce.  Your solution works great.



> 
> I use an NCD, and I have no trouble redefining the Caps Lock key.
> 
> I use xev to determine the keycode, 17 on my system, an then put a line
> in my .keymodrc which I execute using xmodmap. For example, the line in
> .keymodrc is:
> 
> 	keycode 17 = KP_F1
> 
> 	xmodmap .keymodrc
> 
> Using xev again, I verify that the Caps Lock key generates a key press and
> release (on the same stroke) and the LED does NOT come on. Also, the system
> sees the key as keypad function key 1 (PF1 for those VT100 users).
> 
> -Bruce
> -- 
>   Bruce F. Steinke                  | "And the road goes ever on..."
-- 
Henry Melton  qfhca81@memrqa.sps.mot.com 
{slow}  qfhca81@memqa   ..!cs.utexas.edu!execu!sequoia!memqa!qfhca81
{home}  henry@hutto     ..!emx.utexas.edu!hutto!henry

young@hamavnet (02/16/91)

In article <52027@cornell.UUCP>, parmelee@wayback.cs.cornell.edu (Larry Parmelee) writes:
> On the NCD keyboards, I don't believe you can use either of the lock
> keys as general purpose keys, due to the hardware design.
> 
> To see what I mean, use "xev", position the cursor in it's window, then
> try a few keypresses of the num lock key, and compare the events seen with 
> those seen when some other "ordinary" key is pressed.
> 
> Generally, when you type an "A" (or any other key on the keyboard),
> two events should be seen: a "keypress" event when you first push
> the key down, followed by a "keyrelease" event when you let go of the
> key.  The exact timing of these events relative to the actual physical
> actions occuring vary with different hardware designs, in particular,
> key "auto repeat" can be handled in several different ways, "Shift"
> keys (like "shift", "control", "meta", "hyper", etc) may have special
> behaviour, "Lock" keys...
> 
> Most of the NCD keys generate both a keypress and keyrelease event,
> but the num lock (and I believe the caps lock) are "special" (broken :-)
> and generate only one event for each for each actual physical press/
> release cycle.  Apparently by design, the hardware contains a toggle that
> keeps track of wheither the last event generated by the press/release
> of a lock key was either a "keypress" or "keyrelease" event, and generates
> the other type of event when the key is pressed/released again.
> 
> I suspect NCD was forced to use this design in order to have the nifty
> "caps Lock" and "Num Lock" LEDs on the keyboard.
> 
> Attempts to redefine the NCD lock keys are probably doomed to fail,
> unless the new key is supposed to have a similiar locking type of
> function.
> 
> -Larry Parmelee
> parmelee@cs.cornell.edu

I have sucessfully remaped the keyboard. Especially the Num Lck key.
-- 
Brian A. Young       | young@hamavnet.com               | Who gives a rip!
Engineering Services | mcdapps!mcdhwd!briany            | 
Avnet Computer       | fax: 213 280 3944                |

laub@Software.Mitel.COM (Boniface Lau) (02/16/91)

In article <1991Feb12.193608.27897@convex.com> gstiehl@convex.com writes:
|I would try giving this to xmodmap:
|
|	remove mod5 = Num_Lock
|	keysym Num_Lock = "gold-key escape sequence"

I thought xmodmap does not take escape sequence, ie. the right hand side of
the equal must be a KEYSYMNAME. 

If you know how to specify escape sequence to xmodmap, please post it - I for
one would like to do it.

Thanks.
-- 
Boniface Lau    (613) 592-2122 ext. 3042    laub@Software.Mitel.COM
Mitel Corp.  				    ...uunet!mitel!spock!laub
350 Legget Drive, Kanata
Ontario, Canada, K2K 1X3

jbw@bigbird.bu.edu (Joe Wells) (02/23/91)

dc@ncd.COM (Dave Cornelius) writes:

   >From: parmelee@wayback.cs.cornell.edu (Larry Parmelee)

   >Most of the NCD keys generate both a keypress and keyrelease event,
   >but the num lock (and I believe the caps lock) are "special" (broken :-)
   >and generate only one event for each for each actual physical press/
   >release cycle.

   The locking modifiers toggle press and release by design.  They are
   special, as you note, but this operation is not broken.  Again, all
   this happens to be in software on the NCD, but that's really academic.

Num_Lock isn't supposed to be a locking modifier unless it's listed in the
modifier table!  Even after removing "Num_Lock" from any mention in the
modifier table with xmodmap, Num_Lock on an NCD still only sends either a
KeyPress or a KeyRelease event, but not both.  This is bogus!  The only
way around this is to rename the key, which should be unnecessary.  I
should be able to have the keys' X names be the same as the physical
labels on the keys, and, at the same time, I should be able to make the
keys do exactly what I want them to do.

-- 
Joe Wells <jbw@bu.edu>