libusb  1.0.24
USBデバイスにアクセスするためのクロス・プラットフォームのユーザー・ライブラリ
データ構造体 | 列挙型 | 関数
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
 

列挙型

enum  libusb_class_code {
  LIBUSB_CLASS_PER_INTERFACE = 0x00, LIBUSB_CLASS_AUDIO = 0x01, LIBUSB_CLASS_COMM = 0x02, LIBUSB_CLASS_HID = 0x03,
  LIBUSB_CLASS_PHYSICAL = 0x05, LIBUSB_CLASS_IMAGE = 0x06, LIBUSB_CLASS_PTP = 0x06, LIBUSB_CLASS_PRINTER = 0x07,
  LIBUSB_CLASS_MASS_STORAGE = 0x08, LIBUSB_CLASS_HUB = 0x09, LIBUSB_CLASS_DATA = 0x0a, LIBUSB_CLASS_SMART_CARD = 0x0b,
  LIBUSB_CLASS_CONTENT_SECURITY = 0x0d, LIBUSB_CLASS_VIDEO = 0x0e, LIBUSB_CLASS_PERSONAL_HEALTHCARE = 0x0f, LIBUSB_CLASS_DIAGNOSTIC_DEVICE = 0xdc,
  LIBUSB_CLASS_WIRELESS = 0xe0, LIBUSB_CLASS_MISCELLANEOUS = 0xef, LIBUSB_CLASS_APPLICATION = 0xfe, LIBUSB_CLASS_VENDOR_SPEC = 0xff
}
 
enum  libusb_descriptor_type {
  LIBUSB_DT_DEVICE = 0x01, LIBUSB_DT_CONFIG = 0x02, LIBUSB_DT_STRING = 0x03, LIBUSB_DT_INTERFACE = 0x04,
  LIBUSB_DT_ENDPOINT = 0x05, LIBUSB_DT_BOS = 0x0f, LIBUSB_DT_DEVICE_CAPABILITY = 0x10, LIBUSB_DT_HID = 0x21,
  LIBUSB_DT_REPORT = 0x22, LIBUSB_DT_PHYSICAL = 0x23, LIBUSB_DT_HUB = 0x29, LIBUSB_DT_SUPERSPEED_HUB = 0x2a,
  LIBUSB_DT_SS_ENDPOINT_COMPANION = 0x30
}
 
enum  libusb_endpoint_direction { LIBUSB_ENDPOINT_OUT = 0x00, LIBUSB_ENDPOINT_IN = 0x80 }
 
enum  libusb_endpoint_transfer_type { LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL = 0x0, LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS = 0x1, LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK = 0x2, LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT = 0x3 }
 
enum  libusb_iso_sync_type { LIBUSB_ISO_SYNC_TYPE_NONE = 0x0, LIBUSB_ISO_SYNC_TYPE_ASYNC = 0x1, LIBUSB_ISO_SYNC_TYPE_ADAPTIVE = 0x2, LIBUSB_ISO_SYNC_TYPE_SYNC = 0x3 }
 
enum  libusb_iso_usage_type { LIBUSB_ISO_USAGE_TYPE_DATA = 0x0, LIBUSB_ISO_USAGE_TYPE_FEEDBACK = 0x1, LIBUSB_ISO_USAGE_TYPE_IMPLICIT = 0x2 }
 
enum  libusb_supported_speed { LIBUSB_LOW_SPEED_OPERATION = (1 << 0), LIBUSB_FULL_SPEED_OPERATION = (1 << 1), LIBUSB_HIGH_SPEED_OPERATION = (1 << 2), LIBUSB_SUPER_SPEED_OPERATION = (1 << 3) }
 
enum  libusb_usb_2_0_extension_attributes { LIBUSB_BM_LPM_SUPPORT = (1 << 1) }
 
enum  libusb_ss_usb_device_capability_attributes { LIBUSB_BM_LTM_SUPPORT = (1 << 1) }
 
enum  libusb_bos_type { LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY = 0x01, LIBUSB_BT_USB_2_0_EXTENSION = 0x02, LIBUSB_BT_SS_USB_DEVICE_CAPABILITY = 0x03, LIBUSB_BT_CONTAINER_ID = 0x04 }
 

関数

int libusb_get_device_descriptor (libusb_device *dev, struct libusb_device_descriptor *desc)
 
int libusb_get_active_config_descriptor (libusb_device *dev, struct libusb_config_descriptor **config)
 
int libusb_get_config_descriptor (libusb_device *dev, uint8_t config_index, struct libusb_config_descriptor **config)
 
int libusb_get_config_descriptor_by_value (libusb_device *dev, uint8_t bConfigurationValue, struct libusb_config_descriptor **config)
 
void libusb_free_config_descriptor (struct libusb_config_descriptor *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)
 
void libusb_free_ss_endpoint_companion_descriptor (struct libusb_ss_endpoint_companion_descriptor *ep_comp)
 
int libusb_get_bos_descriptor (libusb_device_handle *dev_handle, struct libusb_bos_descriptor **bos)
 
void libusb_free_bos_descriptor (struct libusb_bos_descriptor *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)
 
void libusb_free_usb_2_0_extension_descriptor (struct libusb_usb_2_0_extension_descriptor *usb_2_0_extension)
 
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)
 
void libusb_free_ss_usb_device_capability_descriptor (struct libusb_ss_usb_device_capability_descriptor *ss_usb_device_cap)
 
int libusb_get_container_id_descriptor (libusb_context *ctx, struct libusb_bos_dev_capability_descriptor *dev_cap, struct libusb_container_id_descriptor **container_id)
 
void libusb_free_container_id_descriptor (struct libusb_container_id_descriptor *container_id)
 
int libusb_get_string_descriptor_ascii (libusb_device_handle *dev_handle, uint8_t desc_index, unsigned char *data, int length)
 
static int libusb_get_descriptor (libusb_device_handle *dev_handle, uint8_t desc_type, uint8_t desc_index, unsigned char *data, int length)
 
static int libusb_get_string_descriptor (libusb_device_handle *dev_handle, uint8_t desc_index, uint16_t langid, unsigned char *data, int length)
 

詳細説明

このページでは、検出されたデバイスのさまざまな標準USBデスクリプターを調べる方法について詳しく説明します。

列挙型解説

◆ 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 

ベンダー固有のクラス。

◆ libusb_descriptor_type

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)エンドポイント・コンパニオン・デスクリプター。

◆ libusb_endpoint_direction

エンドポイントの方向。 エンドポイント・アドレス のビット7の値。

列挙型
LIBUSB_ENDPOINT_OUT 

出力: ホストからデバイスへ。

LIBUSB_ENDPOINT_IN 

入力: デバイスからホストへ。

◆ libusb_endpoint_transfer_type

エンドポイント転送タイプ。 エンドポイントのattributesフィールド(訳注:bmAttributes)のビット 0:1 の値。

列挙型
LIBUSB_ENDPOINT_TRANSFER_TYPE_CONTROL 

制御エンドポイント。

LIBUSB_ENDPOINT_TRANSFER_TYPE_ISOCHRONOUS 

アイソクロナス・エンドポイント。

LIBUSB_ENDPOINT_TRANSFER_TYPE_BULK 

バルク・エンドポイント。

LIBUSB_ENDPOINT_TRANSFER_TYPE_INTERRUPT 

割り込みエンドポイント。

◆ libusb_iso_sync_type

アイソクロナス・エンドポイントの同期タイプ。 libusb_endpoint_descriptorbmAttributes フィールドのビット 2:3 の値。

列挙型
LIBUSB_ISO_SYNC_TYPE_NONE 

同期しない。

LIBUSB_ISO_SYNC_TYPE_ASYNC 

非同期。

LIBUSB_ISO_SYNC_TYPE_ADAPTIVE 

アダプティブ。

LIBUSB_ISO_SYNC_TYPE_SYNC 

同期。

◆ libusb_iso_usage_type

アイソクロナス・エンドポイントの利用タイプ。 libusb_endpoint_descriptorbmAttributes フィールドのビット 4:5 の値。

列挙型
LIBUSB_ISO_USAGE_TYPE_DATA 

データ・エンドポイント。

LIBUSB_ISO_USAGE_TYPE_FEEDBACK 

フィードバック・エンドポイント。

LIBUSB_ISO_USAGE_TYPE_IMPLICIT 

暗黙のフィードバック・データ・エンドポイント。

◆ libusb_supported_speed

サポートされている速度(wSpeedSupported)を示すビット・フィールド。デバイスがサポートする速度を示します。

列挙型
LIBUSB_LOW_SPEED_OPERATION 

低速(Low speed)操作をサポート(1.5MBit/s)。

LIBUSB_FULL_SPEED_OPERATION 

全速(Full speed)操作をサポート(12MBit/s)。

LIBUSB_HIGH_SPEED_OPERATION 

高速(High speed)操作をサポート(480MBit/s)。

LIBUSB_SUPER_SPEED_OPERATION 

超速(Superspeed)操作をサポート(5000MBit/s)。

◆ libusb_usb_2_0_extension_attributes

USB2.0拡張デスクリプターの bmAttributes フィールドのビット・マスク。

列挙型
LIBUSB_BM_LPM_SUPPORT 

接続電源管理(Link Power Management)(LPM)のサポート

◆ libusb_ss_usb_device_capability_attributes

超速(SuperSpeed)USBデバイス機能デスクリプターの bmAttributes フィールドのビット・マスク。

列挙型
LIBUSB_BM_LTM_SUPPORT 

レイテンシ・トレランス・メッセージ(LTM)をサポート

◆ libusb_bos_type

USB機能タイプ

列挙型
LIBUSB_BT_WIRELESS_USB_DEVICE_CAPABILITY 

無線USBデバイス機能。

LIBUSB_BT_USB_2_0_EXTENSION 

USB 2.0 拡張。

LIBUSB_BT_SS_USB_DEVICE_CAPABILITY 

超速(SuperSpeed)USBデバイス機能。

LIBUSB_BT_CONTAINER_ID 

コンテナIDタイプ。

関数解説

◆ libusb_get_device_descriptor()

int libusb_get_device_descriptor ( libusb_device dev,
struct libusb_device_descriptor desc 
)

指定のデバイスのUSBデバイス・デスクリプターを取得します。

これは非ブロッキング関数です。 デバイス・デスクリプターはメモリにキャッシュされます。

注意: libusb-1.0.16、LIBUSB_API_VERSION >= 0x01000102 以降ではこの関数は常に成功することに注意してください。

パラメーター
devデバイス
descデスクリプター・データの出力場所
戻り値
0ならば成功、LIBUSB_ERRORコードならば失敗

◆ libusb_get_active_config_descriptor()

int libusb_get_active_config_descriptor ( libusb_device dev,
struct libusb_config_descriptor **  config 
)

現在アクティブな構成のUSB構成デスクリプターを取得します。 これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。

パラメーター
devデバイス
configUSB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERROR_NOT_FOUND デバイスが未構成の状態の場合
LIBUSB_ERRORコードの場合はエラー
以下も参照して下さい
libusb_get_config_descriptor

◆ libusb_get_config_descriptor()

int libusb_get_config_descriptor ( libusb_device dev,
uint8_t  config_index,
struct libusb_config_descriptor **  config 
)

そのインデックスに基づいてUSB構成デスクリプターを取得します。 これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。

パラメーター
devデバイス
config_indexあなたが取得したい構成のインデックス
configUSB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERROR_NOT_FOUND 構成が存在しない場合
LIBUSB_ERRORコードの場合はエラー
以下も参照して下さい
libusb_get_active_config_descriptor()
libusb_get_config_descriptor_by_value()

◆ libusb_get_config_descriptor_by_value()

int libusb_get_config_descriptor_by_value ( libusb_device dev,
uint8_t  bConfigurationValue,
struct libusb_config_descriptor **  config 
)

指定のbConfigurationValueを使用してUSB構成デスクリプターを取得します。これは、デバイスにどんな要求も送信することはない非ブロッキング関数です。

パラメーター
devデバイス
bConfigurationValueあなたが取得したい構成のbConfigurationValue
configUSB構成デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_config_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERROR_NOT_FOUND 構成が存在しない場合
LIBUSB_ERRORコードの場合はエラー
以下も参照して下さい
libusb_get_active_config_descriptor()
libusb_get_config_descriptor()

◆ 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開放したい構成デスクリプター

◆ libusb_get_ss_endpoint_companion_descriptor()

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() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERROR_NOT_FOUND 構成が存在しない場合
LIBUSB_ERRORコードの場合はエラー

◆ 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)エンドポイント・コンパニオン・デスクリプター

◆ libusb_get_bos_descriptor()

int libusb_get_bos_descriptor ( libusb_device_handle dev_handle,
struct libusb_bos_descriptor **  bos 
)

バイナリ・オブジェク・トストア(BOS)デスクリプターを取得する。これはブロッキング関数であり、デバイスに要求を送信します。

パラメーター
dev_handleオープン中のlibbusbデバイスのハンドル
bosBOSデスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_bos_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERROR_NOT_FOUND そのデバイスにBOSデスクリプターが無い場合
LIBUSB_ERRORコードの場合はエラー

◆ libusb_free_bos_descriptor()

void libusb_free_bos_descriptor ( struct libusb_bos_descriptor bos)

libusb_get_bos_descriptor() から取得したBOS・デスクリプターを解放します。 bosパラメータにNULLをセットしてこの関数を呼び出すのは安全です。この場合、関数は単に何もせずに戻ります。

パラメーター
bos開放したいBOSデスクリプター

◆ libusb_get_usb_2_0_extension_descriptor()

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_capbDevCapabilityTypeの値が LIBUSB_BT_USB_2_0_EXTENSION であるデバイス機能デスクリプター
usb_2_0_extensionUSB2.0拡張デスクリプターの出力場所。0が返された場合にのみ有効です。 使用後は libusb_free_usb_2_0_extension_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERRORコードの場合、エラー

◆ 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 拡張デスクリプター

◆ libusb_get_ss_usb_device_capability_descriptor()

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_capbDevCapabilityTypeの値が LIBUSB_BT_SS_USB_DEVICE_CAPABILITY であるデバイス機能デスクリプター
ss_usb_device_cap超速(SuperSpeed)USBデバイス機能デスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_ss_usb_device_capability_descriptor() で解放する必要があります。
戻り値
0ならば成功
LIBUSB_ERRORコードの場合、エラー

◆ 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デバイス機能デスクリプター

◆ libusb_get_container_id_descriptor()

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_capbDevCapabilityTypeの値が LIBUSB_BT_CONTAINER_ID であるデバイス機能デスクリプター
container_idコンテナIDデスクリプターの出力場所。0が返された場合にのみ有効です。使用後は libusb_free_container_id_descriptor() で開放する必要があります。
戻り値
0ならば成功
LIBUSB_ERRORコードの場合、エラー

◆ 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デスクリプター

◆ libusb_get_string_descriptor_ascii()

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取得したいデスクリプターのインデックス
dataASCII文字列デスクリプターのための出力バッファ
lengthデータ・バッファのサイズ
戻り値
データで返されたバイト数、LIBUSB_ERRORコードの場合は失敗

◆ libusb_get_descriptor()

static int libusb_get_descriptor ( libusb_device_handle dev_handle,
uint8_t  desc_type,
uint8_t  desc_index,
unsigned char *  data,
int  length 
)
inlinestatic

デフォルトの制御パイプからデスクリプターを取得します。 これは、デスクリプターを取得するための適切な制御メッセージを作成する便利な関数です。

パラメーター
dev_handleデバイス・ハンドル
desc_typeデスクリプター・タイプ。 libusb_descriptor_type を参照してください。
desc_index取得したいデスクリプターのインデックス
dataデスクリプターのための出力バッファ
lengthデータ・バッファのサイズ
戻り値
データで返されたバイト数、LIBUSB_ERRORコードの場合は失敗

◆ libusb_get_string_descriptor()

static int libusb_get_string_descriptor ( libusb_device_handle dev_handle,
uint8_t  desc_index,
uint16_t  langid,
unsigned char *  data,
int  length 
)
inlinestatic

デバイスからデスクリプターを取得します。 これは、デスクリプターを取得するための適切な制御メッセージを作成する便利な関数です。USB仕様で詳しく説明されているように、返される文字列はUnicodeです。

パラメーター
dev_handleデバイス・ハンドル
desc_index取得したいデスクリプターのインデックス
langid文字列デスクリプターのための言語ID
dataデスクリプターのための出力バッファ
lengthデータ・バッファのサイズ
戻り値
データで返されたバイト数、LIBUSB_ERRORコードの場合は失敗
以下も参照して下さい
libusb_get_string_descriptor_ascii()