From 974aa6b7af9aac816d39c3b5e6d36781d11cb03f Mon Sep 17 00:00:00 2001 From: Naxdy Date: Sat, 20 Apr 2024 11:06:33 +0200 Subject: [PATCH] feat(hid): add msos descriptor --- src/gcc_hid.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/gcc_hid.rs b/src/gcc_hid.rs index 092d7d8..2143315 100644 --- a/src/gcc_hid.rs +++ b/src/gcc_hid.rs @@ -17,6 +17,7 @@ use embassy_time::{Duration, Instant, Timer}; use embassy_usb::{ class::hid::{HidReaderWriter, ReportId, RequestHandler, State}, control::OutResponse, + msos::{self, windows_version}, Builder, Handler, }; use libm::powf; @@ -36,6 +37,9 @@ pub static MUTEX_INPUT_CONSISTENCY_MODE: Mutex< Option, > = Mutex::new(None); +/// Vendor-defined property data +const DEVICE_INTERFACE_GUID: &str = "{ecceff35-146c-4ff3-acd9-8f992d09acdd}"; + #[rustfmt::skip] pub const GCC_REPORT_DESCRIPTOR: &[u8] = &[ 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, ); + 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); let hid_config = embassy_usb::class::hid::Config { -- 2.47.0