ガレスタさんのDIY日記

電子回路、Web、組み込み、自作エフェクターを語るblog

自分用メモ Device Qualifier Descriptor

STのCDCのコードみてたら出てきたので調べてみた

f:id:gsmcustomeffects:20170624211149p:plain

high-speed capable device that has different device information for full-speed and high-speed must have a Device Qualifier Descriptor (USB_DEVICE_QUALIFIER_DESCRIPTOR).

とあるのでハイスピードデバイスが有するディスクリプタでデバイスが他の速度で動作していた場合に変更される高速対応デバイスに関する情報を記述するものらしい。

すっごい回りくどいので要約するとハイスピードデバイスが低速互換で動く場合に必要とされるやつと覚えとけばいいと思う

Offset Field Type Size Value Description
0 bLength uint8_t 1 Number Size of this descriptor in bytes.
1 bDescriptorType uint8_t 1 Constant Device Qualifier Descriptor Type = 6.
2 bcdUSB uint16_t 2 BCD USB Specification Release Number in Binary-Coded Decimal (i.e., 2.10 is 210h). This field identifies the release of the USB Specification with which the device and its descriptors are compliant. At least V2.00 is required to use this descriptor.
4 bDeviceClass uint8_t 1 Class

Class code (assigned by the USB-IF).

If this field is

reset to zero, each interface within a configuration specifies its own class information and the various interfaces operate independently.
set to a value between 1 and FEh, the device supports different class specifications on different interfaces and the interfaces may not operate independently. This value identifies the class definition used for the aggregate interfaces.

If this field is set to FFh, the device class is vendor specific.

5 bDeviceSubClass uint8_t 1 SubClass

Subclass code (assigned by the USB-IF).

These codes are qualified by the value of the bDeviceClass field. If bDeviceClass is

reset to zero, this field must also be reset to zero.
not set to FFh, all values are reserved for assignment by the USB-IF.

6 bDeviceProtocol uint8_t 1 Protocol

Protocol code (assigned by the USB-IF). These codes are qualified by the values of the bDeviceClass and bDeviceSubClass fields. If a device supports class-specific protocols on a device basis as opposed to an interface basis, this code identifies the protocols that the device uses as defined by the specification of the device class.

If this field is

reset to zero, the device does not use class-specific protocols on a device basis. However, it may use class-specific protocols on an interface basis.
set to FFh, the device uses a vendor specific protocol on a device basis.
7 bMaxPacketSize0 uint8_t 1 Number Maximum packet size for other speed.
8 bNumConfigurations uint8_t 1 Number Number of other-speed configurations.
9 bReserved uint8_t 1 Zero Reserved for future use, must be zero.

補助的な意味合いなので特別困ることはない

上記の例ではCDCなのでbDeviceClassは0x02になってる。
あとは上位のディスクリプタ見つつかけばOK