Finished the merging of all three Microsoft/Logitech-style serial mouse types into one single device.

This commit is contained in:
OBattler
2018-01-26 13:50:09 +01:00
parent 65438d5271
commit 37871965a2
3 changed files with 38 additions and 59 deletions

View File

@@ -11,7 +11,7 @@
* TODO: Add the Genius bus- and serial mouse.
* Remove the '3-button' flag from mouse types.
*
* Version: @(#)mouse.c 1.0.19 2018/01/26
* Version: @(#)mouse.c 1.0.20 2018/01/26
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -67,8 +67,6 @@ static mouse_t mouse_devices[] = {
#endif
{ "mssystems", &mouse_mssystems_device },
{ "msserial", &mouse_msserial_device },
{ "lserial", &mouse_lserial_device },
{ "mswheel", &mouse_mswheel_device },
{ "ps2", &mouse_ps2_device },
{ NULL, NULL }
};

View File

@@ -8,7 +8,7 @@
*
* Definitions for the mouse driver.
*
* Version: @(#)mouse.h 1.0.12 2018/01/26
* Version: @(#)mouse.h 1.0.13 2018/01/26
*
* Authors: Miran Grca, <mgrca8@gmail.com>
* Fred N. van Kempen, <decwiz@yahoo.com>
@@ -54,8 +54,6 @@ extern device_t mouse_genibus_device;
#endif
extern device_t mouse_mssystems_device;
extern device_t mouse_msserial_device;
extern device_t mouse_lserial_device;
extern device_t mouse_mswheel_device;
extern device_t mouse_ps2_device;
#endif

View File

@@ -10,7 +10,7 @@
*
* TODO: Add the Genius Serial Mouse.
*
* Version: @(#)mouse_serial.c 1.0.19 2018/01/12
* Version: @(#)mouse_serial.c 1.0.20 2018/01/25
*
* Author: Fred N. van Kempen, <decwiz@yahoo.com>
*/
@@ -138,31 +138,7 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
break;
case MOUSE_TYPE_MICROSOFT:
buff[0] = 0x40;
buff[0] |= (((y >> 6) & 0x03) << 2);
buff[0] |= ((x >> 6) & 0x03);
if (b & 0x01) buff[0] |= 0x20;
if (b & 0x02) buff[0] |= 0x10;
buff[1] = x & 0x3F;
buff[2] = y & 0x3F;
len = 3;
break;
case MOUSE_TYPE_LOGITECH:
buff[0] = 0x40;
buff[0] |= (((y >> 6) & 0x03) << 2);
buff[0] |= ((x >> 6) & 0x03);
if (b & 0x01) buff[0] |= 0x20;
if (b & 0x02) buff[0] |= 0x10;
buff[1] = x & 0x3F;
buff[2] = y & 0x3F;
len = 3;
if (b & 0x04) {
buff[3] = 0x20;
len++;
}
break;
case MOUSE_TYPE_MSWHEEL:
buff[0] = 0x40;
buff[0] |= (((y >> 6) & 0x03) << 2);
@@ -171,11 +147,20 @@ sermouse_poll(int x, int y, int z, int b, void *priv)
if (b & 0x02) buff[0] |= 0x10;
buff[1] = x & 0x3F;
buff[2] = y & 0x3F;
buff[3] = z & 0x0F;
if (b & 0x04)
buff[3] |= 0x10;
len = 4;
if (dev->type == MOUSE_TYPE_LOGITECH) {
len = 3;
if (b & 0x04) {
buff[3] = 0x20;
len++;
}
} else if (dev->type == MOUSE_TYPE_MSWHEEL) {
len = 4;
buff[3] = z & 0x0F;
if (b & 0x04)
buff[3] |= 0x10;
} else
len = 3;
break;
}
#if 0
@@ -219,13 +204,29 @@ sermouse_init(device_t *info)
dev = (mouse_t *)malloc(sizeof(mouse_t));
memset(dev, 0x00, sizeof(mouse_t));
dev->name = info->name;
dev->type = info->local;
dev->port = device_get_config_int("port");
i = device_get_config_int("buttons");
if (i > 2)
dev->flags |= FLAG_3BTN;
if (info->local == MOUSE_TYPE_MSYSTEMS)
dev->type = info->local;
else {
switch(i) {
case 2:
default:
dev->type = MOUSE_TYPE_MICROSOFT;
break;
case 3:
dev->type = MOUSE_TYPE_LOGITECH;
break;
case 4:
dev->type = MOUSE_TYPE_MSWHEEL;
break;
}
}
dev->port = device_get_config_int("port");
/* Attach a serial port to the mouse. */
if (dev->port == 0)
dev->serial = &serial1;
@@ -292,27 +293,9 @@ device_t mouse_mssystems_device = {
};
device_t mouse_msserial_device = {
"Microsoft Serial Mouse",
"Microsoft/Logitech Serial Mouse",
0,
0,
MOUSE_TYPE_MICROSOFT,
sermouse_init, sermouse_close, NULL,
sermouse_poll, NULL, NULL, NULL,
sermouse_config
};
device_t mouse_lserial_device = {
"Logitech Serial Mouse",
0,
MOUSE_TYPE_LOGITECH,
sermouse_init, sermouse_close, NULL,
sermouse_poll, NULL, NULL, NULL,
sermouse_config
};
device_t mouse_mswheel_device = {
"Microsoft Serial Wheel Mouse",
0,
MOUSE_TYPE_MSWHEEL,
sermouse_init, sermouse_close, NULL,
sermouse_poll, NULL, NULL, NULL,
sermouse_config