mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 09:01:54 +08:00
win95 runtime switching
This commit is contained in:
@@ -102,6 +102,8 @@ static void _initOutputs() {
|
||||
outputs |= PROTO::OUTPUTS1::MOUSE::USB_REL;
|
||||
# elif defined(HID_WITH_PS2) && defined(HID_SET_PS2_MOUSE)
|
||||
outputs |= PROTO::OUTPUTS1::MOUSE::PS2;
|
||||
# elif defined(HID_WITH_USB) && defined(HID_WITH_USB_WIN98) && defined(HID_SET_USB_MOUSE_WIN98)
|
||||
outputs |= PROTO::OUTPUTS1::MOUSE::USB_WIN98;
|
||||
# endif
|
||||
|
||||
# ifdef HID_DYNAMIC
|
||||
@@ -122,7 +124,8 @@ static void _initOutputs() {
|
||||
uint8_t mouse = outputs & PROTO::OUTPUTS1::MOUSE::MASK;
|
||||
switch (mouse) {
|
||||
# ifdef HID_WITH_USB
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_ABS: _usb_mouse_abs = new UsbMouseAbsolute(); break;
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_ABS:
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_WIN98: _usb_mouse_abs = new UsbMouseAbsolute(); break;
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_REL: _usb_mouse_rel = new UsbMouseRelative(); break;
|
||||
# endif
|
||||
}
|
||||
@@ -140,7 +143,12 @@ static void _initOutputs() {
|
||||
|
||||
switch (mouse) {
|
||||
# ifdef HID_WITH_USB
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_ABS: _usb_mouse_abs->begin(); break;
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_ABS:
|
||||
# ifdef HID_WITH_USB_WIN98
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_WIN98:
|
||||
# endif
|
||||
_usb_mouse_abs->begin(mouse == PROTO::OUTPUTS1::MOUSE::USB_WIN98);
|
||||
break;
|
||||
case PROTO::OUTPUTS1::MOUSE::USB_REL: _usb_mouse_rel->begin(); break;
|
||||
# endif
|
||||
}
|
||||
@@ -286,7 +294,11 @@ static void _sendResponse(uint8_t code) {
|
||||
}
|
||||
if (_usb_mouse_abs) {
|
||||
response[1] |= _usb_mouse_abs->getOfflineAs(PROTO::PONG::MOUSE_OFFLINE);
|
||||
response[2] |= PROTO::OUTPUTS1::MOUSE::USB_ABS;
|
||||
if (_usb_mouse_abs->isWin98FixEnabled()) {
|
||||
response[2] |= PROTO::OUTPUTS1::MOUSE::USB_WIN98;
|
||||
} else {
|
||||
response[2] |= PROTO::OUTPUTS1::MOUSE::USB_ABS;
|
||||
}
|
||||
} else if (_usb_mouse_rel) {
|
||||
response[1] |= _usb_mouse_rel->getOfflineAs(PROTO::PONG::MOUSE_OFFLINE);
|
||||
response[2] |= PROTO::OUTPUTS1::MOUSE::USB_REL;
|
||||
@@ -299,6 +311,9 @@ static void _sendResponse(uint8_t code) {
|
||||
# endif
|
||||
# ifdef HID_WITH_USB
|
||||
response[3] |= PROTO::OUTPUTS2::HAS_USB;
|
||||
# ifdef HID_WITH_USB_WIN98
|
||||
response[3] |= PROTO::OUTPUTS2::HAS_USB_WIN98;
|
||||
# endif
|
||||
# endif
|
||||
# ifdef HID_WITH_PS2
|
||||
response[3] |= PROTO::OUTPUTS2::HAS_PS2;
|
||||
|
||||
@@ -53,18 +53,20 @@ namespace PROTO {
|
||||
const uint8_t PS2 = 0b00000011;
|
||||
};
|
||||
namespace MOUSE {
|
||||
const uint8_t MASK = 0b00111000;
|
||||
const uint8_t USB_ABS = 0b00001000;
|
||||
const uint8_t USB_REL = 0b00010000;
|
||||
const uint8_t PS2 = 0b00011000;
|
||||
const uint8_t MASK = 0b00111000;
|
||||
const uint8_t USB_ABS = 0b00001000;
|
||||
const uint8_t USB_REL = 0b00010000;
|
||||
const uint8_t PS2 = 0b00011000;
|
||||
const uint8_t USB_WIN98 = 0b00100000;
|
||||
};
|
||||
};
|
||||
|
||||
namespace OUTPUTS2 { // Complex response
|
||||
const uint8_t CONNECTABLE = 0b10000000;
|
||||
const uint8_t CONNECTED = 0b01000000;
|
||||
const uint8_t HAS_USB = 0b00000001;
|
||||
const uint8_t HAS_PS2 = 0b00000010;
|
||||
const uint8_t CONNECTABLE = 0b10000000;
|
||||
const uint8_t CONNECTED = 0b01000000;
|
||||
const uint8_t HAS_USB = 0b00000001;
|
||||
const uint8_t HAS_PS2 = 0b00000010;
|
||||
const uint8_t HAS_USB_WIN98 = 0b00000100;
|
||||
}
|
||||
|
||||
namespace CMD {
|
||||
|
||||
@@ -149,11 +149,13 @@ class UsbMouseAbsolute {
|
||||
public:
|
||||
UsbMouseAbsolute() {}
|
||||
|
||||
void begin() {
|
||||
void begin(bool win98_fix) {
|
||||
_mouse.begin();
|
||||
#ifdef HID_USB_ABS_WIN98_FIX
|
||||
_mouse.setWin98Fix(true);
|
||||
#endif
|
||||
_mouse.setWin98FixEnabled(win98_fix);
|
||||
}
|
||||
|
||||
bool isWin98FixEnabled() {
|
||||
return _mouse.isWin98FixEnabled();
|
||||
}
|
||||
|
||||
void clear() {
|
||||
|
||||
Reference in New Issue
Block a user