罗技F710手柄描述符数据抓包 - 以及stm32读取usb-hid数据程序

news/2025/2/28 17:25:46/
  • 硬件: 罗技F710游戏手柄、一台笔记本电脑
  • 软件: USBlyzer分析仪(下载地址)

大家都知道,罗技F710上有D模式和X模式,D模式是普通模式,每帧数据传输8个字节;X模式是xbox手柄模式,有更多的信息,每帧传输15个字节(因为有陀螺仪数据)。

D模式

  • 先看8个字节的通讯协议
    图片
  • 以下是抓包内容,各种描述符分类清晰,在stm32的usb驱动程序中可以按照命名轻易找到对应的接口来修改。
Connection StatusDevice connected
Current Configuration1
SpeedFull (12 Mbit/s)
Device Address14
Number Of Open Pipes2

Device Descriptor Logitech Cordless RumblePad 2

OffsetFieldSizeValueDescription
0bLength112h
1bDescriptorType101hDevice
2bcdUSB20200hUSB Spec 2.0
4bDeviceClass100hClass info in Ifc Descriptors
5bDeviceSubClass100h
6bDeviceProtocol100h
7bMaxPacketSize0108h8 bytes
8idVendor2046DhLogitech, Inc.
10idProduct2C219h
12bcdDevice20305h3.05
14iManufacturer101h“Logitech”
15iProduct102h“Logitech Cordless RumblePad 2”
16iSerialNumber100h
17bNumConfigurations101h

Configuration Descriptor 1 Bus Powered, 98 mA

OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType102hConfiguration
2wTotalLength20029h
4bNumInterfaces101h
5bConfigurationValue101h
6iConfiguration104h“PACER-X03.05_A”
7bmAttributes180hBus Powered
4…0: Reserved…00000
5: Remote Wakeup…0…No
6: Self Powered.0…No, Bus Powered
7: Reserved (set to one)(bus-powered for 1.0)1…
8bMaxPower131h98 mA

Interface Descriptor 0/0 HID, 2 Endpoints

OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType104hInterface
2bInterfaceNumber100h
3bAlternateSetting100h
4bNumEndpoints102h
5bInterfaceClass103hHID
6bInterfaceSubClass100h
7bInterfaceProtocol100h
8iInterface100h

HID Descriptor

OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType121hHID
2bcdHID20111h1.11
4bCountryCode100h
5bNumDescriptors101h
6bDescriptorType122hReport
7wDescriptorLength20077h119 bytes

Endpoint Descriptor 81 1 In, Interrupt, 4 ms

OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress181h1 In
3bmAttributes103hInterrupt
1…0: Transfer Type…11Interrupt
7…2: Reserved000000…
4wMaxPacketSize20020h32 bytes
6bInterval104h4 ms

Endpoint Descriptor 01 1 Out, Interrupt, 8 ms

OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress101h1 Out
3bmAttributes103hInterrupt
1…0: Transfer Type…11Interrupt
7…2: Reserved000000…
4wMaxPacketSize20020h32 bytes
6bInterval108h8 ms

Interface 0 HID Report Descriptor Game Pad

结合通讯协议,以及报告描述符,可以轻易写joystick驱动代码(用stm32的usb主机模式,读取usb-hid类设备驱动程序即可)

Item Tag (Value)Raw Data
Usage Page (Generic Desktop)05 01
Usage (Game Pad)09 05
Collection (Application)A1 01
Collection (Logical)A1 02
Report ID (1)85 01
Report Size (8)75 08
Report Count (4)95 04
Logical Minimum (0)15 00
Logical Maximum (255)26 FF 00
Physical Minimum (0)35 00
Physical Maximum (255)46 FF 00
Usage (X)09 30
Usage (Y)09 31
Usage (Z)09 32
Usage (Rz)09 35
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
Report Size (4)75 04
Report Count (1)95 01
Logical Maximum (7)25 07
Physical Maximum (315)46 3B 01
Unit (Eng Rot: Degree)66 14 00
Usage (Hat Switch)09 39
Input (Data,Var,Abs,NWrp,Lin,Pref,Null,Bit)81 42
Unit (None)66 00 00
Report Size (1)75 01
Report Count (12)95 0C
Logical Maximum (1)25 01
Physical Maximum (1)45 01
Usage Page (Button)05 09
Usage Minimum (Button 1)19 01
Usage Maximum (Button 12)29 0C
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
Report Count (1)95 01
Report Size (8)75 08
Usage Page (Vendor-Defined 1)06 00 FF
Logical Maximum (255)26 FF 00
Physical Maximum (255)46 FF 00
Usage (Undefined)09 00
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
End CollectionC0
Collection (Logical)A1 02
Report ID (2)85 02
Report Count (7)95 07
Report Size (8)75 08
Logical Maximum (255)26 FF 00
Physical Maximum (255)46 FF 00
Usage Page (Vendor-Defined 1)06 00 FF
Usage (Vendor-Defined 3)09 03
Input (Data,Var,Abs,NWrp,Lin,Pref,NNul,Bit)81 02
End CollectionC0
Collection (Logical)A1 02
Report ID (3)85 03
Usage (Vendor-Defined 4)09 04
Output (Data,Var,Abs,NWrp,Lin,Pref,NNul,NVol,Bit)91 02
End CollectionC0
End CollectionC0

X模式

  • 协议解析
字节0123456,78,910,1112,1314
定义ID0x14ButtonsButtonsLTRTLeft X AxisLeft Y AxisRight X AxisRight Y AxisMode

图片

Connection StatusDevice connected
Current Configuration1
SpeedFull (12 Mbit/s)
Device Address15
Number Of Open Pipes2

Device Descriptor Wireless Gamepad F710

OffsetFieldSizeValueDescription
0bLength112h
1bDescriptorType101hDevice
2bcdUSB20200hUSB Spec 2.0
4bDeviceClass1FFhVendor-Specific
5bDeviceSubClass1FFh
6bDeviceProtocol1FFh
7bMaxPacketSize0108h8 bytes
8idVendor2046DhLogitech, Inc.
10idProduct2C21Fh
12bcdDevice20305h3.05
14iManufacturer101h“Logitech”
15iProduct102h“Wireless Gamepad F710”
16iSerialNumber103h“8F699F3C”
17bNumConfigurations101h

Configuration Descriptor 1 Bus Powered, 98 mA

OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType102hConfiguration
2wTotalLength20030h
4bNumInterfaces101h
5bConfigurationValue101h
6iConfiguration100h
7bmAttributes180hBus Powered
4…0: Reserved…00000
5: Remote Wakeup…0…No
6: Self Powered.0…No, Bus Powered
7: Reserved (set to one)(bus-powered for 1.0)1…
8bMaxPower131h98 mA

Interface Descriptor 0/0 Vendor-Specific, 2 Endpoints

OffsetFieldSizeValueDescription
0bLength109h
1bDescriptorType104hInterface
2bInterfaceNumber100h
3bAlternateSetting100h
4bNumEndpoints102h
5bInterfaceClass1FFhVendor-Specific
6bInterfaceSubClass15Dh
7bInterfaceProtocol101h
8iInterface100h

Unrecognized Class-Specific Descriptor

OffsetFieldSizeValueDescription
0bLength110h
1bDescriptorType121h
21410 01 01 24 81 14 03 00 03 13 02 00 03 00

Endpoint Descriptor 81 1 In, Interrupt, 4 ms

OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress181h1 In
3bmAttributes103hInterrupt
1…0: Transfer Type…11Interrupt
7…2: Reserved000000…
4wMaxPacketSize20020h32 bytes
6bInterval104h4 ms

Endpoint Descriptor 02 2 Out, Interrupt, 8 ms

OffsetFieldSizeValueDescription
0bLength107h
1bDescriptorType105hEndpoint
2bEndpointAddress102h2 Out
3bmAttributes103hInterrupt
1…0: Transfer Type…11Interrupt
7…2: Reserved000000…
4wMaxPacketSize20020h32 bytes
6bInterval108h8 ms

手柄完整的数据协议:https://blog.csdn.net/liudijiang/article/details/86693435#Logitech_Wireless_Gamepad_F710_2

程序

顺便放一个我的程序,裸机读取usb手柄数据并发给串口,基于stm32h743,使用意法半导体官方IDEstm32cubeide生成并修改了部分驱动内容。

蓝奏云:https://www.lanzoui.com/i8wf6de

PS: 后续有时间更新一下生成和修改的过程,并移植到freertos中官方ide直接生成的freertos + usb-host代码有bug,会直接内存泄露)。


http://www.ppmy.cn/news/526042.html

相关文章

罗技x56c语言编程,【罗技X56评测】模拟飞行好伙伴,X56在x-plane中的应用

本帖最后由 5869 于 2018-3-17 19:24 编辑 入手X56有几天了,这段时间把众多的按钮和拨动开关为x-plane 11做了一定的定制,以实现不通过鼠标在驾驶舱内点选即可实现主要功能的控制。将摇杆和节流阀插入电脑时,x-plane 11能自动检测并识别设备的型号,无需驱动。不仅如此,x-p…

在Ubuntu 16.04系统中,将Logitech G920方向盘连接到Carla服务器

注: 电脑是win10 Ubuntu 16.04双系统我们用Logitech g29方向盘的程序来模拟G920方向盘,所以接下来运行出现g29等字样,是没有问题的 1、jstest-gtk 1)描述: jstest-gtk是一个基于Gtk 的简单操纵杆测试和配置工具。…

k120键盘 linux,45元好用不贵!罗技K120 全尺寸有线键盘

45元好用不贵!罗技K120 全尺寸有线键盘 2019-07-03 11:00:00 7点赞 15收藏 12评论 家里的键盘是2011年结婚时买的罗技,用到现在8年了,终于坏掉了,感叹当年的东西质量真好! 本人不打游戏,家里电脑就上上网、…

罗技 无线鼠标 USB HID数据格式

最近在使用 pyusb 进行 鼠标原始数据的读取,使用的是树莓派linux环境,将踩过的“坑”记录下来: 一般需要使用 sudo 运行程序,否则linux系统会报“权限不够”; 对于同时支持无线鼠标、键盘的无线接收器设备&#xff0c…

jna调取第三方dll实战(罗技G29)

如果你是一个java程序员,并且需要调用第三方的dll,那么jna无疑是最好的方式 最近开发遇到一个问题,如何在浏览器上获取罗技G29方向盘的数据,简单的来说是浏览器如何识别到你插入的设备。 一、首先:你得去罗技官网下载…

ROS中使用罗技G29遥控器

ROS中使用罗技G29遥控器 本教程主要教大家如何在ROS环境中读取G29 摇杆的值。 在实验过程中需要使用G29遥控器可以用来做自动驾驶,G29 没有官方的驱动,github上存在两个使用G29的包,但是安装比较复杂,需要依赖的东西太多&#xff…

Linux USB 驱动实验

目录 USB 接口简介什么是USB?USB 电气特性USB 拓扑结构什么是USB OTG?I.MX6ULL USB 接口简介 硬件原理图分析USB HUB 原理图分析V2.4 版本以前底板USB OTG 原理图分析V2.4 及以后版本底板USB OTG 原理图分析 USB 协议简析USB 描述符USB 数据包类型USB 传…

python 方向盘_Carla 0.9.5 简单高效安装方法 Ubuntu18.04 罗技G29方向盘连接

经过很多天的试错以及github咨询,终于基本解决了各种问题。。分享一个比较简单高效的方法:不从源代码编译,直接下载官方发布编译好的release包,地址如下: 0.下载并安装Anconda,能把python调用相关的包全部装好,以及pip等工具。 1. 下载压缩包并解压 里面的./CarlaUE4.sh…