()
| 116 | } |
| 117 | |
| 118 | pub fn print_touchpad_fw_ver() -> Result<(), HidError> { |
| 119 | debug!("Looking for touchpad HID device"); |
| 120 | match HidApi::new() { |
| 121 | Ok(api) => { |
| 122 | for dev_info in api.device_list() { |
| 123 | let vid = dev_info.vendor_id(); |
| 124 | let pid = dev_info.product_id(); |
| 125 | let usage_page = dev_info.usage_page(); |
| 126 | let hid_ver = dev_info.release_number(); |
| 127 | |
| 128 | debug!( |
| 129 | " Found {:04X}:{:04X} (Usage Page {:04X})", |
| 130 | vid, pid, usage_page |
| 131 | ); |
| 132 | if vid != PIX_VID |
| 133 | || (pid != 0x0274 && pid != 0x0239 && pid != 0x0360 && pid != 0x0343) |
| 134 | { |
| 135 | debug!( |
| 136 | " Skipping VID:PID. Expected {:04X}:{:04X}/{:04X}/{:04X}", |
| 137 | PIX_VID, 0x0274, 0x0239, 0x0343 |
| 138 | ); |
| 139 | continue; |
| 140 | } |
| 141 | if usage_page != 0xFF00 { |
| 142 | debug!(" Skipping usage page. Expected {:04X}", 0xFF00); |
| 143 | continue; |
| 144 | } |
| 145 | |
| 146 | debug!(" Found matching touchpad HID device"); |
| 147 | let device = dev_info.open_device(&api).unwrap(); |
| 148 | |
| 149 | println!("Touchpad"); |
| 150 | info!(" IC Type: {:04X}", pid); |
| 151 | |
| 152 | let ver = match pid { |
| 153 | 0x0239 => format!("{:04X}", read_239_ver(&device)?), |
| 154 | 0x0274 => format!("{:04X}", read_274_ver(&device)?), |
| 155 | 0x0343 => format!("{:04X}", read_274_ver(&device)?), |
| 156 | 0x0360 => format!("{:04X}", read_360_ver(&device)?), |
| 157 | _ => "Unsupported".to_string(), |
| 158 | }; |
| 159 | println!(" Firmware Version: v{}", ver); |
| 160 | |
| 161 | if log_enabled!(Level::Debug) { |
| 162 | println!(" Config space 1"); |
| 163 | print!(" "); |
| 164 | for x in 0..16 { |
| 165 | print!("0{:X} ", x); |
| 166 | } |
| 167 | println!(); |
| 168 | for y in 0..16 { |
| 169 | print!("{:X}0 ", y); |
| 170 | for x in 0..16 { |
| 171 | print!("{:02X} ", read_byte(&device, 0x42, x + 16 * y)?); |
| 172 | } |
| 173 | println!(); |
| 174 | } |
| 175 | println!(" Config space 2"); |
no test coverage detected