Skip to content

Functionality to allow set exotic ports names on Linux and MacOS - #182

Closed
andrey-patin-1979 wants to merge 5 commits into
java-native:masterfrom
andrey-patin-1979:master
Closed

andrey-patin-1979 wants to merge 5 commits into
java-native:masterfrom
andrey-patin-1979:master

Conversation

@andrey-patin-1979

Copy link
Copy Markdown

Added functionality for providing exotic port's names on Linux and MacOS as was asked in (#179 (comment)) and tests for this new functionality as was asked in (#179 (comment))

@tresf

tresf commented Jan 10, 2025

Copy link
Copy Markdown

I request we find a better word than EXOTIC that's more suitable. These port names are not exotic, they're just proprietary, or in many cases, just undocumented, or more simply an additional pattern to match.

Comment thread pom.xml
Comment thread pom.xml Outdated
Comment thread src/main/java/jssc/SerialNativeInterface.java
Comment thread src/main/java/jssc/SerialPortList.java
@tresf

tresf commented Jan 10, 2025

Copy link
Copy Markdown

Thanks for this effort. I believe some refactoring is required prior to merger. Thoughts welcome.

@andrey-patin-1979

Copy link
Copy Markdown
Author

I request we find a better word than EXOTIC that's more suitable. These port names are not exotic, they're just proprietary, or in many cases, just undocumented, or more simply an additional pattern to match.

So how do you want me to call them?

@andrey-patin-1979

Copy link
Copy Markdown
Author

@tresf, regarding error "/home/runner/work/jssc/jssc/src/test/java/jssc/SerialPortListTest.java:[27,63] method references are not supported in -source 6"
Do you really need to keep compatibility with Java 6, in that case I will look for mock-mechanism which will work on Java 6, current one works on Java 8 and higher?

Comment thread src/main/java/jssc/SerialNativeInterface.java
Comment thread src/main/java/jssc/SerialPortList.java
@tresf

tresf commented Jan 14, 2025

Copy link
Copy Markdown

Closing as non-planned, this is already covered by getPortNames(...). Thanks for the contribution, even if it wasn't accepted. We appreciate those that take the time to contribute back to this library!

@tresf tresf closed this Jan 14, 2025
pietrygamat pushed a commit to pietrygamat/jssc that referenced this pull request Oct 17, 2026
One test per mistake that reached users before, so each fails if it
comes back (JOURNAL.md now maps lesson -> test):

- java-native#113 baud rate truncated by a cast: set every standard rate and read
  it back with stty (verified: reintroducing a (jbyte) cast fails it)
- java-native#192 0-byte reads on a real open port
- java-native#86/java-native#181 event carries its port; removeEventListener true, then false
- java-native#107/java-native#181 closePort after the device vanished does not throw
- java-native#90 a port opened above fd 1024 still reads (poll on Linux)
- java-native#80 the library loads under a Turkish default locale
- java-native#160 exceptions stay IOExceptions
- java-native#51/java-native#65 tests load the native library just built, not another copy
- java-native#110 class files have the configured target version
- java-native#179/java-native#180/java-native#182 Linux port names incl. Moxa, and getPortNames(Pattern)

VirtualPortRule gets unplug() (stop socat) and one executor per rule:
the shared static executor was shut down after the first test, so a
class could only hold one socat test.

Two tests found open bugs, recorded in BACKLOG:
- reading from an unplugged port hangs on Linux because read() returns
  0 after a hangup and the native loop retries (B-04); that test is
  @ignore'd until the fix
- an incremental build without clean leaves Java 9 class files, because
  the second compiler pass sees up-to-date classes (new B-25)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPFQMyWmP4EyGx33gCHP2r
pietrygamat pushed a commit to pietrygamat/jssc that referenced this pull request Oct 17, 2026
One test per mistake that reached users before, so each fails if it
comes back (JOURNAL.md now maps lesson -> test):

- java-native#113 baud rate truncated by a cast: set every standard rate and read
  it back with stty (verified: reintroducing a (jbyte) cast fails it)
- java-native#192 0-byte reads on a real open port
- java-native#86/java-native#181 event carries its port; removeEventListener true, then false
- java-native#107/java-native#181 closePort after the device vanished does not throw
- java-native#90 a port opened above fd 1024 still reads (poll on Linux)
- java-native#80 the library loads under a Turkish default locale
- java-native#160 exceptions stay IOExceptions
- java-native#51/java-native#65 tests load the native library just built, not another copy
- java-native#110 class files have the configured target version
- java-native#179/java-native#180/java-native#182 Linux port names incl. Moxa, and getPortNames(Pattern)

VirtualPortRule gets unplug() (stop socat) and one executor per rule:
the shared static executor was shut down after the first test, so a
class could only hold one socat test.

Two tests found open bugs, recorded in BACKLOG:
- reading from an unplugged port hangs on Linux because read() returns
  0 after a hangup and the native loop retries (B-04); that test is
  @ignore'd until the fix
- an incremental build without clean leaves Java 9 class files, because
  the second compiler pass sees up-to-date classes (new B-25)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01RPFQMyWmP4EyGx33gCHP2r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants