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.
Would like to add the ability for libserialport to recognize and use symlinks on Linux. This is primarily in support of the Arduino IDE which uses libserialport to enumerate and list serial ports however it seems like it would be beneficial to any libserialport users. Symlinks are created on Linux when udev rules are used to map a specific device or class of devices to a symlink. In order to accommodate this I have added code to find symlinks base on TTY devices found and then I removed a block of code that ensure a real path was passed to the serial port creator and moved this call in the Linux only portion of the code. Based on some research Mac OSX doesn't seem allow for symlink serial ports and there was a guard on the code already to stop it from running on Windows so that leaves BSD which I am unfamiliar with. I am sure BSD allows for symlinks but it doesn't look like it uses the same path searching method to determine port characteristics so I though moving that bit of code would be safe. I have another version of this feature where I added a realpath element to the sp_port struct. This would leave that realpath block in place but assign that real path to the struct there however that seemed more error prone. I was able to get all of the examples to run with my code modifications.
The only other note is that there is two commits here the first adds the code to allow the symlinks to be found. The second moves the realpath code to allow the symlink port names to pass through.
This is my first pull request to an open source project so any feed back is appreciated.