Пример #1
0
 def __init__(self):
     try:
         self.device = hidapi.hid_open(HASSEB_USB_VENDOR,
                                       HASSEB_USB_PRODUCT, None)
         self.device_found = 1
     except:
         self.device_found = None
Пример #2
0
 def __init__(self, path=None):
     try:
         self.device = hidapi.hid_open(
             HASSEB_USB_VENDOR, HASSEB_USB_PRODUCT,
             None) if not bool(path) else hidapi.hid_open_path(path)
         self.device_found = 1
     except:
         self.device_found = None
Пример #3
0
def SendCommand(packet_array):
    packets = chr(0x00)  # pre-pad with 0x00 per hid_write documentation
    for byte in packet_array:
        packets = packets + chr(int(byte, 16))

    hidapi.hid_init()

    # Connect to the RadioSHARK
    dev = hidapi.hid_open(0x077d, 0x627a)

    # Write the packets
    packets_written = hidapi.hid_write(dev, packets)

    # Close out
    hidapi.hid_close(dev)

    if (args.debug):
        print "Packet Array: %s" % packet_array
        print "Number of Packets Sent: %s" % str(1 + len(packet_array))
        print "Number of Packets Written: %i" % packets_written
Пример #4
0
 def open(self) -> None:
     """Opens the connection to the RoIP device."""
     hidapi.hid_init()
     self.hid_device = hidapi.hid_open(self.device[0], self.device[1])
     self._logger.info('Opened hid_device="%s"', self.hid_device)
Пример #5
0
#!/usr/bin/env python

import hidapi
import binascii
import time

hidapi.hid_init()
    
print 'Loaded hidapi library from: {:s}\n'.format(hidapi.hid_lib_path())

devices = hidapi.hid_enumerate(0x0483, 0x5750)
if len(devices) == 0:
    print "No dev attached"
    exit(1)

device = hidapi.hid_open(0x0483, 0x5750)


import random
while True:
    result = hidapi.hid_read(device, 4)
    state = binascii.hexlify(result)
    print "#%d: %s"  % (len(result), state)

hidapi.hid_close(device)
#!/usr/bin/env python

import hidapi
import binascii
import time

hidapi.hid_init()
    
print 'Loaded hidapi library from: {:s}\n'.format(hidapi.hid_lib_path())

devices = hidapi.hid_enumerate(0x17cc, 0x1140)
if len(devices) == 0:
    print "No maschine attached"
    exit(1)

device = hidapi.hid_open(0x17cc, 0x1140)

quiet_state = "20000000100020003000400050006000700080009000a000b000c000d000e000f0000000100020003000400050006000700080009000a000b000c000d000e000f0"

to_bytearray = lambda display: [bytearray(line.replace(" ", "").decode("hex")) for line in display]
write_display = lambda display: [hidapi.hid_write(device, line) for line in to_bytearray(display)]

def clear_display(no):
    for i in range(0, 8):
        hidapi.hid_write(device, (bytearray((("e00000%02x00200008" % (8 * i) + ((265 - 8) * "00")).replace("e0", "e%d" %no)).decode("hex"))))

led_state = bytearray("820a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a0a0a0a 0a3f3f3f 3f3f3f3f".replace(" ", "").decode("hex"))
hidapi.hid_write(device, led_state)

def import_image(display_no, fname):
    import textwrap
Пример #7
0
 def initBase(self):
     hidapi.hid_init()
     device = hidapi.hid_open(0x0e6f, 0x0129)
     hidapi.hid_set_nonblocking(device, False)
     return device
Пример #8
0
import base64
import binascii

__author__ = 'matt'

import hidapi

hidapi.hid_init()

# for dev in hidapi.hid_enumerate():
#     print '------------------------------------------------------------'
#     print dev.description()

dev = hidapi.hid_open(0x1430, 0x0150)
arr = hidapi.hid_read(dev, 1024)
report = ''.join(chr(x) for x in [0x00, 0x00, 0x00, 0x00, 0x08, 0x00])
# num = hidapi.hid_write(dev, report)
print "i don't think we'll get here"
# val = 0
# while (True):
#     arr = hidapi.hid_read(dev, 1024)
#     new_val = arr[1]
#     if new_val is not val:
#         test_one = new_val
#         test_two = hidapi.hid_read(dev, 1024)[1]
#         while test_one is not test_two:
#             test_one = test_two
#             test_two = hidapi.hid_read(dev, 1024)[1]
#         print "Got {}".format(test_two)
#         val = test_two
#         print binascii.hexlify(arr)