NetBSD Problem Report #37683

From tho@openrobots.net  Thu Jan  3 19:14:38 2008
Return-Path: <tho@openrobots.net>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 8D35D63B852
	for <gnats-bugs@gnats.NetBSD.org>; Thu,  3 Jan 2008 19:14:38 +0000 (UTC)
Message-Id: <20080103191434.BFEF05E452@ficus.home>
Date: Thu,  3 Jan 2008 20:14:34 +0100 (CET)
From: anthony.mallet@useless-ficus.net
Reply-To: anthony.mallet@useless-ficus.net
To: gnats-bugs@NetBSD.org
Subject: ukbd: new useful mappings from usb to at keycodes
X-Send-Pr-Version: 3.95

>Number:         37683
>Category:       kern
>Synopsis:       ukbd: new useful mappings from usb to at keycodes
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jan 03 19:15:01 +0000 2008
>Closed-Date:    Thu Mar 03 17:01:08 +0000 2022
>Last-Modified:  Thu Mar 03 17:01:08 +0000 2022
>Originator:     anthony.mallet@useless-ficus.net
>Release:        NetBSD 4.99.40
>Organization:

>Environment:
System: NetBSD ficus 4.99.40 NetBSD 4.99.40 (FICUS) #90: Thu Jan 3 19:57:17 CET 2008 troot@ficus:/usr/obj/sys/arch/i386/compile/FICUS i386
Architecture: i386
Machine: i386
>Description:
The attached patch add mappings from usb to AT keycodes for the L-keys and some
other keys found on e.g. the sun type 6 usb keyboards.
Extended AT-keycodes where found in atKeynames.h.

This patch is required when using xorg in 'standard' keyboard protocol.
>How-To-Repeat:
>Fix:
--- sys/dev/usb/ukbd.c~	2008-01-03 10:19:57.000000000 +0100
+++ sys/dev/usb/ukbd.c	2008-01-03 19:55:33.000000000 +0100
@@ -119,11 +119,11 @@
     0x7f, 0xd2, 0xc7, 0xc9, 0xd3, 0xcf, 0xd1, 0xcd, /* 48 - 4f */
     0xcb, 0xd0, 0xc8, 0x45, 0xb5, 0x37, 0x4a, 0x4e, /* 50 - 57 */
     0x9c, 0x4f, 0x50, 0x51, 0x4b, 0x4c, 0x4d, 0x47, /* 58 - 5f */
-    0x48, 0x49, 0x52, 0x53, 0x56, 0xdd,   NN, 0x59, /* 60 - 67 */
+    0x48, 0x49, 0x52, 0x53, 0x56, 0xdd, 0x84, 0x59, /* 60 - 67 */
     0x5d, 0x5e, 0x5f,   NN,   NN,   NN,   NN,   NN, /* 68 - 6f */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 70 - 77 */
-      NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 78 - 7f */
-      NN,   NN,   NN,   NN,   NN, 0x7e,   NN, 0x73, /* 80 - 87 */
+      NN,   NN,   NN,   NN, 0x8f, 0x88, 0x8b, 0x8d, /* 70 - 77 */
+    0x89, 0x8a, 0x8c, 0x92, 0x8e, 0x90, 0x91, 0x85, /* 78 - 7f */
+    0x87, 0x86,   NN,   NN,   NN, 0x7e,   NN, 0x73, /* 80 - 87 */
     0x70, 0x7d, 0x79, 0x7b, 0x5c,   NN,   NN,   NN, /* 88 - 8f */
       NN,   NN, 0x78, 0x77, 0x76,   NN,   NN,   NN, /* 90 - 97 */
       NN,   NN,   NN,   NN,   NN,   NN,   NN,   NN, /* 98 - 9f */

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: kern-bug-people->tron
Responsible-Changed-By: tron@narn.netbsd.org
Responsible-Changed-When: Wed, 30 Jan 2008 21:22:17 +0000
Responsible-Changed-Why:
I'll handle this PR.


State-Changed-From-To: open->feedback
State-Changed-By: tron@narn.netbsd.org
State-Changed-When: Sat, 02 Feb 2008 15:10:09 +0000
State-Changed-Why:
The extra keys are neither mentioned in the USB-HID spec nor in Microsoft's
specification. Do you know of any technical document which lists the codes?


From: Anthony Mallet <anthony.mallet@useless-ficus.net>
To: gnats-bugs@NetBSD.org
Cc: tron@NetBSD.org,
    netbsd-bugs@netbsd.org,
    gnats-admin@netbsd.org
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes)
Date: Mon, 4 Feb 2008 09:34:15 +0100

 tron@NetBSD.org writes:
 | Synopsis: ukbd: new useful mappings from usb to at keycodes
 | 
 | State-Changed-From-To: open->feedback
 | State-Changed-By: tron@narn.netbsd.org
 | State-Changed-When: Sat, 02 Feb 2008 15:10:09 +0000
 | State-Changed-Why:
 | The extra keys are neither mentioned in the USB-HID spec nor in Microsoft's
 | specification. Do you know of any technical document which lists the codes?

 Hi,

 Yes, that's a kind of hack from Xorg (and XFree). Those "extended keys"
 are defined in atKeynames.h (e.g. /usr/pkg/include/xorg/atKeynames.h)
 because PS/2 keyboards cannot generate such events.

 Xorg says:
  * Fake 'scancodes' in the following ranges are generated for 2-byte
  * codes not handled elsewhere.  These correspond to most extended keys
  * on so-called "Internet" keyboards:
  *      0x79-0x93

 This file is not used when using the 'standard' xorg keyboard protocol
 and the translation is done by ukbd (hence this PR). OpenBSD has a
 similar patch for their driver (their cvsweb seem to be down right now, I
 cannot find the rev number but it's in ukbd.c too, from
 M. Herrb). FreeBSD did also something similar in rev. 1.46 of ukbd.c,
 although I don't know where their mappings come from.

 Note that the atKeyname file is used inside the bsd kbd driver module
 (see PR/37674).

State-Changed-From-To: feedback->open
State-Changed-By: tron@narn.netbsd.org
State-Changed-When: Mon, 04 Feb 2008 08:42:07 +0000
State-Changed-Why:
Feedback was provided.


From: Anthony Mallet <anthony.mallet@useless-ficus.net>
To: gnats-bugs@NetBSD.org
Cc: tron@NetBSD.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes)
Date: Mon, 4 Feb 2008 09:51:25 +0100

 Anthony Mallet writes:
 |  | The extra keys are neither mentioned in the USB-HID spec nor in Microsoft's
 |  | specification. Do you know of any technical document which lists the codes?

 Sorry, forgot to mention this:

 The USB keycode is defined in e.g. the microsoft document mentioned in
 ukbd.c (page 2). That's the mapping to an AT keycode that is not standard
 and defined by Xorg.

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes)
Date: Mon, 4 Feb 2008 11:00:35 +0100

 FWIW, I think we should realy follow Michael Lorenz' suggestion and modify
 all wskbd drivers to only pass raw USB keycodes up. And get rid of the
 ***** back and forth mappings in X.

 Martin

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: Anthony Mallet <anthony.mallet@useless-ficus.net>
Cc: gnats-bugs@NetBSD.org, tron@NetBSD.org, netbsd-bugs@NetBSD.org,
	gnats-admin@NetBSD.org
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes) 
Date: Tue, 05 Feb 2008 18:47:14 +0100

 anthony.mallet@useless-ficus.net said:
 > that's a kind of hack from Xorg (and XFree). Those "extended keys" are
 > defined in atKeynames.h (e.g. /usr/pkg/include/xorg/atKeynames.h)
 > because PS/2 keyboards cannot generate such events. 

 I see -- imo it makes sense to follow the examples.

 > OpenBSD has a similar patch for their driver (their cvsweb seem to be
 > down right now, I cannot find the rev number but it's in ukbd.c too,
 > from M. Herrb)

 So why does your patch differ from the OpenBSD scancodes?

 > FreeBSD did also something similar in rev. 1.46 of ukbd.c,
 > although I don't know where their mappings come from.

 FreeBSD uses another mapping mechanism appearently which I didn't
 look closer at (not just using the MSB as a marker for extended
 scancodes).

 best regards
 Matthias




 -------------------------------------------------------------------
 -------------------------------------------------------------------
 Forschungszentrum Juelich GmbH
 52425 Juelich

 Sitz der Gesellschaft: Juelich
 Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
 Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
 Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
 Dr. Ulrich Krafft (stellv. Vorsitzender), Dr. Sebastian M. Schmidt
 -------------------------------------------------------------------
 -------------------------------------------------------------------

From: Matthias Drochner <M.Drochner@fz-juelich.de>
To: gnats-bugs@NetBSD.org
Cc: tron@NetBSD.org, gnats-admin@NetBSD.org, netbsd-bugs@NetBSD.org,
	anthony.mallet@useless-ficus.net
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes) 
Date: Tue, 05 Feb 2008 18:53:45 +0100

 martin@duskware.de said:
 > we should realy follow Michael Lorenz' suggestion and modify
 >  all wskbd drivers to only pass raw USB keycodes up

 So this would mean to translate at to USB codes in pckbd.c?

 best regards
 Matthias




 -------------------------------------------------------------------
 -------------------------------------------------------------------
 Forschungszentrum Juelich GmbH
 52425 Juelich

 Sitz der Gesellschaft: Juelich
 Eingetragen im Handelsregister des Amtsgerichts Dueren Nr. HR B 3498
 Vorsitzende des Aufsichtsrats: MinDir'in Baerbel Brumme-Bothe
 Geschaeftsfuehrung: Prof. Dr. Achim Bachem (Vorsitzender),
 Dr. Ulrich Krafft (stellv. Vorsitzender), Dr. Sebastian M. Schmidt
 -------------------------------------------------------------------
 -------------------------------------------------------------------

From: Martin Husemann <martin@duskware.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes)
Date: Tue, 5 Feb 2008 21:03:58 +0100

 On Tue, Feb 05, 2008 at 06:55:01PM +0000, Matthias Drochner wrote:
 >  So this would mean to translate at to USB codes in pckbd.c?

 Yes - so wsmux always receives USB codes, no matter what driver is underneath.
 Think of a mac with adb + usb keyboard, or a sparc wit sun + usb. Both of
 those setups have no chance of working with X right now. (only w/o wsmux)

 Martin

From: Anthony Mallet <anthony.mallet@useless-ficus.net>
To: gnats-bugs@NetBSD.org
Cc: tron@NetBSD.org,
    gnats-admin@netbsd.org,
    netbsd-bugs@netbsd.org
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes) 
Date: Wed, 6 Feb 2008 20:24:47 +0100

 Matthias Drochner writes:
 |  > OpenBSD has a similar patch for their driver (their cvsweb seem to be
 |  > down right now, I cannot find the rev number but it's in ukbd.c too,
 |  > from M. Herrb)
 |  
 |  So why does your patch differ from the OpenBSD scancodes?

 I have not a real answer yet. First I mapped more keys than in OpenBSD:
 the L keys plus the Help, Power, AudioMute et al. keys.

 Second, I'll check with Matthieu Herrb and try to understand where the
 OpenBSD scancode come from. What he told me at the moment is that there
 is a magic offset of 8 that is added sowhere between ukbd and xkb...

 I'll keep you informed as soon as I have a more precise answer.

State-Changed-From-To: open->feedback
State-Changed-By: tron@NetBSD.org
State-Changed-When: Tue, 20 May 2008 07:51:40 +0000
State-Changed-Why:
Any update on this? Did you get an answer from Matthieu Herrb?


From: Anthony Mallet <anthony.mallet@useless-ficus.net>
To: gnats-bugs@NetBSD.org
Cc: tron@NetBSD.org,
    netbsd-bugs@netbsd.org,
    gnats-admin@netbsd.org
Subject: Re: kern/37683 (ukbd: new useful mappings from usb to at keycodes)
Date: Thu, 22 May 2008 21:04:46 +0200

 tron@NetBSD.org writes:
 | State-Changed-From-To: open->feedback
 | State-Changed-By: tron@NetBSD.org
 | State-Changed-When: Tue, 20 May 2008 07:51:40 +0000
 | State-Changed-Why:
 | Any update on this? Did you get an answer from Matthieu Herrb?

 Not really. At the time when I asked, he couldn't tell me more than
 "there is a magic offset of 8 somewhere". What is strange is that I
 couldn't find this offset elsewhere in the scancodes. But I must admit
 that I have had hard times following the trajectory of these codes all
 the way long from my keyboard to my X windows ...

 Anyway, I have absolutely no objection if you think that it's better to
 use codes from OpenBSD's patch. What I would like mostly is that my keys
 would generate some keycode, no matter the value :)

State-Changed-From-To: feedback->open
State-Changed-By: tron@NetBSD.org
State-Changed-When: Thu, 22 May 2008 20:16:27 +0000
State-Changed-Why:
Feedback was provided.


Responsible-Changed-From-To: tron->kern-bug-people
Responsible-Changed-By: tron@NetBSD.org
Responsible-Changed-When: Tue, 20 Jan 2009 08:43:46 +0000
Responsible-Changed-Why:
It is unlikely that I'm going to fix this PR.


From: Anthony Mallet <anthony.mallet@laas.fr>
To: gnats-admin@netbsd.org
Cc: 
Subject: Re: kern/37683: ukbd: new useful mappings from usb to at keycodes
Date: Thu, 3 Mar 2022 12:18:21 +0100

 This was fixed in ukbd.c rev. 1.122
 https://anonhg.netbsd.org/src/diff/3549a8c268cb/sys/dev/usb/ukbd.c

 This 14 years old PR can be closed :)
 Thanks!

State-Changed-From-To: open->closed
State-Changed-By: jdolecek@NetBSD.org
State-Changed-When: Thu, 03 Mar 2022 17:01:08 +0000
State-Changed-Why:
Confirmed fixed by:
This was fixed in ukbd.c rev. 1.122
 https://anonhg.netbsd.org/src/diff/3549a8c268cb/sys/dev/usb/ukbd.c

Thanks for report.


>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.46 2020/01/03 16:35:01 leot Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2020 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.