diff options
Diffstat (limited to 'int15ps2.h')
-rw-r--r-- | int15ps2.h | 29 |
1 files changed, 29 insertions, 0 deletions
@@ -268,4 +268,33 @@ static bool ps2m_detect_imps2(void) return err == 0 && device_id == PS2M_DEVICE_ID_IMPS2; } +static bool ps2m_detect_imex(void) +{ + int err; + uint8_t device_id; + + // Get the initial mouse device id + err = ps2m_get_device_id(&device_id); + if (err) { + return false; + } + + if (device_id == PS2M_DEVICE_ID_IMEX + || device_id == PS2M_DEVICE_ID_IMEX_HORZ) { + // Already ImEx + return true; + } + + if (device_id != PS2M_DEVICE_ID_IMPS2) { + return false; + } + + // Send the knock sequence to activate the extended packet + ps2m_send_imex_sequence(); + + // Now check if the device id has changed + err = ps2m_get_device_id(&device_id); + return err == 0 && device_id == PS2M_DEVICE_ID_IMEX; +} + #endif /* INT15PS2_H */ |