|
项目紧急,请教版主以及各位高手关于U盘模拟CDROM问题!
[复制链接]
项目需要实现CDROM+HID功能,主芯片为STM32F103RC,U盘存储器使用的是TFlash卡,目前已经实现了U盘+HID功能。通过修改Scsi_data.c文件中的Standard_Inquiry_Data如下,修改完后,PC机能够看到CD-ROM,但是双击cdrom后,无法打开,弹出一个错误提示框,如附件。请大家指点,多谢啦!
uint8_t Standard_Inquiry_Data[] =
{
#if 0
0x00, /* Direct Access Device */
#else
0x05, /* Direct Access Device CDROM*/
#endif
0x80, /* RMB = 1: Removable Medium */
0x02, /* Version: No conformance claim to standard */
0x02,
36 - 4, /* Additional Length */
#if 0
0x00, /* SCCS = 1: Storage Controller Component */
#else
0x01, /* SCCS = 1: Storage Controller Component */
#endif
0x00,
0x00,
/* Vendor Identification */
'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ',
/* Product Identification */
'S', 'D', ' ', 'F', 'l', 'a', 's', 'h', ' ',
'D', 'i', 's', 'k', ' ', ' ', ' ',
/* Product Revision Level */
'1', '.', '0', ' '
}
另外,配置描述符为:
const uint8_t MASS_ConfigDescriptor[MASS_SIZ_CONFIG_DESC] =
{
0x09, /* bLength: Configuation Descriptor size */
0x02, /* bDescriptorType: Configuration */
MASS_SIZ_CONFIG_DESC,
0x00,
0x02, //0x01, /* bNumInterfaces: 1 interface */
0x01, /* bConfigurationValue: */
/* Configuration value */
0x00, /* iConfiguration: */
/* Index of string descriptor */
/* describing the configuration */
0xC0, /* bmAttributes: */
/* bus powered */
0x32, /* MaxPower 100 mA */
/*09*/
/************** Descriptor of Custom HID interface ****************/
0x09, /* bLength: Interface Descriptor size */
0x04,/* bDescriptorType: Interface descriptor type */
0x00, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, //??/* bNumEndpoints */
0x03, /* bInterfaceClass: HID */
0x00, /* bInterfaceSubClass : 1=BOOT, 0=no boot */
0x00, /* nInterfaceProtocol : 0=none, 1=keyboard, 2=mouse */
0, /* iInterface: Index of string descriptor */
/******************** Descriptor of Custom HID HID ********************/
/* 18 */
0x09, /* bLength: HID Descriptor size */
HID_DESCRIPTOR_TYPE, /* bDescriptorType: HID */
0x10, /* bcdHID: HID Class Spec release number */
0x01,
0x00, /* bCountryCode: Hardware target country */
0x01, /* bNumDescriptors: Number of HID class descriptors to follow */
0x22, //report /* bDescriptorType */
CUSTOMHID_SIZ_REPORT_DESC,/* wItemLength: Total length of Report descriptor */
0x00,
/******************** Descriptor of Custom HID endpoints ******************/
/* 27 */
0x07, /* bLength: Endpoint Descriptor size */
0x05,//USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
0x82, /* bEndpointAddress: Endpoint Address (IN) */
// bit 3...0 : the endpoint number
// bit 6...4 : reserved
// bit 7 : 0(OUT), 1(IN)
0x03, /* bmAttributes: Interrupt endpoint */
0x40,//0x02, /* wMaxPacketSize: 20 Bytes max */
0x00,
0x20, /* bInterval: Polling Interval (21 ms) */
/* 34 */
0x07, /* bLength: Endpoint Descriptor size */
0x05,//USB_ENDPOINT_DESCRIPTOR_TYPE, /* bDescriptorType: */
/* Endpoint descriptor type */
0x02, /* bEndpointAddress: */
/* Endpoint Address (OUT) */
0x03, /* bmAttributes: Interrupt endpoint */
0x40,//0x02, /* wMaxPacketSize: 20 Bytes max */
0x00,
0x20, /* bInterval: Polling Interval (32 ms) */
/******************** Descriptor of Mass Storage interface ********************/
/*41 */
0x09, /* bLength: Interface Descriptor size */
0x04, /* bDescriptorType: */
/* Interface descriptor type */
0x01, /* bInterfaceNumber: Number of Interface */
0x00, /* bAlternateSetting: Alternate setting */
0x02, /* bNumEndpoints*/
0x08, /* bInterfaceClass: MASS STORAGE Class */
0x06, /* bInterfaceSubClass : SCSI transparent*/
0x50, /* nInterfaceProtocol */
4, /* iInterface: */
/* 50 */
0x07, /*Endpoint descriptor length = 7*/
0x05, /*Endpoint descriptor type */
0x81, /*Endpoint address (IN, address 1) */
0x02, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00, /*Polling interval in milliseconds */
/* 57 */
0x07, /*Endpoint descriptor length = 7 */
0x05, /*Endpoint descriptor type */
0x01, /*Endpoint address (OUT, address 2) */
0x02, /*Bulk endpoint type */
0x40, /*Maximum packet size (64 bytes) */
0x00,
0x00, /*Polling interval in milliseconds*/
/*64*/
};
};
-
-
CDROM无法访问.JPG
(21.07 KB)
|
|