def __init__(self, context, device_p, can_load_configuration=True):
        """
        You should not instanciate this class directly.
        Call USBContext methods to receive instances of this class.
        """
        self.__context = context
        self.__close_set = WeakSet()
        libusb1.libusb_ref_device(device_p)
        self.device_p = device_p
        # Fetch device descriptor
        device_descriptor = libusb1.libusb_device_descriptor()
        result = libusb1.libusb_get_device_descriptor(
            device_p, byref(device_descriptor))
        mayRaiseUSBError(result)
        self.device_descriptor = device_descriptor
        if can_load_configuration:
            self.__configuration_descriptor_list = descriptor_list = []
            append = descriptor_list.append
            device_p = self.device_p
            for configuration_id in xrange(
                    self.device_descriptor.bNumConfigurations):
                config = libusb1.libusb_config_descriptor_p()
                result = libusb1.libusb_get_config_descriptor(
                    device_p, configuration_id, byref(config))
                # pylint: disable=undefined-variable
                if result == ERROR_NOT_FOUND:
                # pylint: enable=undefined-variable
                    # Some devices (ex windows' root hubs) tell they have
                    # one configuration, but they have no configuration
                    # descriptor.
                    continue
                mayRaiseUSBError(result)
                append(config.contents)
def __init__ ( self , context , device_p , can_load_configuration = True ) : self . __context = context self . __close_set = WeakSet ( ) libusb1 . libusb_ref_device ( device_p ) self . device_p = device_p device_descriptor = libusb1 . libusb_device_descriptor ( ) result = libusb1 . libusb_get_device_descriptor ( device_p , byref ( device_descriptor ) ) mayRaiseUSBError ( result ) self . device_descriptor = device_descriptor if can_load_configuration : self . __configuration_descriptor_list = descriptor_list = [ ] append = descriptor_list . append device_p = self . device_p for configuration_id in xrange ( self . device_descriptor . bNumConfigurations ) : config = libusb1 . libusb_config_descriptor_p ( ) result = libusb1 . libusb_get_config_descriptor ( device_p , configuration_id , byref ( config ) ) if result == ERROR_NOT_FOUND : continue mayRaiseUSBError ( result ) append ( config . contents )
You should not instanciate this class directly.
        Call USBContext methods to receive instances of this class.