martypc icon indicating copy to clipboard operation
martypc copied to clipboard

Serial mouse in macOS

Open Vutshi opened this issue 1 year ago • 14 comments

Describe the bug I attempted to use the mouse in MartyPC while running ELKS, following the provided instructions. However, the mouse does not work.

In QEMU, running the same ELKS setup, the mouse functions correctly.

To Reproduce I added the following overlays to the standard configuration file martypc.toml:

config_overlays = [ "ibm_ega",
                    "pcxt_2_serial_ports",
                    "microsoft_serial_mouse"]

Expected behavior Working mouse

Environment (please complete the following information):

  • macOS 15.3.2
  • MacBook trackpad is the physical mouse

Build info

  • Built from source a05a41f6a1b0b735a2ae277fc8100834f3cab80e

Thanks!

Vutshi avatar Mar 27 '25 12:03 Vutshi

That commit is a year old, can you try using the current main?

If that still doesn't work, can you provide instructions on how to use the mouse with ELKS? What version of ELKS are you using? Can you provide the VHD?

dbalsom avatar Mar 27 '25 12:03 dbalsom

That commit is a year old, can you try using the current main?

Holly shit! I have messed up some git magic. Now I am on the current commit and get the following compilation error:

Compiling display_backend_trait v0.4.0 (/Users/x2241064/Install/8088/martypc/crates/lib/backend/display_backend_trait)
error[E0554]: `#![feature]` may not be used on the stable release channel
  --> crates/lib/backend/display_backend_trait/src/lib.rs:46:1
   |
46 | #![feature(trait_alias)]
   | ^^^^^^^^^^^^^^^^^^^^^^^^

For more information about this error, try `rustc --explain E0554`.
error: could not compile `display_backend_trait` (lib) due to 1 previous error
warning: build failed, waiting for other jobs to finish...

My Rust is rustc 1.85.1 (4eb161250 2025-03-15)

Vutshi avatar Mar 27 '25 13:03 Vutshi

You need to switch to nightly rustup default nightly

dbalsom avatar Mar 27 '25 13:03 dbalsom

You need to switch to nightly rustup default nightly

Done.

Now it is compiled but it has lost its configuration file somehow:

Running `target/release/martypc`
[2025-03-27T13:23:22Z ERROR martypc_eframe::app] Failed to build emulator: Configuration file './martypc.toml' could not be found

thread 'main' panicked at /Users/x2241064/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/winit-0.30.8/src/platform_impl/macos/event_loop.rs:227:13:
`winit` requires control over the principal class. You must create the event loop before other parts of your application initialize NSApplication

The file is where it has always been.

Vutshi avatar Mar 27 '25 13:03 Vutshi

Oh, found it. Now I have to execute cargo run -r from the install folder

Vutshi avatar Mar 27 '25 13:03 Vutshi

Alright, I’ve got MartyPC running now. It indicates that the mouse is captured—and it really is, since I can’t move it outside of MartyPC. However, it doesn’t actually move the cursor in the ELKS app.

It also says to click the middle button to release, but on a MacBook trackpad, I have no idea where the middle button is… so I end up having to kill MartyPC :)

Vutshi avatar Mar 27 '25 13:03 Vutshi

It works!!!

I just had to switch it to port 0 apparently ELKS expects it there.

Vutshi avatar Mar 27 '25 13:03 Vutshi

Cool, thanks for checking.

dbalsom avatar Mar 27 '25 13:03 dbalsom

So, can we have an alternative way of releasing mouse?

Vutshi avatar Mar 27 '25 13:03 Vutshi

So, can we have an alternative way of releasing mouse?

What would you suggest?

dbalsom avatar Mar 27 '25 13:03 dbalsom

What would you suggest?

How about Ctrl+Alt+G as in QEMU.

Btw, here is how it works https://github.com/ghaerr/elks/issues/2269#issuecomment-2758187835

Vutshi avatar Mar 27 '25 14:03 Vutshi

What would you suggest?

How about Ctrl+Alt+G as in QEMU.

You can customize the mouse capture toggle hotkey

hotkeys = [
    { event = "CaptureMouse", keys = ["ControlLeft", "F10"], scope = "Any", capture_disable = false },

Change the keys array to ["ControlLeft", "AltLeft", "KeyG"]

Btw, here is how it works ghaerr/elks#2269 (comment)

You can try MartyPC's VGA emulation, although it is very incomplete.

dbalsom avatar Mar 27 '25 14:03 dbalsom

hotkeys = [
    { event = "CaptureMouse", keys = ["ControlLeft", "F10"], scope = "Any", capture_disable = false },

This actually works very well, I didn't know about it. I like how QEMU tells you how to release mouse in the title bar:

Image

It helps a poor user to get his mouse back without reading the configuration files :)

Vutshi avatar Mar 27 '25 14:03 Vutshi

I do plan to have something like that, but it's tricky since the hotkey is customizable.

If you'd like to join the discord you can ask questions about things and see development progress https://discord.gg/8Gv7mVz4CC

dbalsom avatar Mar 27 '25 14:03 dbalsom