def __init__(self, device_path, parent_instance_id = 0, instance_id=""):
        #allow safe access (and object browsing)
        self.__open_status = False
        self.__input_report_templates = dict()

        #initialize hardware related vars
        self.__button_caps_storage     = list()
        self.report_set                = dict()
        self.__evt_handlers            = dict()
        self.__reading_thread          = None
        self.__input_processing_thread = None
        self.__raw_handler             = None
        self._input_report_queue       = None
        self.hid_caps                  = None
        self.ptr_preparsed_data        = None
        self.hid_handle                = None
        self.usages_storage            = dict()

        self.device_path        = device_path
        self.instance_id        = instance_id
        self.parent_instance_id = parent_instance_id
        self.product_name       = ""
        self.vendor_name        = ""
        self.serial_number      = ""
        self.vendor_id          = 0
        self.product_id         = 0
        self.version_number     = 0
        HidDeviceBaseClass.__init__(self)

        # HID device handle first
        h_hid = INVALID_HANDLE_VALUE
        try:
            h_hid = int( winapi.CreateFile(device_path,
                winapi.GENERIC_READ | winapi.GENERIC_WRITE,
                winapi.FILE_SHARE_READ | winapi.FILE_SHARE_WRITE,
                None, winapi.OPEN_EXISTING, 0, 0))
        except:
            pass

        if h_hid == INVALID_HANDLE_VALUE:
            return

        try:
            # get device attributes
            hidd_attributes = winapi.HIDD_ATTRIBUTES()
            hidd_attributes.cb_size = sizeof(hidd_attributes)
            if not hid_dll.HidD_GetAttributes(h_hid, byref(hidd_attributes)):
                del hidd_attributes
                return #can't read attributes

            #set local references
            self.vendor_id  = hidd_attributes.vendor_id
            self.product_id = hidd_attributes.product_id
            self.version_number = hidd_attributes.version_number
            del hidd_attributes

            # manufacturer string
            vendor_string_type = c_wchar * self.MAX_MANUFACTURER_STRING_LEN
            vendor_name = vendor_string_type()
            if not hid_dll.HidD_GetManufacturerString(h_hid,
                    byref(vendor_name),
                    sizeof(vendor_name)) or not len(vendor_name.value):
                # would be any possibility to get a vendor id table?,
                # maybe not worth it
                self.vendor_name = "Unknown manufacturer"
            else:
                self.vendor_name = vendor_name.value
            del vendor_name
            del vendor_string_type

            # string buffer for product string
            product_name_type = c_wchar * self.MAX_PRODUCT_STRING_LEN
            product_name = product_name_type()
            if not hid_dll.HidD_GetProductString(h_hid,
                        byref(product_name),
                        sizeof(product_name)) or not len(product_name.value):
                # alternate method, refer to windows registry for product
                # information
                path_parts = device_path[len("\\\\.\\"):].split("#")
                h_register = winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE,
                    "SYSTEM\\CurrentControlSet\\Enum\\" + \
                    path_parts[0] + "\\" + \
                    path_parts[1] + "\\" + \
                    path_parts[2] )
                self.product_name, other = winreg.QueryValueEx(h_register,
                        "DeviceDesc")
                winreg.CloseKey(h_register)
            else:
                self.product_name = product_name.value
            del product_name
            del product_name_type

            # serial number string
            serial_number_string = c_wchar * self.MAX_SERIAL_NUMBER_LEN
            serial_number = serial_number_string()
            if not hid_dll.HidD_GetSerialNumberString(h_hid,
                    byref(serial_number),
                    sizeof(serial_number)) or not len(serial_number.value):
                self.serial_number = ""
            else:
                self.serial_number = serial_number.value
            del serial_number
            del serial_number_string
        finally:
            # clean up
            winapi.CloseHandle(h_hid)
Plots the density of a given Distribution instance and plots some
dataset/ETHPy150Open rene-aguirre/pywinusb/pywinusb/hid/core.py/HidDevice.__init__--crossover with--dataset/ETHPy150Open karlnapf/kameleon-mcmc/kameleon_mcmc/tools/Visualise.py/Visualise.visualise_distribution