Author Topic: Re-writing keyboard controller firmware  (Read 2319 times)

0 Members and 1 Guest are viewing this topic.

Offline cribbit

  • Thread Starter
  • Posts: 288
Re-writing keyboard controller firmware
« on: Tue, 29 July 2014, 11:27:26 »
To my understanding, a keyboard can tell when any given key is being pressed. This information is sent to the controller, which then determines what press to send to the system. Why can't we override the firmware on a board? I want to write a controller that makes sense, one that's completely programmable. Not the crappy poker II programmable, I mean actually being able to give instructions for everything programmable.
I typed this post on my Slanck. I also developed a stronger, cleaner, easier handwiring method.


Offline CPTBadAss

  • Woke up like this
  • Posts: 14365
    • Tactile Zine
Re: Re-writing keyboard controller firmware
« Reply #1 on: Tue, 29 July 2014, 11:32:25 »
Doesn't a Teensy and firmware fulfill your needs?

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: Re-writing keyboard controller firmware
« Reply #2 on: Tue, 29 July 2014, 11:34:07 »
Most stock firmware don't have a bootloader - besides there is no keycombo or button to get there. Even then the pcb won't have breakout pins for programming. So you will have to manually connect the 6 or so pins to reprogram the chip. Worst comes to worst there is probably a way to JTAG it (just like they programmed it for the first time at the factory).

All that makes it a lot of effort. It's easier for people to just buy something else like the Pegasus replacement controller.

Offline cribbit

  • Thread Starter
  • Posts: 288
Re: Re-writing keyboard controller firmware
« Reply #3 on: Tue, 29 July 2014, 11:48:48 »
But how do you put that controller into the PCB? Isn't the controller hardwired into most boards?
I typed this post on my Slanck. I also developed a stronger, cleaner, easier handwiring method.


Offline CPTBadAss

  • Woke up like this
  • Posts: 14365
    • Tactile Zine
Re: Re-writing keyboard controller firmware
« Reply #4 on: Tue, 29 July 2014, 11:54:50 »
On my Filco Zero, the controller is held in with sip sockets. I'll remove the controller from its sip sockets then install bphiphany's custom controller. On the 6019284, I have to desolder the old controller and then solder in xwhatsit's controller.

Offline Smasher816

  • HHKB Master
  • Posts: 538
  • Location: return STATE_MISSOURI;
Re: Re-writing keyboard controller firmware
« Reply #5 on: Tue, 29 July 2014, 11:55:38 »
But how do you put that controller into the PCB? Isn't the controller hardwired into most boards?

Some have a daughter board that can be replaced. See here http://geekhack.org/index.php?topic=46700.0

If not you have to find a way to reprogram the chip (jtag). Or you can always find a custom pcb/board and throw in something like a teensy.

Offline CPTBadAss

  • Woke up like this
  • Posts: 14365
    • Tactile Zine
Re: Re-writing keyboard controller firmware
« Reply #6 on: Tue, 29 July 2014, 11:57:46 »
If it's not on a daughterboard, couldn't you solder in an ATMEGA chip?

Offline cribbit

  • Thread Starter
  • Posts: 288
Re: Re-writing keyboard controller firmware
« Reply #7 on: Tue, 29 July 2014, 12:17:19 »
There are two specific boards I'm looking at. One is a Das which I bought cheap because it's slightly broken - it appears that one column of the PCB is kaput, so qaz or something like that isn't registering. The other eventual one is a poker II, so I can add the functionality I want.

For the future, I'm also looking at how to program my own controllers. I'd really like to make boards that are programmable in an AHK style fullness.
I typed this post on my Slanck. I also developed a stronger, cleaner, easier handwiring method.


Offline AKmalamute

  • HHKB Scrub
  • Posts: 837
  • Location: Western WA, USA
Re: Re-writing keyboard controller firmware
« Reply #8 on: Tue, 29 July 2014, 13:01:13 »
For the future, I'm also looking at how to program my own controllers. I'd really like to make boards that are programmable in an AHK style fullness.

 There are lots of keyboard firmwares out there now -- the most well known of them are hasu's TMK, and Soarer has his thing ... a great many of the other things regulars on this board know about are derivitive of that, although there's others like the no-rewrite ergodox firmware that relies on some voodoo that tells the keyboard to reprogram itself on the fly.

 All of those are for the Teensy 2.0, but there are other uC out there, such as the teensy 3.0 which could control a much fancier setup but relies on a non-atmega cpu so would require a different set of hoops to jump through.

 Full-fledged programability is one of the primary reasons I have an account on this board. Welcome to the club! (the ergodox, by itself, is really the other reason. But mechanical, by itself, isn't quite reason enough to spend the money. Keyswitch-top removal cutouts, however ... )

HHKB-lite2, Dvorak user

Offline technomancy

  • Posts: 134
Re: Re-writing keyboard controller firmware
« Reply #9 on: Wed, 30 July 2014, 11:45:43 »
For the future, I'm also looking at how to program my own controllers. I'd really like to make boards that are programmable in an AHK style fullness.

A simple keyboard firmware can be implemented in about 100 lines of C if you don't need anything fancy.

https://github.com/technomancy/atreus-firmware/blob/5fdd52500c59130ff80a58f62cd3a030ed6571f1/atreus.c

This is an early draft of mine that should be fairly readable; it implements scanning the matrix, debouncing, layers, and invoking arbitrary C functions upon a keypress. I use it on my daily driver which has a Teensy 2 in it. You might find it interesting if you're wondering how much work it is to put together the basics.

Offline domoaligato

  • * Exquisite Elder
  • Posts: 1672
  • Location: USA
  • All your base are belong to us!
    • All your base are belong to us!
Re: Re-writing keyboard controller firmware
« Reply #10 on: Wed, 30 July 2014, 12:33:01 »
btw the ergodox voodoo is just a command to trigger the bootloader. you can do this in tmk firmware with the magic button combo

Offline cribbit

  • Thread Starter
  • Posts: 288
Re: Re-writing keyboard controller firmware
« Reply #11 on: Wed, 30 July 2014, 13:17:56 »
Thanks for the advice & links!

For the super long term, I'm looking at making a driver that allows for actual AHK functionality, not just remapping & being able to make every key a modifier key if I want. Things like setting windows to be always on top, special alt-tab type functions, macros that use mouse clicks, rendering objects on screen... lots of fun potential. Hard to write, but my uni is considering starting a class on device drivers which should help.
I typed this post on my Slanck. I also developed a stronger, cleaner, easier handwiring method.


Offline dorkvader

  • Posts: 6288
  • Location: Boston area
  • all about the "hack" in "geekhack"
Re: Re-writing keyboard controller firmware
« Reply #12 on: Thu, 31 July 2014, 00:00:03 »
You can wire the switch matrix on the KB to a controller of your choice. It's also possible to desolder the PCB and direct wire, though this isn't necessary.

which DAS? there are like 5.

another option is hasu's USB-to-USB converter, if you want hardware reprogrammability. I think the pokerII and most of the DAS support PS/2 natively, so this is possible with the much better soarer or TMK firmware PS/2 to USB adapter code. Note you cant reprogram the function key or pn key this way.