NetBSD Problem Report #57148

From ryo_on@yk.rim.or.jp  Thu Dec 29 22:20:23 2022
Return-Path: <ryo_on@yk.rim.or.jp>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits))
	(Client CN "mail.NetBSD.org", Issuer "mail.NetBSD.org CA" (not verified))
	by mollari.NetBSD.org (Postfix) with ESMTPS id D832B1A9239
	for <gnats-bugs@gnats.NetBSD.org>; Thu, 29 Dec 2022 22:20:22 +0000 (UTC)
Message-Id: <4Njgqk4Sdwz1XLYZ3@mail.SiriusCloud.jp>
Date: Fri, 30 Dec 2022 06:04:16 +0900
From: ryo@tetera.org
Reply-To: ryo@tetera.org
To: gnats-bugs@NetBSD.org
Subject: wscons keymap is incorrect
X-Send-Pr-Version: 3.95

>Number:         57148
>Category:       kern
>Synopsis:       wscons keymap is incorrect
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    kern-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Dec 29 22:25:00 +0000 2022
>Last-Modified:  Fri Dec 30 15:05:00 +0000 2022
>Originator:     Ryo ONODERA
>Release:        NetBSD 10.99.2
>Organization:
Ryo ONODERA // ryo@tetera.org
PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3
>Environment:


System: NetBSD brownie 10.99.2 NetBSD 10.99.2 (DTRACE8) #1: Tue Dec 27 10:10:11 JST 2022 ryoon@brownie:/usr/world/9.99/amd64/obj/sys/arch/amd64/compile/DTRACE8 amd64
Architecture: x86_64
Machine: amd64
>Description:
On NetBSD/amd64 10.99.2 and 9.99.88 at least has incorrect keymap
for wscons.
The output of 'wsconsctl map' is as follows.
My keymap is us.swapctrlcaps. However the keymap is always incorrect,
for example for 'us', 'uk' and 'jp'.

The settings in /etc/ttys seems not related to this problem.
So freshly installed environment with
http://nyftp.netbsd.org/pub/NetBSD-daily/HEAD/202212280510Z/images/NetBSD-10.99.2-amd64-install.img.gz
has same problem.

My NetBSD/i386 9.2_STABLE environment has no problem.

Due to this incorrect keymap, I cannot input characters
in mlterm-wscons from pkgsrc/x11/mlterm.

# wsconsctl map
map=
keycode 4 = a A
keycode 5 = b B
keycode 6 = c C
keycode 7 = d D
keycode 8 = e E
keycode 9 = f F
keycode 10 = g G
keycode 11 = h H
keycode 12 = i I
keycode 13 = j J
keycode 14 = k K
keycode 15 = l L
keycode 16 = m M
keycode 17 = n N
keycode 18 = o O
keycode 19 = p P
keycode 20 = q Q
keycode 21 = r R
keycode 22 = s S
keycode 23 = t T
keycode 24 = u U
keycode 25 = v V
keycode 26 = w W
keycode 27 = x X
keycode 28 = y Y
keycode 29 = z Z
keycode 30 = 1 exclam
keycode 31 = 2 at
keycode 32 = 3 numbersign
keycode 33 = 4 dollar
keycode 34 = 5 percent
keycode 35 = 6 asciicircum
keycode 36 = 7 ampersand
keycode 37 = 8 asterisk
keycode 38 = 9 parenleft
keycode 39 = 0 parenright
keycode 40 = Return
keycode 41 = Cmd_Debugger Escape
keycode 42 = BackSpace
keycode 43 = Tab
keycode 44 = space
keycode 45 = minus underscore
keycode 46 = equal plus
keycode 47 = bracketleft braceleft
keycode 48 = bracketright braceright
keycode 49 = backslash bar
keycode 50 = backslash bar
keycode 51 = semicolon colon
keycode 52 = apostrophe quotedbl
keycode 53 = grave asciitilde
keycode 54 = comma less
keycode 55 = period greater
keycode 56 = slash question
keycode 57 = Cmd1 Control_L
keycode 58 = Cmd_Screen0 f1 F1
keycode 59 = Cmd_Screen1 f2 F2
keycode 60 = Cmd_Screen2 f3 F3
keycode 61 = Cmd_Screen3 f4 F4
keycode 62 = Cmd_Screen4 f5 F5
keycode 63 = Cmd_Screen5 f6 F6
keycode 64 = Cmd_Screen6 f7 F7
keycode 65 = Cmd_Screen7 f8 F8
keycode 66 = Cmd_Screen8 f9 F9
keycode 67 = Cmd_Screen9 f10 F10
keycode 68 = f11 F11
keycode 69 = f12 F12
keycode 70 = Print_Screen
keycode 71 = Hold_Screen
keycode 72 = Pause
keycode 73 = Insert
keycode 74 = Home
keycode 75 = Cmd_ScrollFastUp Prior
keycode 76 = Delete
keycode 77 = End
keycode 78 = Cmd_ScrollFastDown Next
keycode 79 = Right
keycode 80 = Left
keycode 81 = Down
keycode 82 = Up
keycode 83 = Num_Lock
keycode 84 = KP_Divide
keycode 85 = KP_Multiply
keycode 86 = KP_Subtract
keycode 87 = KP_Add
keycode 88 = KP_Enter
keycode 89 = KP_End KP_1
keycode 90 = KP_Down KP_2
keycode 91 = Cmd_ScrollFastDown KP_Next KP_3
keycode 92 = KP_Left KP_4
keycode 93 = KP_Begin KP_5
keycode 94 = KP_Right KP_6
keycode 95 = KP_Home KP_7
keycode 96 = KP_Up KP_8
keycode 97 = Cmd_ScrollFastUp KP_Prior KP_9
keycode 98 = KP_Insert KP_0
keycode 99 = KP_Delete KP_Decimal
keycode 100 = backslash bar
keycode 101 = Menu
keycode 104 = f13 F13
keycode 105 = f14 F14
keycode 106 = f15 F15
keycode 107 = f16 F16
keycode 109 = Power


>How-To-Repeat:
Install NetBSD/amd64-current and run
# wsconsctl map
>Fix:
I have no idea.

>Audit-Trail:
From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Thu, 29 Dec 2022 22:33:55 -0000 (UTC)

 ryo@tetera.org writes:

 ># wsconsctl map
 >map=
 >keycode 4 = a A
 >keycode 5 = b B
 >keycode 6 = c C
 >keycode 7 = d D


 Can't see that on:

 NetBSD tazz 10.99.2 NetBSD 10.99.2 (TAZZ) #35: Sun Dec 25 17:41:19 UTC 2022  mlelstv@slowpoke:/scratch2/obj.amd64/scratch/netbsd-current/src/sys/arch/amd64/compile/TAZZ amd64

 map=
 keycode 1 = Cmd_Debugger Escape
 keycode 2 = 1 exclam
 keycode 3 = 2 quotedbl twosuperior twosuperior
 keycode 4 = 3 section threesuperior threesuperior
 keycode 5 = 4 dollar
 ...


From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
To: gnats-bugs@netbsd.org
Cc: netbsd-bugs@netbsd.org
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Thu, 29 Dec 2022 16:49:29 -0600

 Keymaps for ukbd and pckbd are different, and the wskbd mux won't
 protect you from the difference.

From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
To: gnats-bugs@netbsd.org
Cc: jakllsch@kollasch.net, tsutsui@ceres.dti.ne.jp
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Fri, 30 Dec 2022 09:20:03 +0900

 > Keymaps for ukbd and pckbd are different, and the wskbd mux won't
 > protect you from the difference.

 Indeed, I guess there is a design issue in /dev/wskbd on wsmux(4),
 i.e. there is no way to get keymap for raw keycodes from each wskbdN.

 Maybe "wsconsctl -f /dev/wskbd0 map" (or wskbd1) works around?

 ---
 Izumi Tsutsui

From: Ryo ONODERA <ryo@tetera.org>
To: gnats-bugs@netbsd.org, jakllsch@kollasch.net
Cc: 
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Fri, 30 Dec 2022 10:03:07 +0900

 Hi,

 "Jonathan A. Kollasch" <jakllsch@kollasch.net> writes:

 > The following reply was made to PR kern/57148; it has been noted by GNATS.
 >
 > From: "Jonathan A. Kollasch" <jakllsch@kollasch.net>
 > To: gnats-bugs@netbsd.org
 > Cc: netbsd-bugs@netbsd.org
 > Subject: Re: kern/57148: wscons keymap is incorrect
 > Date: Thu, 29 Dec 2022 16:49:29 -0600
 >
 >  Keymaps for ukbd and pckbd are different, and the wskbd mux won't
 >  protect you from the difference.

 Thank you very much for your information.
 My mouse was also detected as USB keyboard and wscons keymap is
 defined as USB keyboard type. It may be use for keyboard macro or
 the other unused features.

 However my laptop's keyboard is connected via PS/2.
 Can I change wscon keymap to PS/2 type, even if USB keyboard attached?

 Thank you.

 -- 
 Ryo ONODERA // ryo@tetera.org
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3

From: mlelstv@serpens.de (Michael van Elst)
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Fri, 30 Dec 2022 08:03:54 -0000 (UTC)

 ryo@tetera.org (Ryo ONODERA) writes:

 > However my laptop's keyboard is connected via PS/2.
 > Can I change wscon keymap to PS/2 type, even if USB keyboard attached?

 The keymap reflects what the hardware produces and every keyboard
 has its own keymap. wskbd0 (the internal keyboard) has the PS/2 keymap
 and wskbd1 (the USB keyboard) has the USB keymap.

 The problem aren't the different keymaps, but that for raw events
 these are not used and translated events are also filtered by the
 terminal emulation (so you lose key and type information).

 The only way seems to be to read events from each wskbd? device
 individually.

 We should extend events to identify the source and we should
 allow a mode that translates keyboard events only to keysyms
 without going through the terminal emulation.

From: Ryo ONODERA <ryo@tetera.org>
To: gnats-bugs@netbsd.org, kern-bug-people@netbsd.org,
 gnats-admin@netbsd.org, netbsd-bugs@netbsd.org
Cc: 
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Fri, 30 Dec 2022 17:32:24 +0900

 Izumi Tsutsui <tsutsui@ceres.dti.ne.jp> writes:

 > The following reply was made to PR kern/57148; it has been noted by GNATS.
 >
 > From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
 > To: gnats-bugs@netbsd.org
 > Cc: jakllsch@kollasch.net, tsutsui@ceres.dti.ne.jp
 > Subject: Re: kern/57148: wscons keymap is incorrect
 > Date: Fri, 30 Dec 2022 09:20:03 +0900
 >
 >  > Keymaps for ukbd and pckbd are different, and the wskbd mux won't
 >  > protect you from the difference.
 >  
 >  Indeed, I guess there is a design issue in /dev/wskbd on wsmux(4),
 >  i.e. there is no way to get keymap for raw keycodes from each wskbdN.
 >  
 >  Maybe "wsconsctl -f /dev/wskbd0 map" (or wskbd1) works around?

 Thank you very much.

 $ WSKBD=/dev/wskbd0 /usr/pkg/bin/mlterm-wscons

 works without keymap problem for me.

 I have no special knowledge about this kind of things.
 However I sometimes want Linux's evdev support for NetBSD.
 I have heard that FreeBSD implements Linux's evdev.

 >  ---
 >  Izumi Tsutsui
 >  

 -- 
 Ryo ONODERA // ryo@tetera.org
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3

From: Ryo ONODERA <ryo@tetera.org>
To: gnats-bugs@netbsd.org, mlelstv@serpens.de
Cc: 
Subject: Re: kern/57148: wscons keymap is incorrect
Date: Sat, 31 Dec 2022 00:03:15 +0900

 Hi,

 mlelstv@serpens.de (Michael van Elst) writes:

 > The following reply was made to PR kern/57148; it has been noted by GNATS.
 >
 > From: mlelstv@serpens.de (Michael van Elst)
 > To: gnats-bugs@netbsd.org
 > Cc: 
 > Subject: Re: kern/57148: wscons keymap is incorrect
 > Date: Fri, 30 Dec 2022 08:03:54 -0000 (UTC)
 >
 >  ryo@tetera.org (Ryo ONODERA) writes:
 >  
 >  > However my laptop's keyboard is connected via PS/2.
 >  > Can I change wscon keymap to PS/2 type, even if USB keyboard attached?
 >  
 >  The keymap reflects what the hardware produces and every keyboard
 >  has its own keymap. wskbd0 (the internal keyboard) has the PS/2 keymap
 >  and wskbd1 (the USB keyboard) has the USB keymap.
 >  
 >  The problem aren't the different keymaps, but that for raw events
 >  these are not used and translated events are also filtered by the
 >  terminal emulation (so you lose key and type information).
 >  
 >  The only way seems to be to read events from each wskbd? device
 >  individually.

 Thanks for your explanation.
 Reading events from each /dev/wskbd? works fine for me.

 >  
 >  We should extend events to identify the source and we should
 >  allow a mode that translates keyboard events only to keysyms
 >  without going through the terminal emulation.
 >  

 I wish this kind of change.


 Thank you.

 -- 
 Ryo ONODERA // ryo@tetera.org
 PGP fingerprint = 82A2 DC91 76E0 A10A 8ABB  FD1B F404 27FA C7D1 15F3

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.47 2022/09/11 19:34:41 kim Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2022 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.