def main(indev, p_thres, p_mul):
    udev = UInputDevice("Virtual Input Device", 0x0, 0x1, 1)
    udev.create()
    udev.send_event(InputEvent.new(0,0,0))
    poll = select.poll()
    fds = {}
    dev = ForwardDevice(udev, float(p_thres)/1000, p_mul, indev, indev)
    poll.register(dev, select.POLLIN | select.POLLPRI)

    fds[dev.fileno()] = dev
    while True:
        for x,e in poll.poll():
            dev = fds[x]
            dev.read()
示例#2
0
def main(devs):
    udev = UInputDevice("Virtual Input Device", 0x0, 0x1, 1)
    udev.create()
    poll = select.poll()
    fds = {}
    for devpath in devs:
        dev = ForwardDevice(udev, devpath, devpath)
        poll.register(dev, select.POLLIN | select.POLLPRI)
	fcntl.ioctl(dev.fileno(), 0x40044590, 1)
        fds[dev.fileno()] = dev
    while True:
        for x,e in poll.poll():
            dev = fds[x]
            dev.read()