RVP <r...@sdf.org> writes:

> On Tue, 23 Nov 2021, Michael van Elst wrote:
>
>> If you restrict yourself to PC hardware (i386/amd64 arch) then
>> you probably have either
>>
>> a PS/2 keyboard -> the backspace key generates a DEL.
>> a USB keyboard  -> the backspace key generates a BS.
>>
>> That's something you cannot shoehorn into a single terminfo
>> attribute and that's why many programs simply ignore terminfo
>> here, in particular when you think about remote access.
>
> So, if I had a USB keyboard (don't have one to check right now), the
> terminfo entry would be correct? How do we make this consistent then?
> Have 2 terminfo entries: wsvt25-ps2 and wsvt25-usb (and fix-up getty
> to set the correct one)?

wscons is supposed to abstract all this, so making wsvt25-foo for
different keyboard classes seems like the wrong approach.

wskbd(4) says:

     •   Mapping from keycodes (defined by the specific keyboard driver) to
         keysyms (hardware independent, defined in
         /usr/include/dev/wscons/wsksymdef.h).

As uwe@ points out, the terms we use and the actual key labels are
confusing.  When I've talked about the DEL key, I've meant the key that
the user types to delete backwards, almost always upper right and easily
reachable when touch typing, and that in DEC tradition sent the DEL 0x1f
character.  It was pointed out that newer terminals have a backarrow
logo, and I see that an IBM USB keyboard has that too.

Then there's the BS key, which older (almost all actual?) terminals had,
but my IBM USB keyboard doesn't have one, and my mac doesn't either.

Looking in wsksymdef.h (netbsd-9, which is handy), we see "keysyms"
which is what keycodes are supposed to map into, and it talks about them
being aligned with ASCII.   Relevant to this discussion there is

#define KS_BackSpace            0x08
#define KS_Delete               0x7f
#define KS_KP_Delete            0xf29f

So that's for BS, DEL (to use ASCII) and the extended keypad "delete
right" introduced with I think the VT220.

On my USB keyboard, in NetBSD 9 wscons without trying to mess with
mappings, I get

  backarrow (key where DEL should) ==> BS (^H)
  keypad Delete key (next to insert/home/end/pageup/pagedown) ==> DEL (^?)

and I see that stty has erase to to ^H.


The underlying issue is that the norms of some systems are to map that
"user wants to delete left easily reachable key" to BS and some want to
map it to DEL.  I see these as the PC tradition and the UNIX tradition.

So I think NetBSD should decide that we're following the UNIX tradition
that this key is DEL, have wskbd map it that way for all keyboard types,
and have stty erase start out DEL.  (Plus of course carrying this across
ssh so cross-deletionism works, which I think is already the case.)

A quick glance at wskbd and ukbd did not enlighten me.

xev shows similar wrong x keysyms, BS and DEL for "backarrow" and
"keypad delete".

Attachment: signature.asc
Description: PGP signature

Reply via email to