1.我的上位机是使用hidapi 库的,仅仅通过hid_read读取。通过上位机读取数据,无法读到上传数据 2.另...
拷贝函数会用到len参数}break;caseUSB_DESCR_TYP_CONFIG://主机想获得配置描述符{ pDescr= MyCfgDescr;//将配置描述符字符串放在pDescr地址中,之后会发送len = MyCfgDescr[2];//协议规定配置描述符的第三个字节存放配置信息的总长}break;caseUSB_DESCR_TYP_HID://主机想获得人机接口类描述符。此处结构体中的...
static const USB_CFG_DESCR_KEYBOARD CfgDescr_keyboard = { .cfg_descr = USBCfgDescr_KB, .itf_descr = KeyBoardItfDescr, .hid_descr = KeyBoardHIDDescr, .inendp_descr = KeyBoardINEndpDescr, .outendp_descr = KeyBoardOUTEndpDescr, }; static const USB_CFG_DESCR_MOUSE CfgDescr_Mouse = { .cf...
voidUSBFS_IRQHandler(void){// 省略无关代码if(intflag&USBFS_UIF_TRANSFER)// 传输中断{switch(intst&USBFS_UIS_TOKEN_MASK)// 判断传输令牌{// 省略无关代码case USBFS_UIS_TOKEN_SETUP:// SETUP令牌// 省略无关代码if((USBFS_SetupReqType&USB_REQ_TYP_MASK)!=USB_REQ_TYP_STANDARD)// 处理非标...
主机请示得到某个字符串描述符时一般分成两步:首先主机向设备发出USB标准命令Get_Descriptor,其中所使用的字符串的索引值为0,设备返回一个字符串描述符,此描述符的结构如F:表14、USB字符串描述符(响应主机请求时返回的表示语言ID的字符串描述符)偏移量域大小值描述0bLength1N+2此描述表的字节数1bDescriptorTyp 25...
DevEP4_IN_Deal(sizeof(HIDKey)); }#defineDevEP0SIZE 0x40//支持的最大接口数量#defineUSB_INTERFACE_MAX_NUM 2//接口号的最大值#defineUSB_INTERFACE_MAX_INDEX 1//设备描述符constuint8_t MyDevDescr[] = {0x12,0x01,0x10,0x01,0x00,0x00,0x00, DevEP0SIZE,0x3d,0x41,0x07,0x21,0x00,0x00...
Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Cancel Create saved search Sign in Sign up Reseting focus {{ message }} dsm / USB-Blaster_CH552 Public Notifications You must be signed in to change notification settings Fork 1 Star 7 ...
__code uint8_t SetupSetHIDIdle[]= { 0x21,HID_SET_IDLE,0x00,0x00,0x00,0x00,0x00,0x00 }; __code uint8_t SetupGetHIDDevReport[] = { 0x81, USB_GET_DESCRIPTOR, 0x00, USB_DESCR_TYP_REPORT, 0x00, 0x00, 0xFF, 0x00 }; __code uint8_t XPrinterReport[] = { 0xA1, 0, 0x...
USB_GET_DESCRIPTOR, USB_DESCR_TYP_DEVICE << 8, 0, reqLen); s = HostCtrlTransfer(&SetupReq, MaxPacketSize0, pDevDescr, &len); if (s == ERR_SUCCESS) { if (pRetLen != NULL) { *pRetLen = len; } } return s; ...
case USB_REQ_TYP_CLASS: /*HID类命令*/ if ((UsbSetupBuf->bRequestType & USB_REQ_RECIP_MASK) == USB_REQ_RECIP_INTERF) { switch (SetupReq) { case 0x01: // GetReport //pDescr = UserEp2Buf; //控制端点上传输据 if (SetupLen >= THIS_ENDP0_SIZE) //大于端点0大小,需要...