Skip to content

Commit a45118f

Browse files
committed
touchpad_present: Relax check a bit
The laptop 13 touchpad does not have the same board ID as on laptop 16. Signed-off-by: Daniel Schaefer <dhs@frame.work>
1 parent 4faef7d commit a45118f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

framework_lib/src/chromium_ec/input_deck.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ pub struct InputDeckStatus {
136136
pub state: InputDeckState,
137137
pub hubboard_present: bool,
138138
pub touchpad_present: bool,
139+
pub touchpad_id: u8,
139140
pub top_row: TopRowPositions,
140141
}
141142

@@ -177,16 +178,20 @@ impl InputDeckStatus {
177178

178179
impl From<EcResponseDeckState> for InputDeckStatus {
179180
fn from(item: EcResponseDeckState) -> Self {
181+
let tp_id = InputModuleType::from(item.board_id[InputDeckMux::Touchpad as usize]);
182+
let tp_present = !matches!(
183+
tp_id,
184+
InputModuleType::Short | InputModuleType::Disconnected
185+
);
186+
180187
InputDeckStatus {
181188
state: InputDeckState::from(item.deck_state),
182189
hubboard_present: matches!(
183190
InputModuleType::from(item.board_id[InputDeckMux::HubBoard as usize],),
184191
InputModuleType::HubBoard
185192
),
186-
touchpad_present: matches!(
187-
InputModuleType::from(item.board_id[InputDeckMux::Touchpad as usize],),
188-
InputModuleType::Touchpad
189-
),
193+
touchpad_present: tp_present,
194+
touchpad_id: item.board_id[InputDeckMux::Touchpad as usize],
190195
top_row: TopRowPositions {
191196
pos0: InputModuleType::from(item.board_id[InputDeckMux::TopRow0 as usize]),
192197
pos1: InputModuleType::from(item.board_id[InputDeckMux::TopRow1 as usize]),

0 commit comments

Comments
 (0)