mirror of
https://github.com/siemens-mobile-hacks/node-serialport-bindings-cpp.git
synced 2026-11-26 02:47:17 +00:00
Merge pull request #375 from giseburt/master
Fix for windows and Node 0.11.13 (atom-shell)
This commit is contained in:
commit
b47202dd3b
2 changed files with 13 additions and 8 deletions
|
|
@ -27,6 +27,9 @@ before_install:
|
|||
# If version is 0.9 do not publish to avoid duplicated binary error, caused by 0.9 and 0.10
|
||||
# returning same v number in node.js.
|
||||
- if [[ "$TRAVIS_NODE_VERSION" == '0.9' ]]; then PUBLISH_BINARY=false; fi;
|
||||
# Fix a problem with apt-get failing later, see http://docs.travis-ci.com/user/installing-dependencies/#Installing-Ubuntu-packages
|
||||
- sudo apt-get update -qq
|
||||
|
||||
|
||||
install:
|
||||
# ensure source install works
|
||||
|
|
|
|||
|
|
@ -5,6 +5,8 @@
|
|||
#include "win/stdafx.h"
|
||||
#include "win/enumser.h"
|
||||
|
||||
#include <nan.h>
|
||||
|
||||
#ifdef WIN32
|
||||
|
||||
#define MAX_BUFFER_SIZE 1000
|
||||
|
|
@ -131,7 +133,7 @@ void EIO_Open(uv_work_t* req) {
|
|||
}
|
||||
|
||||
// Remove garbage data in RX/TX queues
|
||||
PurgeComm(file, PURGE_RXCLEAR);
|
||||
PurgeComm(file, PURGE_RXCLEAR);
|
||||
PurgeComm(file, PURGE_TXCLEAR);
|
||||
|
||||
data->result = (int)file;
|
||||
|
|
@ -251,7 +253,7 @@ void EIO_AfterWatchPort(uv_work_t* req) {
|
|||
goto cleanup;
|
||||
} else {
|
||||
v8::Handle<v8::Value> argv[1];
|
||||
argv[0] = v8::Exception::Error(v8::String::New(data->errorString));
|
||||
argv[0] = NanError(data->errorString);
|
||||
data->errorCallback->Call(1, argv);
|
||||
Sleep(100); // prevent the errors from occurring too fast
|
||||
}
|
||||
|
|
@ -359,7 +361,7 @@ void EIO_Close(uv_work_t* req) {
|
|||
*
|
||||
* Notable VIDs & PIDs combos:
|
||||
* VID 0403 - FTDI
|
||||
*
|
||||
*
|
||||
* VID 0403 / PID 6001 - Arduino Diecimila
|
||||
*
|
||||
*/
|
||||
|
|
@ -372,7 +374,7 @@ void EIO_List(uv_work_t* req) {
|
|||
|
||||
dhInitialize(TRUE);
|
||||
dhToggleExceptions(FALSE);
|
||||
|
||||
|
||||
dhGetObject(L"winmgmts:{impersonationLevel=impersonate}!\\\\.\\root\\cimv2", NULL, &wmiSvc);
|
||||
dhGetValue(L"%o", &colDevices, wmiSvc, L".ExecQuery(%S)", L"Select * from Win32_PnPEntity");
|
||||
|
||||
|
|
@ -385,7 +387,7 @@ void EIO_List(uv_work_t* req) {
|
|||
|
||||
dhGetValue(L"%s", &name, objDevice, L".Name");
|
||||
dhGetValue(L"%s", &pnpid, objDevice, L".PnPDeviceID");
|
||||
|
||||
|
||||
if( name != NULL && ((match = strstr( name, "(COM" )) != NULL) ) { // look for "(COM23)"
|
||||
// 'Manufacturuer' can be null, so only get it if we need it
|
||||
dhGetValue(L"%s", &manu, objDevice, L".Manufacturer");
|
||||
|
|
@ -398,14 +400,14 @@ void EIO_List(uv_work_t* req) {
|
|||
data->results.push_back(resultItem);
|
||||
dhFreeString(manu);
|
||||
}
|
||||
|
||||
|
||||
dhFreeString(name);
|
||||
dhFreeString(pnpid);
|
||||
} NEXT(objDevice);
|
||||
|
||||
|
||||
SAFE_RELEASE(colDevices);
|
||||
SAFE_RELEASE(wmiSvc);
|
||||
|
||||
|
||||
dhUninitialize(TRUE);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue