How to use pyusb - 1 common examples

To help you get started, we’ve selected a few pyusb examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github freevo / freevo1 / src / plugins / vfd.py View on Github external
self.disable = 0
        self.playitem = None
        self.event_listener = 1

        # There seem to exist at least two different vendor/product ID
        # combinations for the Shuttle VFD. Thus, we have to check all
        # of them, until a valid one is found.
        #self.idVendor = 4872    # Shuttle Inc
        #self.idProduct = 0003   # VFD Module

        # self.usbIDs is a list of tuples (idVendor, idProduct)
        self.usbIDs = [ (0x1308, 0x0003), (0x051c, 0x0005), (0x1308, 0xc001), ]
        self.maxStringLength = 20
        self.sleepLength = 0.015
        self.vfd = None
        for bus in pyusb.busses():
            for dev in bus.devices:
                for (self.idVendor, self.idProduct) in self.usbIDs:
                    if dev.idVendor == self.idVendor and dev.idProduct == self.idProduct:
                        self.vfd = dev.open()
                        logger.info('Found VFD on bus %s at device %s', bus.dirname, dev.filename)
                        break

        if not self.vfd:
            logger.error("Cannot find VFD device")
            self.disable = 1
            self.reason = "Cannot find VFD device"
            return
        self.clear()

        # We need a mixer to set the volume level
        self.mixer = plugin.getbyname('MIXER')

pyusb

Python USB access module

BSD-3-Clause
Latest version published 3 years ago

Package Health Score

78 / 100
Full package analysis

Popular pyusb functions