XT/AT/PS2/Terminal to USB Converter with NKRO

User avatar
sealclubber

04 Oct 2012, 20:43

I am honestly surprised that this is so easy!

Thank you for all of your help :D

User avatar
Soarer

04 Oct 2012, 21:59

Cool! :D

I made a little mistake in the last three macros - well, not really a mistake, but... when setting modifiers it's usually more appropriate to just set one of them! So I've edited it now to say ASSIGN_META LCTRL instead of ASSIGN_META CTRL, which would make both controls. (Conversely, when clearing modifiers it's best to do both, so CLEAR_META SHIFT is correct in the other macro).

User avatar
Soarer

05 Oct 2012, 18:57

Heh, another minor mistake... the code prefixed by 'd' is after remapping. The one you want for remapping begins with a '+'. Of course, it's the same code if you haven't loaded any remappings!

User avatar
sealclubber

05 Oct 2012, 23:38

Gotcha. Just popped in again to tell you everything is working all nice and smooth. The original ideas for remapping most of those other keys was because I thought my control key didn't work... thankfully it was just a matter of cleaning out the housing and it's working nicely now.

Thank you again for all of your great help sir!

User avatar
Soarer

06 Oct 2012, 01:05

Aha, well, that's even better!

...

I finally finished my set of adapters...
converter_and_adapters.jpg
converter_and_adapters.jpg (226.9 KiB) Viewed 11722 times
... by finding an ethernet extension cable and butchering it :D

User avatar
wcass

26 Oct 2012, 05:59

feature request:

i know that all of the guys that like trackpoints would like to see a PS2 pass through and keyboard equivalent to left, right, center mouse buttons. i personally am not a trackpoint fan, but i would like to make this:
track.JPG
track.JPG (67.22 KiB) Viewed 11620 times

User avatar
Soarer

26 Oct 2012, 17:55

Hmm. I might add mousekeys functions at some point (similar to hasu's code), but I'm not sure there's much benefit to adding another PS/2 input for pointer devices (apart from neatness) since existing converters work pretty well for them.

User avatar
wcass

26 Oct 2012, 22:15

Soarer wrote:Hmm. I might add mousekeys functions at some point (similar to hasu's code), but I'm not sure there's much benefit to adding another PS/2 input for pointer devices (apart from neatness) since existing converters work pretty well for them.
a trackpoint mod would have bare leads rather than a proper PS2 plug. yes, i could cram a plug, PS2/USB converter, and USB hub and teensy adapter into my jumbo keyboard case, and finally run a single USB out of the case - but it would be better if i could just go from bare lead on trackpoint to bare lead on teensy. hasu included this feature with his origional code, but last i heard he had not used it in a while - but i don't think he is a trackpoint fan.

User avatar
Soarer

26 Oct 2012, 23:23

wcass wrote:a trackpoint mod would have bare leads rather than a proper PS2 plug. yes, i could cram a plug, PS2/USB converter, and USB hub and teensy adapter into my jumbo keyboard case, and finally run a single USB out of the case - but it would be better if i could just go from bare lead on trackpoint to bare lead on teensy. hasu included this feature with his origional code, but last i heard he had not used it in a while - but i don't think he is a trackpoint fan.
Are you sure? I'd only spotted the Mouse Keys ("You can emulates mouse move and button click using keyboard"), and I recall him saying he didn't really find it as useful as he thought it would be.

I know it would be better for you, but you'll need to get a bunch more people to ask for it because it would be quite a lot of work for me! :evilgeek:

User avatar
wcass

27 Oct 2012, 01:43

https://github.com/tmk/tmk_keyboard - Features section, 5th bullet item.
if you have a copy of his code, look for ps2_mouse.c and ps2_mouse.h and maybe usb_mouse.c and h

i dreamt up the idea for the 92key+trackball after reading his feature set but i don't have the programming skill to actually use it (i tried!). i did not have any problems building and customizing your code though and used it for 3 keyboards now.

User avatar
Soarer

27 Oct 2012, 03:12

Ah, so it does :oops:

User avatar
hasu

27 Oct 2012, 10:54

I'm a fan of trackpoint, sure :) But it is very difficult to integrate it into my favorite keyboard(HHKB/Poker) mainly because of keycap/case/PCB moding work. If you can use Trackpoint unit with PS/2 interface electrical or firmware part is not big problem. Also, we can obtain detail specification of Trackpoint extension commands to support exotic Trackpoint functions.

I'm currently happy with mousekey as main pointing device and living without real mouse most of the time except for funcy GUI apps. Mousekey is not complete replacement for real mouse, though, it is comfortable to do pointing job without leting my hand leave from keyboard. To be honest, I occasionally use physical mouse unintentionally if it is placed on side of keyboard.

User avatar
Icarium

27 Oct 2012, 17:32

Actually there is another good reason for putting PS/2 through the Teensy but I haven't tried it yet. I would like to
1. be able to flip the coordinates on the trackpoint to have that option for mounting it
2. be able to map the motion to scrolling using a modifier

but I have no idea how much strain that would put on the Teensy and whether it is doable.

User avatar
Soarer

27 Oct 2012, 22:05

I might pencil it in for v2.0 :P

It sounds like quite a lot of work to do it nicely - detect pointer device type, utilize trackpoint commands if trackpoint, deal with extra buttons / wheels (which are presumably not standardized on PS/2), add some config commands... and all of that after adding a mouse endpoint with all the bells and whistles so everything can be output, mousekeys for testing that, and optimizing my PS/2 code so that two of it can run at once. Not to mention a real risk of introducing bugs into code that's been pretty well tested by now, and dealing with them :lol:

User avatar
suka
frobiac

29 Oct 2012, 07:19

Icarium wrote:I would like to
1. be able to flip the coordinates on the trackpoint to have that option for mounting it
2. be able to map the motion to scrolling using a modifier
but I have no idea how much strain that would put on the Teensy and whether it is doable.
I have used exactly such a setup in my custom board for the last couple of months, and it has been reliable and very responsive, so the Teensy is definitely capable of handling PS/2 in addition to the general keyboard functions. Implementation of these two features is also fairly trivial if you start with some established PS/2 code. And the trackpoint specifics are not that hard to implement thanks to the great reference manual of IBM that was already mentioned - that's where I got the idea to use press-to-select as a scrolling modifier from in the first place :D

User avatar
Soarer

29 Oct 2012, 13:50

Heh, I'm not saying it would be hard, just that it would take time :D

And I don't even have a trackpoint module!

To match the ethos of my keyboard code, I'd want it to handle most different PS/2 pointing devices without recompilation. That takes more effort, but allows people to do just a little DIY and get stuff working without having to learn how to compile and tweak the source code.

User avatar
fossala
Elite +1

29 Oct 2012, 21:18

I've got a teensy coming for a 122 key terminal M. What would be the best way to connect it inside the case? Should I strip the wire or just remove the wire completely? What pins/wires are which?

User avatar
wcass

29 Oct 2012, 22:59

fossala wrote:I've got a teensy coming for a 122 key terminal M. What would be the best way to connect it inside the case? Should I strip the wire or just remove the wire completely? What pins/wires are which?
I installed a teensy inside the case of my keyboard. i'll post pictures of how i did it when i get home.
Icarium wrote:Actually there is another good reason for putting PS/2 through the Teensy but I haven't tried it yet. I would like to
1. be able to flip the coordinates on the trackpoint to have that option for mounting it
Soarer wrote:To match the ethos of my keyboard code, I'd want it to handle most different PS/2 pointing devices without recompilation. That takes more effort, but allows people to do just a little DIY and get stuff working without having to learn how to compile and tweak the source code.
i would like this too. i am making a trackball out of a generic mouse, so one axis needs to be swapped. i could do it through a modified driver, but would prefer to use native drivers and be plug and play. the mouse buttons will be unused and instead i will be using regular keyboard keys.

User avatar
wcass

30 Oct 2012, 05:02

fossala wrote:I've got a teensy coming for a 122 key terminal M. What would be the best way to connect it inside the case? Should I strip the wire or just remove the wire completely? What pins/wires are which?
This is what i did and it has worked very well for me. You will need a 6' USB A-to-miniB cable. I just use old cell phone cables.

1. Cut the wire about 6” from the case.
2. Disassemble the case. The wire might be a bit tight – if so, lift the plastic piece around the grommet straight up while holding the cable and grommet down. The grommet should slide out the bottom of the plastic piece. Remove the wires from the controller. You might need to temporarily remove a mounting screw.
cut_cable.JPG
cut_cable.JPG (189.08 KiB) Viewed 11493 times
3. Pull the wires free of the wire casing if they come easily. Use a razor to slice the rubber grommet on one of the long sides (top or bottom). Slice all the way to the wire casing. Open the slice and pull the wire casing off of the grommet. Slide your USB cable into the grommet and check the fit. You may want to ream the hole to improve the fit.
cut_gromet.JPG
cut_gromet.JPG (208.13 KiB) Viewed 11493 times
move_gromet.JPG
move_gromet.JPG (187.77 KiB) Viewed 11493 times
fit_gromet.JPG
fit_gromet.JPG (136.67 KiB) Viewed 11493 times
fit_gromet2.JPG
fit_gromet2.JPG (139.02 KiB) Viewed 11493 times
4. Using the wires pulled free from the casing, attach as follows: black=VCC, white=GND, red=PD0, yellow=PD1. I prefer to use the VCC and GND from the pins furthest away from the USB port for this. I also like a caps-lock LED so I make a connection to GND and PF5. I feed the LED to a light pipe that replaces one of the rivets directly below the caps-lock key. Wrap the Teensy with electrical tape.
teensy.JPG
teensy.JPG (186.62 KiB) Viewed 11493 times
5. Attack the plug to the pins and USB cable and reassemble the case.
teensy2.JPG
teensy2.JPG (203.31 KiB) Viewed 11493 times
tssk_drawer.JPG
tssk_drawer.JPG (132.7 KiB) Viewed 11493 times

User avatar
fossala
Elite +1

30 Oct 2012, 07:38

Looks good, lots of good info. I'll take mine apart and look at it later. I can see from looking at the back that it doesn't have a grommet though.

User avatar
Soarer

30 Oct 2012, 15:14

That's excellent, wcass!

I'll just add my usual caveat about not trusting the wire colours - check that yours has them going to the same pins on the connector!

If you don't want to hack at the original cable you could try and find a connector to fit, or solder to the connector's solder pads on the back of the PCB (if you're confident with your soldering).

User avatar
fossala
Elite +1

08 Nov 2012, 09:04

OK, the teensy turned up yesterday. I've stripped the wires ready for doing the soldering at the weekend. When I load the code is all that I need to load is the hexfiles? I then use scas to assemble the config file and then load it using scwr? Do I need to load a config file for it to work or can I just use the hexfile and get a basic working converter?

JBert

08 Nov 2012, 10:21

It should work fine without a config loaded. Only when you got some ancient keyboard like a model F PC / terminal keyboard will it be needed to get some keys like Print Screen or Break to work.

The config file is mostly used for macros, function layers or to remap e.g. caps lock to control.

User avatar
Soarer

08 Nov 2012, 13:50

Indeed; config files are just tweaks to the default mappings (one for each scan code set) that are built into the hex files.

User avatar
Vierax

10 Nov 2012, 10:14

Hello, just a noob in C (in Python too but work in progress for both…) so I might missunderstand the code.

I was just wondering if with this code the Teensy still sends keycodes or characters?
With appropriate drivers, a keyboard can have any layout like Neo, bépo… but not directly in hard except for the US qwerty dvorak colemak and workman which are ASCII, am I right ? (It sounds obvious to me and it's just to be sure)

I saw only the 4 modifiers but is it possible to add a key and make a "Fn" layout in hard with a Teensy ? If yes, by passing through the serial I suppose, or may be sacrificing the CJK modifier keys as Henkan, Muhekan ?

thx for replies :)

User avatar
fossala
Elite +1

10 Nov 2012, 11:33

All up and running, typing this with it now. Thanks for your hard work. Sure there will be more questions once I try and play with layouts.

User avatar
Soarer

10 Nov 2012, 12:34

It still sends keycodes, so yes, the sensible layouts to do in hardware are those which are mainly key-swapping (colemak etc). Macros can do a lot more than key-swapping of course, but it would require so many of them for something like bépo that a driver on the host makes a lot more sense.

You can define up to 8 keys as Fn keys, giving a theoretical total of 255 extra layers! You'd run out of memory long before that though (both your own and the converter's :lol: ). There's three parts to defining a layer, this example is in the configs directory:

Code: Select all

# basic layer example - cursors on r.h. home position when caps lock is held

# define that FN1 accesses layer 1
layerblock
	FN1 1
	FN2 1		# in case FN2 is used as well, define it as an alternative
	FN1 FN2 1	# both together still gets layer 1
endblock

# the layer itself is just some remaps tagged with the layer number
remapblock
layer 1
	I UP
	J LEFT
	K DOWN
	L RIGHT
endblock

# need to map the FN key into the base layer (0)
remapblock
layer 0
	CAPS_LOCK FN1
endblock
That's actually a bit inconsistent, because I've defined what happens with FN2 as well as FN1, but I haven't defined a FN2. The last remapblock could be replaced by this one to use the Windows keys as FN keys:

Code: Select all

# need to map FN keys into the base layer (0)
remapblock
layer 0
	LGUI FN1
	RGUI FN2
endblock

User avatar
Vierax

11 Nov 2012, 06:46

Oh yeah macros, that's clever ! You just need a referential layout who can handle the whole signs as « ¨+u=ü » (seems not so easy to find this pearl) or to display the unicode shortcut but it sounds difficult as different OS have different Unicode shortcuts and this kb is useless during POST and terminal sessions :/

255 Fn layers ! Oo Well, it's better to think larger to provide any request but it's a way too much here :D

Thx for the code, that's pretty clear. Now this part of the program doesn't seems difficult :)

User avatar
Soarer

11 Nov 2012, 12:28

Hmm, true, and being OS specific would make it a bit pointless really, unless you weren't allowed to install a keyboard layout on the OS.

255 layers just follows from the method of implementation... I wanted to allow using 4 layers, and having left and right Fn keys for each. So that's 8 Fn keys, which could be 255 layers, but is far more likely to be 4 :lol:

User avatar
Vierax

12 Nov 2012, 05:26

Yes the simplest way seems to have hard dvorak and colemak and combining the hard qwerty with a layout driver. With a soft like PKL, you don't have to be admin to use an exotic layout on Windows, and on Linux you can add one in your home repository. For MacOS or BSD I have no idea but may be it's the same than Linux as they're part of Unix family.

For the 255 hypothetic layers, I followed you in the calculation ;) I think that 4 layers layout is ever well enough, after more than 6 (Neo) it seems to be hard to remember (as you said)

I should go back to my C learning lessons now :)

Post Reply

Return to “Workshop”