Basic support for SLPH-00051

This commit is contained in:
Marc Riera 2023-05-20 12:35:45 +02:00
parent e35e08055a
commit c6013f2b74
2 changed files with 211 additions and 0 deletions

View file

@ -18,6 +18,7 @@ mod sotp031201_p5b5;
mod sotp031201_p5b7;
mod vok00106;
mod zkns001;
mod slph00051;
const FFS_MOUNT: &str = "/tmp/ffs";
const ENDPOINT0: &str = "/tmp/ffs/ep0";
@ -35,6 +36,7 @@ pub enum ControllerModel {
SOTP031201P5B7,
VOK00106,
ZKNS001,
SLPH00051,
}
pub struct DeviceDescriptor {
@ -62,6 +64,11 @@ pub fn set_model(state: &ControllerState) -> Option<ControllerModel> {
model = ControllerModel::ZKNS001;
descriptors = (&zkns001::DEVICE_DESCRIPTOR, &zkns001::DESCRIPTORS, &zkns001::STRINGS);
}
else if state.button_down && state.power == 0 {
model_name = "SLPH-00051";
model = ControllerModel::SLPH00051;
descriptors = (&slph00051::DEVICE_DESCRIPTOR, &slph00051::DESCRIPTORS, &slph00051::STRINGS);
}
else if state.button_d {
model_name = "TCPP-20009";
model = ControllerModel::TCPP20009;
@ -136,6 +143,9 @@ pub fn set_state(state: &mut ControllerState, model: &ControllerModel) {
ControllerModel::ZKNS001 => {
zkns001::update_gadget(state);
}
ControllerModel::SLPH00051 => {
slph00051::update_gadget(state);
}
}
}
@ -151,6 +161,9 @@ pub fn handle_ctrl_transfer(model: ControllerModel, data: &[u8]) {
ControllerModel::ZKNS001 => {
report = Some(&zkns001::HID_REPORT_DESCRIPTOR);
}
ControllerModel::SLPH00051 => {
report = Some(&slph00051::HID_REPORT_DESCRIPTOR);
}
_ => {
report = None;
}