Exemplo n.º 1
0
    def __init__(self):
        PyHID.initialise()
        devices = PyHID.scan_devices()
        mobile = []
#        print [x.name for x in devices]
#        ir =  [x for x in devices if x.name == 'Logitech Buzz(tm) Controller V1'][0]
        ir =  [x for x in devices if x.name == 'Wbuzz'][0]
        
        mobile =  [x for x in devices if x.name == 'C902']

        if mobile:
            mobile = mobile[0]
            mobile.enable_monitoring()
            mobile.elements[4].enable_monitoring()

        ir.enable_monitoring()
        time.sleep(0.5)
        ir.elements[28].write(1)
        
        self.ir = ir
        self.mobile = mobile
        
        self.setup_buttons()
Exemplo n.º 2
0
from time import sleep
import PyHID
PyHID.initialise()
d = PyHID.scan_devices()[-2]
print d.name
d.enable_monitoring()
#el = d.elements[0]
#
#
for el in d.elements:
    try:
#        el.enable_monitoring()
        print el.read(), el(), "ok"
#        print 
#        print "ok"
    except:
        print "fail"
#print "\n".join([str(e) for e in d.elements])
#print "\n".join([e.get_usage_string() for e in d.elements])
#print "\n".join([e.get_usage_page_string() for e in d.elements])
try:
#    pass
    while True:
        sleep(0.1)
        res = d.poll()
        if res:
            print res 
except KeyboardInterrupt:
    PyHID.finalise()

PyHID.finalise()