mirror of
https://github.com/marcriera/ddgo-pnp-controller.git
synced 2025-04-11 06:29:29 +02:00
Fix for MTC
This commit is contained in:
parent
38d88d9e7f
commit
52d47a0bc3
2 changed files with 9 additions and 9 deletions
|
@ -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<ControllerModel> {
|
|||
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);
|
||||
|
|
|
@ -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();
|
||||
}
|
Loading…
Add table
Reference in a new issue