USB Light HID control with Node.JS & node-usb - flash only? -


i've got delcom usb light - think build light (http://www.delcomproducts.com/products_usblmp.asp) i'm trying control node.js (running on ubuntu if makes difference)

i'm using node-usb (https://github.com/schakko/node-usb) , can connect & claim device. can "flash" (just when first plug in), can't stay lit, let alone change colours

var usb_driver = require("../usb.js"),      assert = require('assert');  // setup our vars var lightvid = 0x0fc5 var lightpid = 0xb080  // search ledlight var usb = usb_driver.create()  var thelight_devices = usb.find_by_vid_and_pid(lightvid, lightpid); assert.ok((thelight_devices.length >= 1)); console.log("total lights found: " + thelight_devices.length);    // light var thelight = thelight_devices[0];  var thelightinterfaces = thelight.getinterfaces(); assert.ok((thelightinterfaces.length >= 1)); console.log("the light contains interfaces: " + thelightinterfaces.length);  var thelightinterface = thelightinterfaces[0]; console.log("claiming light interface further actions") thelightinterface.detachkerneldriver(); //thelightinterface.claim()  console.log(thelightinterface.claim());  // controltransfer(mixed read|write, _bmrequesttyc8, _brequest, _wvalue, _windex, func, timeout); thelight.controltransfer(new buffer(10), 0x88, 0xc8, 0x0635, 0x04, function() {     console.log("led toggled") }, 0); 

when run this, tells me there device, claims it, flashes, won't stay on.

any thoughts on turn next?

would have node.js turning off , "flash" computer taking control of usb port again?

heres updated code:

var thelightinterface = thelightinterfaces[0] console.log("claiming light interface further actions " + thelightinterface)  for(var inter in thelightinterface){     console.log("name: "+ inter)     console.log("value: "+ thelightinterface[inter]) } console.log("is active: "+ thelightinterface.iskerneldriveractive() ) console.log("release kernel: "+ thelightinterface.detachkerneldriver() ) console.log("claim interface: "+ thelightinterface.claim() )  thelight.controltransfer(new buffer(0), 0x12, 0xc8, 0x04, 101, function() { console.log("led toggled") }, 1000) 

and outupt is:

is active: 1 release kernel: undefined claim interface: undefined 

with 0x12 , 0xc8 set, make light blink/flash - don't think have control of usb driver


Comments

Popular posts from this blog

Hatching array of circles in AutoCAD using c# -

ios - UITEXTFIELD InputView Uipicker not working in swift -

Python Pig Latin Translator -