Author Topic: converting USB HID devices (keyboard and mouse) to PS/2  (Read 13164 times)

0 Members and 1 Guest are viewing this topic.

Offline Doctorandus_P

  • Super Contributor
  • ***
  • Posts: 4124
  • Country: nl
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #25 on: February 03, 2019, 11:57:36 am »
Keyboards have a microcontroller in them and it's likely to be flash based.
Ideally you can re program that microcontroller, cut of the USB cord and attach a PS/2 port to the keyboard.

You can also replace the microcontroller with another and only use the case, keys, and PCB for the keys matrix.
For a single board you can glue in an adapterboard and connect it with enamelled wire (burn through the isolation with a hot iron).
For many keyboards you can design an adapter board and castellations on the side to solder it another keyboard if the original uC can not be reprogrammed.
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #26 on: February 03, 2019, 12:32:02 pm »
Keyboards have a microcontroller in them and it's likely to be flash based.

yup, excellent idea.

some keyboards that I have inspected are ROM-masked based, some are based on Intel 8049, some are not clear what they are based on (cannot read anything on the chip), and some don't come with any flash.

I have also found some keyboards based on AVR8 (so Yuuupeeee we have a flash here, and a simple reprogramming interface) but we are looking at "mini keyboards" and this kind doesn't usually have the internal space for a hack.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7556
  • Country: fi
    • My home page and email address
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #27 on: February 03, 2019, 10:49:07 pm »
Whether they work for any particular USB keyboard, I wonder.
The Logitech ones I have even came with those, and I imagine it would be easier and cheaper to keep the support than remove it (because the USB HID protocol has not changed, nor PS/2, and both have a mechanism for supporting new keycodes and macros like those in "media keyboards").

A long time ago I connected knobs, switches and dials to Microsoft Flight Simulator using RawHID on one of the early Teensy devices.
ATmega32u4 on the Teensy 2, AT90USB1286 on the Teensy 2++. Yes, Paul Stoffregen even provided a pre-Arduino library, RawHID (or USB keyboard for keyboards specifically), so all you need to implement it is those files, avr-gcc, and a Teensy (of the older variants; 2.0 or 2.0++).  Stoffregen wrote the bootloader (HalfKay) in assembly, and it is smaller than the ones used in Arduinos (Pro Micro/Leonardo), so you can fit a bit more stuff on those compared to the Arduinos using the same chips.  Teensy keyboard implementations abound if you look for them. I seem to recall that there is at least one commercial keyboard one, that has a Teensy inside (licensed from PJRC.com).

The main reason the microcontroller approach appeals to me, is the adaptability (wired or BLE) and ease of mapping the keystrokes to whatever one wants.  In fact, I'd wager that I would probably want to switch between some different layouts at run time.  For playing games (via emulators thus far) I definitely want to change the mappings; that's why I designed this Pro Micro gamepad for use with Arduino Pro Micro (has the same ATmega32U4 core as Teensy 2.0, but an Arduino Leonardo bootloader (slightly bigger), but is dirt cheap and ubiquitous on fleabay). It's two 10cm × 5cm PCBs panelized as one 10cm × 10cm one for cheapness, the side-by-side images showing both sides.  I designed it to be used with Flash games, Mame, and other emulators, with a large number of mappings built in to choose from.  I like the problem-solving and planning part way too much, and haven't even ordered the boards.

(I did use a Logitech Rumble 2 with an userspace uinput mapping daemon in Linux (for flash/web games), until I wore out the right-side buttons. Where do you get that graphite paint they use on the contact surfaces? It does not seem to be impregnated in the rubber button, just painted on. Or maybe glued from a sheet.)
 

Offline legacyTopic starter

  • Super Contributor
  • ***
  • !
  • Posts: 4415
  • Country: ch
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #28 on: February 03, 2019, 11:40:46 pm »
I have just found that we need PS/2 scan set3 for our Tektronix and HP Xterminals.
We will have a couple of them for sale during the camping, so if people want a USB keyboard with the X11 terminal ... we have to support the proper scan set :D

If we will ever decide to design our own keyboard, we will go with the EMACS layout recommendations.
Keyboards optimized for UNIX, VI, and Emacs have a different layout and a couple of keys have also different behavior.

Having a customizable firmware will solve both these two needs.
 

Online Nominal Animal

  • Super Contributor
  • ***
  • Posts: 7556
  • Country: fi
    • My home page and email address
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #29 on: February 04, 2019, 01:01:38 am »
(You might find the Hackaday article on turning ThinkPad T61 keyboard into an external keyboard using a Teensy interesting.  To add support for PS/2, you'll need to move two I/O pins, similar to how Teensy LC maps some of the keyboard pins as it has fewer I/O pins than the Teensy 3.2.)
 

Online PCB.Wiz

  • Super Contributor
  • ***
  • Posts: 2367
  • Country: au
Re: converting USB HID devices (keyboard and mouse) to PS/2
« Reply #30 on: February 04, 2019, 05:09:08 am »
Further to the CH54x/CH55x parts I linked above, I find this link
http://www.wch.cn/downloads/CH549EVT_ZIP.html

includes USBHostHUB_KM.C code for creating a USB host device that checks for each of

        loc = SearchTypeDevice( DEV_TYPE_MOUSE );       
        loc = SearchTypeDevice( DEV_TYPE_KEYBOARD );     
        loc = SearchTypeDevice( USB_DEV_CLASS_PRINTER );
        loc = SearchTypeDevice( USB_DEV_CLASS_HID );     
        loc = SearchTypeDevice( DEF_AOA_DEVICE );       


I think AOA is Android Open Accessory ?
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf