aboutsummaryrefslogtreecommitdiff
path: root/int15ps2.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-04-18 22:13:00 +0200
committerJavier <dev.git@javispedro.com>2022-04-18 22:13:00 +0200
commitb9396bdeff4588762ab017cb3446910a2684b380 (patch)
treea43e4647125e52e02507127043b62bcb3f59c3c3 /int15ps2.h
parent3da9d4d5eff694e7e91116a693f328c289fc82f6 (diff)
downloadvbados-b9396bdeff4588762ab017cb3446910a2684b380.tar.gz
vbados-b9396bdeff4588762ab017cb3446910a2684b380.zip
switch mouse driver to always use 1-byte packets from BIOS
Diffstat (limited to 'int15ps2.h')
-rw-r--r--int15ps2.h13
1 files changed, 5 insertions, 8 deletions
diff --git a/int15ps2.h b/int15ps2.h
index 6b6c415..cce254d 100644
--- a/int15ps2.h
+++ b/int15ps2.h
@@ -63,6 +63,7 @@ enum ps2m_device_ids {
PS2M_DEVICE_ID_IMEX_HORZ = 5
};
+/** Valid PS/2 mouse resolutions in DPI. */
enum ps2m_resolution {
PS2M_RESOLUTION_25 = 0,
PS2M_RESOLUTION_50 = 1,
@@ -70,6 +71,7 @@ enum ps2m_resolution {
PS2M_RESOLUTION_200 = 3
};
+/** Valid PS/2 mouse sampling rates in Hz. */
enum ps2m_sample_rate {
PS2M_SAMPLE_RATE_10 = 0,
PS2M_SAMPLE_RATE_20 = 1,
@@ -197,6 +199,7 @@ static ps2m_err ps2m_enable(bool enable);
__value [ah] \
__modify [ax]
+/** Sends the magic sequence to switch the mouse to the IMPS2 protocol. */
static void ps2m_send_imps2_sequence(void)
{
ps2m_set_sample_rate(PS2M_SAMPLE_RATE_200);
@@ -204,21 +207,15 @@ static void ps2m_send_imps2_sequence(void)
ps2m_set_sample_rate(PS2M_SAMPLE_RATE_80);
}
+/** Detects whether we have a IMPS2 mouse with wheel support. */
static bool ps2m_detect_wheel(void)
{
int err;
uint8_t device_id;
- // Switch to the 4-byte packet and reset the mouse.
- // We are not supposed to receive messages at this time anyway.
- err = ps2m_init(PS2M_PACKET_SIZE_EXT);
- if (err) {
- return false;
- }
-
// Get the initial mouse device id
err = ps2m_get_device_id(&device_id);
- if (err || device_id != 0) {
+ if (err || device_id != PS2M_DEVICE_ID_PLAIN) {
// TODO : Likely have to accept more device_ids here.
return false;
}