-
Notifications
You must be signed in to change notification settings - Fork 291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds getPortProperties for Linux, OSX, Windows #113
Open
RomanBelkov
wants to merge
17
commits into
scream3r:2.8.0
Choose a base branch
from
RomanBelkov:port-info
base: 2.8.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Opening /dev/cu.* doesn't require DCD to be asserted and succeeds immediately.
This includes /dev/tty.Bluetooth-Modem and friends.
Opening certain devices, such as serial endpoints over Bluetooth, can take a long time before they fail. Moreover, it's better to show devices even when the user currently doesn't have permissions to access them - else one might think of a problem with the device or driver, when a "sudo chmod 666" would do the trick.
Before dynamically extracting the matching native library, first try to load it using System.loadLibrary(). This is helpful when it's not desired to modify the host system (but rather make changes to java.library.path).
The command used to compile this on 10.9.1: g++ -shared -arch i386 -arch x86_64 -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" -I"/System/Library/Frameworks/IOKit.framework/Headers" -o libjSSC-2.8_universal.jnilib jssc.cpp
getPortProperties() returns a map with keys and values as string. The currently available properties are: idProduct (lowercase hexadecimal zero-padded to four digits), idVendor (same as idProduct), manufacturer, product, serial. This is currently implemented for Linux and OS X (only in the Universal binary). The command used to compile this on 10.9.1: g++ -shared -arch i386 -arch x86_64 -I"$JAVA_HOME/include" -I"$JAVA_HOME/include/darwin" -I"/System/Library/Frameworks/IOKit.framework/Headers" -framework CoreFoundation -framework IOKit -o libjSSC-2.8_universal.jnilib jssc.cpp
Command used to compile on a current Raspbian: g++ -shared -march=armv6 -mfpu=vfp -mfloat-abi=hard -I/usr/lib/jvm/jdk-7 -oracle-armhf/include -I/usr/lib/jvm/jdk-7-oracle-armhf/include/linux -o libjSSC-2.8_armhf.so jssc.cpp
This was built with: g++ -shared -I /usr/lib/jdk1.8.0_121/include -I/usr/lib/jdk1.8.0_121/include/linux -o libjSSC-2.8_aarch64.so jssc.cpp
also made a few changes so that MS compiler would be able to compile
Compiled in MSVC 2017. Needs to add setupapi.lib for linker & give path to JDK includes.
Tested on Win & Linux
It appeared, that if you change device description (CP2102 in my case), you'll still get default description given by Windows where the new, changed device description is expected. Luckily, in Windows 7 and above there is a way to do so. Note that this commit will probably break everything on XP & Vista.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Thanks @gohai for his amazing work for Linux/OSX (see closed, unmerged #33; opened #88)
As this repo is cold dead for some time, this PR has only the intention to inform you of this feature.
Also, if someone can help & make a code review, I would be very grateful for that, as I'm a C++ noob. You can make an issue or propose a PR in my fork.