serialport
Advanced tools
Comparing version 1.2.4 to 1.2.5
@@ -0,1 +1,6 @@ | ||
Version 1.2.5 | ||
------------- | ||
- Fixed an issue with pool handlers being global instead of instance isolation (Issue #252 and #255 thanks: foobarth !!! ) | ||
Version 1.2.4 | ||
@@ -64,3 +69,3 @@ ------------- | ||
----------------------------- | ||
- Debugging issue with IOWatcher not holding in the event loop in node.js. | ||
- Debugging issue with IOWatcher not holding in the event loop in node.js. | ||
- Converted to ReadStream instead of IOWatcher. | ||
@@ -67,0 +72,0 @@ |
{ | ||
"name": "serialport", | ||
"version": "1.2.4", | ||
"version": "1.2.5", | ||
"description": "Welcome your robotic javascript overlords. Better yet, program them!", | ||
@@ -5,0 +5,0 @@ "author": { |
``` | ||
eeeee eeeee eeeee eeee e eeeee | ||
8 8 8 88 8 8 8 8 8 " | ||
8e 8 8 8 8e 8 8eee 8e 8eeee | ||
88 8 8 8 88 8 88 e 88 88 | ||
eeeee eeeee eeeee eeee e eeeee | ||
8 8 8 88 8 8 8 8 8 " | ||
8e 8 8 8 8e 8 8eee 8e 8eeee | ||
88 8 8 8 88 8 88 e 88 88 | ||
88 8 8eee8 88ee8 88ee 88 8ee88 8ee88 | ||
eeeee eeee eeeee e eeeee e eeeee eeeee eeeee eeeee | ||
8 " 8 8 8 8 8 8 8 8 8 8 88 8 8 8 | ||
8eeee 8eee 8eee8e 8e 8eee8 8e 8eee8 8 8 8eee8e 8e | ||
88 88 88 8 88 88 8 88 88 8 8 88 8 88 | ||
eeeee eeee eeeee e eeeee e eeeee eeeee eeeee eeeee | ||
8 " 8 8 8 8 8 8 8 8 8 8 88 8 8 8 | ||
8eeee 8eee 8eee8e 8e 8eee8 8e 8eee8 8 8 8eee8e 8e | ||
88 88 88 8 88 88 8 88 88 8 8 88 8 88 | ||
8ee88 88ee 88 8 88 88 8 88eee 88 8eee8 88 8 88 | ||
@@ -17,3 +17,3 @@ ``` | ||
Version: 1.2.4 - Released November 5, 2013 | ||
Version: 1.2.5 - Released November 11, 2013 | ||
@@ -122,3 +122,3 @@ ***** | ||
``` | ||
When opening a serial port, you can specify (in this order). | ||
@@ -143,3 +143,3 @@ | ||
You MUST wait for the open event to be emitted before reading/writing to the serial port. The open happens asynchronously so installing 'data' listeners and writing | ||
You MUST wait for the open event to be emitted before reading/writing to the serial port. The open happens asynchronously so installing 'data' listeners and writing | ||
before the open event might result in... nothing at all. | ||
@@ -154,7 +154,7 @@ | ||
console.log('data received: ' + data); | ||
}); | ||
}); | ||
serialPort.write("ls\n", function(err, results) { | ||
console.log('err ' + err); | ||
console.log('results ' + results); | ||
}); | ||
}); | ||
}); | ||
@@ -175,7 +175,7 @@ ``` | ||
console.log('data received: ' + data); | ||
}); | ||
}); | ||
serialPort.write("ls\n", function(err, results) { | ||
console.log('err ' + err); | ||
console.log('results ' + results); | ||
}); | ||
}); | ||
}); | ||
@@ -208,4 +208,4 @@ ``` | ||
var sp = new SerialPort("/dev/tty-usbserial1", { | ||
parser: serialport.parsers.readline("\n") | ||
var sp = new SerialPort("/dev/tty-usbserial1", { | ||
parser: serialport.parsers.readline("\n") | ||
}); | ||
@@ -220,3 +220,3 @@ ``` | ||
var sp = new SerialPort("/dev/tty-usbserial1", { | ||
var sp = new SerialPort("/dev/tty-usbserial1", { | ||
parser: serialport.parsers.raw | ||
@@ -223,0 +223,0 @@ }); |
@@ -33,9 +33,3 @@ /*jslint node: true */ | ||
var kMinPoolSpace = 128; | ||
var pool; | ||
function allocNewPool() { | ||
pool = new Buffer(kPoolSize); | ||
pool.used = 0; | ||
} | ||
var parsers = { | ||
@@ -285,7 +279,10 @@ raw: function (emitter, buffer) { | ||
if (!pool || pool.length - pool.used < kMinPoolSpace) { | ||
if (!self.pool || self.pool.length - self.pool.used < kMinPoolSpace) { | ||
// discard the old pool. Can't add to the free list because | ||
// users might have refernces to slices on it. | ||
pool = null; | ||
allocNewPool(); | ||
self.pool = null; | ||
// alloc new pool | ||
self.pool = new Buffer(kPoolSize); | ||
self.pool.used = 0; | ||
} | ||
@@ -296,5 +293,5 @@ | ||
// one. | ||
var thisPool = pool; | ||
var toRead = Math.min(pool.length - pool.used, ~~self.bufferSize); | ||
var start = pool.used; | ||
var thisPool = self.pool; | ||
var toRead = Math.min(self.pool.length - self.pool.used, ~~self.bufferSize); | ||
var start = self.pool.used; | ||
@@ -316,3 +313,3 @@ function afterRead(err, bytesRead, readPool, bytesRequested) { | ||
// let's mark the ones we didn't need as available again. | ||
pool.used -= bytesRequested - bytesRead; | ||
self.pool.used -= bytesRequested - bytesRead; | ||
@@ -325,3 +322,3 @@ // console.log(">>ACTUALLY READ: ", bytesRead); | ||
} else { | ||
var b = thisPool.slice(start, start + bytesRead); | ||
var b = self.pool.slice(start, start + bytesRead); | ||
@@ -343,5 +340,8 @@ // do not emit events if the stream is paused | ||
// debug this device's pool offset | ||
// console.log(self.path + ' >> POOL OFFSET: ', self.pool.used); | ||
// console.log(">>REQUEST READ: ", toRead); | ||
fs.read(self.fd, pool, pool.used, toRead, self.pos, function(err, bytesRead){ | ||
var readPool = pool; | ||
fs.read(self.fd, self.pool, self.pool.used, toRead, self.pos, function(err, bytesRead){ | ||
var readPool = self.pool; | ||
var bytesRequested = toRead; | ||
@@ -351,3 +351,3 @@ afterRead(err, bytesRead, readPool, bytesRequested);} | ||
pool.used += toRead; | ||
self.pool.used += toRead; | ||
}; | ||
@@ -354,0 +354,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
731603
927