Conversation
|
The ELKS Using The Nano-X mouse driver has also been updated to automatically use the /dev/psaux port when MOUSE_TYPE=ps2. It already supported PS/2 mice so the rest of that driver is unchanged. |
|
Wow, I think my modernish Thinkpad trackpad is PS2! I might be able to test this in real hardware. I'll double check |
|
Hello @ghaerr I have tried fd1440-fat.img on FabGL/PCEmulator with PS2 mouse, Thank you. |
|
@tyama501 we must be sure that FabGL/PCEmulator provides / exposes the PS2 hardware (8042 controller) to ELKS. If you ever need a different board: https://www.olimex.com/Products/Retro-Computers/ESP32-SBC-FabGL/open-source-hardware |
|
I just saw that actually @ghaerr improved the driver. I personally am unable to test or work on it for the moment. |
|
Yes, I have used the latest one. |
|
@tyama501 Are you running the standard IBM PC configuration, or PC-98? The /dev/psaux mouse is only compiled in on IBM PC right now. Also, @toncho11 is correct that the PS/2 mouse is actually implemented within the 8042 controller, so that must be emulated as well. To try the PS/2 mouse on other architectures, add #define CONFIG_MOUSE_PS2 in config.h. I can't figure out errno 22 (=EINVAL), the only place that is in the driver is in Also add the line to see the ioctl being sent to mouse driver: You might also check Thank you! |
|
I am using IBM fd1440-fat from github actions. I assume the mouse is attached to the i8042. FabGL/examples/VGA/PCEmulator/machine.cpp at master · fdivitto/FabGL https://share.google/hCzL1IfeS3IEMt5bI It seems it also uses INT. I will the char dev although it is existing. Thank you. |
|
@tyama501 Can you send me a picture of the boot screen? I have tracked down the -EINVAL response on open and it appears it only occurs as the result of the inability for the PS/2 mouse driver to grab IRQ 12 for the mouse. It could be that the emulator thinks your system is PC/XT instead of PX/AT, in which case sys_caps does not have IRQ8TO15 capability. This will show in the "PC/XT class cpu YY" or "PC/AT class CPU YY" line at boot. I would like to know whether your system shows PC/XT, PC/AT and the class cpu YY value. |
|
@tyama501 I'm getting ahead of your test results, but looking at FabGL source it appears they emulate an 8086 CPU (https://github.com/fdivitto/FabGL/blob/master/src/emudevs/i8086.cpp) based on code from 8086tiny. They also emulate two 8259 PICs, enabling the to have interrupts 8-15. Normally, the PC/XT (8086-only) only has a single 8259 PIC, and ELKS assumes if the CPU is < 80286 (i.e. 8086) then the ability to use IRQs 8-15 is not possible. Meanwhile, FabGL also uses IRQ 12 within the 8042 emulation (https://github.com/fdivitto/FabGL/blob/master/src/emudevs/i8042.cpp) for the PS/2 mouse. In order to make this work, we can either change ELKS to always allow IRQs 8-15 even when it finds an 8086 processor, or we could implement a syscaps= option in /bootopts, which would allow overriding the default sys_caps, which is 0 for 8086 and CAPS_ALL for 80286+. What do you think? Here are the system capabilities that now settable at compile-time only in config.h, which override the rule above: |
|
@tyama501, you should be able to test directly from the GitHub Actions downloads from the above PR, which aims to automatically fix this issue on FabGL and other emulators that implement a PS/2 mouse on IRQ 12 while emulating an 8086 CPU. |
|
Thank you! I will test again late this week. |
|
Hello @ghaerr The ps2 mouse on the FabGL worked with the latest https://github.com/ghaerr/elks/actions/runs/21502723483 ELKS_ps2_FabGL.mp4Thank you! |

Requested and discussed in ghaerr/microwindows#109 (comment).
This PR takes @toncho11's initial PS/2 mouse driver and adapts it into the TTY infrastructure in ELKS. The driver is not tested on any real hardware nor emulator. The mouse driver is accessible from /dev/psaux and likely only supports the base 3-byte PS/2 protocol. I have tested the basic operation of the TTY infrastructure around the driver, which works. I doubt the driver works as-is though.
There are likely serious issues with this driver, noted within the source with FIXME comments. These include the following:
These will be further researched by @toncho11 and tested on copy.sh/v86.
For now, the driver is always compiled and included on IBM PC builds by having the CONFIG_MOUSE_PS2 define set in linuxmt/config.h.
There is further work to do in Nano-X and ELKS to automatically access this driver when MOUSE_TYPE=ps2. I will be adding those changes either within this PR or as follow ups. The ELKS
mouseprogram will be included allowing for easier debugging by enabling a user to see mouse activity using ASCII print statements rather than inside a GUI where that is much harder.