Switch to old descriptors, data write test for TCPP-20009

This commit is contained in:
Marc Riera 2023-03-17 13:38:40 +01:00
parent 983e807fc7
commit be4bb1f76d
3 changed files with 12 additions and 3 deletions

View file

@ -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)

View file

@ -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];

View file

@ -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();
}
}