- We now only return a port object if it's open and list and open methods are now exported on an interface
- hardware tests now work and only require a loopback (no ready event)
- Test pass on darwin (not on mock - it's not up to date yet and coverage is going to drop)
- cleanup up tests with modern javascript
- Breaking - change the names of the exported types
- No more constructors, now all binding specicific open options are specificd on open
- Arduino test file for loopback
* 250k baudrate now works
* Generic linux non-standard baudrate setting using termios2
* Tested successfully with an FTDI usb chip with the tx and rx pins bridged. Previous solution using the B38400 hack returned gibberish in same setup.
* Test for linux and win32 baudrate setting. Darwin stubbed out.
The arbitrary baud interface has been working on darwin up to this point so it's
likely that it works properly. The GetBaudRate extension should still get
written to be thorough but for now, this will let the CI tests pass properly and
still throw a warning about the check being disabled.
That is, of course, if anyone's testing with the arduino hardware on darwin,
otherwise, these tests never run anyway.
- [osx] remove the 0x from productID and locationId and vendorId
- [linux] remove the starting 0x from any values, small refactor
- [linux] Fixup output using the hex encoded fields
- [windows] Grab the serial number from the pnp id
- Isolate list functions to their own platform files (c++)
- Better ensure our serialports fields are present
closes#1220
- [unix] small changes to flushing data during port open and setup to prevent bad data
- [all] mock binding flush now works
- cleanup on mock-binding pending reads
- add `serialport-repl` as a bin and npm command
This has always been the dream. Use `fs.read` and `fs.write` to do reading and writing. To make that happen I've created a cross platform `Poller` object that notifies us once on `readable` and `writable` states.
- Reduce large write cpu usage from 100% to 1-2%
- Replace ReadPoller with a multi purpose poller because you can only have a single uv_poll_t on a fd at a time because reasons
- Experimented with doing this all in c++, maybe there are gains to doing that but I'd never finish.
- Some unrelated eslint changes
- Arduino echo should just echo, writing random bytes was messing it up
- use a file to disable tests in envs
- read and write errors can trigger disconnects
- disconnect event only happens if there are listeners, otherwise error events will be triggered
- a disconnect during write will always have a write error too
- win32 bindings seem to only trigger disconnects on writes
This is a major change. To reading, the poller and the bindings layer, there isn’t a great way to do this piecemeal. The goal here is to make bindings a plugin layer, our c++ bindings isolated and tested, and make Serialport a streams object.
- Move all bindings into platform specific modules DarwinBinding LinuxBinding, and WindowsBinding
- Separate out the bindings from the SerialPort class so it can be required by itself.
- Provide mock bindings as a tested first class bindings layer
- Mixin stream methods with `pushBindingWrap`, inspired from fs.readStream
- All integration tests now require an Arduino
- Ditch sandboxed modules as we don't need to be that heavy handed to test anymore
TODO
- windows binding
- performance test
- memory leak test
- 🎉
- Fix bug where write callback was being called multiple times when write operations blocked
- [windows] refactored write code to be less complex
- [unix] refactored write code to be less complex
- added arduino required integration tests
- Errors should always be an error or null
- bindings.close doesn't throw with proper args so why are we catching?
- throw on update if given bad options
- support and test updating and opening with custom baud rates
HUPCL is a TTY control flag, not an FCNTL flag. Remove its effect on
open(2), and instead apply it tcsetattr(3).
Signed-off-by: Peter A. Bigot <pab@pabigot.com>
Fixes:
```
> serialport@2.0.1 install /Users/rwaldron/clonez/node-serialport
> node-pre-gyp install --fallback-to-build
(node) child_process: options.customFds option is deprecated. Use options.stdio instead.
CXX(target) Release/obj.target/serialport/src/serialport.o
CXX(target) Release/obj.target/serialport/src/serialport_unix.o
../src/serialport_unix.cpp:695:20: warning: comparison of array 'device.locationId' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.locationId != NULL) {
~~~~~~~^~~~~~~~~~ ~~~~
../src/serialport_unix.cpp:698:20: warning: comparison of array 'device.vendorId' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.vendorId != NULL) {
~~~~~~~^~~~~~~~ ~~~~
../src/serialport_unix.cpp:701:20: warning: comparison of array 'device.productId' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.productId != NULL) {
~~~~~~~^~~~~~~~~ ~~~~
../src/serialport_unix.cpp:704:20: warning: comparison of array 'device.manufacturer' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.manufacturer != NULL) {
~~~~~~~^~~~~~~~~~~~ ~~~~
../src/serialport_unix.cpp:707:20: warning: comparison of array 'device.serialNumber' not
equal to a null pointer is always true [-Wtautological-pointer-compare]
if (device.serialNumber != NULL) {
~~~~~~~^~~~~~~~~~~~ ~~~~
5 warnings generated.
```
It appears as though the registry topology has changed in 10.11.
In order to fix that, this code assumes nothing about the path, but
instead works on the assumption that we can already find the registry
entry as soon as the device is enumerated. By increasing the bounds
of the search we have a better chance of finding the registry entry
that we are looking for
refs: voodootikigod/node-serialport#552