Skip to content

Commit

Permalink
fix: Parity option broken in bindings (#2377)
Browse files Browse the repository at this point in the history
closes #2373
  • Loading branch information
reconbot authored Dec 25, 2021
1 parent 8712986 commit 07a71f2
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/bindings/src/serialport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ Napi::Value Close(const Napi::CallbackInfo& info) {
Napi::Function callback = info[1].As<Napi::Function>();
CloseBaton* baton = new CloseBaton(callback);
baton->fd = info[0].ToNumber().Int64Value();;

baton->Queue();
return env.Undefined();
}
Expand Down Expand Up @@ -189,7 +189,7 @@ Napi::Value Set(const Napi::CallbackInfo& info) {
baton->dtr = getBoolFromObject(options, "dtr");
baton->dsr = getBoolFromObject(options, "dsr");
baton->lowLatency = getBoolFromObject(options, "lowLatency");

baton->Queue();
return env.Undefined();
}
Expand Down Expand Up @@ -263,13 +263,15 @@ Napi::Value Drain(const Napi::CallbackInfo& info) {
Napi::Function callback = info[1].As<Napi::Function>();
DrainBaton* baton = new DrainBaton(callback);
baton->fd = fd;

baton->Queue();
return env.Undefined();
}

inline SerialPortParity ToParityEnum(const Napi::String& napistr) {
const char* str = napistr.Utf8Value().c_str();
auto tmp = napistr.Utf8Value();
const char* str = tmp.c_str();

size_t count = strlen(str);
SerialPortParity parity = SERIALPORT_PARITY_NONE;
if (!strncasecmp(str, "none", count)) {
Expand Down

0 comments on commit 07a71f2

Please sign in to comment.