mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
win95 runtime switching
This commit is contained in:
@@ -7,7 +7,7 @@ platform = atmelavr
|
||||
board = micro
|
||||
framework = arduino
|
||||
lib_deps =
|
||||
git+https://github.com/mdevaev/HID#f12b7d633f7437552707d6ccd411204cf36601f2
|
||||
git+https://github.com/mdevaev/HID#a8877bc878a1a2f39d993a3defa750b6ec1b2ee0
|
||||
git+https://github.com/Harvie/ps2dev#v0.0.3
|
||||
digitalWriteFast@1.0.0
|
||||
extra_scripts =
|
||||
@@ -25,7 +25,7 @@ build_flags =
|
||||
-DHID_SET_USB_KBD
|
||||
-DHID_SET_USB_MOUSE_ABS
|
||||
# ----- The USB ABS fix for Windows 98 (https://github.com/pikvm/pikvm/issues/159) -----
|
||||
# -DHID_USB_ABS_WIN98_FIX
|
||||
# -DHID_WITH_USB_WIN98
|
||||
# ----- PS2 keyboard only -----
|
||||
# -DHID_WITH_PS2
|
||||
# -DHID_SET_PS2_KBD
|
||||
|
||||
@@ -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