USB鼠标实现——HID 报告的返回(八)

HID 报告的返回

仓库地址

仓库地址

USB 鼠标阅读顺序

报告返回

根据 HID 报告描述符 中设置的报告,返回 5 字节数据

typedef struct __attribute__ ((packed))
{
    uint8_t buttons; /**< buttons mask for currently pressed buttons in the mouse. */
    int8_t  x;       /**< Current delta x movement of the mouse. */
    int8_t  y;       /**< Current delta y movement on the mouse. */
    int8_t  wheel;   /**< Current delta wheel movement on the mouse. */
    int8_t  pan;     // using AC Pan
} hid_mouse_report_t;

USB 端点数据分析

0x0 0x5 0x5 0x0 0x0
  • buttons:0x00
    • 鼠标左键是否按下 0 表示没有按下
  • x:0x05
    • x 轴移动量
  • y:0x05
    • y 轴移动量
  • whell:0x00
    • 滚轮移动量
  • pan:0x00
    • AC pan

配置描述符集合 中设置的端点地址为 0x81 ,bit7 位表示数据方向,输入端点 D7 为 1。所以输入端点 1 的地址为 0x81。

将上述报告通过端点返回即可。

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值