From 4a8fe8127c57b0953e2ba2ad4da5e45a20300645 Mon Sep 17 00:00:00 2001 From: Javier Date: Sun, 19 May 2024 21:03:50 +0200 Subject: add initial support for 2nd wheel & 4-5 mouse buttons --- mousmain.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) (limited to 'mousmain.c') diff --git a/mousmain.c b/mousmain.c index f457adf..7198b56 100644 --- a/mousmain.c +++ b/mousmain.c @@ -36,12 +36,15 @@ static nl_catd cat; #if USE_WHEEL -static void detect_wheel(LPTSRDATA data) +static bool detect_wheel() { // Do a quick check for a mouse wheel here. // The TSR will do its own check when it is reset anyway - if (data->haswheel = ps2m_detect_wheel()) { + if (ps2m_detect_imps2()) { printf(_(1, 0, "Wheel mouse found and enabled\n")); + return true; + } else { + return false; } } @@ -51,20 +54,20 @@ static int set_wheel(LPTSRDATA data, bool enable) data->usewheel = enable; if (data->usewheel) { - detect_wheel(data); - if (!data->haswheel) { + if (detect_wheel()) { fprintf(stderr, _(3, 0, "Could not find PS/2 wheel mouse\n")); } } else { - data->haswheel = false; + // Force num_wheels to 0 even before the next mouse reset + data->num_wheels = 0; } - return 0; +return 0; } static int set_wheel_key(LPTSRDATA data, const char *keyname) { - if (!data->usewheel || !data->haswheel) { + if (!data->usewheel) { fprintf(stderr, _(3, 1, "Wheel not detected or support not enabled\n")); return EXIT_FAILURE; } @@ -249,7 +252,7 @@ static int configure_driver(LPTSRDATA data) dlog_init(); // Check for PS/2 mouse BIOS availability - if ((err = ps2m_init(PS2M_PACKET_SIZE_PLAIN))) { + if ((err = ps2m_init(PS2M_PACKET_SIZE_STD))) { fprintf(stderr, _(3, 8, "Cannot init PS/2 mouse BIOS, err=%d\n"), err); // Can't do anything without PS/2 return err; @@ -260,7 +263,7 @@ static int configure_driver(LPTSRDATA data) data->usewheel = true; data->wheel_up_key = 0; data->wheel_down_key = 0; - detect_wheel(data); + detect_wheel(); // Prints message if wheel found #endif #if USE_INTEGRATION -- cgit v1.2.3