diff --git a/src/controller/emulated.rs b/src/controller/emulated.rs index 2816908..76abdd7 100644 --- a/src/controller/emulated.rs +++ b/src/controller/emulated.rs @@ -9,7 +9,7 @@ use crate::controller::physical::ControllerState; mod dgoc44u; mod tcpp20009; mod tcpp20011; -mod sotp031201_p5b7; +mod sotp031201_p4b7; mod vok00106; const FFS_MOUNT: &str = "/tmp/ffs"; @@ -22,7 +22,7 @@ pub enum ControllerModel { DGOC44U, TCPP20009, TCPP20011, - SOTP031201P5B7, + SOTP031201P4B7, VOK00106, } @@ -53,9 +53,9 @@ pub fn set_model(state: &ControllerState) -> Option { return Some(ControllerModel::TCPP20011); } else if state.button_c && state.power == 0 { - println!("Selected controller SOTP-031201 (P5/B7 mode)."); - init_gadget(&sotp031201_p5b7::DEVICE_DESCRIPTOR, &sotp031201_p5b7::DESCRIPTORS, &sotp031201_p5b7::STRINGS); - return Some(ControllerModel::SOTP031201P5B7); + println!("Selected controller SOTP-031201 (P4/B7 mode)."); + init_gadget(&sotp031201_p4b7::DEVICE_DESCRIPTOR, &sotp031201_p4b7::DESCRIPTORS, &sotp031201_p4b7::STRINGS); + return Some(ControllerModel::SOTP031201P4B7); } /* else if state.button_a { println!("Selected controller VOK-00106."); @@ -78,8 +78,8 @@ pub fn set_state(state: &mut ControllerState, model: &ControllerModel) { ControllerModel::TCPP20011 => { tcpp20011::update_gadget(state); } - ControllerModel::SOTP031201P5B7 => { - sotp031201_p5b7::update_gadget(state); + ControllerModel::SOTP031201P4B7 => { + sotp031201_p4b7::update_gadget(state); } ControllerModel::VOK00106 => { vok00106::update_gadget(state); diff --git a/src/controller/emulated/sotp031201_p5b7.rs b/src/controller/emulated/sotp031201_p4b7.rs similarity index 95% rename from src/controller/emulated/sotp031201_p5b7.rs rename to src/controller/emulated/sotp031201_p4b7.rs index 97f07be..837363e 100644 --- a/src/controller/emulated/sotp031201_p5b7.rs +++ b/src/controller/emulated/sotp031201_p4b7.rs @@ -6,7 +6,7 @@ use crate::controller::physical::ControllerState; use crate::controller::emulated::{DeviceDescriptor, ENDPOINT1}; pub const DESCRIPTORS: [u8; 48] = [0x01, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, -0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, +0x09, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x14, 0x09, 0x04, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x14]; @@ -62,7 +62,7 @@ pub fn update_gadget(state: &mut ControllerState) { if state.button_select { buttons2.insert(Buttons2::SELECT) } // Assemble data and send it to endpoint - let data = [handle, buttons1.bits, buttons2.bits, 0x0]; + let data = [0x0, handle, buttons1.bits, buttons2.bits]; if let Ok(mut file) = File::create(ENDPOINT1) { file.write(&data).ok(); }