Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to compile on Windows 8 #1

Open
panbhatt opened this issue Nov 3, 2015 · 18 comments
Open

Unable to compile on Windows 8 #1

panbhatt opened this issue Nov 3, 2015 · 18 comments

Comments

@panbhatt
Copy link

panbhatt commented Nov 3, 2015

Hi Team,
I am unable to compile this. afer doing on npm install on nodejs v0.12.7, it gives an error related to windows tools v120 is not present. However I have VS2013 perfectly set up. Even i tried to download and install MS build tools but it is of no help.
Can anyone tried this on windows 8.

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

I've gotten this error before, but I'm afraid I can't remember exactly what I did to fix it. Maybe I had to install an older version of Visual C++. Does this article help at all? http://stackoverflow.com/questions/19801072/the-builds-tools-for-v120-platform-toolset-v120-cannot-be-found. Can you post the exact error message?

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

Hi, Here is the exact message: (Running node v0.12.7 n VS 2013). Even i opened the sos-device project in VS and the toolset is v120, but still it is failing there also.

[email protected] install D:\Temp\SOS\node_modules\sos-device
node-gyp rebuild

D:\Temp\SOS\node_modules\sos-device>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V110\Microsoft.Cpp.Platform.targets(44,5): error MSB8020: The builds tools for v120 (Platform Toolset = 'v120') cannot be found. To build using the v120 build tools, either click the Projec t menu or right-click the solution, and then select "Update VC++ Projects...". Install v120 to build using the v120 build tools. [D:\Temp\SOS\node_modules\sos-device\build\sos.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: msbuild failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack at ChildProcess.emit (events.js:110:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.3.9600
gyp ERR! command "node" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Temp\SOS\node_modules\sos-device
gyp ERR! node -v v0.12.7
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "sos-device" "--save"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the sos-device package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get their info via:
npm ERR! npm owner ls sos-device
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\Temp\SOS\npm-debug.log

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

I feel like that error message is misleading. It's been a long time since I've opened this project, but VS2013 just sounds too recent. Do you have a build\bindings.sln? Can you open it? When I do the version selector opens it in VS2010, and it builds fine.

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

Which version of Node you are running at.. and which version of Studio..i m on 64 bit machine..

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

0.10.29 (x64), and I have both VS2010 and VS2013

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

oh that is the reason. Since u r running in node 10. going ahead from node 12 the way the bindings are done is changed. n since i can't downgrade that is one issue. however it should work on node v12 and ahead as this is the future otherwise we might unable to use this device.

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

Oh, that's interesting. What's involved in upgrading to v12?

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

The way the bindings are being created has been changed and now the way node V12 provides it is consistent. NAN is the standard. You can read it online and let me know if you are able to build it.

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

i think the bindings needs to be changed to NAN. https://github.com/nodejs/nan

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

If you can help me to know the controlTransfer syntax to ring the bell on the device that would be great. device.controlTransfer9a,b,c,d,e,function(err,data)){} .
Once you get the Device via vendor ID. I can try to make it work via node module 'usb'.

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

I put together some documentation for the hid report protocol. Just converted it to markdown, so the formatting may be a little off. Let me know if you have any questions: https://github.com/AutomatedArchitecture/SirenOfShame/wiki/Hardware-API

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

Thanks that looks great. I have some sample code for getting the descriptor from the Device via node V12. Can you help me to transform this code ( by placing exact bytes) to play the sound .
var usb = require("usb");

var list = usb.getDeviceList();
//console.log("List = " , list);
var device = usb.findByIds(5840, 1606);
console.log(device) ;
device.open();
device.controlTransfer(0x80, 0x06, 0x0100, 0x0000, 0x0012, function(err, data){
if(err){
console.log("Error = " , err) ;
}
else {
console.log("Data = ", data.toString('utf16le', 2));
}
device.close();
});

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

There's a "Sample Send Packet" at the end of that page. Basically: 01FFFFFFFFFFFFFFFF00FFFFFFFFFF0000000000000000000000000000000000000000000000

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

ya, i saw it tha'ts great, however, if you can help out it to translate in the call as i have shown above. the FFFFFF at the start and the length/data is confusing me. I had just started creating it today, so sorry for asking basic questions.

@lprichar
Copy link
Member

lprichar commented Nov 4, 2015

No worries. It might be easier to transfer it the way the original code does at https://github.com/AutomatedArchitecture/node-sos-device/blob/master/src/nodeSos.cpp#L305 using a UsbControlPacket, but I guess if the code you have above is close (and honestly it looks a bit odd to me) then perhaps this is what you're looking for:

device.controlTransfer(0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, function(err, data)...

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

Thanks a ton. i will try tommorrow and let you know the results and then we can work on the bindings for node v12.

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

Hi, Iprichar
the code you sent look difficult to me. as from the node-usb url, it has to be something like this.
.controlTransfer(bmRequestType, bRequest, wValue, wIndex, data_or_length, callback(error, data))
https://github.com/nonolith/node-usb
since you know the HID pattern better, it would be great if you can help me to transform the above pattern into this structure.

@panbhatt
Copy link
Author

panbhatt commented Nov 4, 2015

This is what we tried, but it is returing with Error: "LIBUSB_ERROR_NOT_FOUND" errno: -5 , Here is the code.
var usb = require('usb');
var util = require('util');
var buffer = require('buffer');

var vendorId = 5840;
var productId = 1606;

var buf = new Buffer([0x01, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]);

//Control transfer 1 - prepare device
var buf1 = new Buffer(8);
buf1.writeUInt8(0x01,0)
buf1.writeUInt8(0x82,1)
buf1.writeUInt8(0x77,2)
buf1.writeUInt8(0x01,3)
buf1.writeUInt8(0x00,4)
buf1.writeUInt8(0x00,5)
buf1.writeUInt8(0x00,6)
buf1.writeUInt8(0x00,7)

//Control transfer 2 - prepare device
var buf2 = new Buffer(8);
buf2.writeUInt8(0x01,0)
buf2.writeUInt8(0x86,1)
buf2.writeUInt8(0xFF,2)
buf2.writeUInt8(0x01,3)
buf2.writeUInt8(0x00,4)
buf2.writeUInt8(0x00,5)
buf2.writeUInt8(0x00,6)
buf2.writeUInt8(0x00,7)

//Control transfer 3 - Request value
var buf3 = new Buffer(8);
buf3.writeUInt8(0x01,0)
buf3.writeUInt8(0x80,1)
buf3.writeUInt8(0x33,2)
buf3.writeUInt8(0x01,3)
buf3.writeUInt8(0x00,4)
buf3.writeUInt8(0x00,5)
buf3.writeUInt8(0x00,6)
buf3.writeUInt8(0x00,7)

process.stdout.write("Searching for device 0x"+vendorId.toString(16)+" 9x"+productId.toString(16)+"...");
var device = usb.findByIds(vendorId,productId);
if(device)
{
console.log(util.format("Found device at bus %d address %d",device.busNumber,device.deviceAddress));
}
else
{
console.log("Device not found, exiting");
process.exit();
}

device.open();

device.controlTransfer(0x21,0x09,0x0200,0x01,buf1, function(err,data)
{
if(err)
console.log("Error in opening control transfer:"+err);

//Won't get any data without this one, 1.4Per1F with
device.controlTransfer(0x21,0x09,0x0200,0x01,buf2, function(err,data)
{
    if(err)
        console.log("Error in opening control transfer:"+err);
});

});

//Get interface
var interface = device.interface(0);

//Gotta claim away from OS (should hear windows disconnect device sound)
interface.claim();

var configurationDescriptor = device.configurationDescriptor;
var deviceDescriptor = device.deviceDescriptor;

var endpoint = interface.endpoints[0];

console.log("DEVICE ENDPOINTS = ", interface.endpoints.length) ;
endpoint.transfer(buf,function(err){
if(err){
console.log("An Error Occured. ",err);
}
console.log("DONE") ;
//device.close();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants