OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Hardware => Topic started by: Neil Waldhauer on September 26, 2018, 12:45:08 am

Title: 122-Key keyboard
Post by: Neil Waldhauer on September 26, 2018, 12:45:08 am
I've got a Affirmative Unicomp 1225T 5250 Model M 122-Key PS2 Buckling Spring Keyboard (See attachment for picture)

I had to hook it to the computer using a Belkin USB adapter. It seems to work. Is there anything I need to do to have the system recognize all 122 keys? I have ArcaOS 5.0.3 running, and the last version of Personal Communications.

I'm trying to support Access to an AS400.

Title: Re: 122-Key keyboard
Post by: ivan on September 26, 2018, 02:23:09 am
Hi Neil,

If you have to use a USB adapter  then as far as I know there is no way that you can use the extra keys.  I have 4 USB keyboards with extra keys that work as standard keyboards without problems but the extra keys are dead.

On the other hand if you can use it as a PS/2 keyboard plugged into a PS/2 socket then you can use the WIN95KEY software - it even allows assigning functions to special keys.  I have a Logitech multimedia PS/2 keyboard plugged nto a PS/2 socket with all the keys operational and assigned to such programs as PMMail Firefox PMseek and so on.

I just tried that keyboard with a USB adapter (don't know the brand but it looks like the one you show) and the extra keys are not available.  I seem to remember Lars daying something about the USB keyboard driver not having the extra keys function in it.
Title: Re: 122-Key keyboard
Post by: xynixme on September 26, 2018, 03:56:10 pm
The code below doesn't support all keys, but it should print something if e.g. F12 is pressed and successfully processed by a keyboard driver, without an app having to be aware of F12 or F20. F12 should produce something; F20 may not:

Code: [Select]
/* Untested.CMD*/
CALL RxFuncAdd 'SysGetKey','RexxUtil','SysGetKey'
SAY 'Press 10 (recognized) keys now:'
SAY
DO i=1 TO 10
   key=SysGetKey()
   CALL CharOut '','Key' Format (i,2,0)||':'
   DO j=1 TO Length(key)
      CALL CharOut '',' '||C2X(SubStr(key,j,1))
   END j
   SAY
END i
EXIT
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on September 26, 2018, 05:49:03 pm
Sure enough, keys F13 to F24 do not work with the above REXX program (tweaked a bit) on my system with the PS/2 to USB adapter.
Many of the left group of keys do not function, either.

The keys do work on the old system, which uses the PS/2 connector. The PS/2 to USB adapter does work for supported operating systems.
Title: Re: 122-Key keyboard
Post by: RickCHodgin on September 26, 2018, 07:08:53 pm
Sure enough, keys F13 to F24 do not work with the above REXX program (tweaked a bit) on my system with the PS/2 to USB adapter.
Many of the left group of keys do not function, either.

The keys do work on the old system, which uses the PS/2 connector. The PS/2 to USB adapter does work for supported operating systems.

My original Exodus kernel (from the early 2000s) had a mode I used to bootup and return the physical keypress values from the hardware device itself, so I could see which key values each key physically mapped to on a PS/2 keyboard.

If you're interested in that, I could try and build a copy that would boot and display that information about each key.  It would require a floppy disk to boot.  You could at least use the actual key values returned at the hardware level to create a custom keyboard driver or mapping if the existing keyboard drivers support a vkey mapping.
Title: Re: 122-Key keyboard
Post by: ivan on September 26, 2018, 08:04:28 pm
Until such time as those looking and updating the USB stack manage to update the usbkbd.sys to enable non standard keycodes extra keys on usb keyboards will never work, in fact you will never see the keycodes.

There is a linux program that was developed to get that information to allow the extra keys and functions (lights on the keys) to be used with the Corsair K95 gaming keyboard on linux.  I have a copy of it and the other tools if anyone is interested. 
Title: Re: 122-Key keyboard
Post by: Andreas Schnellbacher on September 27, 2018, 02:55:25 pm
Win95Key (http://hobbes.nmsu.edu/download/pub/os2/util/keyboard/w95k210.zip) contains tools\showkey.exe. It outputs for each key press and release a line in its window. I suppose that it reports evrything that the system functions see.

Neil, in your case, I suppose, you won't see output lines for your additional USB keys.

BTW: There exists also testkeys.e for EPM. In NEPMD, you can just type 'testkeys' to switch it on. The output goes then to the message line and for NEPMD also to a PMPrintf window, if opened. End that mode with 2x Esc.
Title: Re: 122-Key keyboard and USBKBD.SYS
Post by: Neil Waldhauer on September 27, 2018, 03:37:02 pm
I think Ivan has the right answer, regarding usbkbd.sys. Hopefully his conclusion regarding a fix is wrong, as I note that new versions of usbkbd.sys are being released. This would apply to both 5350 and 3270 keyboards that are commonly used in legacy OS/2 installations, so it can be considered to be of strategic for continued use of OS/2.

Isn't the DEVINFO statement in config.sys supposed to select the keyboard table? But testing, I see that the USB adapter plugged into the old machine still does not transmit all the keystrokes, so I imagine usbkbd.sys is the driver that needs to be fixed.

In case DEVINFO is relevant, the one that works is DEVINFO=KBD,US103,C:\OS2\KEYBOARD.DCP
US103.KBL is in c:\language\keyboards with the other KBL files.
Title: Re: 122-Key keyboard and USBKBD.SYS
Post by: RickCHodgin on September 27, 2018, 03:58:15 pm
In case DEVINFO is relevant, the one that works is DEVINFO=KBD,US103,C:\OS2\KEYBOARD.DCP
US103.KBL is in c:\language\keyboards with the other KBL files.

What's the tool used to edit a .KBL file?

UPDATE:  I found this Hobbes mirror (http://xenia.sote.hu/vmirror/os2/hobbes/Hobbes.util.keyboard.html), and the file kbdredef.zip which is used for editing OS/2 Warp 3 .KBD files.  Would like to edit .KBL files for Warp 4.
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on September 28, 2018, 02:32:16 am
I've entered bug 2171 in the Arca Noae bug tracker. If there is a chance to fix USBKBD.SYS, they would know.

https://mantis.arcanoae.com/view.php?id=2171
Title: Re: 122-Key keyboard
Post by: Silvan Scherrer on September 28, 2018, 11:24:17 am
I've got a Affirmative Unicomp 1225T 5250 Model M 122-Key PS2 Buckling Spring Keyboard (See attachment for picture)

I had to hook it to the computer using a Belkin USB adapter. It seems to work. Is there anything I need to do to have the system recognize all 122 keys? I have ArcaOS 5.0.3 running, and the last version of Personal Communications.

I'm trying to support Access to an AS400.
Neil still using that old piece of shit? Is that a very old AS400 customer? Or does he have a later >=V7R1 release? If so i strongly suggest to use IBM i Access Client Solution (ACS in short). It's written in Java and works like a charm. I use it daily, as thats my main development job

regards
Silvan
Title: Re: 122-Key keyboard
Post by: Sergey Posokhov on September 28, 2018, 03:26:50 pm
Unicomp, a company in Kentucky, still produces them (http://www.pckeyboard.com/page/category/PC122).
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 03, 2018, 04:42:33 pm
I have added an internal extension cable (part number 43N9149) to the Lenovo M93p computer. With this part, the keyboard works fine.

While the USBKBD.SYS driver can be modified to accept F13-F24 keys, supporting all such keyboards would not be easy.

I tried to get IBM i Access Client Solution, but it is restricted to subscribers. I'm working on getting it. I assume it will work well with our OpenJava port.
Title: Re: 122-Key keyboard
Post by: ivan on October 03, 2018, 09:31:29 pm
Is that a PS/2 to USB converter or is it the part that plugs onto the PS/2 header and hence you are using the keyboard as a PS/2 keyboard?
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 04, 2018, 04:24:48 am
Ivan: that's a real pair PS/2 ports, no USB is involved. It's not in any local catalog that I can find, but it seems widely available in China.
Title: Re: 122-Key keyboard
Post by: Lars on October 04, 2018, 10:42:32 am
As far as PS/2 to USB conversion goes I wonder if there can be a generic solution. The PS/2 to USB adapter acts as a USB device from the computer's point of view. That said, it should provide all the descriptor info (standard USB device and config descriptors as well as HID device specific HID descriptor) to present itself as a USB keyboard and/or mouse.

But of course, that HID info cannot possibly cover each and every keyboard on planet earth. I would expect that most of these adapters will limit themselves to a MF102 keyboard. And USBKBD.SYS (and USBMOUSE.SYS) can only serve what the USB device reports as being supported.
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 04, 2018, 03:32:29 pm
So far, I only considered the case of supporting just this USB device. There are actually two of the devices, one for 5250 and one for 3270, that are interesting. There are more industrial users who are stuck with OS/2 because they used Personal Communications. When IBM discontinued Personal Communications for Windows, their migration path became unclear, and they are lost in the woods.

It would be nice to support any device that claimed to be a keyboard. But a keyboard through a USB adapter would not even claim to be a keyboard, would it?

For now, I like the solution with adding the PS/2 assembly to the computer. I checked, and the PS/2 socket is still on the latest MB, the one I plan to support once USB 3 is available.
Title: Re: 122-Key keyboard
Post by: Lars on October 05, 2018, 07:48:15 am
Maybe I should have read your posts more thoroughly:
Quote
The PS/2 to USB adapter does work for supported operating systems

If that means that say under Windows all keys of this keyboard did work with the PS/2 to USB adapter then my assumption was wrong and it should be possible to support all keys with the USBKBD.SYS driver.

As to what exactly the PS/2 to USB adapter reports to the USB host (computer): maybe you can plug in just the adapter and then run a tool like "lsusb.exe" with the "-v" switch and see what you get back as HID info. I would expect that the OS sees a combination of a keyboard and mouse (plus a generic HID device maybe) even if no such device is plugged into the adapter.
Title: Re: 122-Key keyboard
Post by: ivan on October 05, 2018, 01:39:18 pm
Hi Lars,

Here are the outputs from usbres and lsusb for a similar adapter to the one Neil is using.  It passes the multimedia keys from my Logotech PS/2 keyboard but on a  Kensington USB keyboard they are not seen even the ones with identical keycodes.
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 05, 2018, 04:30:12 pm
Thanks, Ivan, for the example. I have fixed my installation of lsusb and posted a verbose dump of my PS/2 to USB converter.

This is the PS/2 to USB converter that came with the keyboard and is pictured in the original post.
Title: Re: 122-Key keyboard
Post by: Andreas Schnellbacher on October 05, 2018, 06:34:31 pm
they are not seen even the ones with identical keycodes.
That sounds strange. Which code do you mean? Scancode, charcode or vk_code?
Title: Re: 122-Key keyboard
Post by: ivan on October 05, 2018, 11:35:20 pm
Sorry that was scan codes.  I used win05key-v309 on OS/2 and checkscancode v4 on win 7
Title: Re: 122-Key keyboard
Post by: Lars on October 07, 2018, 03:49:28 pm
If I ever find the time, I'll try and read the USB HID specification (https://usb.org/sites/default/files/documents/hid1_11.pdf) plus the HID usage tables doc (https://usb.org/sites/default/files/documents/hut1_12v2.pdf).
These are horrible documents to read but they should give a clue what scancode range the adapter supports.
Title: Re: 122-Key keyboard
Post by: Lars on October 07, 2018, 06:54:48 pm
Neil: I have a vague idea of what needs to be done. I have now modified USBKBD.SYS to hopefully support the F13-F24 keys. Where do you want me to send you an updated USBKBD.SYS ?

By the way: when you hit Shift-F1 on this keyboard, is this equivalent to hitting SysReq on an ordinary AT keyboard ?
Title: Re: 122-Key keyboard
Post by: Lars on October 07, 2018, 07:05:48 pm
Neil: Never mind, found your email address. I have sent the updated driver to you.
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 08, 2018, 05:25:41 am
Thanks Lars. I got your new USBKBD.SYS.

My first attempt didn't go well, because your USBKBD.SYS doesn't work well with the Arca Noae stack. I should have known that.

I installed the whole 224 stack, and then added the new USBKBD.SYS to it, and it seems to work well with my standard usb keyboard. However, keys F13-F24 still don't work on the 122 key keyboard when connected via USB.

I plugged the 122 key keyboard into a PS/2 port, and I tried SysReq to see if it was the same as Shift F1. SysReq doesn't give any output on the 122-key keyboard. I'll have to find an AT keyboard to try. SysReq gives no keyboard output on my standard USB keyboard.
Title: Re: 122-Key keyboard
Post by: Lars on October 08, 2018, 08:03:04 am
Hi Neil,

1) how do you query the received scan codes (how did you get the results in the AN ticket) ? If you have written a REXX util, can you post it here ? Do I understand correctly that you get scancodes for the F13-F24 keys only if you directly attach the 122 key keyboard to a PS/2 port ?

2) <quote>SysReq gives no keyboard output on my standard USB keyboard</quote>. So that means, that disregarding the 122 key keyboard you also don't get a scancode for this key on a "normal" keyboard ? Maybe that gives me a chance to find a common cause.

Title: Re: 122-Key keyboard
Post by: Lars on October 08, 2018, 03:40:20 pm
I found the piece of information I was looking for. I am going to update USBKBD.SYS and send it to you.
Let's hope for the best ...
Title: Re: 122-Key keyboard
Post by: Neil Waldhauer on October 08, 2018, 08:33:18 pm
Thanks for looking into the USB keyboard driver. As far as the original problem, I found out how to add standard PS/2 ports, so I'm in no rush to get results.

But it would be great to find, fix and document what is wrong with the original IBM USB keyboard. I will try to help and test.

I have a Microsoft Ergonomic keyboard I'm still using after my bicycle accident. That's pretty much a standard USB keyboard without the multi-media keys found on some new keyboards, but with the extra Microsoft keys. On this keyboard, SysRq is a key that is also PrtScn.

The 122-key keyboard only shows F13-F24 when plugged into PS/2 port. I have now shipped the machine to which I added the PS/2 port, so I'll now be testing on an older machine with a PS/2 port. I hope the PS/2 ports are equivalent.

Still to do is to get a standard IBM PS/2 keyboard and test that in the PS/2 port.

The code for my REXX utility is below. Please feel free to improve it.


Code: [Select]
/* program to test keyboard input */

CALL RxFuncAdd 'SysGetKey','RexxUtil','SysGetKey'
SAY 'Press q to quit:'
SAY
do while key <> 'q'
   key=SysGetKey()
   say ''
   SAY 'Key (' || Length(key) || '): '
   DO j=1 TO Length(key)
      say ' '||C2X(SubStr(key,j,1))
   END j
   SAY
END
return
Title: Re: 122-Key keyboard
Post by: ivan on October 08, 2018, 09:19:44 pm
Hi Lars,

Any chance you could send me the modified USBKBD.SYS so I can test it with my USB keyboards with extra keys?

ivan10 at free dot fr

Thanks
Title: Re: 122-Key keyboard
Post by: Lars on October 09, 2018, 01:31:29 pm
Hi Lars,

Any chance you could send me the modified USBKBD.SYS so I can test it with my USB keyboards with extra keys?

ivan10 at free dot fr

Thanks
If I can get anything to work at all, I am also going to send it to you.
Title: Re: 122-Key keyboard
Post by: ivan on October 09, 2018, 10:41:16 pm
Thanks Lars,

Would the output from LSUSB of the various keyboards be helpful?
Title: Re: 122-Key keyboard
Post by: Lars on October 09, 2018, 11:44:57 pm
Thanks Lars,

Would the output from LSUSB of the various keyboards be helpful?

That won't be necessary yet (you did already attach lsusb Output for one of your PS/2 to USB Adapters, that's a starting point). The LSUSB Output only Shows the report descriptor which is the structural description of the received data packet(s) but not more.
First I need to find out if the keypresses reach USBKBD.SYS (that is, USBKBD.SYS receives a report with the USB keycode of the key on the keyboard). Then I need to find out if the mapping from USB keycode to PS/2 scancode(s) is done correctly. What happens underneath is that USBKBD.SYS calls the legacy mouse driver (amouse.sys, mouse.sys) with the PS/2 scancodes for "make" (key press) and "break" (key release) for the key. Not all USB keycodes have a defined mapping to PS/2 scancode so let's see where this Ends up ...
Title: Re: 122-Key keyboard
Post by: Andreas Schnellbacher on October 10, 2018, 12:21:27 am
Hi Lars,

one comment to your last post:

Scan codes are hardware-specific. Via scan code defined keys require user action (and a tool that is prepared for scan code configuration) to work. Of more interest would be char codes, if they exist at all for the to-be-added key definitions.

Checking for scan codes might be a good start. (I hope that I haven't written something that you already know.)
Title: Re: 122-Key keyboard
Post by: Lars on October 10, 2018, 07:25:36 am
That's not how it works. The only thing that USBKBD.SYS does it to transform a USB keycode (that's just a number for a key on the keyboard) to the corresponding "make" and "break" scancodes as defined by some Microsoft table and then send this sequence of scancodes to the legacy mouse driver (AMOUSE.SYS, MOUSE.SYS) which in turn send that to IBMKBD.SYS (I think, I would need to check the code).

It is the job of upper layers to map these scancodes to a keycode (for example by using the KEYBOARD.DCP table).

And that might also be the problem. It is possible that the legacy mouse driver and/or IBMKBD.SYS do not know what to do with the scancodes or the KEYBOARD.DCP table contains no entry for these scancodes.

Fortunately, for PM virtual keys VK_F13 to VK_F24 are defined which gives me some hope that the OS/2 keyboard subsystem at least knows that these keys exist on some keyboards.