Found a cheap USB LED Notifier at Radio Shack the other day, this code makes it go, I based this code on many random examples I found strewn around the interwebz let this be my official credit of their work
#!/usr/bin/python
import usb
from optparse import OptionParser
from array import array
parser = OptionParser()
parser.add_option("-r", "--red", dest="red",
help="Red Vaule")
parser.add_option("-g", "--green", dest="green",
help="green Vaule")
parser.add_option("-b", "--blue", dest="blue",
help="blue Vaule")
(options, args) = parser.parse_args()
dev = usb.core.find(idVendor=0x1d34, idProduct=0x0004)
try:
dev.detach_kernel_driver(0)
except:
pass
msg = bytearray('\x00\x00\x00\x00\x00\x00\x1a\x05')
msg[0] = int(options.red)
msg[1] = int(options.green)
msg[2] = int(options.blue)
dev.ctrl_transfer(0x21, 0x09, 0x0200, 0x000, msg)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment