I want to fix this double-close issue: First close at the end of a 'scan':
sr: [00:00.045171] openbench-logic-sniffer: Got metadata key 0x00, metadata ends. sr: [00:00.045178] openbench-logic-sniffer: Disabling demux mode. sr: [00:00.045186] serial: Closing serial port /dev/ttyACM0. Second one as part of hwdriver cleanup: sr: [00:00.046088] hwdriver: Cleaning up all drivers. sr: [00:00.046108] serial: Closing serial port /dev/ttyACM0. sr: [00:00.046116] serial-libsp: Cannot close unopened serial port /dev/ttyACM0. So, before closing a second time, check if the device is not idle. Signed-off-by: Wolfram Sang <w...@the-dreams.de> --- I am not sure if the added condition is good enough. Yet, I'd appreciate comments to see if I am on the right track. src/std.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/std.c b/src/std.c index 581e2e46..09ebf1ed 100644 --- a/src/std.c +++ b/src/std.c @@ -443,7 +443,7 @@ SR_PRIV int std_dev_clear_with_callback(const struct sr_dev_driver *driver, ret = SR_ERR_BUG; continue; } - if (driver->dev_close) + if (driver->dev_close && sdi->status == SR_ST_ACTIVE) driver->dev_close(sdi); if (sdi->conn) { -- 2.20.1 _______________________________________________ sigrok-devel mailing list sigrok-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/sigrok-devel