资源简介
使用STM32的库进行USB-HID开发时,会出现某些电脑枚举不出设备的情况,通过bus hound 来抓包分析会出现 PC 发送set idle命令下去后,从设备没有响应,所以PC变为stall状态,之后枚举失败。通过分析源代码和HID协议,找到问题所在,修补漏洞之后可以在任何电脑上枚举成功。
可以对比库中的源代码,可以找到修改的地方。
可以对比库中的源代码,可以找到修改的地方。

代码片段和文件信息
/**
******************************************************************************
* @file usb_core.c
* @author MCD Application Team
* @version V4.0.0
* @date 28-August-2012
* @brief Standard protocol processing (USB v2.0)
******************************************************************************
* @attention
*
* © COPYRIGHT 2012 STMicroelectronics
*
* Licensed under MCD-ST Liberty SW License Agreement V2 (the “License“);
* You may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.st.com/software_license_agreement_liberty_v2
*
* Unless required by applicable law or agreed to in writing software
* distributed under the License is distributed on an “AS IS“ BASIS
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include “usb_lib.h“
#include “string.h“
#include “usb_prop.h“
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
#define ValBit(VARPlace) (VAR & (1 << Place))
#define SetBit(VARPlace) (VAR |= (1 << Place))
#define ClrBit(VARPlace) (VAR &= ((1 << Place) ^ 255))
#define Send0LengthData() { _SetEPTxCount(ENDP0 0); \
vSetEPTxStatus(EP_TX_VALID); \
}
#define vSetEPRxStatus(st) (SaveRState = st)
#define vSetEPTxStatus(st) (SaveTState = st)
#define USB_StatusIn() Send0LengthData()
#define USB_StatusOut() vSetEPRxStatus(EP_RX_VALID)
#define StatusInfo0 StatusInfo.bw.bb1 /* Reverse bb0 & bb1 */
#define StatusInfo1 StatusInfo.bw.bb0
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
uint16_t_uint8_t StatusInfo;
bool Data_Mul_MaxPacketSize = FALSE;
/* Private function prototypes -----------------------------------------------*/
static void DataStageOut(void);
static void DataStageIn(void);
static void NoData_Setup0(void);
static void Data_Setup0(void);
/* Private functions ---------------------------------------------------------*/
/*******************************************************************************
* Function Name : Standard_GetConfiguration.
* Description : Return the current configuration variable address.
* Input : Length - How many bytes are needed.
* Output : None.
* Return : Return 1 if the request is invalid when “Length“ is 0.
* Return “Buffer“ if the “Length“ is not 0.
*********************************************
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 32753 2016-11-17 15:22 usb_core.c
----------- --------- ---------- ----- ----
32753 1
相关资源
- I2C读写AT24C02 基于STM32F103 cube116540
- 基于stm32f103ve的程序——跑马灯实验
- 基于STM32RCT6的步进电机驱动程序
- stm32f407上的两个can发送和接收例程
- STM32 led 时钟
- STM32 2.4G通信例程
- 直流无刷电机方波驱动 stm32 例程代码
- STM32中文资料
- usb hid调试工具
- HID调试助手
- STM32蓝牙和串口程序
- USB.Over.Network.Server 注册机
- STM32f103超声波模块例程
- stm32f103c8t6 4 oled.rar
- WPF USB 网络 串口 通信软件
- stm32f030 IAP Demo(原创)
- USB转串口驱动,FT232R驱动程序,最新
- STM32基于rt_thread操作系统的SDHC卡文件
- WinCE下CP210x的驱动程序
- hidusage.h hidpi.h 等USB开发用头文件
- NRF24L01实现51与STM32双向通讯
- STM32F103 串口程序(完整版)
- stm32 ds18b20 温度传感器 测试通过
- stm32官方例程
- STM32F103定时器中断程序
- [免费]基于stm32f103ze 的OLED驱动代码
- STM32F103RBT6驱动UC1698控制芯片的160160黑
- STM32F103 DS18B20 V3.5.0固件库驱动程序工
- STM32定时器使用入门。看了这个程序会
- SIM908 SDIO FSMC STM32 FIFO
评论
共有 条评论