最終更新:2015-07-13 (月) 18:59:26 (3221d)  

USB/HID
Top / USB / HID

メモ

速度

USB.orgのドキュメント

転送モード

コントロール転送(エンドポイント0、双方向)

  • Receiving and responding to requests for USB control and class data.
  • Transmitting data when polled by the HID class driver (using the Get_Report request).
  • Receiving data from the host.

インタラプト転送

  • Receiving asynchronous (unrequested) data from the device.
  • Transmitting low latency data to the device.
  • インタラプトIN(デバイス→ホスト):必須
  • インタラプトOUT(ホスト→デバイス):オプション
    • インタラプトOUTが宣言されてない場合、OutputレポートはSet_Report(Output)を使ってエンドポイント0にコントロール転送で送られる。
    • If no Interrupt Out endpoint is declared then Output reports are transmitted to a device through the Control endpoint, using Set_Report(Output) requests.

パケットサイズ

転送間隔

インタラプト転送で最低限保証されるパケット数とその間隔

  • ロースピードフルスピードハイスピードスーパースピード
    1/10ms1/1ms3/125us3/125us

最大転送速度

  • USB 2.0およびUSB 3.0仕様に準拠するために、デフォルトインターフェイスでのインタラプトエンドポイントは64KB/sを超えて要求してはいけない。(USB 2.0仕様P49)
  • 超えるためには代替インターフェイス(USB/代替設定)が必要になるが、そうなると独自ドライバが必要になる。
  • 1フレームで1024バイト以上送るには広帯域エンドポイントのサポートが必要だがWindowsでは未サポート(Windows 7でも)
    転送ロースピードフルスピードハイスピードスーパースピード
    インタラプト転送8 * 100B/s64 * 1000B/s1024 * 3 * 8 * 1000B/s(24.576MB/s)
    広帯域エンドポイント非サポートの場合、1024 * 1 * 8 * 1000B/s (8.192MB/s))
    1024 * 3 * 8 * 1000B/s(24.576MB/s)
    Windowsでの実質8 * 100B/s64 * 1000B/s64(デフォルトインターフェイスの制限) * 1(広帯域エンドポイント非サポート) * 8 * 1000B/s(512KB/s)?
  • Universal Serial Bus Specification Revision 2.0 (P49)
    • USB 2.0およびUSB 3.0仕様に準拠するために、デフォルトインターフェイスでのインタラプトエンドポイントは64KB/sを超えて要求してはいけない。
    • All high-speed device default interface settings must not include any interrupt endpoints with a data payload size (specified via wMaxPacketSize in the endpoint descriptor) greater than 64 bytes.
    • Alternate interface settings may specify larger data payload sizes for interrupt endpoints.
    • If the interrupt endpoints have a large data payload size, it is recommended that additional configurations or alternate interface settings be used to specify a range of data payload sizes.
    • This increases the chances that the device can be used successfully in combination with other USB devices.
  • HIDは1トランザクションあたりハイスピードで最大64バイトまで。
  • A device may send or receive a transaction every USB frame (1 millisecond).
  • A transaction may be made up of multiple packets (token, data, handshake) but is limited in size to 8 bytes for low-speed devices and 64 bytes for high-speed devices.
  • 参考図書/USBコンプリート
    • USB 2.0 and USB 3.0 require interrupt endpoints in a default interface to have a maximum packet size of 64 bytes or less.
    • If the data doesn’t fit in a single transaction, the host uses multiple transactions to complete the transfer.

ディスクリプタ

HIDクラスリクエスト

  • コントロール転送エンドポイント0にリスエスト送信。
    bRequestの値bRequest
    0x01GET_REPORTコントロール転送を使い、デバイスから USB ホストに HID データを転送要求
    0x02SET_IDLEインタラプト転送の間隔(アイドルレート)の現在値を報告要求
    0x03GET_PROTOCOL?現在選択されているプロトコル(ブートプロトコルまたはレポートプロトコル)を報告要求
    0x09SET_REPORTコントロール転送を使い、USB ホストからデバイスに HID データを転送
    0x0ASET_IDLEインタラプト転送の間隔(アイドルレート)を設定
    0x0BSET_PROTOCOL?使用するプロトコル(ブートプロトコルまたはレポートプロトコル)を設定