File tree Expand file tree Collapse file tree 2 files changed +17
-4
lines changed
Expand file tree Collapse file tree 2 files changed +17
-4
lines changed Original file line number Diff line number Diff line change 11/*
22 * USBSerialDevice.h
3- * Ver 1.2
3+ * Ver 1.3
44 */
55
66/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3030#include < ctype.h>
3131#include < sstream>
3232
33+ #ifdef __FreeBSD__
34+ #include < sys/param.h>
35+ #endif
36+
3337class USBSerialDevice {
3438public:
3539 USBSerialDevice ();
Original file line number Diff line number Diff line change 11/*
22 * USBSerialDevice.cpp
3- * Ver 1.5
3+ * Ver 1.6
44 */
55
66/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
@@ -71,8 +71,12 @@ bool USBSerialDevice::connect(const char *devicePath) {
7171 opts.c_iflag &= ~(INLCR | IGNCR | ICRNL | IXON | IXOFF);
7272 opts.c_oflag &= ~(ONLCR | OCRNL);
7373
74- // Set time out to 100 milliseconds for read serial device operations
74+ // Set time out or read serial device operations
75+ #ifdef __FreeBSD__
76+ opts.c_cc [VTIME] = 2 ;
77+ #else
7578 opts.c_cc [VTIME] = 1 ;
79+ #endif
7680 opts.c_cc [VMIN] = 0 ;
7781
7882 retVal = tcsetattr (m_fd, TCSANOW, &opts);
@@ -220,8 +224,13 @@ void USBSerialDevice::scan_available_devices() {
220224 continue ;
221225 }
222226 if (device_candidate) {
227+ #if __FreeBSD_version < 1400000
223228 if (strstr (line, " VCOM" ) != nullptr && strstr (line, " umodem" ) != nullptr ) {
224- // Found VCOM description. Extract 'cuaU' number.
229+ #else
230+ if (strstr (line, " umodem" ) != nullptr ) {
231+
232+ #endif
233+ // Found description. Extract 'cuaU' number.
225234 char *p = strstr (line, " umodem" );
226235 if (p == nullptr ) {
227236 continue ;
You can’t perform that action at this time.
0 commit comments