* Ideas on improving powercomputing keyboard
@ 1999-07-27 15:52 Jerry Quinn
1999-07-27 16:06 ` Geert Uytterhoeven
1999-07-27 17:36 ` anthony tong
0 siblings, 2 replies; 6+ messages in thread
From: Jerry Quinn @ 1999-07-27 15:52 UTC (permalink / raw)
To: linuxppc-dev
Hi, all. I'm finally annoyed enough by the 'a' chars generated by the caps
lock key on power computing keyboards under X to try to fix it. In the
process, maybe it will be useful enough to actually swap it to be the control
key (as any good keyboard should be :-).
The situation on the powercomputing keyboard hardware is a bit braindead as
far as I can tell. I used showkeys to give me the info on what is coming back
from the keys. So the first question is - can I trust the output of showkeys?
According to showkeys:
'a' down returns 0x00
'a' up returns 0x80
CapsLock down returns 0x39 or 0xb9
CapsLock up returns 0x80 !
Needless to say, this is ugly. The keyboard seems pretty broken here.
Anyway, my thought is to play games with the return values of capslock based
on the state of the two keys. Basically, if both keys are down, then when an
0x80 is seen, I will start by assuming that it is the 'a' that was released
and return 0x80. I'm making the assumption that if someone presses both of
them together, the capslock is probably being used as a control key and the
user is more likely to release and repress the 'a' than the capslock key.
I have a 7-state state machine to represent what's going on. The place where
trouble emerges is if both are down and the user really releases the capslock
(but we signal an 'a' release). If the capslock is pressed again, the 'a' key
is physically down but logically released. I think the right thing to do is
to assume the next 0x80 is still an 'a' release, but swallow it in the
driver.
A second issue is that if we goof and the capslock is pressed again, do I
return another capslock press (two in a row) or swallow it?
A few other questions I have:
What is RAW mode? When is raw mode versus non-raw used and should the
behavior I describe be any different in the two cases? Does raw vs. non-raw
explain why 'a's appear when pressing capslock in X but not at the console?
Also, where is the best place to stick this code? I see two logical places -
the kbd_translate() call and the scan code call (I don't have the file in
front of me so don't remember exact names).
Anyone know if I'm going to trash the response of other keyboards by doing
this?
Finally, there is a comment in the code (mac_kbd.c) from Anthony Tong about
emulating the PC keyboard capslock key by immediately sending caps up as soon
as it's pressed. What is going on with this and how might it relate to what I
want to do?
I know this is a lot of questions, but people with a better overall view of
how the keyboard code works will save me a lot of anguish and embarassment :-)
Thanks,
Jerry
--
Jerry Quinn Tel: (514) 761-8737
jquinn@nortelnetworks.com Fax: (514) 761-8505
Speech Recognition Research
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ideas on improving powercomputing keyboard
1999-07-27 15:52 Ideas on improving powercomputing keyboard Jerry Quinn
@ 1999-07-27 16:06 ` Geert Uytterhoeven
1999-07-27 16:45 ` Jerry Quinn
1999-07-27 17:36 ` anthony tong
1 sibling, 1 reply; 6+ messages in thread
From: Geert Uytterhoeven @ 1999-07-27 16:06 UTC (permalink / raw)
To: Jerry Quinn; +Cc: linuxppc-dev
On Tue, 27 Jul 1999, Jerry Quinn wrote:
> Finally, there is a comment in the code (mac_kbd.c) from Anthony Tong about
> emulating the PC keyboard capslock key by immediately sending caps up as soon
> as it's pressed. What is going on with this and how might it relate to what I
> want to do?
Mac and Amiga keyboards handle Caps Lock in the keyboard itself: the keyboard
remembers the Caps Lock state.
If you press Caps Lock, a `Caps Lock down' code is sent by the keyboard. If
you release Caps Lock, nothing is sent.
If you press Caps Lock again, a `Caps Lock up' code is sent by the keyboard.
If you release Caps Lock, nothing is sent.
PC keyboards don't behave that way: there the computer has to remember the
Caps Lock state and the Caps Lock key behaves like any other key: it always
sents `Caps Lock down' when you press it, and sents `Caps Lock up' when you
release it.
To emulate this behavior, the Mac and Amiga keyboard driver always feeds two
codes (`Caps Lock down' followed by `Caps Lock up') to the upper keyboard layer
through handle_scancode() when the keyboard sent any of `Caps Lock down' or
`Caps Lock up'.
This works fine in most cases. The only problem is that the keyboard is not
stateless w.r.t. the Caps Lock key. If you press `Caps Lock' and switch to
another virtual console, the keyboard and the kernel disagree on the Caps Lock
state for that virtual console. Hence the virtual console still has Caps Lock
disabled, while the Caps Lock LED on the keyboard (or the mechanical up/down
flip-flop on older keyboards) is still lit.
Greetings,
Geert
--
Geert Uytterhoeven Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP} http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ideas on improving powercomputing keyboard
1999-07-27 16:06 ` Geert Uytterhoeven
@ 1999-07-27 16:45 ` Jerry Quinn
0 siblings, 0 replies; 6+ messages in thread
From: Jerry Quinn @ 1999-07-27 16:45 UTC (permalink / raw)
To: Geert Uytterhoeven; +Cc: linuxppc-dev
>> "Geert" == Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be> writes:
Geert> On Tue, 27 Jul 1999, Jerry Quinn wrote:
>> Finally, there is a comment in the code (mac_kbd.c) from Anthony Tong
>> about emulating the PC keyboard capslock key by immediately sending caps
>> up as soon as it's pressed. What is going on with this and how might it
>> relate to what I want to do?
Geert> Mac and Amiga keyboards handle Caps Lock in the keyboard itself: the
Geert> keyboard remembers the Caps Lock state.
Geert> If you press Caps Lock, a `Caps Lock down' code is sent by the
Geert> keyboard. If you release Caps Lock, nothing is sent. If you press
Geert> Caps Lock again, a `Caps Lock up' code is sent by the keyboard. If
Geert> you release Caps Lock, nothing is sent.
Geert> PC keyboards don't behave that way: there the computer has to remember
Geert> the Caps Lock state and the Caps Lock key behaves like any other key:
Geert> it always sents `Caps Lock down' when you press it, and sents `Caps
Geert> Lock up' when you release it.
Geert> To emulate this behavior, the Mac and Amiga keyboard driver always
Geert> feeds two codes (`Caps Lock down' followed by `Caps Lock up') to the
Geert> upper keyboard layer through handle_scancode() when the keyboard sent
Geert> any of `Caps Lock down' or `Caps Lock up'.
OK, I think I understand this. So, what I'm trying to do is get a
powercomputing keyboard, which fortunately doesn't have a mechanical lock but
does have this broken 0x80 behavior to act like a PC keyboard.
It sounds like I need to disable the down/up output behavior for a
powercomputing keyboard and add the state logic I described including ignoring
the difference between the keyboard's notion of down and up. However, this
sounds like I'm going to break other keyboards.
Is there any way to probe a keyboard and get some info out of it so that this
stuff can be detected rather than compile-time configured?
By the way, do you have any comments on whether my idea makes sense?
Jerry
--
Jerry Quinn Tel: (514) 761-8737
jquinn@nortelnetworks.com Fax: (514) 761-8505
Speech Recognition Research
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ideas on improving powercomputing keyboard
1999-07-27 15:52 Ideas on improving powercomputing keyboard Jerry Quinn
1999-07-27 16:06 ` Geert Uytterhoeven
@ 1999-07-27 17:36 ` anthony tong
1999-07-27 18:28 ` David A. Gatwood
1999-07-27 19:21 ` Jerry Quinn
1 sibling, 2 replies; 6+ messages in thread
From: anthony tong @ 1999-07-27 17:36 UTC (permalink / raw)
To: Jerry Quinn; +Cc: linuxppc-dev
Jerry Quinn (Tue, Jul 27, 1999 at 11:52:15AM -0400):
> Hi, all. I'm finally annoyed enough by the 'a' chars generated by the caps
> lock key on power computing keyboards under X to try to fix it. In the
> process, maybe it will be useful enough to actually swap it to be the control
> key (as any good keyboard should be :-).
Didn't a patch from Fred Bacon get into on of the DR2 updates to take
care of this? I forget how it worked around this problem, but I can
did it up if you can't find it.
> from the keys. So the first question is - can I trust the output of showkeys?
Generally, yes, with showkeys -s
> What is RAW mode? When is raw mode versus non-raw used and should the
> behavior I describe be any different in the two cases? Does raw vs. non-raw
> explain why 'a's appear when pressing capslock in X but not at the console?
I think that we should figure out why it behaves properly at the
console first. I remember Paul M mentioning something about that but
I don't really recall the specifics.
On another note Franz Sirl mentioned that a capslock (with an apple
adjustable keyboard, I think) keypress generates extraneous capslock
up/down events in X.
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ideas on improving powercomputing keyboard
1999-07-27 17:36 ` anthony tong
@ 1999-07-27 18:28 ` David A. Gatwood
1999-07-27 19:21 ` Jerry Quinn
1 sibling, 0 replies; 6+ messages in thread
From: David A. Gatwood @ 1999-07-27 18:28 UTC (permalink / raw)
To: anthony tong; +Cc: Jerry Quinn, linuxppc-dev
On Tue, 27 Jul 1999, anthony tong wrote:
> Jerry Quinn (Tue, Jul 27, 1999 at 11:52:15AM -0400):
> > Hi, all. I'm finally annoyed enough by the 'a' chars generated by the caps
> > lock key on power computing keyboards under X to try to fix it. In the
> > process, maybe it will be useful enough to actually swap it to be the control
> > key (as any good keyboard should be :-).
>
> Didn't a patch from Fred Bacon get into on of the DR2 updates to take
> care of this? I forget how it worked around this problem, but I can
> did it up if you can't find it.
I didn't remember who committed it, but yeah, it's been in there for...
ever.... IIRC, some keyboards generate just two key downs for caps lock,
once per press, while those generate a key up. I may be remembering
wrong, though. It's something weird like that.
David
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Ideas on improving powercomputing keyboard
1999-07-27 17:36 ` anthony tong
1999-07-27 18:28 ` David A. Gatwood
@ 1999-07-27 19:21 ` Jerry Quinn
1 sibling, 0 replies; 6+ messages in thread
From: Jerry Quinn @ 1999-07-27 19:21 UTC (permalink / raw)
To: anthony tong; +Cc: linuxppc-dev
>> "anthony" == anthony tong <atong@uiuc.edu> writes:
anthony> Jerry Quinn (Tue, Jul 27, 1999 at 11:52:15AM -0400):
>> Hi, all. I'm finally annoyed enough by the 'a' chars generated by the
>> caps lock key on power computing keyboards under X to try to fix it. In
>> the process, maybe it will be useful enough to actually swap it to be the
>> control key (as any good keyboard should be :-).
anthony> Didn't a patch from Fred Bacon get into on of the DR2 updates to
anthony> take care of this? I forget how it worked around this problem, but I
anthony> can did it up if you can't find it.
As it turns out, I still have the 3 messages Fred sent about this. The 3rd
one does the following bit:
if ( (last_keycode == 0x39) && (data[3] == 0x80) ) {
last_keycode = data[3] & 0x7f;
return;
}
As I look at it now, this should behave reasonably if the capslock key is used
by itself. However, if you want to do something like, say, remap capslock to
be a control key, this won't play nicely with 'a'. If you were to press 'a'
after capslock (C-a in emacs for instance), last_keycode will no longer be
0x39. Then when you finally release the capslock, the 0x80 on release will
trigger an 'a'-up event.
>> from the keys. So the first question is - can I trust the output of
>> showkeys?
anthony> Generally, yes, with showkeys -s
>> What is RAW mode? When is raw mode versus non-raw used and should the
>> behavior I describe be any different in the two cases? Does raw
>> vs. non-raw explain why 'a's appear when pressing capslock in X but not at
>> the console?
anthony> I think that we should figure out why it behaves properly at the
anthony> console first. I remember Paul M mentioning something about that but
anthony> I don't really recall the specifics.
This is why I asked the question about raw vs non-raw mode. When capslock is
pressed on my keyboard, we generate a keypress/keyrelease pair. When it is
released, we get the spurious 0x80. So among the possible solutions are that
the console driver discards spurious key releases while the X server doesn't.
Even if we find this out, it doesn't change that generating
keypress/keyrelease on capslock down won't allow me to use it as a control
key. So some kind of fix to address this is required.
It sounds more and more like it will have to be a compile-time switch :-(
anthony> On another note Franz Sirl mentioned that a capslock (with an apple
anthony> adjustable keyboard, I think) keypress generates extraneous capslock
anthony> up/down events in X.
Perhaps this keyboard also generates its own capslock upkey event?
Jerry
--
Jerry Quinn Tel: (514) 761-8737
jquinn@nortelnetworks.com Fax: (514) 761-8505
Speech Recognition Research
[[ This message was sent via the linuxppc-dev mailing list. Replies are ]]
[[ not forced back to the list, so be sure to Cc linuxppc-dev if your ]]
[[ reply is of general interest. Please check http://lists.linuxppc.org/ ]]
[[ and http://www.linuxppc.org/ for useful information before posting. ]]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~1999-07-27 19:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1999-07-27 15:52 Ideas on improving powercomputing keyboard Jerry Quinn
1999-07-27 16:06 ` Geert Uytterhoeven
1999-07-27 16:45 ` Jerry Quinn
1999-07-27 17:36 ` anthony tong
1999-07-27 18:28 ` David A. Gatwood
1999-07-27 19:21 ` Jerry Quinn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).