NetBSD Problem Report #53627

From www@NetBSD.org  Sun Sep 23 16:03:23 2018
Return-Path: <www@NetBSD.org>
Received: from mail.netbsd.org (mail.netbsd.org [199.233.217.200])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-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 69E997A104
	for <gnats-bugs@gnats.NetBSD.org>; Sun, 23 Sep 2018 16:03:23 +0000 (UTC)
Message-Id: <20180923160322.4691E7A1FE@mollari.NetBSD.org>
Date: Sun, 23 Sep 2018 16:03:22 +0000 (UTC)
From: anon@mailinator.com
Reply-To: anon@mailinator.com
To: gnats-bugs@NetBSD.org
Subject: DOSBox keyboard does not work on console (wscons)
X-Send-Pr-Version: www-1.0

>Number:         53627
>Category:       pkg
>Synopsis:       DOSBox keyboard does not work on console (wscons)
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 23 16:05:00 +0000 2018
>Last-Modified:  Sat Sep 29 00:05:00 +0000 2018
>Originator:     Anonymous
>Release:        NetBSD 8.0
>Organization:
N/A
>Environment:
NetBSD ocean 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018  mkrepro@mkrepro.NetBSD.org:/usr/src/sys/arch/amd64/compile/GENERIC amd64

>Description:
Keyboard in DOSBox run on the console (wscons) does not work as a linux-specific patch in DOSBox shifts scancodes (due to Linux shifting them by 8 apparently)
>How-To-Repeat:
pkg_add dosbox
(sudo) dosbox (on the console, not in xterm)
keyboard input is garbled, eg. 'a' (scancode 30) output 'u' (scancode 22)
>Fix:
remove or bypass following code in dosbox-0.74/src/gui/sdl_mapper.cpp
#if !defined (WIN32) && !defined (MACOSX) && !defined(OS2)
                /* Linux adds 8 to all scancodes */
                else key-=8;
#endif
rebuild/reinstall
dosbox (on the console)
keyboard input works as intended

>Audit-Trail:
From: coypu@sdf.org
To: gnats-bugs@netbsd.org
Cc: 
Subject: Re: pkg/53627: DOSBox keyboard does not work on console (wscons)
Date: Fri, 28 Sep 2018 20:13:13 +0000

 The result of applying this patch is broken in Xorg, though.
 Will need to ask someone who is clueful about keyboard scan codes.

From: Michael van Elst <mlelstv@serpens.de>
To: gnats-bugs@NetBSD.org
Cc: 
Subject: Re: pkg/53627 DOSBox keyboard does not work on console (wscons)
Date: Sat, 29 Sep 2018 01:46:24 +0200

 wscons gives you scancodes as is, i.e. dependent on the actual hardware.
 E.g. on a PC with AT keyboard you'll get scancode 30 for the 'a' key.

 Xorg (not Linux) shifts this by MIN_KEYCODE (== 8), but when talking to
 wscons it might do some additional remapping of scancodes to appear like
 an AT keyboard (plus that shift). Apparently Xorg needs codes 0..7 for
 something else, that's why the shift is done.

 SDL just passes through the scancodes it gets passed from wscons or from X.

 DOSbox thinks Linux is always X and X is always Xorg and subtracts 8 to get
 back to AT scancodes.

 SDL may also pass through some virtualized keyboard events that are supposed
 to be identical for all environments. DOSbox can use this by disabling
 the "usescancodes" entry in the configuration file. Unfortunately that
 feature isn't implemented fully, the wscons code in SDL supports this
 only for WSKBD_TYPE_ZAURUS.

 So it's all a mess.


 DOSBox could use SDL_VideoDriverName() to find out wether it's using the
 wscons driver and not adjust the scancode then. Still gross, but SDL
 apparently doesn't reveal the keyboard mapping to a client.



 Greetings,
 -- 
                                 Michael van Elst
 Internet: mlelstv@serpens.de
                                 "A potential Snark may lurk in every tree."

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.43 2018/01/16 07:36:43 maya Exp $
$NetBSD: gnats_config.sh,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.