Class Interface

Constructors

Properties

altSetting: number = 0

Integer alternate setting number.

Object with fields from the interface descriptor -- see libusb documentation or USB spec.

device: Device
endpoints: Endpoint[]

List of endpoints on this interface: InEndpoint and OutEndpoint objects.

id: number
interfaceNumber: number

Integer interface number.

releaseAsync: (() => Promise<void>)
setAltSettingAsync: ((alternateSetting: number) => Promise<void>)

Methods

  • Re-attaches the kernel driver for the interface.

    The device must be open to use this method.

    Returns void

  • Claims the interface. This method must be called before using any endpoints of this interface.

    The device must be open to use this method.

    Returns void

  • Detaches the kernel driver from the interface.

    The device must be open to use this method.

    Returns void

  • Return the InEndpoint or OutEndpoint with the specified address.

    The device must be open to use this method.

    Parameters

    • addr: number

    Returns undefined | Endpoint

  • Returns false if a kernel driver is not active; true if active.

    The device must be open to use this method.

    Returns boolean

  • Releases the interface and resets the alternate setting. Calls callback when complete.

    It is an error to release an interface with pending transfers.

    The device must be open to use this method.

    Parameters

    Returns void

  • Releases the interface and resets the alternate setting. Calls callback when complete.

    It is an error to release an interface with pending transfers. If the optional closeEndpoints parameter is true, any active endpoint streams are stopped (see Endpoint.stopStream), and the interface is released after the stream transfers are cancelled. Transfers submitted individually with Endpoint.transfer are not affected by this parameter.

    The device must be open to use this method.

    Parameters

    • OptionalcloseEndpoints: boolean
    • Optionalcallback: ((error?: LibUSBException) => void)

    Returns void

  • Sets the alternate setting. It updates the interface.endpoints array to reflect the endpoints found in the alternate setting.

    The device must be open to use this method.

    Parameters

    • altSetting: number
    • Optionalcallback: ((error: undefined | LibUSBException) => void)

    Returns void