---
name: "usb_get_descriptor"
section: "9"
platform: "linux"
package: "linux-manual-4.9"
version: "4.9.228-1"
release: "Debian 9 (Stretch)"
platforms: ["linux"]
url: "https://new.carta.tech/usb_get_descriptor/9"
---

# usb\_get\_descriptor(9)

issues a generic GET\_DESCRIPTOR request

## NAME

usb\_get\_descriptor - issues a generic GET\_DESCRIPTOR request

## SYNOPSIS

**int usb\_get\_descriptor(struct usb\_device \*** *dev***, unsigned char** *type***, unsigned char** *index***, void \*** *buf***, int** *size***);**

## ARGUMENTS

*dev*

the device whose descriptor is being retrieved

*type*

the descriptor type (USB\_DT\_\*)

*index*

the number of the descriptor

*buf*

where to put the descriptor

*size*

how big is “buf”?

## CONTEXT

!in\_interrupt ()

## DESCRIPTION

Gets a USB descriptor. Convenience functions exist to simplify getting some types of descriptors. Use **usb\_get\_string** or **usb\_string** for USB\_DT\_STRING. Device (USB\_DT\_DEVICE) and configuration descriptors (USB\_DT\_CONFIG) are part of the device structure. In addition to a number of USB-standard descriptors, some devices also use class-specific or vendor-specific descriptors.

This call is synchronous, and may not be used in an interrupt context.

## RETURN

The number of bytes received on success, or else the status code returned by the underlying **usb\_control\_msg** call.

## COPYRIGHT
