Skip to content

Commit 49cd23e

Browse files
committed
feat: add libserialport sources
http://sigrok.org/wiki/Libserialport Signed-off-by: Frederic Pillon <[email protected]>
1 parent 9401acf commit 49cd23e

File tree

10 files changed

+5981
-0
lines changed

10 files changed

+5981
-0
lines changed

src/libserialport/AUTHORS

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
-------------------------------------------------------------------------------
2+
AUTHORS
3+
-------------------------------------------------------------------------------
4+
5+
Martin Ling conceived the idea for the library, designed the API and wrote much
6+
of the implementation and documentation.
7+
8+
The initial codebase was adapted from serial code in libsigrok, written by Bert
9+
Vermeulen and Uwe Hermann, who gave permission for it to be relicensed under
10+
the LGPL3+ for inclusion in libserialport.
11+
12+
The package is maintained by Uwe Hermann, with input from Martin Ling.
13+
14+
Aurelien Jacobs made several contributions, including the USB metadata API,
15+
improvements to the port enumeration code, and eliminating the previous
16+
dependence on libudev for enumeration on Linux.
17+
18+
Uffe Jakobsen contributed the FreeBSD support.
19+
20+
Matthias Heidbrink contributed support for non-standard baudrates on Mac OS X.
21+
22+
Bug fixes have been contributed by Bert Vermeulen, silverbuddy, Marcus
23+
Comstedt, Antti Nykanen, Michael B. Trausch and Janne Huttunen.
24+
25+
For a full history of contributions, see the git history.
26+
27+
Others have helped the project by contributing bug reports and discussion.

src/libserialport/COPYING

+165
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
GNU LESSER GENERAL PUBLIC LICENSE
2+
Version 3, 29 June 2007
3+
4+
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5+
Everyone is permitted to copy and distribute verbatim copies
6+
of this license document, but changing it is not allowed.
7+
8+
9+
This version of the GNU Lesser General Public License incorporates
10+
the terms and conditions of version 3 of the GNU General Public
11+
License, supplemented by the additional permissions listed below.
12+
13+
0. Additional Definitions.
14+
15+
As used herein, "this License" refers to version 3 of the GNU Lesser
16+
General Public License, and the "GNU GPL" refers to version 3 of the GNU
17+
General Public License.
18+
19+
"The Library" refers to a covered work governed by this License,
20+
other than an Application or a Combined Work as defined below.
21+
22+
An "Application" is any work that makes use of an interface provided
23+
by the Library, but which is not otherwise based on the Library.
24+
Defining a subclass of a class defined by the Library is deemed a mode
25+
of using an interface provided by the Library.
26+
27+
A "Combined Work" is a work produced by combining or linking an
28+
Application with the Library. The particular version of the Library
29+
with which the Combined Work was made is also called the "Linked
30+
Version".
31+
32+
The "Minimal Corresponding Source" for a Combined Work means the
33+
Corresponding Source for the Combined Work, excluding any source code
34+
for portions of the Combined Work that, considered in isolation, are
35+
based on the Application, and not on the Linked Version.
36+
37+
The "Corresponding Application Code" for a Combined Work means the
38+
object code and/or source code for the Application, including any data
39+
and utility programs needed for reproducing the Combined Work from the
40+
Application, but excluding the System Libraries of the Combined Work.
41+
42+
1. Exception to Section 3 of the GNU GPL.
43+
44+
You may convey a covered work under sections 3 and 4 of this License
45+
without being bound by section 3 of the GNU GPL.
46+
47+
2. Conveying Modified Versions.
48+
49+
If you modify a copy of the Library, and, in your modifications, a
50+
facility refers to a function or data to be supplied by an Application
51+
that uses the facility (other than as an argument passed when the
52+
facility is invoked), then you may convey a copy of the modified
53+
version:
54+
55+
a) under this License, provided that you make a good faith effort to
56+
ensure that, in the event an Application does not supply the
57+
function or data, the facility still operates, and performs
58+
whatever part of its purpose remains meaningful, or
59+
60+
b) under the GNU GPL, with none of the additional permissions of
61+
this License applicable to that copy.
62+
63+
3. Object Code Incorporating Material from Library Header Files.
64+
65+
The object code form of an Application may incorporate material from
66+
a header file that is part of the Library. You may convey such object
67+
code under terms of your choice, provided that, if the incorporated
68+
material is not limited to numerical parameters, data structure
69+
layouts and accessors, or small macros, inline functions and templates
70+
(ten or fewer lines in length), you do both of the following:
71+
72+
a) Give prominent notice with each copy of the object code that the
73+
Library is used in it and that the Library and its use are
74+
covered by this License.
75+
76+
b) Accompany the object code with a copy of the GNU GPL and this license
77+
document.
78+
79+
4. Combined Works.
80+
81+
You may convey a Combined Work under terms of your choice that,
82+
taken together, effectively do not restrict modification of the
83+
portions of the Library contained in the Combined Work and reverse
84+
engineering for debugging such modifications, if you also do each of
85+
the following:
86+
87+
a) Give prominent notice with each copy of the Combined Work that
88+
the Library is used in it and that the Library and its use are
89+
covered by this License.
90+
91+
b) Accompany the Combined Work with a copy of the GNU GPL and this license
92+
document.
93+
94+
c) For a Combined Work that displays copyright notices during
95+
execution, include the copyright notice for the Library among
96+
these notices, as well as a reference directing the user to the
97+
copies of the GNU GPL and this license document.
98+
99+
d) Do one of the following:
100+
101+
0) Convey the Minimal Corresponding Source under the terms of this
102+
License, and the Corresponding Application Code in a form
103+
suitable for, and under terms that permit, the user to
104+
recombine or relink the Application with a modified version of
105+
the Linked Version to produce a modified Combined Work, in the
106+
manner specified by section 6 of the GNU GPL for conveying
107+
Corresponding Source.
108+
109+
1) Use a suitable shared library mechanism for linking with the
110+
Library. A suitable mechanism is one that (a) uses at run time
111+
a copy of the Library already present on the user's computer
112+
system, and (b) will operate properly with a modified version
113+
of the Library that is interface-compatible with the Linked
114+
Version.
115+
116+
e) Provide Installation Information, but only if you would otherwise
117+
be required to provide such information under section 6 of the
118+
GNU GPL, and only to the extent that such information is
119+
necessary to install and execute a modified version of the
120+
Combined Work produced by recombining or relinking the
121+
Application with a modified version of the Linked Version. (If
122+
you use option 4d0, the Installation Information must accompany
123+
the Minimal Corresponding Source and Corresponding Application
124+
Code. If you use option 4d1, you must provide the Installation
125+
Information in the manner specified by section 6 of the GNU GPL
126+
for conveying Corresponding Source.)
127+
128+
5. Combined Libraries.
129+
130+
You may place library facilities that are a work based on the
131+
Library side by side in a single library together with other library
132+
facilities that are not Applications and are not covered by this
133+
License, and convey such a combined library under terms of your
134+
choice, if you do both of the following:
135+
136+
a) Accompany the combined library with a copy of the same work based
137+
on the Library, uncombined with any other library facilities,
138+
conveyed under the terms of this License.
139+
140+
b) Give prominent notice with the combined library that part of it
141+
is a work based on the Library, and explaining where to find the
142+
accompanying uncombined form of the same work.
143+
144+
6. Revised Versions of the GNU Lesser General Public License.
145+
146+
The Free Software Foundation may publish revised and/or new versions
147+
of the GNU Lesser General Public License from time to time. Such new
148+
versions will be similar in spirit to the present version, but may
149+
differ in detail to address new problems or concerns.
150+
151+
Each version is given a distinguishing version number. If the
152+
Library as you received it specifies that a certain numbered version
153+
of the GNU Lesser General Public License "or any later version"
154+
applies to it, you have the option of following the terms and
155+
conditions either of that published version or of any later version
156+
published by the Free Software Foundation. If the Library as you
157+
received it does not specify a version number of the GNU Lesser
158+
General Public License, you may choose any version of the GNU Lesser
159+
General Public License ever published by the Free Software Foundation.
160+
161+
If the Library as you received it specifies that a proxy can decide
162+
whether future versions of the GNU Lesser General Public License shall
163+
apply, that proxy's public statement of acceptance of any version is
164+
permanent authorization for you to choose that version for the
165+
Library.

src/libserialport/NEWS

+81
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
0.1.1 (2016-01-27)
2+
------------------
3+
4+
Note: This release does NOT change the libserialport API or ABI in
5+
backwards-incompatible ways. Programs using libserialport should
6+
continue to work fine without recompiling or relinking.
7+
8+
* New API calls:
9+
- sp_get_port_description(): Obtain a user friendly port description.
10+
- sp_get_port_transport(): Obtain the underlying transport type.
11+
- sp_get_port_usb_bus_address(): Obtain the USB bus number & device address.
12+
- sp_get_port_usb_vid_pid(): Obtain the USB VID and PID.
13+
- sp_get_port_usb_manufacturer(): Obtain the USB manufacturer string.
14+
- sp_get_port_usb_product(): Obtain the USB product string.
15+
- sp_get_port_usb_serial(): Obtain the USB serial number string.
16+
- sp_get_port_bluetooth_address(): Obtain the Bluetooth MAC address.
17+
- sp_blocking_read_next(): Read bytes from the specified serial port,
18+
returning as soon as any data is available.
19+
* API related additions:
20+
- enum sp_mode: Add SP_MODE_READ_WRITE.
21+
- Add enum sp_transport with the following enum entries:
22+
SP_TRANSPORT_NATIVE, SP_TRANSPORT_USB, SP_TRANSPORT_BLUETOOTH.
23+
* Fix the build on platforms where port enumeration and/or port
24+
metadata is not available or implemented.
25+
* Build system:
26+
- Don't set/override "user variables" such as CFLAGS or LDFLAGS, since
27+
those are meant to be controlled by the "user" (bug #577).
28+
- Modernize and cleanup autotools setup.
29+
* Remove trailing commas in libserialport.h enum definitions to allow
30+
the code to build with the -pedantic compiler option.
31+
* Fix various issues to allow successful builds with -std=c99.
32+
* Fix various (non-fatal) compiler warnings.
33+
* Fix various memory leaks (bug #419, among others).
34+
* Fix a potential overflow of the timeout parameter of poll().
35+
* Fix ReadFile() ERROR_IO_PENDING in sp_nonblocking_read() (bug #707).
36+
* Fix a glibc >= 2.20 compiler warning for deprecated _BSD_SOURCE (bug #716).
37+
* Rename a 'signals' parameter to 'signal_mask' to avoid a conflict with Qt.
38+
* Fix two potential segfaults in sp_get_port_handle() and sp_get_config_*()
39+
(which only occurred if the user incorrectly passed in a NULL argument).
40+
* sp_list_ports(): Actually set list_ptr NULL as documented.
41+
* Use "Port not open" debug message when a closed port is used (bug #710).
42+
* Linux:
43+
- The libudev requirement has been dropped (/sys is now used directly).
44+
- Fix a build issue in the get_termios_get_ioctl() call (bug #396).
45+
- Fix sp_flush() so that it only flushes the requested buffers.
46+
- Fix a build error if BOTHER is not available (bug #363).
47+
- If present, add the USB "description" for better port identification.
48+
- Handle the case when /sys/class/tty/ entries are not symlinks.
49+
* Windows:
50+
- MinGW-w64 (mingw-w64.sf.net) is now required for building, and MinGW
51+
(mingw.org) is no longer supported (bug #393).
52+
- Fix a build issue due to a missing <initguid.h> #include.
53+
- Fix a build issue due to the missing -lsetupapi linker argument.
54+
- Use libtool's -no-undefined option to allow shared (DLL) builds.
55+
- Fix a compile error due to multiply or not defined GUIDs (bug #416).
56+
- Fix a build issue related to the SP_PRIV/SP_API macros (bug #553).
57+
- Fix a bug where an uninitialized pointer was free()'d (bug #512).
58+
- Fix a bug wrt the SetupDiOpenDevRegKey() return code (bug #499).
59+
- Fix a bug wrt restart of RX/error wait operations after read (bug #421).
60+
- Fix a bug wrt WaitCommEvents() and/or fAbortOnError handling (bug #341).
61+
- Fix USB iSerial queries on USB composite devices.
62+
- Strip CR/LF from end of system error messages (bug #585).
63+
- Avoid unnecessary calls to the SetCommTimeouts() function (bug #586).
64+
- Fix a bug in the Windows implementation of sp_blocking_read_next().
65+
- Fix an ERROR_SEM_TIMEOUT related issue in sp_blocking_write().
66+
* FreeBSD:
67+
- Implement serial port enumeration for FreeBSD systems.
68+
* Android:
69+
- Fix a portability issue wrt the unavailable 'serial_struct' (bug #376).
70+
- Fix a portability issue wrt a readlinkat() call (bug #377).
71+
* Mac OS X:
72+
- Fix port listing on Mac OS X 10.11 (El Capitan).
73+
* README: Various documentation updates and fixes.
74+
* AUTHORS: Add/update list of contributors.
75+
* Doxygen API docs: Various documentation updates and fixes.
76+
77+
0.1.0 (2014-05-06)
78+
------------------
79+
80+
* Initial release.
81+

src/libserialport/README

+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
-------------------------------------------------------------------------------
2+
libserialport: cross-platform library for accessing serial ports
3+
-------------------------------------------------------------------------------
4+
5+
libserialport is a minimal library written in C that is intended to take care
6+
of the OS-specific details when writing software that uses serial ports.
7+
8+
By writing your serial code to use libserialport, you enable it to work
9+
transparently on any platform supported by the library.
10+
11+
The operations that are supported are:
12+
13+
- Port enumeration (obtaining a list of serial ports on the system).
14+
- Obtaining port metadata (USB device information, Bluetooth address, etc).
15+
- Opening and closing ports.
16+
- Setting port parameters (baud rate, parity, etc).
17+
- Reading, writing and flushing data.
18+
- Obtaining error information.
19+
20+
libserialport is an open source project released under the LGPL3+ license.
21+
22+
Status
23+
======
24+
25+
The library should build and work on any Windows or Unix-based system. If it
26+
does not, please submit a bug.
27+
28+
Enumeration is currently implemented on Windows, Mac OS X, FreeBSD and Linux.
29+
On other systems enumeration is not supported, but ports can still be opened
30+
by name and then used.
31+
32+
If you know how to enumerate available ports on another OS, please submit a bug
33+
with this information, or better still a patch implementing it.
34+
35+
Dependencies
36+
============
37+
38+
No other libraries are required.
39+
40+
Building
41+
========
42+
43+
On Windows, libserialport can be built with Visual Studio 2019 or with
44+
the standalone MSBuild tool, using the solution and project files provided.
45+
46+
For other environments, the package uses a GNU style build based on autotools.
47+
48+
Run "./autogen.sh" to generate the build system, "./configure" to setup, then
49+
"make" to build the library and "make install" to install it.
50+
51+
Windows builds can also be created using the autotools build system, using the
52+
MinGW-w64 toolchain from http://mingw-w64.sourceforge.net/ - either natively
53+
in Windows with the MSYS2 environment, or cross-compiling from another system.
54+
55+
To build from MSYS2, the following packages must be installed: autoconf,
56+
automake-wrapper, libtool, make, and either mingw-w64-i686-gcc (for 32-bit)
57+
or mingw-w64-x86_64-gcc (for 64-bit). Open either the "MSYS2 MinGW 32-bit" or
58+
"MSYS2 MinGW 64-bit" command window from the Start menu and use this when
59+
configuring and building the package. Using the "MSYS2 MSYS" shell will build
60+
against the Cygwin compatibility layer; this works, but port enumeration and
61+
metadata will not be available, and binaries will depend on Cygwin. The builds
62+
produced by MinGW-w64 are normal Windows DLLs without additional dependencies.
63+
64+
API
65+
===
66+
67+
Doxygen API documentation is included.
68+
69+
It can also be viewed online at:
70+
71+
http://sigrok.org/api/libserialport/unstable/
72+
73+
Bug reports
74+
===========
75+
76+
You can report bugs for libserialport at https://sigrok.org/bugzilla.
77+
78+
Mailing list
79+
============
80+
81+
https://lists.sourceforge.net/lists/listinfo/sigrok-devel
82+
83+
IRC
84+
===
85+
86+
You can find the developers in the #sigrok IRC channel on Libera.Chat.
87+
88+
Website
89+
=======
90+
91+
http://sigrok.org/wiki/Libserialport
92+

0 commit comments

Comments
 (0)