diff --git a/src/controller/emulated.rs b/src/controller/emulated.rs index ce10ded..c2bf3e8 100644 --- a/src/controller/emulated.rs +++ b/src/controller/emulated.rs @@ -63,7 +63,7 @@ pub fn set_state(state: &mut ControllerState, model: &ControllerModel) { fn init_gadget(device: &DeviceDescriptor, descriptors: &[u8], strings: &[u8]) { Command::new("modprobe").arg("g_ffs") .arg(String::from("bDeviceClass=")+&device.b_device_class.to_string()) - .arg(String::from("bDeviceSubclass=")+&device.b_device_sub_class.to_string()) + .arg(String::from("bDeviceSubClass=")+&device.b_device_sub_class.to_string()) .arg(String::from("idVendor=")+&device.id_vendor.to_string()) .arg(String::from("idProduct=")+&device.id_product.to_string()) .arg(String::from("iManufacturer=")+device.i_manufacturer) diff --git a/src/controller/emulated/dgoc44u.rs b/src/controller/emulated/dgoc44u.rs index fa0657e..c799283 100644 --- a/src/controller/emulated/dgoc44u.rs +++ b/src/controller/emulated/dgoc44u.rs @@ -1,8 +1,10 @@ +use std::fs::File; +use std::io::{Write}; use bitflags::bitflags; use crate::controller::physical::ControllerState; use crate::controller::emulated::DeviceDescriptor; -pub const DESCRIPTORS: [u8; 41] = [0x03, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, +pub const DESCRIPTORS: [u8; 41] = [0x01, 0x00, 0x00, 0x00, 0x29, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x09, 0x21, 0x11, 0x01, 0x00, 0x01, 0x22, 0x3F, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x14]; diff --git a/src/controller/emulated/tcpp20009.rs b/src/controller/emulated/tcpp20009.rs index e47025c..1267b97 100644 --- a/src/controller/emulated/tcpp20009.rs +++ b/src/controller/emulated/tcpp20009.rs @@ -1,8 +1,11 @@ +use std::fs::File; +use std::io::Write; + use bitflags::bitflags; use crate::controller::physical::ControllerState; use crate::controller::emulated::DeviceDescriptor; -pub const DESCRIPTORS: [u8; 32] = [0x03, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, +pub const DESCRIPTORS: [u8; 32] = [0x01, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, 0x04, 0x00, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x07, 0x05, 0x81, 0x03, 0x08, 0x00, 0x14]; pub const STRINGS: [u8; 16] = [0x02, 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]; @@ -51,4 +54,8 @@ pub fn update_gadget(state: &mut ControllerState) { // Assemble data and send it to gadget let data = [0x1, brake, power, 0xFF, dpad, buttons.bits]; + + if let Ok(mut file) = File::create("/tmp/ffs-mascon/ep1") { + file.write(&data).ok(); + } } \ No newline at end of file