![]() |
libusb 1.0.24
USBデバイスにアクセスするためのクロス・プラットフォームのユーザー・ライブラリ
|
このページでは、検出されたデバイスのさまざまな標準USBデスクリプターを調べる方法について詳しく説明します。 さらに…
データ構造体 | |
struct | libusb_device_descriptor |
struct | libusb_endpoint_descriptor |
struct | libusb_interface_descriptor |
struct | libusb_interface |
struct | libusb_config_descriptor |
struct | libusb_ss_endpoint_companion_descriptor |
struct | libusb_bos_dev_capability_descriptor |
struct | libusb_bos_descriptor |
struct | libusb_usb_2_0_extension_descriptor |
struct | libusb_ss_usb_device_capability_descriptor |
struct | libusb_container_id_descriptor |
このページでは、検出されたデバイスのさまざまな標準USBデスクリプターを調べる方法について詳しく説明します。
enum libusb_class_code |
デバイスとインターフェイスのクラス・コード
列挙型 | |
---|---|
LIBUSB_CLASS_PER_INTERFACE | デバイス・デスクリプターのコンテキストでは、このbDeviceClass値は、各インターフェイスが独自のクラス情報を指定し、すべてのインターフェイスが独立して動作することを示します。 |
LIBUSB_CLASS_AUDIO | オーディオ・クラス。 |
LIBUSB_CLASS_COMM | 通信クラス。 |
LIBUSB_CLASS_HID | ヒューマン・インターフェイス・デバイス・クラス。 |
LIBUSB_CLASS_PHYSICAL | 物理。 |
LIBUSB_CLASS_IMAGE | イメージ・クラス。 |
LIBUSB_CLASS_PRINTER | プリンター・クラス。 |
LIBUSB_CLASS_MASS_STORAGE | 大容量記憶装置クラス。 |
LIBUSB_CLASS_HUB | ハブ・クラス。 |
LIBUSB_CLASS_DATA | データ・クラス。 |
LIBUSB_CLASS_SMART_CARD | スマート・カード。 |
LIBUSB_CLASS_CONTENT_SECURITY | コンテンツ・セキュリティ。 |
LIBUSB_CLASS_VIDEO | ビデオ。 |
LIBUSB_CLASS_PERSONAL_HEALTHCARE | パーソナル・ヘルスケア。 |
LIBUSB_CLASS_DIAGNOSTIC_DEVICE | 診断デバイス。 |
LIBUSB_CLASS_WIRELESS | 無線クラス。 |
LIBUSB_CLASS_MISCELLANEOUS | その他(Miscellaneous)クラス。 |
LIBUSB_CLASS_APPLICATION | アプリケーション・クラス。 |
LIBUSB_CLASS_VENDOR_SPEC | ベンダー固有のクラス。 |
USB仕様で定義されているデスクリプター・タイプ。
列挙型 | |
---|---|
LIBUSB_DT_DEVICE | デバイス・デスクリプター。 libusb_device_descriptor を参照して下さい。 |
LIBUSB_DT_CONFIG | 構成デスクリプター。 libusb_config_descriptor を参照して下さい。 |
LIBUSB_DT_STRING | 文字列デスクリプター。 |
LIBUSB_DT_INTERFACE | インターフェイス・デスクリプター。 libusb_interface_descriptor を参照して下さい。 |
LIBUSB_DT_ENDPOINT | エンドポイント・デスクリプター。 libusb_endpoint_descriptor を参照して下さい。 |
LIBUSB_DT_BOS | BOSデスクリプター。 |
LIBUSB_DT_DEVICE_CAPABILITY | デバイス機能(capability)デスクリプター。 |
LIBUSB_DT_HID | HIDデスクリプター。 |
LIBUSB_DT_REPORT | HID報告(report)デスクリプター。 |
LIBUSB_DT_PHYSICAL | 物理(physical)デスクリプター。 |
LIBUSB_DT_HUB | ハブ・デスクリプター。 |
LIBUSB_DT_SUPERSPEED_HUB | 超速(SuperSpeed)ハブ・デスクリプター。 |
LIBUSB_DT_SS_ENDPOINT_COMPANION | 超速(SuperSpeed)エンドポイント・コンパニオン・デスクリプター。 |
エンドポイントの方向。 エンドポイント・アドレス のビット7の値。
列挙型 | |
---|---|
LIBUSB_ENDPOINT_OUT | 出力: ホストからデバイスへ。 |
LIBUSB_ENDPOINT_IN | 入力: デバイスからホストへ。 |
エンドポイント転送タイプ。 エンドポイントのattributesフィールド(訳注:bmAttributes)のビット 0:1 の値。
enum libusb_iso_sync_type |
アイソクロナス・エンドポイントの同期タイプ。 libusb_endpoint_descriptor の bmAttributes フィールドのビット 2:3 の値。
列挙型 | |
---|---|
LIBUSB_ISO_SYNC_TYPE_NONE | 同期しない。 |
LIBUSB_ISO_SYNC_TYPE_ASYNC | 非同期。 |
LIBUSB_ISO_SYNC_TYPE_ADAPTIVE | アダプティブ。 |
LIBUSB_ISO_SYNC_TYPE_SYNC | 同期。 |
アイソクロナス・エンドポイントの利用タイプ。 libusb_endpoint_descriptor の bmAttributes フィールドのビット 4:5 の値。
列挙型 | |
---|---|
LIBUSB_ISO_USAGE_TYPE_DATA | データ・エンドポイント。 |
LIBUSB_ISO_USAGE_TYPE_FEEDBACK | フィードバック・エンドポイント。 |
LIBUSB_ISO_USAGE_TYPE_IMPLICIT | 暗黙のフィードバック・データ・エンドポイント。 |
サポートされている速度(wSpeedSupported)を示すビット・フィールド。デバイスがサポートする速度を示します。
USB2.0拡張デスクリプターの bmAttributes フィールドのビット・マスク。
列挙型 | |
---|---|
LIBUSB_BM_LPM_SUPPORT | 接続電源管理(Link Power Management)(LPM)のサポート |
超速(SuperSpeed)USBデバイス機能デスクリプターの bmAttributes フィールドのビット・マスク。
列挙型 | |
---|---|
LIBUSB_BM_LTM_SUPPORT | レイテンシ・トレランス・メッセージ(LTM)をサポート |
enum libusb_bos_type |
int libusb_get_device_descriptor | ( | libusb_device * | dev, |
struct libusb_device_descriptor * | desc | ||
) |
指定のデバイスのUSBデバイス・デスクリプターを取得します。
これは非ブロッキング関数です。 デバイス・デスクリプターはメモリにキャッシュされます。
注意: libusb-1.0.16、LIBUSB_API_VERSION >= 0x01000102 以降ではこの関数は常に成功することに注意してください。
dev | デバイス |
desc | デスクリプター・データの出力場所 |
int libusb_get_active_config_descriptor | ( | libusb_device * | dev, |
struct libusb_config_descriptor ** | config | ||
) |
現在アクティブな構成のUSB構成デスクリプターを取得します。 これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。
dev | デバイス |
config | USB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。 |
int libusb_get_config_descriptor | ( | libusb_device * | dev, |
uint8_t | config_index, | ||
struct libusb_config_descriptor ** | config | ||
) |
そのインデックスに基づいてUSB構成デスクリプターを取得します。 これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。
dev | デバイス |
config_index | あなたが取得したい構成のインデックス |
config | USB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。 |
int libusb_get_config_descriptor_by_value | ( | libusb_device * | dev, |
uint8_t | bConfigurationValue, | ||
struct libusb_config_descriptor ** | config | ||
) |
指定のbConfigurationValueを使用してUSB構成デスクリプターを取得します。これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。
dev | デバイス |
bConfigurationValue | あなたが取得したい構成のbConfigurationValue |
config | USB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。 |
void libusb_free_config_descriptor | ( | struct libusb_config_descriptor * | config | ) |
libusb_get_active_config_descriptor() または libusb_get_config_descriptor() から取得した構成デスクリプターを解放します。 NULL構成パラメーターを使用してこの関数を呼び出すのは安全です。その場合、関数は何もせずに戻ります。
config | 開放したい構成デスクリプター |
int libusb_get_ss_endpoint_companion_descriptor | ( | libusb_context * | ctx, |
const struct libusb_endpoint_descriptor * | endpoint, | ||
struct libusb_ss_endpoint_companion_descriptor ** | ep_comp | ||
) |
エンドポイントの超速(superspeed)エンドポイント・コンパニオン・デスクリプターを取得します(存在する場合)
ctx | 操作するコンテキスト。デフォルトのコンテキストの場合はNULL |
endpoint | 超速(superspeed)エンドポイント・コンパニオン・デスクリプターを取得するエンドポイント・デスクリプター |
ep_comp | 超速(superspeed)エンドポイント・コンパニオン・デスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_ss_endpoint_companion_descriptor() で解放する必要があります。 |
void libusb_free_ss_endpoint_companion_descriptor | ( | struct libusb_ss_endpoint_companion_descriptor * | ep_comp | ) |
libusb_get_ss_endpoint_companion_descriptor() から取得した超速(superspeed)エンドポイント・コンパニオン・デスクリプターを解放します。 ep_compパラメーターにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせずに戻ります。
ep_comp | 開放したい超速(superspeed)エンドポイント・コンパニオン・デスクリプター |
int libusb_get_bos_descriptor | ( | libusb_device_handle * | dev_handle, |
struct libusb_bos_descriptor ** | bos | ||
) |
バイナリ・オブジェク・トストア(BOS)デスクリプターを取得する。これはブロッキング関数であり、デバイスに要求を送信します。
dev_handle | オープン中のlibbusbデバイスのハンドル |
bos | BOSデスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_bos_descriptor() で解放する必要があります。 |
void libusb_free_bos_descriptor | ( | struct libusb_bos_descriptor * | bos | ) |
libusb_get_bos_descriptor() から取得したBOS・デスクリプターを解放します。 bosパラメータにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせずに戻ります。
bos | 開放したいBOSデスクリプター |
int libusb_get_usb_2_0_extension_descriptor | ( | libusb_context * | ctx, |
struct libusb_bos_dev_capability_descriptor * | dev_cap, | ||
struct libusb_usb_2_0_extension_descriptor ** | usb_2_0_extension | ||
) |
USB 2.0 拡張デスクリプターを取得する
ctx | 操作するコンテキスト。デフォルトのコンテキストの場合はNULL |
dev_cap | bDevCapabilityTypeの値が LIBUSB_BT_USB_2_0_EXTENSION であるデバイス機能デスクリプター |
usb_2_0_extension | USB2.0拡張デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_usb_2_0_extension_descriptor() で解放する必要があります。 |
void libusb_free_usb_2_0_extension_descriptor | ( | struct libusb_usb_2_0_extension_descriptor * | usb_2_0_extension | ) |
libusb_get_usb_2_0_extension_descriptor() から取得したUSB2.0拡張デスクリプターを解放します。 usb_2_0_extensionパラメータにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせず戻ります。
usb_2_0_extension | 開放したいUSB 2.0 拡張デスクリプター |
int libusb_get_ss_usb_device_capability_descriptor | ( | libusb_context * | ctx, |
struct libusb_bos_dev_capability_descriptor * | dev_cap, | ||
struct libusb_ss_usb_device_capability_descriptor ** | ss_usb_device_cap | ||
) |
超速(SuperSpeed)USBデバイス機能デスクリプターを取得する
ctx | 操作するコンテキスト。デフォルトのコンテキストの場合はNULL |
dev_cap | bDevCapabilityTypeの値が LIBUSB_BT_SS_USB_DEVICE_CAPABILITY であるデバイス機能デスクリプター |
ss_usb_device_cap | 超速(SuperSpeed)USBデバイス機能デスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_ss_usb_device_capability_descriptor() で解放する必要があります。 |
void libusb_free_ss_usb_device_capability_descriptor | ( | struct libusb_ss_usb_device_capability_descriptor * | ss_usb_device_cap | ) |
libusb_get_ss_usb_device_capability_descriptor() から取得した超速(SuperSpeed)USBデバイス機能デスクリプターを解放します。ss_usb_device_capパラメーターにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせず戻ります。
ss_usb_device_cap | 開放したい超速(SuperSpeed)USBデバイス機能デスクリプター |
int libusb_get_container_id_descriptor | ( | libusb_context * | ctx, |
struct libusb_bos_dev_capability_descriptor * | dev_cap, | ||
struct libusb_container_id_descriptor ** | container_id | ||
) |
コンテナIDデスクリプターを取得する
ctx | 操作するコンテキスト。デフォルトのコンテキストの場合はNULL |
dev_cap | bDevCapabilityTypeの値が LIBUSB_BT_CONTAINER_ID であるデバイス機能デスクリプター |
container_id | コンテナIDデスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_container_id_descriptor() で開放する必要があります。 |
void libusb_free_container_id_descriptor | ( | struct libusb_container_id_descriptor * | container_id | ) |
libusb_get_container_id_descriptor() から取得したコンテナIDデスクリプターを解放します。container_idパラメータにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせず戻ります。
container_id | 開放したいコンテナIDデスクリプター |
int libusb_get_string_descriptor_ascii | ( | libusb_device_handle * | dev_handle, |
uint8_t | desc_index, | ||
unsigned char * | data, | ||
int | length | ||
) |
CスタイルのASCIIで文字列デスクリプターを取得する。
libusb_get_string_descriptor() のラッパー。デバイスでサポートされている最初の言語を使用します。
dev_handle | デバイス・ハンドル |
desc_index | 取得したいデスクリプターのインデックス |
data | ASCII文字列デスクリプターのための出力バッファ |
length | データ・バッファのサイズ |
|
inlinestatic |
デフォルトの制御パイプからデスクリプターを取得します。 これは、デスクリプターを取得するための適切な制御メッセージを作成する便利な関数です。
dev_handle | デバイス・ハンドル |
desc_type | デスクリプター・タイプ。 libusb_descriptor_type を参照してください。 |
desc_index | 取得したいデスクリプターのインデックス |
data | デスクリプターのための出力バッファ |
length | データ・バッファのサイズ |
|
inlinestatic |
デバイスからデスクリプターを取得します。 これは、デスクリプターを取得するための適切な制御メッセージを作成する便利な関数です。USB仕様で詳しく説明されているように、返される文字列はUnicodeです。
dev_handle | デバイス・ハンドル |
desc_index | 取得したいデスクリプターのインデックス |
langid | 文字列デスクリプターのための言語ID |
data | デスクリプターのための出力バッファ |
length | データ・バッファのサイズ |