Add missing MTC modes

This commit is contained in:
Marc Riera 2023-04-14 00:22:20 +02:00
parent 77ad46ea5d
commit e6cabd3b0f
4 changed files with 160 additions and 2 deletions

View file

@ -10,7 +10,9 @@ mod dgoc44u;
mod tcpp20009;
mod tcpp20011;
mod sotp031201_p4b7;
mod sotp031201_p4b2b7;
mod sotp031201_p5b5;
mod sotp031201_p5b7;
mod vok00106;
const FFS_MOUNT: &str = "/tmp/ffs";
@ -24,7 +26,9 @@ pub enum ControllerModel {
TCPP20009,
TCPP20011,
SOTP031201P4B7,
SOTP031201P4B2B7,
SOTP031201P5B5,
SOTP031201P5B7,
VOK00106,
}
@ -59,11 +63,21 @@ pub fn set_model(state: &ControllerState) -> Option<ControllerModel> {
init_gadget(&sotp031201_p4b7::DEVICE_DESCRIPTOR, &sotp031201_p4b7::DESCRIPTORS, &sotp031201_p4b7::STRINGS);
return Some(ControllerModel::SOTP031201P4B7);
}
else if state.button_c && state.power == 1 {
println!("Selected controller SOTP-031201 (P4/B2-B7 mode).");
init_gadget(&sotp031201_p4b2b7::DEVICE_DESCRIPTOR, &sotp031201_p4b2b7::DESCRIPTORS, &sotp031201_p4b2b7::STRINGS);
return Some(ControllerModel::SOTP031201P4B2B7);
}
else if state.button_c && state.power == 2 {
println!("Selected controller SOTP-031201 (P5/B5 mode).");
init_gadget(&sotp031201_p5b5::DEVICE_DESCRIPTOR, &sotp031201_p5b5::DESCRIPTORS, &sotp031201_p5b5::STRINGS);
return Some(ControllerModel::SOTP031201P5B5);
}
else if state.button_c && state.power == 3 {
println!("Selected controller SOTP-031201 (P5/B7 mode).");
init_gadget(&sotp031201_p5b7::DEVICE_DESCRIPTOR, &sotp031201_p5b7::DESCRIPTORS, &sotp031201_p5b7::STRINGS);
return Some(ControllerModel::SOTP031201P5B7);
}
/* else if state.button_a {
println!("Selected controller VOK-00106.");
return Some(ControllerModel::VOK00106);
@ -88,9 +102,15 @@ pub fn set_state(state: &mut ControllerState, model: &ControllerModel) {
ControllerModel::SOTP031201P4B7 => {
sotp031201_p4b7::update_gadget(state);
}
ControllerModel::SOTP031201P4B2B7 => {
sotp031201_p4b2b7::update_gadget(state);
}
ControllerModel::SOTP031201P5B5 => {
sotp031201_p5b5::update_gadget(state);
}
ControllerModel::SOTP031201P5B7 => {
sotp031201_p5b7::update_gadget(state);
}
ControllerModel::VOK00106 => {
vok00106::update_gadget(state);
}