No0ne / ps2x2pico

USB keyboard/mouse to PS/2 interface converter using a Raspberry Pi Pico
MIT License
196 stars 35 forks source link

Scan code set 3 fully implemented and tested, scan code set 1 added (untested), minor USB fixes #39

Closed bstrobel closed 1 month ago

bstrobel commented 1 month ago

So I think it is time for the pull request. I hope your not shocked by the big changes that I introduced in ps2kb.c but I felt that in order to support the switching of scan code sets and correctly implement their considerable different way of handling certain things would require some refactoring.

I think all three sets are now implemented completely, no functionality is missing. I tested what I could in scs 2 and 3 with my PCs and my SGI O2.

Regarding the USB side of things. There are still bugs that prevent certain devices from working. I"m not sure all of them are related to tinyusb. I tried tinyusb 0.16.0 (latest release) and also their master branch. They are quite active, so I can"t really tell what was what each time I pulled. That's why I switched back to the latest release version.

Regarding the bugs: I found that many modern USB keyboards act as 3 devices and some even as hubs. That's why I changed the values in tusb_config.h to support more hubs and devices. I think we could even go higher to be on the safe side. But I want to check the memory situation first. I also have one keyboard that still doesn't work at all. The behaviour is very strange. All of its events are received as mouse events. The same keyboard works flawlessly under Linux and Windows on my modern PCs.

I also think that there are concurrency problems when events come in very fast. Especially on the mouse side but also on the kb side occur lockups when a lot of events come in. I think there should be also a queue for the communication between the USB call-backs and the ps/2 handling routines. But that is just a thought at the moment. What do you think about it?

I plan to build a Pico debug probe and investigate all of this a bit deeper. I"ll let you know what I found out. I really love this little project and want to make it work 100%. Thanks for starting it!

Bernd

No0ne commented 1 month ago

Looks good at first glance, will dig into this later, thanks!