Direct port access, wheel mouse support and other changes#12
Direct port access, wheel mouse support and other changes#12sweetlilmre wants to merge 13 commits into
Conversation
…ed wheel mouse mode. Deprecated streaming mode toggle via jumper (wheel mode replaces this)
* Refactored init sequence (PS2, then serial on RTS signal) Refactored Ps2Mouse to bring all Impl related functions, structs and enums into the class definition. Upated README.md to indicate jumper change. * updated comment about wheel mouse support in ctmouse driver * fixit serial message logic * updated README.md with better wording * added parity check to Ps2 code
|
I've removed the KVM hack and done some additional refactoring, specifically around the init sequence. The changes look quite broad in Ps2Mouse.cpp but are mainly moving the impl functionality into the class, actual logic hasn't changed. |
Interrupt impl
|
Moved mouse handling to interrupt based code. |
|
I want to mention I moved my board over to this PR, and it worked for me. I have a D-link DKVM-8E, on main branch it seems to crash after a few seconds going through the KVM; with this PR it works perfectly. My only small issue is it has a Platform.IO configuration for a bigger Arduino, the one I have is from this kit (https://www.ebay.com/itm/135150815235), and that one is a pro16MHzatmega168. But that is more of a personal thing. (Thank you for getting the platform.io config setup!) |
|
I'm glad this worked for you. I have done some additional work in my fork on another branch, but haven't been back to the code for a while. https://github.com/sweetlilmre/ps2-serial-mouse-adapter/tree/serial_mouse I'll have a look at adding in the atmega168 configuration, I just don't have one to test on. |
|
I posted about it (https://buildingtents.com/2025/03/30/ps-2-to-rs-232-serial-mouse-converter/) and was talking to this (https://www.ebay.com/itm/135150815235) fine ebay seller about it. He sells kits, thats how I got going here, for this and sells it with the atmega168, easy change in the config. Our big question is, is this repo still maintained, it hasnt seen any updates in 2+ years. It would be great to centralize efforts here, but if this repo is basically archived, then figuring out which fork is the new main would be useful. Thanks for your work @sweetlilmre and @necroware ! |
|
I also put together a little guide on how to get started which I am happy to commit into a mark down file here or another repo that is the main one. |
|
A guide would be great, but you have a good point, where to put it? I was hoping to consolidate to a single repo, preferably the original one by @necroware. The 2 interrupts servicing the PS2 and Serial comms in my code are (I think) maxing out resources on the poor atmega. I've done what I can to optimise the code, but a small board redesign where the HW serial port of the Arduino handles the serial communications would go a long way to making this more stable, see here at the bottom of the thread: #9 I may try this myself, although I have a million projects and little time to devote to this atm. If you want to add your guide as a PR to my branch, then at least it will be more visible? Nice post by the way, top job! |
Hi,
I've spent some time refactoring the code to use direct port writes, initially based on this fork: https://github.com/morphinejh/ps2-serial-mouse-adapter
This has significantly sped up streaming mode to the point where it seems to be reliable and is now the only mode used in the code. In addition I have added wheel mouse support (tested and working with cutemouse) and an experimental hack to work around a KVM issue reported by the user that created the fork above.
As streaming mode is now used, I have repurposed the jumper as an enabler for wheel mode (I have updated the documentation accordingly). Additionally I have made changes to the code to disable / enable data reporting before / after sending commands to the mouse as per this document: https://isdaman.com/alsos/hardware/mouse/ps2interface.htm
I would like to get your thoughts and feedback on the changes.
Thank you for this excellent adapter.