在Ubuntu下驱动Logicool unify receiver

作者 : RY    标签: usb
切换行号 全选 下载代码

Logicool的unify receiver可以同时支持多个无线设备,但是Logicool只提供了Windows下的驱动程序。本程序可在Ubuntu下对无线设备进行绑定。只需要sudo执行本程序,并打开设备的电源开关即可。参考程序: http://tycho.ws/blog/2011/12/logitech-unifying-receiver

01from glob import glob
02from os import path
03target = "/sys/class/hidraw/*"
04for folder in glob(target):
05    fn = path.join(folder, "device/uevent")
06    with open(fn) as f:
07        if "logitech-djreceiver" in f.read():
08            devfn = path.join("/dev", path.basename(folder))
09            magic = "\x10\xff\x80\xb2\x01\x00\x00"
10            with open(devfn, "w") as dev:
11                dev.write(magic)
12                dev.flush()
13                dev.close()
14                print "turn the device on"
15                break

loading...