First, I am sorry for my bad english. I'm not english native speaker and explanation technical things is hard for me...
These informations are from my personal experience. They can be incorrectness and bad. These document describe only part of "controll layer" usb.
[71828 ms] UsbSnoop - FilterDispatchAny(eb8fdfd2) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[71828 ms] UsbSnoop - FdoHookDispatchInternalIoctl(eb8fe1ea) : fdo=89060de8, Irp=88ce3a68, IRQL=0
[71828 ms] >>> URB 7 going down >>>
-- URB_FUNCTION_VENDOR_DEVICE:
TransferFlags = 00000000 (USBD_TRANSFER_DIRECTION_OUT, ~USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 88e5d9f8
TransferBufferMDL = 00000000
00000000: 13 13 81 02
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000004
Value = 00000019
Index = 00000000
[71829 ms] UsbSnoop - MyInternalIOCTLCompletion(eb8fe126) : fido=00000000, Irp=88ce3a68, Context=88e8fe08, IRQL=2
[71829 ms] <<< URB 7 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 8905c210
TransferFlags = 0000000a (USBD_TRANSFER_DIRECTION_OUT, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000004
TransferBuffer = 88e5d9f8
TransferBufferMDL = 88c6fe30
UrbLink = 00000000
SetupPacket =
00000000: 40 04 19 00 00 00 04 00
[71829 ms] UsbSnoop - FilterDispatchAny(eb8fdfd2) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[71829 ms] UsbSnoop - FdoHookDispatchInternalIoctl(eb8fe1ea) : fdo=89060de8, Irp=88ce3a68, IRQL=01
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
Offset | Name | Width (in bytes) | Description |
---|---|---|---|
0 | bmRequestType | 1 |
Maps of bits characterize request.
|
1 | bRequest | 1 | request specification |
2 | wValue | 2 | Connotation depends on request. |
4 | wIndex | 2 | Connotation depends on request. Mostly index or offset. |
6 | wLength | 2 | Length data part of request (in bytes). |
int usb_control_msg(struct usb_device * dev, unsigned int pipe, __u8 request, __u8 requesttype, __u16 value, __u16 index, void * data, __u16 size, int timeout);
0x13, 0x00, 0x81, 0x00register address is puting on offset 1, register data on offset 3. For example transfer buffer is
13 14 81 02Its write value 0x02 to register with address 0x14.
0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, M5602_XB_I2C_DEV_ADDR (0x6a), 0x81, S5K83A_I2C_SLAVE_WRITE_ADDRESS (0x5a), 0x13, M5602_XB_I2C_REG_ADDR (0x6b), 0x81, 0x00 (sensor reg. addr.), 0x13, M5602_XB_I2C_DATA (0x6c), 0x81, 0x00 (sensor first byte value), 0x13, M5602_XB_I2C_CTRL (0x68), 0x81, 0x11In green are values for m5602 and s5k83a sensor.
0x23, 0x74, 0x81, 0x06, 0x23, 0x62, 0x81, 0x80, 0x13, M5602_XB_I2C_DEV_ADDR (0x6a), 0x81, S5K83A_I2C_SLAVE_WRITE_ADDRESS (0x5a), 0x13, M5602_XB_I2C_REG_ADDR (0x6b), 0x81, 0x00 (sensor reg. addr.), 0x13, M5602_XB_I2C_DATA (0x6c), 0x81, 0x00 (sensor first byte value), 0x13, M5602_XB_I2C_DATA (0x6c), 0x81, 0x00 (sensor second byte value), 0x13, M5602_XB_I2C_CTRL (0x68), 0x81, 0x11
00000000: 23 74 81 06 23 62 81 80 13 6a 81 5a 13 6b 81 09 00000010: 13 6c 81 88 13 68 81 11or like this (for two bytes)
00000000: 23 74 81 06 23 62 81 80 13 6a 81 5a 13 6b 81 14 00000010: 13 6c 81 00 13 6c 81 20 13 68 81 12