Wireshark - 未使用的设置标头

问题描述 投票:0回答:1

我正在尝试对我的 SteelSeries Apex 3 TKL 键盘的 RGB 控件进行逆向工程。我的最终目标是使用 Python 控制 RGB,特别是

ctrl_transfer(bmRequestType, bmRequest, wValue, wIndex, data)
命令。

当使用 OpenRGB 要求颜色时,我使用 Wireshark 捕获发送到键盘的数据。但是,我不明白为什么我在发送的数据包中丢失了某些信息。我看过另一篇文章,其中包含 USB URB 中的附加信息,例如设置数据。 如何正确进行USB控制传输(libusb)?.我缺少此信息,并且只有未使用的设置标头(请参阅下面的 USB URB 摘录)。我想用它来提取

bmRequestType
bRequest
wValue
wIndex
wLength
Data Fragment
。有没有办法查看设置数据?

环顾四周,

bmRequestType: 0x21
bRequest: 9
似乎对于 RGB 控件很常见,但
wValue
wIndex
可能会因设备而异。

这些是我使用 OpenRGB 更改颜色时捕获的帧: 初始帧:

Frame 219: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits) on interface usbmon1, id 0
    Section number: 1
    Interface id: 0 (usbmon1)
        Interface name: usbmon1
    Encapsulation type: USB packets with Linux header and padding (115)
    Arrival Time: Sep 21, 2024 12:35:27.591740000 BST
    UTC Arrival Time: Sep 21, 2024 11:35:27.591740000 UTC
    Epoch Arrival Time: 1726918527.591740000
    [Time shift for this packet: 0.000000000 seconds]
    [Time delta from previous captured frame: 0.001744000 seconds]
    [Time delta from previous displayed frame: 0.000000000 seconds]
    [Time since reference or first frame: 1.540403000 seconds]
    Frame Number: 219
    Frame Length: 128 bytes (1024 bits)
    Capture Length: 128 bytes (1024 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: usb:usbhid]
USB URB
    [Source: 1.7.2]
    [Destination: host]
    URB id: 0xffff8b7f8e353d80
    URB type: URB_COMPLETE ('C')
    URB transfer type: URB_INTERRUPT (0x01)
    Endpoint: 0x82, Direction: IN
        1... .... = Direction: IN (1)
        .... 0010 = Endpoint number: 2
    Device: 7
    URB bus id: 1
    Device setup request: not relevant ('-')
    Data: present ('\0')
    URB sec: 1726918527
    URB usec: 591740
    URB status: Success (0)
    URB length [bytes]: 64
    Data length [bytes]: 64
    [bInterfaceClass: HID (0x03)]
    Unused Setup Header
    Interval: 1
    Start frame: 0
    Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
    Number of ISO descriptors: 0
HID Data: 21000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

第二帧:

Frame 220: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon1, id 0
    Section number: 1
    Interface id: 0 (usbmon1)
        Interface name: usbmon1
    Encapsulation type: USB packets with Linux header and padding (115)
    Arrival Time: Sep 21, 2024 12:35:27.591762000 BST
    UTC Arrival Time: Sep 21, 2024 11:35:27.591762000 UTC
    Epoch Arrival Time: 1726918527.591762000
    [Time shift for this packet: 0.000000000 seconds]
    [Time delta from previous captured frame: 0.000022000 seconds]
    [Time delta from previous displayed frame: 0.000022000 seconds]
    [Time since reference or first frame: 1.540425000 seconds]
    Frame Number: 220
    Frame Length: 64 bytes (512 bits)
    Capture Length: 64 bytes (512 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: usb]
USB URB
    [Source: host]
    [Destination: 1.7.2]
    URB id: 0xffff8b7f8e353d80
    URB type: URB_SUBMIT ('S')
    URB transfer type: URB_INTERRUPT (0x01)
    Endpoint: 0x82, Direction: IN
        1... .... = Direction: IN (1)
        .... 0010 = Endpoint number: 2
    Device: 7
    URB bus id: 1
    Device setup request: not relevant ('-')
    Data: not present ('<')
    URB sec: 1726918527
    URB usec: 591762
    URB status: Operation now in progress (-EINPROGRESS) (-115)
    URB length [bytes]: 64
    Data length [bytes]: 0
    [Response in: 223]
    [bInterfaceClass: HID (0x03)]
    Unused Setup Header
    Interval: 1
    Start frame: 0
    Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
    Number of ISO descriptors: 0

第三帧:

Frame 223: 128 bytes on wire (1024 bits), 128 bytes captured (1024 bits) on interface usbmon1, id 0
    Section number: 1
    Interface id: 0 (usbmon1)
        Interface name: usbmon1
    Encapsulation type: USB packets with Linux header and padding (115)
    Arrival Time: Sep 21, 2024 12:35:27.594736000 BST
    UTC Arrival Time: Sep 21, 2024 11:35:27.594736000 UTC
    Epoch Arrival Time: 1726918527.594736000
    [Time shift for this packet: 0.000000000 seconds]
    [Time delta from previous captured frame: 0.002949000 seconds]
    [Time delta from previous displayed frame: 0.002974000 seconds]
    [Time since reference or first frame: 1.543399000 seconds]
    Frame Number: 223
    Frame Length: 128 bytes (1024 bits)
    Capture Length: 128 bytes (1024 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: usb:usbhid]
USB URB
    [Source: 1.7.2]
    [Destination: host]
    URB id: 0xffff8b7f8e353d80
    URB type: URB_COMPLETE ('C')
    URB transfer type: URB_INTERRUPT (0x01)
    Endpoint: 0x82, Direction: IN
        1... .... = Direction: IN (1)
        .... 0010 = Endpoint number: 2
    Device: 7
    URB bus id: 1
    Device setup request: not relevant ('-')
    Data: present ('\0')
    URB sec: 1726918527
    URB usec: 594736
    URB status: Success (0)
    URB length [bytes]: 64
    Data length [bytes]: 64
    [Request in: 220]
    [Time from request: 0.002974000 seconds]
    [bInterfaceClass: HID (0x03)]
    Unused Setup Header
    Interval: 1
    Start frame: 0
    Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
    Number of ISO descriptors: 0
HID Data: 23000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000

第四帧:

Frame 224: 64 bytes on wire (512 bits), 64 bytes captured (512 bits) on interface usbmon1, id 0
    Section number: 1
    Interface id: 0 (usbmon1)
        Interface name: usbmon1
    Encapsulation type: USB packets with Linux header and padding (115)
    Arrival Time: Sep 21, 2024 12:35:27.594743000 BST
    UTC Arrival Time: Sep 21, 2024 11:35:27.594743000 UTC
    Epoch Arrival Time: 1726918527.594743000
    [Time shift for this packet: 0.000000000 seconds]
    [Time delta from previous captured frame: 0.000007000 seconds]
    [Time delta from previous displayed frame: 0.000007000 seconds]
    [Time since reference or first frame: 1.543406000 seconds]
    Frame Number: 224
    Frame Length: 64 bytes (512 bits)
    Capture Length: 64 bytes (512 bits)
    [Frame is marked: False]
    [Frame is ignored: False]
    [Protocols in frame: usb]
USB URB
    [Source: host]
    [Destination: 1.7.2]
    URB id: 0xffff8b7f8e353d80
    URB type: URB_SUBMIT ('S')
    URB transfer type: URB_INTERRUPT (0x01)
    Endpoint: 0x82, Direction: IN
        1... .... = Direction: IN (1)
        .... 0010 = Endpoint number: 2
    Device: 7
    URB bus id: 1
    Device setup request: not relevant ('-')
    Data: not present ('<')
    URB sec: 1726918527
    URB usec: 594743
    URB status: Operation now in progress (-EINPROGRESS) (-115)
    URB length [bytes]: 64
    Data length [bytes]: 0
    [bInterfaceClass: HID (0x03)]
    Unused Setup Header
    Interval: 1
    Start frame: 0
    Copy of Transfer Flags: 0x00000204, No transfer DMA map, Dir IN
    Number of ISO descriptors: 0

我尝试了 OpenRGB 的各种要求排列来尝试提取设置数据,但没有成功。

usb rgb wireshark pyusb
1个回答
0
投票

我自己解决了这个问题。我正在监控不正确的USB数据包!所有信息,如

bmRequestType = 0x21
bRequest = 0x09
wValue = 0x0200
wIndex = 0x1
wLength = 64
Data Fragment = varies by request...
)都存在于这些数据包中。

我的脚本现在正在运行。

© www.soinside.com 2019 - 2024. All rights reserved.