Open the PTP HID interface of the touchpad. Note: every modern touchpad exposes this interface; only haptic touchpads respond to the feature reports used by `set_haptic_intensity` / `set_click_force`.
()
| 33 | /// exposes this interface; only haptic touchpads respond to the feature |
| 34 | /// reports used by `set_haptic_intensity` / `set_click_force`. |
| 35 | fn open_haptic_touchpad() -> Option<HidDevice> { |
| 36 | let api = HidApi::new().ok()?; |
| 37 | for dev_info in api.device_list() { |
| 38 | if dev_info.usage_page() != TOUCHPAD_USAGE_PAGE || dev_info.usage() != TOUCHPAD_USAGE { |
| 39 | continue; |
| 40 | } |
| 41 | debug!( |
| 42 | " Touchpad candidate {:04X}:{:04X} (Usage Page {:04X}, Usage {:04X})", |
| 43 | dev_info.vendor_id(), |
| 44 | dev_info.product_id(), |
| 45 | dev_info.usage_page(), |
| 46 | dev_info.usage() |
| 47 | ); |
| 48 | if let Ok(device) = dev_info.open_device(&api) { |
| 49 | return Some(device); |
| 50 | } |
| 51 | } |
| 52 | None |
| 53 | } |
| 54 | |
| 55 | // The firmware accepts SET_FEATURE for these reports but doesn't reply |
| 56 | // to GET_FEATURE, so both controls are write-only. |
no test coverage detected