linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andries Brouwer <aebr@win.tue.nl>
To: Chris Heath <chris@heathens.co.nz>
Cc: Andries Brouwer <aebr@win.tue.nl>,
	Jamie Lokier <jamie@shareable.org>,
	linux-kernel@vger.kernel.org, vojtech@ucw.cz,
	Ralf Hildebrandt <Ralf.Hildebrandt@charite.de>
Subject: Re: keyboard - was: Re: Linux 2.6.0-test4
Date: Fri, 5 Sep 2003 12:08:12 +0200	[thread overview]
Message-ID: <20030905120812.A3403@pclin040.win.tue.nl> (raw)
In-Reply-To: <20030904225728.C7CB.CHRIS@heathens.co.nz>; from chris@heathens.co.nz on Thu, Sep 04, 2003 at 11:41:38PM -0400

On Thu, Sep 04, 2003 at 11:41:38PM -0400, Chris Heath wrote:

> Well... I think the overall design is the right one.  The atkbd driver
> expects to be talking to an AT keyboard, usually using Set 2.

Always be precise: there are six modes, namely
translated/untranslated Set 1/2/3.

By default every recent keyboard comes up in translated Set 2.
atkbd.c is broken, because it expects what the keyboard does not send,
namely untranslated Set 2.

{and here "send" is not defined as what bits are on some cable,
that is invisible for the programmer and varies between systems,
but as what bits get read by the kernel}

> However, the bytes that come from the i8042 are a mixture of Set 1 and
> Set 2.  Set 1 because the key releases have their 8th bits set, and Set
> 2 because we get the non-XT keys escaped with E0. I guess the keyboard
> is sending Set 2 and the BIOS is translating the set 2 codes to set 1
> for "compatibility with XT software".

There are several misunderstandings in this paragraph.
No, the BIOS is not involved - Linux does not use the BIOS,
except possibly at boot time.
Both translated and untranslated Set 2 use E0 prefixes,
and E0 is translated to E0.

The translation is done by the keyboard controller.
On many laptops the strange construction of a keyboard that sends
the wrong codes, which then are translated by a separate microprocessor,
is thrown out, and the keyboard directly produces the desired codes,
namely translated Set 2, and no translation happens.
Also the compatibility mode of USB only knows about translated Set 2.

> So the i8042 layer is IMHO the right place to untranslate this mess back
> into normal Set 2.

There is nothing normal about this untranslated Set 2.
It is a figment of the imagination.
Laptop hardware doesnt know anything about it.

> The problem is that the translation is not invertible

Yes, indeed, so we introduce some small bugs by doing this silly
untranslation.

> The current algorithm is to untranslate all bytes 0x00-0x7f, and to
> untranslate the others only if there was a previous key press.  This
> means the i8042 layer has to know about scancodes, knowledge which
> probably only belongs in the atkbd layer.

Yes, precisely.

> Probably, now that I think about it, the sanitization of duplicate key
> releases should rightfully be part of the atkbd layer, because those
> codes are actually being sent from the keyboard.

Yes, precisely.
And indeed, no sanitization is needed at all.

> But either way, the problem remains to find a good untranslate
> hack^Walgorithm.  Because we are getting duplicate key releases, we have
> to make sure they they are either untranslated or removed.  Sending them
> through unchanged, as we were in -test1 causes lots of grief to the
> atkbd layer.

But that is a bug in atkbd.

Andries


  reply	other threads:[~2003-09-05 15:43 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-09-04  4:09 keyboard - was: Re: Linux 2.6.0-test4 Chris Heath
2003-09-04 20:48 ` Jamie Lokier
2003-09-04 22:34   ` Andries Brouwer
2003-09-04 23:00     ` Jamie Lokier
2003-09-05  0:19       ` Andries Brouwer
2003-09-05  3:41         ` Chris Heath
2003-09-05 10:08           ` Andries Brouwer [this message]
  -- strict thread matches above, loose matches on Subject: below --
2003-09-05 14:57 John Bradford
2003-09-05 23:45 ` Andries Brouwer
2003-09-05 13:46 Norman Diamond
2003-08-31 16:22 Chris Heath
2003-09-02  8:07 ` Ralf Hildebrandt
2003-09-02 10:47   ` keyboard - was: " Andries Brouwer
2003-09-02 11:18     ` Ralf Hildebrandt
2003-09-02 12:32     ` Ralf Hildebrandt
2003-09-02 21:41       ` Andries Brouwer
2003-09-03  7:45         ` Ralf Hildebrandt
2003-09-03 13:25         ` Ralf Hildebrandt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20030905120812.A3403@pclin040.win.tue.nl \
    --to=aebr@win.tue.nl \
    --cc=Ralf.Hildebrandt@charite.de \
    --cc=chris@heathens.co.nz \
    --cc=jamie@shareable.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=vojtech@ucw.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).