Skip to content

Commit e85b0d3

Browse files
committed
touchpad: Also print HID descriptor version
On Windows you can read it using HidD_GetAttributes. The Linux kernel does not expose this. Signed-off-by: Daniel Schaefer <[email protected]>
1 parent de3fd04 commit e85b0d3

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

framework_lib/src/touchpad.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ pub fn print_touchpad_fw_ver() -> Result<(), HidError> {
3636
let vid = dev_info.vendor_id();
3737
let pid = dev_info.product_id();
3838
let usage_page = dev_info.usage_page();
39+
let hid_ver = dev_info.release_number();
3940

4041
debug!(
4142
" Found {:04X}:{:04X} (Usage Page {:04X})",
@@ -58,13 +59,24 @@ pub fn print_touchpad_fw_ver() -> Result<(), HidError> {
5859

5960
println!("Touchpad");
6061
println!(" IC Type: {:04X}", pid);
62+
6163
let ver = match pid {
6264
0x0239 => format!("{:04X}", read_239_ver(&device)?),
6365
0x0274 => format!("{:04X}", read_274_ver(&device)?),
6466
_ => "Unsupported".to_string(),
6567
};
6668
println!(" Firmware Version: v{}", ver);
6769

70+
// Linux does not expose a useful version number for I2C HID devices
71+
#[cfg(target_os = "linux")]
72+
debug!(" HID Version {:04X}", hid_ver);
73+
#[cfg(not(target_os = "linux"))]
74+
if ver != format!("{:04X}", hid_ver) {
75+
println!(" HID Version v{:04X}", hid_ver);
76+
} else if log_enabled!(Level::Debug) {
77+
println!(" HID Version v{:04X}", hid_ver);
78+
}
79+
6880
// If we found one, there's no need to look for more
6981
return Ok(());
7082
}

0 commit comments

Comments
 (0)