Quantcast

[Patch] Support F13-F24 on PC-122 terminal keyboard

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[Patch] Support F13-F24 on PC-122 terminal keyboard

Creamy
The following patch adds the keycodes for F13-F24 on a standard PC-122
terminal keyboard.

Doesn't seem to conflict with anything else I've found.
--
Creamy

support_f13-f24 (648 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Patch] Support F13-F24 on PC-122 terminal keyboard

Miod Vallat
> The following patch adds the keycodes for F13-F24 on a standard PC-122
> terminal keyboard.
>
> Doesn't seem to conflict with anything else I've found.

Well, it conflicts with the codes listed in the `USB HID to PS/2 Scan
Code Translation Table', which you can download from

  http://download.microsoft.com/download/1/6/1/161ba512-40e2-4cc9-843a-923143f3456c/translate.pdf

I have no objection against adding the F13-F24 scan codes to the pckbd
and ukbd drivers; but then I'd rather go with the scan codes listed in
the above document. If your IBM keyboard uses different scancodes for
the extra function keys, then it would be better to handle them with a
specific submap, as already done in the declk or iopener submaps.

Miod

> --- wskbdmap_mfii.c.orig Tue May 24 13:23:46 2011
> +++ wskbdmap_mfii.c Thu Mar 14 13:10:56 2013
> @@ -130,6 +130,18 @@
>      KC(83), KS_KP_Delete, KS_KP_Decimal,
>      KC(87),  KS_Cmd_Screen10, KS_f11,
>      KC(88),  KS_Cmd_Screen11, KS_f12,
> +    KC(91), KS_f13,
> +    KC(92), KS_f14,
> +    KC(93), KS_f15,
> +    KC(99), KS_f16,
> +    KC(100), KS_f17,
> +    KC(101), KS_f18,
> +    KC(102), KS_f19,
> +    KC(103), KS_f20,
> +    KC(104), KS_f21,
> +    KC(105), KS_f22,
> +    KC(106), KS_f23,
> +    KC(107), KS_f24,
>      KC(127), KS_Pause, /* Break */
>      KC(156), KS_KP_Enter,
>      KC(157), KS_Cmd1, KS_Control_R,

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Patch] Support F13-F24 on PC-122 terminal keyboard

Creamy
Hi Miod,

Thanks for looking at my patches...

> > The following patch adds the keycodes for F13-F24 on a standard PC-122
> > terminal keyboard.
> >
> > Doesn't seem to conflict with anything else I've found.
>
> Well, it conflicts with the codes listed in the `USB HID to PS/2 Scan
> Code Translation Table'

Yes, but that document just lists the codes that Windows translates to
internally when a USB keyboard is in use.  I have no reason to believe
that any PS/2 device actually uses them in hardware, and good reason to
believe that they don't, (and wouldn't).

The unofficial 'standard' for terminal keyboard designed for Windows
based terminal emulators is to send control-F1 for F13, ^F2 for F14, etc.
They also send other strange combinations for the other extra keys on
a terminal keyboard.  The reason for this is because the terminal
emulator software is designed to be usable with a 'normal' keyboard as
well.

Even 122 key USB keyboards do this, rather than send the USB HID codes
listed in the document above.  For example, Unicomp PS/2 terminal
keyboards are switchable between this mode I just described, and the
mode where they send the codes I listed in my patch.  Unicomp USB
terminal keyboards always send the multi-key sequences, and never send
unique USB HID codes for the 'extra' keys.

As far as I know, other manufacturers do the same thing.

> I have no objection against adding the F13-F24 scan codes to the pckbd
> and ukbd drivers; but then I'd rather go with the scan codes listed in
> the above document.

Please don't add them at all, unless you are sure that there are real
keyboards which use those codes.  I have never seen one.

It will cause funny behavior with a real terminal keyboard if you add
those codes for F13-F24, as some of them overlap, and will cause the
wrong F key to be interpreted.

> If your IBM keyboard uses different scancodes for
> the extra function keys, then it would be better to handle them with a
> specific submap, as already done in the declk or iopener submaps.

I'm happy to use a submap for 122 key terminal keyboards, anyway.

However, whilst F13-F24 have a definite use, the function keys on the left
of the keyboard were traditionally used for OS-specific functions and
have no standard layout.

Since most of these functions do not relate to OpenBSD, I set mine to
switch between virtual consoles.  However, this required a hack to the
kernel to disable the need to hold down control and alt to select VC,
because that is hard-coded in wskbd.c.

If some keymaps have dedicated keys for VC-switch, whilst others do not,
we need some way to handle this if it's eventually going to be in the
main tree.

I am happy to produce the patch making a submap for 122 key terminal
keyboards, but how would you like it done exactly?

--
Creamy

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Patch] Support F13-F24 on PC-122 terminal keyboard

Miod Vallat
> > Well, it conflicts with the codes listed in the `USB HID to PS/2 Scan
> > Code Translation Table'
>
> Yes, but that document just lists the codes that Windows translates to
> internally when a USB keyboard is in use.  I have no reason to believe
> that any PS/2 device actually uses them in hardware, and good reason to
> believe that they don't, (and wouldn't).

Hmm. You're right. According to
http://www.win.tue.nl/~aeb/linux/kbd/scancodes-5.html
the IBM 122 key keyboard, which seems to be the most common 122-key
keyboard around, matches the scan codes from your diff.

> > If your IBM keyboard uses different scancodes for
> > the extra function keys, then it would be better to handle them with a
> > specific submap, as already done in the declk or iopener submaps.
>
> I'm happy to use a submap for 122 key terminal keyboards, anyway.

I think this would be easier. But on the other hand this would restrict
the use of the extra keys to the us layout. So for the sake of
hypothetical localized 122 key keyboards, I think your diff is the way
to go, with a range test added to the PS/2-to-USB map converter to skip
those keys.

> Since most of these functions do not relate to OpenBSD, I set mine to
> switch between virtual consoles.  However, this required a hack to the
> kernel to disable the need to hold down control and alt to select VC,
> because that is hard-coded in wskbd.c.

That's a different story. We probably need a way to know that a given
key has been assigned only one function, and remove the need for the two
main command modifiers to be down in that case.

Miod

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [Patch] Support F13-F24 on PC-122 terminal keyboard

Creamy
On Thu, Mar 21, 2013 at 06:00:09AM +0000, Miod Vallat wrote:

> > > Well, it conflicts with the codes listed in the `USB HID to PS/2 Scan
> > > Code Translation Table'
> >
> > Yes, but that document just lists the codes that Windows translates to
> > internally when a USB keyboard is in use.  I have no reason to believe
> > that any PS/2 device actually uses them in hardware, and good reason to
> > believe that they don't, (and wouldn't).
>
> Hmm. You're right. According to
> http://www.win.tue.nl/~aeb/linux/kbd/scancodes-5.html
> the IBM 122 key keyboard, which seems to be the most common 122-key
> keyboard around, matches the scan codes from your diff.

The scan codes for the other keys, (left function keys, extra keypad key,
etc), match as well.

> > > If your IBM keyboard uses different scancodes for
> > > the extra function keys, then it would be better to handle them with a
> > > specific submap, as already done in the declk or iopener submaps.
> >
> > I'm happy to use a submap for 122 key terminal keyboards, anyway.
>
> I think this would be easier. But on the other hand this would restrict
> the use of the extra keys to the us layout. So for the sake of
> hypothetical localized 122 key keyboards, I think your diff is the way
> to go, with a range test added to the PS/2-to-USB map converter to skip
> those keys.

I think it's safe and useful to add F13-F24 to the main us layout, but
best to leave the other extra keys to a submap.  That way, the use of
F13-F24 can be relied on as fairly standard, and we can add submaps as
required to do funky things with the left hand keys if people choose to
use them.

> > Since most of these functions do not relate to OpenBSD, I set mine to
> > switch between virtual consoles.  However, this required a hack to the
> > kernel to disable the need to hold down control and alt to select VC,
> > because that is hard-coded in wskbd.c.
>
> That's a different story. We probably need a way to know that a given
> key has been assigned only one function, and remove the need for the two
> main command modifiers to be down in that case.

I notice that scrollback buffer keys are hard-coded to require shift
as well.  I think it would be nice to define all this somewhere in the
keyboard map, but I don't know if other people might consider it to be
unnecessarily bloating things, because the existing system works well
enough for most users, (who don't have loads of extra keys, ha! ha! ha!).

--
Creamy

Loading...