Add shared serial port access between tabs#1401
Conversation
@Vzor- and I are working on integrating TestNG, so we'd love to see something similar to socat to ensure basic functionality is working, but until we have some boilerplate tests, I'd rather we hold off on adding this to our codebase. Furthemore, @bratpeki is working on NPM tests, which may be a better home, depending. Thanks for the contribution, @Vzor- and I will be reviewing this shortly. If you need a one-off build in the meantime, just let me know, I'd happily provide one that's signed and all that. |
|
Thanks @tresf I could push the virtual serial port testing parts in a separate PR if that's helpful and you're welcome to just close it? It's not super urgent for us for now so no worries about a one-off build but thanks. Do you have a rough estimate for when the 2.3.0 will ship? |
@tomfrew TestNG is in WIP status on the With regards to testing on platforms such as Windows, I spent hours attempting this today, but it seems that we need a signed kernel-mode driver and the ones that are compatible with JSSC just-so-happen to also be commercially licensed in either a time-limited or feature-limited fashion not allow running in any automated fashion. I considered patching JSSC to allow named pipes directly to make this easier on ourselves but we'd have to add some win32 API bypasses, which wouldn't really be an honest test. So if we do add tests, we'll probably have to skip windows for the foreseeable future (I'd love to be proven wrong here).
Our plan is to start QA on 2.2.6 in the next week or two, then we'll be bumping master branch to 2.3.0-SNAPSHOT merging the ivy branch for better dependencies. This creates a moving target with TestNG since it should be targeted against IVY (for quite a few reasons), but we're still in the R&D process on the We're hoping a 2.3.0 in February / March. Almost definitely by April. |
FYI, TestNG is live on |
|
FYI, created a temporary branch to make this available to our portal. https://github.com/qzind/tray/tree/shared-serial. When this branch is rebased on master, |
Summary
Enables multiple browser tabs to share access to the same serial port. Previously, only the first tab could open a serial port; subsequent tabs received "port busy" errors.
Fixes #1366
Changes
SerialPortMonitor- Central coordinator following the existingStatusMonitorpattern with reference countingSharedSerialPort- Wraps JSSC SerialPort with multi-listener dispatch, broadcasts received data to all connected tabsSerialSession- WebSocket session wrapper for sending serial eventsSerialOptions- Added explicit settings tracking and equals() methods for conflict detectionSerialUtilities- Routes through SerialPortMonitor instead of direct SerialIO creationSocketConnection- Added cleanup on disconnectBehavior
Testing
We have a dev testing utility using socat to create virtual serial port pairs for automated testing without physical hardware. It's not included in this PR since socat isn't universally available, but we can add it if helpful for CI or review.