HIDデバイスからデータを読み取ろうとしています。基本的に次のようなUSBスニファキャプチャがあります。
Get Device Descriptor
Get Device Descriptor
Set Address
Get Configuration Descriptor
Get Configuration Descriptor
Set Configuration
Set Idle
Get Input Report
Get Input Report
Get Input Report
Get Input Report
Set Feature Report
Get Input Report
Set Feature Report
Get Input Report
Get Input Report
Set Output Report
Get Input Report
Set Feature Report
Input Report
Input Report
Input Reportセットアップ前のすべてInput Reportが、デバイスからの定期的なデータ収集であるように見えます。
libusbでは、次のことを行っています。
usb_init();
usb_find_busses();
usb_find_devices();
loop through busses
loop through devices
if correct vendor and correct product
handle = usb_open(device)
break
usb_set_configuration(dev_handle, 1)
// Endpoint 0 is a 'write endpoint', endpoint 1 is a 'read endpoint'.
endpoint = &device->config[0].interface[0].altsetting[0].endpoint[1]
usb_claim_interface(dev_handle, 0)
usb_set_altinterface(dev_handle, 0)
usb_bulk_read(dev_handle, endpoint->bEndpointAddress, buffer, endpoint->wMaxPacketSize, 1);
までのドライバーとコードは、までusb_set_configurationのスニファー分析に対応していると思いますSet Configuration。
コード内のすべては、失敗するまで成功usb_bulk_readします。
- どのように私
Set IdleはGet Input Report、、、、?Set Feature ReportSet Output Report - なぜ
usb_bulk_read失敗するのですか? - デバイスとの通信を設定するには、他に何をする必要がありますか?