geekhack

geekhack Projects => Making Stuff Together! => Topic started by: obones on Sat, 12 December 2015, 15:38:33

Title: Teensy with TMK firmware in composite mode
Post by: obones on Sat, 12 December 2015, 15:38:33
Hello all,

As I'm trying to find some use to a dead laptop sitting around here, I came up with the idea to use it as a KVM for a server.
With the help of a dedicated controller board, I got the original LCD to display the server image via a standard VGA connection.
But now, I'm moving on to the keyboard and trackpad on it. Looking at the various parts on the motherboard, I discovered the following details:

The keyboard has a set of rows and columns connected to a specialized chip that talks directly to the CPU via the internal bus (National Semiconductor PC87570)
The trackpad uses a 5V chipset that outputs a PS/2 signal that is connected to the same specialized chip.

Clearly, I can't scavenge this chip but doing searches on the web, I stumbled across the use of a Teensy++ 2.0 board with the TMK keyboard firmware collection. It appears to be quite versatile and I believe it could be the solution for me because the homepage for the project on GitHub mentions "PS/2 mouse support as composite device"

However, I could not confirm this would indeed working fine, mostly because I could not find any configuration examples for such a situation.

Would any of you have any hints as to what I should be looking at?

Thanks a lot for your answers.
Title: Re: Teensy with TMK firmware in composite mode
Post by: hasu on Sun, 13 December 2015, 06:54:38
You will find some hints in keyboard/onekey files.
To enable PS/2 mouse you have to uncomment PS2_MOUSE_ENABLE and PS2_USE_INT in Makefile.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/onekey/Makefile#L119-L122

and have pin configuration in config.h for your wiring.
https://github.com/tmk/tmk_keyboard/blob/master/keyboard/onekey/config.h#L85-L107

It works probably, I've not check the function for long.
Title: Re: Teensy with TMK firmware in composite mode
Post by: obones on Sun, 13 December 2015, 15:12:06
Thanks for your answer.
I'll study that and will put it to the test when I receive the Teensy++ 2.0 that I just ordered.
I'll keep everyone posted when I have the results
Title: Re: Teensy with TMK firmware in composite mode
Post by: obones on Mon, 08 February 2016, 06:34:44
Well,

I've finally had time to test all this with the Teensy++ and it works, I'm delighted!
The keyboard matrix is fine and the touchpad makes the mouse cursor move.

There is a slight issue though: mouse scrolling does not work.

I tried looking a the code to see where the PS/2 data gets converted to USB packets, but reading the code inside ps2_uart.c did not help me that much.
Would you have suggestions for where I should look?
Also, how can I debug?

Regards
Title: Re: Teensy with TMK firmware in composite mode
Post by: obones on Mon, 08 February 2016, 07:30:53
Hum, after a bit more looking around, I found the ps2_mouse.c file and I believe all I need is in there.
I'll see if I manage to activate the intellimouse scrolling wheel mode and make it work