How to use the libusb1.libusb_context_p function in libusb1

To help you get started, we’ve selected a few libusb1 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 glaubitz / linux-minidisc / netmd / usb1.py View on Github external
def __init__(self):
        """
        Create a new USB context.
        """
        context_p = libusb1.libusb_context_p()
        result = libusb1.libusb_init(byref(context_p))
        if result:
            raise libusb1.USBError(result)
        self.__context_p = context_p
github kozec / sc-controller / scc / lib / usb1.py View on Github external
def _exit(self):
        context_p = self.__context_p
        if context_p:
            for handle in self.__hotplug_callback_dict.keys():
                self.hotplugDeregisterCallback(handle)
            pop = self.__close_set.pop
            while True:
                try:
                    closable = pop()
                except self.__KeyError:
                    break
                closable.close()
            self.__libusb_exit(context_p)
            self.__context_p = libusb1.libusb_context_p()
            self.__added_cb = self.__null_pointer
            self.__removed_cb = self.__null_pointer
github Tinkerforge / brickd / src / brickd / libusb / usb1.py View on Github external
def __init__(self):
        """
        Create a new USB context.
        """
        # Used to prevent an exit to cause a segfault if a concurrent thread
        # is still in libusb.
        self.__context_refcount = 0
        self.__context_cond = threading.Condition()
        context_p = libusb1.libusb_context_p()
        result = libusb1.libusb_init(byref(context_p))
        if result:
            raise libusb1.USBError(result)
        self.__context_p = context_p
github kozec / sc-controller / scc / lib / usb1.py View on Github external
def __init__(self):
        """
        Create a new USB context.
        """
        # Used to prevent an exit to cause a segfault if a concurrent thread
        # is still in libusb.
        self.__context_refcount = 0
        self.__context_cond = threading.Condition()
        self.__context_p = libusb1.libusb_context_p()
        self.__hotplug_callback_dict = {}
        self.__close_set = WeakSet()