NetBSD Problem Report #53627

From  Sun Sep 23 16:03:23 2018
Return-Path: <>
Received: from ( [])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(Client CN "", Issuer " CA" (not verified))
	by (Postfix) with ESMTPS id 69E997A104
	for <>; Sun, 23 Sep 2018 16:03:23 +0000 (UTC)
Message-Id: <>
Date: Sun, 23 Sep 2018 16:03:22 +0000 (UTC)
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
NetBSD ocean 8.0 NetBSD 8.0 (GENERIC) #0: Tue Jul 17 14:59:51 UTC 2018 amd64

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)
pkg_add dosbox
(sudo) dosbox (on the console, not in xterm)
keyboard input is garbled, eg. 'a' (scancode 30) output 'u' (scancode 22)
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;
dosbox (on the console)
keyboard input works as intended

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 <>
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

 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.

                                 Michael van Elst
                                 "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:,v 1.9 2014/08/02 14:16:04 spz Exp $
Copyright © 1994-2017 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.