def __init__(self, idVendor, idProduct):
        """Low level USB device access via PyUSB 1.0 library.

        :param idVendor: the USB "vendor ID" number, for example 0x1941.

        :type idVendor: int

        :param idProduct: the USB "product ID" number, for example 0x8021.

        :type idProduct: int

        """
        self.dev = usb.core.find(idVendor=idVendor, idProduct=idProduct)
        if not self.dev:
            raise IOError("Weather station device not found")
        if sys.platform.startswith('linux'):
            try:
                detach = self.dev.is_kernel_driver_active(0)
            except NotImplementedError:
                detach = True
            if detach:
                try:
                    self.dev.detach_kernel_driver(0)
                except usb.core.USBError:
                    pass
        self.dev.reset()
        self.dev.set_configuration()
        usb.util.claim_interface(self.dev, 0)
def __init__ ( self , idVendor , idProduct ) : self . dev = usb . core . find ( idVendor = idVendor , idProduct = idProduct ) if not self . dev : raise IOError ( "Weather station device not found" ) if sys . platform . startswith ( 'linux' ) : try : detach = self . dev . is_kernel_driver_active ( 0 ) except NotImplementedError : detach = True if detach : try : self . dev . detach_kernel_driver ( 0 ) except usb . core . USBError : pass self . dev . reset ( ) self . dev . set_configuration ( ) usb . util . claim_interface ( self . dev , 0 )
Low level USB device access via PyUSB 1.0 library.

        :param idVendor: the USB "vendor ID" number, for example 0x1941.

        :type idVendor: int

        :param idProduct: the USB "product ID" number, for example 0x8021.

        :type idProduct: int