aboutsummaryrefslogtreecommitdiff
path: root/mousmain.c
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2024-05-19 21:03:50 +0200
committerJavier <dev.git@javispedro.com>2024-05-19 21:03:50 +0200
commit4a8fe8127c57b0953e2ba2ad4da5e45a20300645 (patch)
tree60eacf9089c2883bc78b3fc8bf22dc1a7c456031 /mousmain.c
parentdfa929d625028dae01c8317823f210a3b056c385 (diff)
downloadvbados-4a8fe8127c57b0953e2ba2ad4da5e45a20300645.tar.gz
vbados-4a8fe8127c57b0953e2ba2ad4da5e45a20300645.zip
add initial support for 2nd wheel & 4-5 mouse buttons
Diffstat (limited to 'mousmain.c')
-rw-r--r--mousmain.c21
1 files changed, 12 insertions, 9 deletions
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