完善资料让更多小伙伴认识你,还能领取20积分哦, 立即完善>
这是整合的一个多功能接口设备的描述符,实现CDC+Mass Storage两个设备功能,描述符如下:
unsigned char device_framework_high_speed[] = { /* Device descriptor */ 0x12, 0x01, 0x00, 0x02, 0xEF, 0x02, 0x01, 0x40, 0x84, 0x84, 0x00, 0x01, 0x00, 0x01, 0x01, 0x02, 0x03, 0x01, //bNumConfigurations:configuration 1 /* Device qualifier descriptor */ 0x0a, 0x06, 0x00, 0x02, 0x02, 0x00, 0x00, 0x40, 0x01, 0x00, /* Configuration 1 descriptor */ 0x09, 0x02, 0x59, 0x00, //wTotallength=97 0x03, //bNumInterfaces 0x01, //bConfigurationValue:Enable configuration 1 0x00, 0x80, 0x32, /* Interface association descriptor of CDC. */ 0x08, 0x0b, 0x00, //bFirstInterface 0x02, //bInterfaceCount 0x02, //bFunctionClass:2--CDC 0x02, 0x00, 0x00, /**********************************The Descriptor of CDC *************************************/ /* Communication Class Interface Descriptor Requirement */ 0x09, 0x04, 0x00, //bInterfaceNumber 0x00, 0x01, //bNumEndpoints:one Endpoint(0x84) 0x02, //bInterfaceClass:2--CDC 0x02, 0x01, 0x00, /* Header Functional Descriptor */ 0x05, 0x24, 0x00, 0x10, 0x01, //bcdCDC /* ACM Functional Descriptor */ 0x04, 0x24, 0x02, 0x0f, /* Union Functional Descriptor */ 0x05, 0x24, 0x06, 0x00, //bMasterInterface 0x01, //bSlaveInterface0:Data Class Interface /* Call Management Functional Descriptor */ 0x05, 0x24, 0x01, 0x03, 0x01, /* Endpoint 1 descriptor */ 0x07, 0x05, 0x81, //bEndpointAddress:IN, EndpointID=1 0x03, //bmAttributes:Interrupt 0x08, 0x00, //wMaxPacketSize 0x0b, //bInterval /* Data Class Interface Descriptor Requirement */ 0x09, 0x04, 0x01, //bInterfaceNumber 0x00, 0x02, //bNumEndpoints:two endpoints for IN_endpoints and OUT_endpoints 0x0A, //bInterfaceClass:0A--CDC 0x00, 0x00, 0x00, /* First alternate setting Endpoint 2 descriptor */ 0x07, 0x05, 0x02, //bEndpointAddress:OUT, EndpointID=2 0x02, //bmAttributes:Bulk 0x00, 0x02, //wMaxPacketSize:0200h=512--high_speed 0x00, /* Endpoint 3 descriptor */ 0x07, 0x05, 0x83, //bEndpointAddress:IN, EndpointID=3 0x02, //bmAttributes:Bulk 0x00, 0x02, //wMaxPacketSize:0200h=512--high_speed 0x00, /************************************************************************************************************/ #if 0 /* Interface association descriptor of Mass Storage. */ 0x08, 0x0b, 0x01, //bFirstInterface 0x01, //bInterfaceCount 0x08, //bFunctionClass:08--MASS STORAGE Class 0x06, 0x00, 0x00, #endif /*******************************The descriptor of Mass Storage ************************************/ /* Mass Storage Class Interface Descriptor Requirement */ 0x09, 0x04, 0x02, //bInterfaceNumber 0x00, //bAlternateSetting 0x02, //bNumEndpoints:two endpoints for IN and OUT 0x08, //bInterfaceClass:08--MASS STORAGE Class 0x06, //bInterfaceSubClass:SCSI transparent 0x50, 0x00, /* Mass Storage Class Endpoint 4 Descriptor Requirement */ 0x07, 0x05, 0x84, //bEndpointAddress:IN, EndpointID=4 0x02, //bmAttributes:Bulk 0x00, 0x02, //wMaxPacketSize:0200h=512--high_speed 0x00, /* Mass Storage Class Endpoint 5 Descriptor Requirement */ 0x07, 0x05, 0x05, //bEndpointAddress:OUT, EndpointID=5 0x02, //bmAttributes:Bulk 0x00, 0x02, //wMaxPacketSize:0200h=512--high_speed 0x00, /*********************************************************************************************/ }; 将该描述符在目标平台运行并接入Linux主机,用“dmesg”查看打印信息如下: [ 1925.208169] u*** 2-4: new high-speed USB device number 5 using ehci-pci [ 1925.341185] u*** 2-4: config 1 has an invalid descriptor of length 7, skipping remainder of the config [ 1925.341203] u*** 2-4: config 1 interface 2 altsetting 0 has 0 endpoint descriptors, different from the interface descriptor's value: 2 [ 1925.342182] u*** 2-4: New USB device found, idVendor=8484, idProduct=0100 [ 1925.342190] u*** 2-4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 1925.342197] u*** 2-4: Product: EL Composite device [ 1925.342203] u*** 2-4: Manufacturer: Expres Logic [ 1925.342209] u*** 2-4: SerialNumber: 0001 [ 1925.380015] cdc_acm 2-4:1.0: ttyACM0: USB ACM device [ 1925.380545] u***core: registered new interface driver cdc_acm [ 1925.380548] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters [ 1925.392882] u***-storage 2-4:1.2: USB Mass Storage device detected [ 1925.394796] u***-storage: probe of 2-4:1.2 failed with error -5 [ 1925.394834] u***core: registered new interface driver u***-storage [ 1925.437745] u***core: registered new interface driver uas 第二条和第三条报错怎么改也都有......还有Mass Storage能被检测到,但失败了,根据“probe of 2-4:1.2 failed with error -5”报错信息也没查到,是因为缺少处理Mass Storage接口的命令吗?因为这个是自己添加的,CDC是原先USB协议栈里自带定义好的....... 大伙帮忙看看,拜谢了! |
|
相关推荐
|
|
你正在撰写答案
如果你是对答案或其他答案精选点评或询问,请使用“评论”功能。
STM32进行DMA数据转运,为什么只有A组最后一位数据被转运到B组去?
1148 浏览 2 评论
1497 浏览 3 评论
1129 浏览 0 评论
嵌入式开发 Win11安装ST-Link 提示 设备描述符请求失败 怎么处理?
1266 浏览 0 评论
1553 浏览 1 评论
小黑屋| 手机版| Archiver| 电子发烧友 ( 湘ICP备2023018690号 )
GMT+8, 2024-8-16 17:14 , Processed in 0.978686 second(s), Total 70, Slave 53 queries .
Powered by 电子发烧友网
© 2015 www.ws-dc.com
关注我们的微信
下载发烧友APP
电子发烧友观察
版权所有 © 湖南华秋数字科技有限公司
电子发烧友 (电路图) 湘公网安备 43011202000918 号 电信与信息服务业务经营许可证:合字B2-20210191 工商网监 湘ICP备2023018690号