我知道有几个例子使用WiNUSB与CyUSB,但我似乎找不到一个专门解决如何获得MSOS扩展属性描述函数的方法。我想添加一个GUID,这样当设备枚举时,它将用GUID枚举。
我已经这样做了,当我插入设备时,我可以使用MSOS描述符来加载WiNUSB,并且USB配置描述符从CYUSB变为WiUSB。我可以查询计算机的注册表,并且我发现该设备已经被枚举。
我发现一个项目很长一段时间后,虽然我不能的状态,我发现它现在已经表明,它解决了这个,但采摘后的项目后,我发现它并没有解决这个问题。这是进入计算机的注册表和手动添加GUID调试。一旦这样做,我#应用可以选择此设备并开始与它交流。
在u***fs_descr。C文件,我一直在用,它试图通过添加以下:
如果定义(UbfssNeabLeMasoScript字符串)
/ ******************************************************************************
* USB微软OS字符串描述符
*“MSFT”标识的微软主机
*“100”指定版本1
* u***fs_get_extended_config_descriptor成为brequest价值
*在主机厂商设备/类请求
****************************************************************************** /
const函数时,cycode u***fs_msos_descriptor [ u***fs_msos_descriptor_length ] = {
/*描述符长度*/0x12u,
/ * descriptortype:字符串/ 0x03u,
/ * qwsignature“msft100“* /(卡片)现在,0U,(卡片)的,0U,(卡片)F,0U,(卡片)不,0u,
(卡片)1,0U,(卡片)'0',0U,'0',0u(卡片),
/ * * / u***fs_get_extended_config_descriptor bms_vendorcode,
/*BPA*/0x00 U
};
/ * * /扩展配置描述符
const函数时,cycode u***fs_msos_configura
tion_descr [ u***fs_msos_conf_descr_length ] = {
/ *长度* / 0x28u描述符4个字节,0x00u,0x00u,0x00u,
/ * * / 0x00u描述符2个字节版本,0x01u,
/*该固定:index_config_descriptor * / 0x04u,0x00u,
/ *图块统计计数功能。*/0x01U,
/*保留:七字节* / 0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,
/ * * / 0x00u bfirstinterfacenumber,
/*保留*/0x01u,
/ * compatibleid”适用于CYUSB 0 0”* / / *(卡片)C(卡片),Y,U(卡片),(卡片)的,(卡片)B,
0x00 u,0x00 u,0x00 u,*/
/ * compatibleid”适用于CYUSB 0 0”* /(卡片)’w',(卡片)“我”(卡片)n,(卡片)U,(卡片)的,(卡片)B,
0x00 U,0x00 U,
/ * subcompatibleid -“00001 0 0”* / / *(卡片)0,0”(卡片),(卡片)0,0”(卡片),(卡片)1,* /
0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,0x00u,
/ * * / 0x00u保留:6字节,0x00u,0x00u,0x00u,0x00u,0x00u
};
const uint8_t u***fs_msos_extended_properties_descr [ u***fs_msos_ext_prop_descr_length ] =
{
//头段
/ *长度4个字节的描述符*/ /*送回如下信息,0x00,0x00,0x00,dwlength:142 = 10 + 132 * /
/ * * / 2字节的描述符0x00,0x01版/ * bcdversion:描述符的版本号* /
/*该固定:index_config_descriptor * / 0x05,0x00,/*该:扩展属性操作系统描述符*/
/ *图块统计计数功能。* / 0x01,0x00,/ *图块统计:属性*号/
//自定义属性第1节
/ * * / 0x84,0x00,0x00,0x00 dwSize:,/ * 132 = 14 + dwSize:40 + 78 * /
/ * * / dwpropertydatatype:0x01,0x00,0x00,0x00,/ * dwpropertydatatype:空终止字符串(reg_sz)* /
/ * wpropertynamelength:40 * / 0x28,0x00,wpropertynamelength:40 * / / *
/ * bpropertyname:“deviceinterfaceguid”/“D”,0x00,e,0x00,V,0x00,'i',0x00,c、e、0x00 0x00,
“我”,0x00,n,0x00,不,0x00,e,0x00,R,0x00,F,0x00,'a',0x00,c,e,0x00 0x00,
“G”,0x00,U,0x00,'i',0x00,会',0x00,
0x00,0x00,
/ * dwpropertydatalength:78 * / 0x4e,0x00,0x00,0x00,
/ * bpropertydata:“{ 01234567-2a4f-49ee-8dd3-fadea377234a }“* /
“{”,0x00,
'零',0x00,1,2,0x00,0x00,3,4,0x00,0x00,5,6,0x00,0x00,7’,0x00,' ',0x00,
“2”,0x00,'a',0x00,4,0x00,F,0x00,' ',0x00,
“4”,0x00,9,0x00,e,0x00,e,0x00,' ',0x00,
“8”,0x00,会的,会的,0x00,0x00,3,0x00,' ',0x00,
“F”,0x00,'a',0x00,会',0x00,e,0x00,'a',0x00,3,0x00,7’,0x00,7’,0x00,2,0x00,3,4,0x00,0x00,'a',0x00,
“},0x00,
0x00,0x00
};
# endif / * * / u***fs_enable_msos_string
还有一个u***fs_msos_ext_prop_descr_length在USB系统的定义。H.
我的猜测是,没有调用u***fs_msos_extended_properties_descr数组传递给系统,但我不知道我需要得到这个要传递给操作系统在适当的时候。
如有任何帮助,我们将不胜感激。
以上来自于百度翻译
以下为原文
I know that there are a few examples using WinUSB vs CyUSB, but I cannot seem to find one that specifically addresses how to get MSOS Extended Properties Description functions working. I am wanting to add a GUID such that when the device enumerates, it will enumerate with the GUID.
I already have it such that when I plug the device in, I can get it to load the WinUSB using the MSOS Descriptor, and the USB Configuration Descriptor changed from CYUSB to WINUSB. I can query the registry of the computer, and I find that the device has been enumerated.
I found a project a long while back, though I cannot state where I found it now, that had indicated that it solved this, but after picking the project back up, I realize that it did not fix this issue. This was debugged by going into the computer registry and manually adding the GUID. Once this was done, my C# application could pick this device and begin to communicate with it.
In the USBFS_descr.c file that I have been using, it attempts to do this by adding the following:
#if defined(USBFS_ENABLE_MSOS_STRING)
/******************************************************************************
* USB Microsoft OS String Descriptor
* "MSFT" identifies a Microsoft host
* "100" specifies version 1.00
* USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR becomes the bRequest value
* in a host vendor device/class request
******************************************************************************/
const uint8 CYCODE USBFS_MSOS_DESCRIPTOR[USBFS_MSOS_DESCRIPTOR_LENGTH] = {
/* Descriptor Length */ 0x12u,
/* DescriptorType: STRING */ 0x03u,
/* qwSignature - "MSFT100" */ (uint8)'M', 0u, (uint8)'S', 0u, (uint8)'F', 0u, (uint8)'T', 0u,
(uint8)'1', 0u, (uint8)'0', 0u, (uint8)'0', 0u,
/* bMS_VendorCode: */ USBFS_GET_EXTENDED_CONFIG_DESCRIPTOR,
/* bPad */ 0x00u
};
/* Extended Configuration Descriptor */
const uint8 CYCODE USBFS_MSOS_CONFIGURATION_DESCR[USBFS_MSOS_CONF_DESCR_LENGTH] = {
/* Length of the descriptor 4 bytes */ 0x28u, 0x00u, 0x00u, 0x00u,
/* Version of the descriptor 2 bytes */ 0x00u, 0x01u,
/* wIndex - Fixed:INDEX_CONFIG_DESCRIPTOR */ 0x04u, 0x00u,
/* bCount - Count of device functions. */ 0x01u,
/* Reserved : 7 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,
/* bFirstInterfaceNumber */ 0x00u,
/* Reserved */ 0x01u,
/* compatibleID - "CYUSB " */ /*(uint8)'C', (uint8)'Y', (uint8)'U', (uint8)'S', (uint8)'B',
0x00u, 0x00u, 0x00u,*/
/* compatibleID - "CYUSB " */ (uint8)'W', (uint8)'I', (uint8)'N', (uint8)'U', (uint8)'S', (uint8)'B',
0x00u, 0x00u,
/* subcompatibleID - "00001 " */ /*(uint8)'0', (uint8)'0', (uint8)'0', (uint8)'0', (uint8)'1',*/
0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u,0x00u, 0x00u,
/* Reserved : 6 bytes */ 0x00u, 0x00u, 0x00u, 0x00u, 0x00u, 0x00u
};
const uint8_t USBFS_MSOS_EXTENDED_PROPERTIES_DESCR[USBFS_MSOS_EXT_PROP_DESCR_LENGTH] =
{
// Header Section
/* Length of the descriptor 4 bytes */ 0x8E,0x00,0x00,0x00, /* dwLength: 142 = 10 + 132 */
/* Version of the descriptor 2 bytes */ 0x00,0x01, /* bcdVersion: The descriptor’s version number */
/* wIndex - Fixed:INDEX_CONFIG_DESCRIPTOR */ 0x05,0x00, /* wIndex: Extended property OS descriptor */
/* bCount - Count of device functions. */ 0x01,0x00, /* bCount: Number of properties */
// Custom Property Section 1
/* dwSize: */ 0x84,0x00,0x00,0x00, /* dwSize: 132 = 14 + 40 + 78 */
/* dwPropertyDataType: */ 0x01,0x00,0x00,0x00, /* dwPropertyDataType: A NULL-terminated Unicode String (REG_SZ) */
/* wPropertyNameLength: 40 */ 0x28,0x00, /* wPropertyNameLength: 40 */
/* bPropertyName: "DeviceInterfaceGUID" */ 'D',0x00,'e',0x00,'v',0x00,'i',0x00,'c',0x00,'e',0x00,
'I',0x00,'n',0x00,'t',0x00,'e',0x00,'r',0x00,'f',0x00,'a',0x00,'c',0x00,'e',0x00,
'G',0x00,'U',0x00,'I',0x00,'D',0x00,
0x00,0x00,
/* dwPropertyDataLength: 78 */ 0x4E,0x00,0x00,0x00,
/* bPropertyData: "{01234567-2A4F-49EE-8DD3-FADEA377234A}" */
'{',0x00,
'0',0x00,'1',0x00,'2',0x00,'3',0x00,'4',0x00,'5',0x00,'6',0x00,'7',0x00,'-',0x00,
'2',0x00,'A',0x00,'4',0x00,'F',0x00,'-',0x00,
'4',0x00,'9',0x00,'E',0x00,'E',0x00,'-',0x00,
'8',0x00,'D',0x00,'D',0x00,'3',0x00,'-',0x00,
'F',0x00,'A',0x00,'D',0x00,'E',0x00,'A',0x00,'3',0x00,'7',0x00,'7',0x00,'2',0x00,'3',0x00,'4',0x00,'A',0x00,
'}',0x00,
0x00, 0x00
};
#endif /* USBFS_ENABLE_MSOS_STRING */
There is also a definition of USBFS_MSOS_EXT_PROP_DESCR_LENGTH in USBFS.h.
My guess is that there is nothing that invokes the array of USBFS_MSOS_EXTENDED_PROPERTIES_DESCR to pass it to the system, but I am not sure where I need to be looking to get this to get passed to the OS at the appropriate time.
Any help would be appreciated.