示例#1
0
	def setupPosix(self, headsetId):
		hid.hid_set_debug(HID_DEBUG_ALL)
		hid.hid_init()
		matcher = hid.HIDInterfaceMatcher()
		matcher.vendor_id  = 0x21a1
		matcher.product_id = 0x0001
		self.interface = interface = hid.hid_new_HIDInterface()
		if hid.hid_force_open(interface, 0, matcher, 1000) != HID_RET_SUCCESS:
			self.interface = interface = hid.hid_new_HIDInterface()
			if hid.hid_force_open(interface, 1, matcher, 1000) != HID_RET_SUCCESS:
				return False
		def reader():
			while True:
				ret, data = hid.hid_interrupt_read(interface, 0x81, 0x20, 0)
				if ret == 0:
					self.gotData(data)
		thread.start_new_thread(reader, ())
示例#2
0
import platform
import sys

if sys.version_info >= (3, 0):  # pragma: no cover
    unicode = str

system_platform = platform.system()
if system_platform == "Windows":
    import pywinusb.hid as hidapi
else:
    import pyhidapi as hidapi

    hidapi.hid_init()


def hid_enumerate_nix():
    return hidapi.hid_enumerate()


def hid_enumerate_win():
    return hidapi.find_all_hid_devices()


def print_hid_enumerate(platform):
    """
    Loops over all devices in the hidapi and attempts prints information.

    This is a fall back method that gives the user information to give the developers when opening an issue.
    """
    devices = get_hid_devices[platform]()
    for device in devices:
示例#3
0
import platform
import sys

if sys.version_info >= (3, 0):  # pragma: no cover
    unicode = str

system_platform = platform.system()
if system_platform == "Windows":
    import pywinusb.hid as hidapi
else:
    import hidapi

    hidapi.hid_init()


def hid_enumerate_nix():
    return hidapi.hid_enumerate()


def hid_enumerate_win():
    return hidapi.find_all_hid_devices()


def print_hid_enumerate(platform):
    """
    Loops over all devices in the hidapi and attempts prints information.

    This is a fall back method that give the user information to give the developers when opening an issue.
    """
    devices = get_hid_devices[platform]()
    for device in devices: