openusb_get_altsetting,openusb_set_altsetting

OpenUSB Developers Guide
Prev |  | Next

# `openusb_get_altsetting,openusb_set_altsetting`

## Name

`openusb_get_altsetting,openusb_set_altsetting` -- Get alternate setting number, Set alternate setting

## Synopsis

``int32_t openusb_get_altsetting`(openusb_dev_handle_t dev, uint8_t ifc, openusb_init_flag_t* alt);`

``int32_topenusb_set_altsetting`(openusb_dev_handle_t dev, uint8_t ifc, uint8_t alt);`

## Parameters

`dev` - Device handle.

`ifc` - Interface number.

`alt` - Alternate setting number

## Description

`openusb_get_altsetting()` get the current alternate setting number of interface `ifc`. The alternate number is returned in `alt`.

`openusb_set_altsetting()` sets the active alternate setting of the interface `ifc`. Application should call this function to set proper alternate setting of an interface before doing data transfer on endpoints in that setting.

## Return Value

`openusb_get_altsetting`(), `openusb_set_altsetting`() returns 0 on success. Otherwise, a openusb error is returned.

OPENUSB_SUCCESS No errors.

OPENUSB_BADARG `ifc` or `alt` is not valid.

OPENUSB_UNKNOWN_DEVICE Device handle is not valid

OPENUSB_PLATFORM_FAILURE Unspecified kernel/driver failure

OPENUSB_BUSY The interface `ifc` has already been claimed.

## See Also

`openusb_claim_interface, openusb_release_interface, openusb_is_interface_claimed`

Prev | Home | Next
`openusb_claim_interface, openusb_release_interface, openusb_is_interface_claimed` | Up | `openusb_reset`