class io.UsbDevice

class UsbDevice {
    // fields

    bool readonly m_isOpen;

    // properties

    io.UsbDeviceDescriptor const* const property m_deviceDescriptor;
    io.UsbConfigurationDescriptor const* const property m_activeConfigurationDescriptor;
    uint8_t property m_configurationId;
    uint8_t const property m_address;
    uint8_t const property m_bus;
    uint8_t const property m_port;
    io.UsbSpeed const property m_speed;
    bool autoget property m_isAutoDetachKernelDriverEnabled;
    bool const indexed property m_isKernelDriverActive(uint_t interfaceId);

    // construction

    construct();
    destruct();

    // methods

    bool errorcode open();
    void close();
    uint16_t const* errorcode getLangIdTable();

    string_t errorcode getStringDescriptor(
        uint_t stringId,
        uint_t langId = 0
    );

    bool errorcode attachKernelDriver(uint_t interfaceId);
    bool errorcode detachKernelDriver(uint_t interfaceId);

    io.UsbInterface* errorcode claimInterface(
        uint_t interfaceId,
        uint_t altSettingId = 0
    );

    size_t errorcode controlTransfer(
        uint_t requestType,
        uint_t requestCode,
        uint_t value,
        uint_t index,
        void* p,
        size_t size,
        uint_t timeout = -1
    );

    bool errorcode controlTransfer(
        uint_t requestType,
        uint_t requestCode,
        uint_t value,
        uint_t index,
        void* p,
        size_t size,
        uint_t timeout = -1,
        void function* onCompleted(size_t size, import const io.UsbDevice.std.Error* error)
    );

    void cancelControlTransfers();

    // aliases

    alias dispose = close;
};