diff options
| author | kutayboz <kutayboz@gmail.com> | 2023-06-09 02:02:07 +0300 |
|---|---|---|
| committer | kutayboz <kutayboz@gmail.com> | 2023-06-09 02:02:07 +0300 |
| commit | 386074fd3ffd04ae21cb914dc84969c9fd981c5e (patch) | |
| tree | 4e48a10607a75c09fb253b275b3048908a686fa9 /src/serial.c | |
| parent | 05a602d2abd9716af6707d5b31c0e8beee707634 (diff) | |
| download | celnetmon-386074fd3ffd04ae21cb914dc84969c9fd981c5e.tar.gz | |
Overhaul. Created bg96 lib.
Diffstat (limited to 'src/serial.c')
| -rw-r--r-- | src/serial.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/serial.c b/src/serial.c index 8456e68..88e9a4c 100644 --- a/src/serial.c +++ b/src/serial.c @@ -57,7 +57,8 @@ int openSerialPort(char pathToPort[]) { return serialPort; } -int querySerialPort(char **output, int serialPort, char *input) { +int querySerialPort(char **output, int serialPort, char *input, + int timeoutSeconds) { time_t timeStart; unsigned long idx; @@ -104,8 +105,8 @@ int querySerialPort(char **output, int serialPort, char *input) { break; } } - } else if (bytesRead == 0 && time(NULL) - timeStart > 180) { - printf("Response timeout after 180 seconds\n"); + } else if (bytesRead == 0 && time(NULL) - timeStart > timeoutSeconds) { + printf("Response timeout after %d seconds\n", timeoutSeconds); returnCode = 1; break; } |
