From ee4f105a94bccc2db66012fa3c4b01046417e738 Mon Sep 17 00:00:00 2001 From: Jef Driesen Date: Thu, 19 Jan 2012 21:04:59 +0100 Subject: [PATCH] Revert back to a standard baudrate on Unix. The linux USB CDC-ACM driver, which is used by the Mares Icon HD interface, doesn't support the ioctl's to configure a custom baudrate. But since the actual baudrate doesn't seem to matter at all, we revert back to the nearest standard baudrate. Because custom baudrates are confirmed to be supported on Windows and Mac OS X, those platforms can keep using the non-standard baudrate. --- src/mares_iconhd.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/mares_iconhd.c b/src/mares_iconhd.c index dc40c85..9ac25d7 100644 --- a/src/mares_iconhd.c +++ b/src/mares_iconhd.c @@ -33,6 +33,12 @@ rc == -1 ? DEVICE_STATUS_IO : DEVICE_STATUS_TIMEOUT \ ) +#if defined(_WIN32) || defined(__APPLE__) +#define BAUDRATE 256000 +#else +#define BAUDRATE 230400 +#endif + #define ICONHD 0x14 #define ICONHDNET 0x15 @@ -228,7 +234,7 @@ mares_iconhd_device_open (device_t **out, const char* name) } // Set the serial communication protocol (256000 8N1). - rc = serial_configure (device->port, 256000, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE); + rc = serial_configure (device->port, BAUDRATE, 8, SERIAL_PARITY_NONE, 1, SERIAL_FLOWCONTROL_NONE); if (rc == -1) { WARNING ("Failed to set the terminal attributes."); serial_close (device->port);