(dev, desc_size, desc_type, desc_index, wIndex = 0)
return desc
r"""Return the specified descriptor.

    dev is the Device object to which the request will be
    sent to.

    desc_size is the descriptor size.

    desc_type and desc_index are the descriptor type and index,
    respectively. wIndex index is used for string descriptors
    and represents the Language ID. For other types of descriptors,
    it is zero.
r"""Return the specified descriptor.
r Return the specified descriptor .
def get_descriptor(dev, desc_size, desc_type, desc_index, wIndex = 0):
    r"""Return the specified descriptor.

    dev is the Device object to which the request will be
    sent to.

    desc_size is the descriptor size.

    desc_type and desc_index are the descriptor type and index,
    respectively. wIndex index is used for string descriptors
    and represents the Language ID. For other types of descriptors,
    it is zero.
    """
    wValue = desc_index | (desc_type << 8)

    bmRequestType = util.build_request_type(
                        util.CTRL_IN,
                        util.CTRL_TYPE_STANDARD,
                        util.CTRL_RECIPIENT_DEVICE)

    desc = dev.ctrl_transfer(
            bmRequestType = bmRequestType,
            bRequest = 0x06,
            wValue = wValue,
            wIndex = wIndex,
            data_or_wLength = desc_size)

    if len(desc) < 2:
        raise USBError('Invalid descriptor')

    return desc
def get_descriptor ( dev , desc_size , desc_type , desc_index , wIndex = 0 ) : wValue = desc_index | ( desc_type << 8 ) bmRequestType = util . build_request_type ( util . CTRL_IN , util . CTRL_TYPE_STANDARD , util . CTRL_RECIPIENT_DEVICE ) desc = dev . ctrl_transfer ( bmRequestType = bmRequestType , bRequest = 0x06 , wValue = wValue , wIndex = wIndex , data_or_wLength = desc_size ) if len ( desc ) < 2 : raise USBError ( 'Invalid descriptor' ) return desc