我试图弄清楚如何为 Microsoft LifeCam 打开“TrueColor”。我有几个来自 USBSniffer 的大 USB 日志,以及当我单击 Microsoft 软件中的复选框时始终显示的一些序列。这是启用序列开头的请求和设备响应(如果我误解了此数据,请纠正我):
[156918643 ms] UsbSnoop - FilterDispatchAny(ac56afd2) : IRP_MJ_INTERNAL_DEVICE_CONTROL
[156918643 ms] UsbSnoop - FdoHookDispatchInternalIoctl(ac56b1ea) : fdo=88b25448, Irp=889911d8, IRQL=0
[156918643 ms] >>> URB 1482 going down >>>
-- URB_FUNCTION_CLASS_INTERFACE:
TransferFlags = 00000001 (USBD_TRANSFER_DIRECTION_IN, ~USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000002
TransferBuffer = abb04b86
TransferBufferMDL = 00000000
UrbLink = 00000000
RequestTypeReservedBits = 00000000
Request = 00000085
Value = 00001600
Index = 00000500
[156918644 ms] UsbSnoop - MyInternalIOCTLCompletion(ac56b126) : fido=00000000, Irp=889911d8, Context=894d6c98, IRQL=2
[156918644 ms] <<< URB 1482 coming back <<<
-- URB_FUNCTION_CONTROL_TRANSFER:
PipeHandle = 885639a0
TransferFlags = 0000000b (USBD_TRANSFER_DIRECTION_IN, USBD_SHORT_TRANSFER_OK)
TransferBufferLength = 00000002
TransferBuffer = abb04b86
TransferBufferMDL = 8837fee0
00000000: 40 00
UrbLink = 00000000
SetupPacket =
00000000: a1 85 00 16 00 05 02 00
现在,我想通过 PyUSB 发送我看到的请求序列,但是当我发送第一个请求时,我得到:
>>> ret = dev.ctrl_transfer(0x80, 0x85, 0x1600, 0x0500, 8)
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "c:\Python24\Lib\site-packages\usb\core.py", line 702, in ctrl_transfer
self.__get_timeout(timeout)
File "c:\Python24\Lib\site-packages\usb\backend\libusb0.py", line 539, in ctrl_transfer
timeout
File "c:\Python24\Lib\site-packages\usb\backend\libusb0.py", line 387, in _check
raise USBError(errmsg, ret)
usb.core.USBError: (None, 'usb_control_msg: invalid request 0x85')
对于它的价值,一个简单的 GET_STATUS 似乎工作:
>>> ret = dev.ctrl_transfer(0x80, 0, 0, 0, 8)
>>> print ret
array('B', [0, 0])
为什么在一种情况下得到答复的请求在另一种情况下无效?句法?设备状态?