feat(hid): add msos descriptor

This commit is contained in:
Naxdy 2024-04-20 11:06:33 +02:00
parent 2a01cd732a
commit 974aa6b7af
Signed by: Naxdy
GPG key ID: CC15075846BCE91B

View file

@ -17,6 +17,7 @@ use embassy_time::{Duration, Instant, Timer};
use embassy_usb::{ use embassy_usb::{
class::hid::{HidReaderWriter, ReportId, RequestHandler, State}, class::hid::{HidReaderWriter, ReportId, RequestHandler, State},
control::OutResponse, control::OutResponse,
msos::{self, windows_version},
Builder, Handler, Builder, Handler,
}; };
use libm::powf; use libm::powf;
@ -36,6 +37,9 @@ pub static MUTEX_INPUT_CONSISTENCY_MODE: Mutex<
Option<InputConsistencyMode>, Option<InputConsistencyMode>,
> = Mutex::new(None); > = Mutex::new(None);
/// Vendor-defined property data
const DEVICE_INTERFACE_GUID: &str = "{ecceff35-146c-4ff3-acd9-8f992d09acdd}";
#[rustfmt::skip] #[rustfmt::skip]
pub const GCC_REPORT_DESCRIPTOR: &[u8] = &[ pub const GCC_REPORT_DESCRIPTOR: &[u8] = &[
0x05, 0x01, // Usage Page (Generic Desktop Ctrls) 0x05, 0x01, // Usage Page (Generic Desktop Ctrls)
@ -334,6 +338,15 @@ pub async fn usb_transfer_task(raw_serial: [u8; 8], driver: Driver<'static, USB>
&mut control_buf, &mut control_buf,
); );
builder.msos_descriptor(windows_version::WIN8_1, 2);
let msos_writer = builder.msos_writer();
msos_writer.device_feature(msos::CompatibleIdFeatureDescriptor::new("WINUSB", ""));
msos_writer.device_feature(msos::RegistryPropertyFeatureDescriptor::new(
"DeviceInterfaceGUID",
msos::PropertyData::Sz(DEVICE_INTERFACE_GUID),
));
builder.handler(&mut device_handler); builder.handler(&mut device_handler);
let hid_config = embassy_usb::class::hid::Config { let hid_config = embassy_usb::class::hid::Config {