我試圖設置USB設備,以便在連接到Windows 8機器時自動使用WinUSB作爲驅動程序,如概述here。在設備固件中支持WinUSB
它說:
爲了使USB驅動程序堆棧,以瞭解該設備支持擴展的特徵描述,該設備必須定義存儲在字符串索引0xEE的OS字符串描述符。
我認爲我需要在內存位置0xEE創建一個包含描述符的結構體。我會怎麼去解決C?
這裏是我的嘗試:
// The struct definition
typedef struct {
uint8_t bLength;
uint8_t bDescriptorType;
uint8_t qwSignature[14];
uint8_t bMS_VendorCode;
uint8_t bPad;
} usb_os_str_desc_t;
// Create a pointer to a struct located at 0xEE
volatile usb_os_str_desc_t* const extended_feature_support = (usb_os_str_desc_t*) 0xEE;
// Create a new struct at the location specified in "extended_feature_support"
(*extended_feature_support) = {
.bLength = 0x12,
.bDescriptorType = 0x03,
.qwSignature = "MSFT100",
.bMS_VendorCode = 0x04,
.bPad = 0x00
};
但是編譯器不喜歡這個,抱怨那個數據定義沒有類型。 有沒有辦法在C中做到這一點?我是否正確理解文章?
任何幫助將被apprciated。
這github鏈接看起來像我之後。謝謝! –