Ejemplo n.º 1
0
 def setup_not_windows(self):
     """
     Setup for headset on a non-windows platform.
     Receives packets from headset and sends them to a Queue to be processed
     by the crypto thread.
     """
     if os.path.exists('/dev/eeg/raw'):
         self.hid = open("/dev/eeg/raw")
     if self.hid is not None:
         # The decryption is handled by the Linux epoc daemon. We don't need to handle it.
         self.platform += " raw_eeg"
     else:
         path, serial_number = hid_enumerate(hidapi, self.platform)
         if len(path) == 0:
             print_hid_enumerate(system_platform, hidapi)
             raise Exception("Device not found")
         self.serial_number = serial_number
         self.hid = hidapi.hid_open_path(path)
Ejemplo n.º 2
0
 These modes are mentioned in the BMP Badge software.
 Text is shown static, or sometimes (longer texts?) not shown at all.
 One significant difference is: The text of the first message stays visible after
 upload, even if the USB cable remains connected.
 (No "rotation" or "smoothing"(?) effect can be expected, though)
""" % sys.argv[0])
args = parser.parse_args()
if have_pyhidapi:
    devinfo = pyhidapi.hid_enumerate(0x0416, 0x5020)
    #dev = pyhidapi.hid_open(0x0416, 0x5020)
else:
    dev = usb.core.find(idVendor=0x0416, idProduct=0x5020)

if have_pyhidapi:
    if devinfo:
        dev = pyhidapi.hid_open_path(devinfo[0].path)
        print("using [%s %s] int=%d page=%s via pyHIDAPI" %
              (devinfo[0].manufacturer_string, devinfo[0].product_string,
               devinfo[0].interface_number, devinfo[0].usage_page))
    else:
        print("No led tag with vendorID 0x0416 and productID 0x5020 found.")
        print("Connect the led tag and run this tool as root.")
        sys.exit(1)
else:
    if dev is None:
        print("No led tag with vendorID 0x0416 and productID 0x5020 found.")
        print("Connect the led tag and run this tool as root.")
        sys.exit(1)
    try:
        # win32: NotImplementedError: is_kernel_driver_active
        if dev.is_kernel_driver_active(0):