Author Topic: Avant keyboard programming software!  (Read 2727 times)

0 Members and 1 Guest are viewing this topic.

Offline omnigeek

  • Thread Starter
  • Posts: 8
Avant keyboard programming software!
« on: Wed, 04 October 2023, 02:14:03 »
I've been working on a project, mostly for fun and learning and for my own use.  The project was to get some software running on modern Windows versions, that can program Avant Stellar and Prime keyboards.

After quite a bit more work than I thought it would take, I have it running!  And it actually works quite well on the couple of Stellars and couple of systems I've used it on.  It uses a keyboard filter driver that sits above the i8042 PS/2 port driver in Windows, and allows the Avant's programming protocol to work.

My first question is: would this software be of use to anyone else?  If so, I could upload the source, e.g. to Github, along with the information I've put together on the Avant keyboards and its programming protocol and the old software versions that came with it.

Next question: Since systems that have a PS/2 port are mostly long gone by now, ideally I'd like to be able to program the Avants through a USB-to-PS/2 converter like Soarer's or TMK.

My understanding is that Soarer's source code isn't public... I saw TMK's source code online, so would that be the best choice?  What I would need is a way to disable the scan code translation in the converter, so the Avant programming protocol could be used, and then re-enable the scan code translation when done.  That would probably require some firmware changes to the TMK converter; and it might require a Windows USB driver to set up the TMK to send/receive programming info to/from the keyboard.

Has anyone set up a USB-to-PS/2 converter to be able to write and read raw bytes on a programmable keyboard like this?

This leads to a larger question: is anyone even dealing with programmable keyboards anymore, since you can edit the scan code maps in Windows and there are things like AutoHotkey that can remap keys for you?  I feel like remapping keys in the keyboard itself is better since it doesn't depend on having software in each system and OS you use it on.  Or is that not so much of a concern anymore?

I can go into a lot more detail about the Avant hardware and software if anyone's interested, otherwise this post is too long already so I'll stop here :)
Northgate Omnikey Ultra rebuilt w/Matias clickies | Northgate Omnikey 102 | Avant Stellar | [/url]Visit the Typing Test and try!

Offline Findecanor

  • Posts: 5043
  • Location: Koriko
Re: Avant keyboard programming software!
« Reply #1 on: Wed, 04 October 2023, 06:07:01 »
Cool project!

TMK contains probably the most used open source PS/2 to USB converter, and it is actively maintained.

This leads to a larger question: is anyone even dealing with programmable keyboards anymore, since you can edit the scan code maps in Windows and there are things like AutoHotkey that can remap keys for you?
I think most people who program/remap their keyboards prefer the programming to be stored in the keyboard  and be persistent between boots, even if a desktop app is the preferred way to program it.

Having the programming/mapping require software in the background could be a nuisance if you e.g. dual-boot Windows and Linux, use virtual machines or use multiple computers with a KVM.
I've even read accounts on this forum about people physically moving keyboards between computers and wanting the programming to be persistent.
« Last Edit: Wed, 04 October 2023, 06:27:29 by Findecanor »
🍉

Offline meyertime

  • Posts: 2
Re: Avant keyboard programming software!
« Reply #2 on: Tue, 25 June 2024, 00:43:10 »
My first question is: would this software be of use to anyone else?  If so, I could upload the source, e.g. to Github, along with the information I've put together on the Avant keyboards and its programming protocol and the old software versions that came with it.

I would be interested!  Please upload.

I'm in the process of fixing and modding an Avant Stellar keyboard. I happen to have a retro PC with a real PS/2 port running Windows 95, so if all else fails, I can use that with the official software. But I'm pretty sure I'll need to craft a special .kbd file to get it to send the key codes that I want for the top function keys, so any details about that format would be helpful. The file is the same size as the memory chip in the keyboard, so I'm guessing it's a dump of what's stored on the keyboard and thus the programming protocol would be related.

In the longer term, I would also like to be able to program it on modern hardware. I use Linux as my daily driver, so I would be looking at implementing it for Linux.
« Last Edit: Tue, 25 June 2024, 00:45:50 by meyertime »

Offline omnigeek

  • Thread Starter
  • Posts: 8
Re: Avant keyboard programming software!
« Reply #3 on: Thu, 27 June 2024, 01:33:39 »
Cool, I'm glad someone else is interested in this!  Here is the repo with source code and docs I put together:

https://github.com/p-codes25/avant-programmer

Now that I look at it again, the formatting isn't quite right in the KBD file layout page -- it should use 8-space tabs but it's showing as 4 now... there might be other glitches like that, because I'm pretty new to GitHub.  Also, I uploaded all this 4 months ago but the page still doesn't show up in a Google search, so maybe I need to make a Gist page or something else to make it searchable?

As you'll see in those docs pages, the layout on the memory chip, the *.kbd file format and the on-the-wire protocol are all similar and related but not quite the same.  So a lot of the code in my utility deals with converting between those formats.  To edit the *.kbd files, I used CVT's 'new' Win2K/XP GUI (Avant.exe, which works fine through Win7, except for the programming upload/download part, of course).

What kind of special key codes do you want to generate with the top F keys?  I'm not sure exactly what the keyboard might be capable of, beyond what's supported in the old CVT GUI software.  Unfortunately the 82C51 chip seems to be locked, at least on my Avants, so I wasn't able to read the firmware to see what goodies might be lurking in there...

But as far as the existing key remapping and macro protocols, they seem to only be capable of sending keystrokes that any of the stock keyboard keys can generate -- each remap or macro keystroke entry gives a 'key slot' as I call it, which indicates a press of a key position on the stock keyboard layout.  I don't know if it can generate arbitrary scan codes that didn't exist in the stock layout though, if that's what you need.

I haven't worked with drivers on Linux, but I could maybe help in terms of understanding the i8042 hardware and how to work with it for programming these keyboards using their existing protocol.  Otherwise, or if you wanted to program one through a USB port, it might take coming up with new firmware and a new controller chip in the keyboard itself.  That would be a fun project, but I haven't looked into it.

Let me know if you have more questions and I'll see what I can do...

Northgate Omnikey Ultra rebuilt w/Matias clickies | Northgate Omnikey 102 | Avant Stellar | [/url]Visit the Typing Test and try!

Offline meyertime

  • Posts: 2
Re: Avant keyboard programming software!
« Reply #4 on: Fri, 12 July 2024, 02:11:19 »
Thanks for all the info!

That's a bummer that it will only swap key slots. I knew that's all that the software can do, but I was hoping to be able to use arbitrary scan codes through the programming protocol. I wanted to have media keys like Pause, Mute, etc. These keys are not on the Avant keyboards.

A possible workaround would be to map the SF-keys to Ctrl+Alt+Shift+F-keys, since I don't know of any real scenario where those key combinations are used. Then, I can map them in the Linux desktop environment.

As far as being able to program the keyboard itself, sounds like we would have to change the firmware. I know that it's read locked. I am trying to locate a copy of it by reaching out to former CVT employees. Primarily for the possibility of repair, though source code would be a nice bonus. Without that, I am also looking into having the chip disassembled to read the firmware. We could decompile it as a starting point. If none of that is possible, then we'd have to rewrite the firmware from scratch...

Offline omnigeek

  • Thread Starter
  • Posts: 8
Re: Avant keyboard programming software!
« Reply #5 on: Sat, 20 July 2024, 03:12:29 »
That would be cool if you could get the firmware binary file at least, and there seem to be 8051 disassemblers that could produce source code from that.  Or having the physical chip reverse-engineered should get you there too; that looked like more money than I wanted to sink into this for myself though.

Either way, then we could see if there's any possibility in the firmware for mapping keys to arbitrary scan codes, or if not then we could see about customizing the code to support it.  One thought is to have a mode where you can assign a macro to a key, but instead of defining the macro with key slot numbers, define it to send a list of scan codes... I don't know enough about the scan code sets to say how that could work, but maybe we could figure out something along those lines.

Writing new firmware from scratch wasn't something I had considered either, because I've never worked with 8051 code before and didn't want to learn it all from the ground up.  On the other hand, I was wondering if using a more modern USB-based controller would be feasible.  The problem there is being able to program it through USB, since the USB protocol only allows the keyboard to send known keystroke codes back, from what I understand.  We'd have to fit the programming protocol into that set of codes somehow, it seemed to me...

It would make an interesting project to be able to produce firmware for the Avants that we could reflash onto new, unlocked 82C59 chips; please keep me posted.  Your other alternative of mapping Ctrl+Shift+Alt+F-keys would probably be a faster route to success though...
Northgate Omnikey Ultra rebuilt w/Matias clickies | Northgate Omnikey 102 | Avant Stellar | [/url]Visit the Typing Test and try!