Fix supported for old compilers and make non-standard (termios.h) baud
rates optional (spotted by Tim Larson).
This commit is contained in:
@@ -14,6 +14,7 @@ Things for the short term:
|
|||||||
- MtxOrb: Recover the code for I2C connectivity to MtxOrb
|
- MtxOrb: Recover the code for I2C connectivity to MtxOrb
|
||||||
- shuttleVFD: Use output() method for these special "out-of-band" symbols.
|
- shuttleVFD: Use output() method for these special "out-of-band" symbols.
|
||||||
- glk: port icon, vBar and hBar to 0.5 API.
|
- glk: port icon, vBar and hBar to 0.5 API.
|
||||||
|
- Use non-standard serial baud rates (57600 and higher) only optional.
|
||||||
|
|
||||||
|
|
||||||
Things for the longer term:
|
Things for the longer term:
|
||||||
|
|||||||
@@ -67,9 +67,13 @@ unsigned int bitrate_conversion[][2] = {
|
|||||||
{ 4800, B4800 },
|
{ 4800, B4800 },
|
||||||
{ 9600, B9600 },
|
{ 9600, B9600 },
|
||||||
{ 19200, B19200 },
|
{ 19200, B19200 },
|
||||||
{ 38400, B38400 },
|
{ 38400, B38400 }
|
||||||
{ 57600, B57600 },
|
#if defined(B57600)
|
||||||
{ 115200, B115200 }
|
, { 57600, B57600 }
|
||||||
|
#endif
|
||||||
|
#if defined(B115200)
|
||||||
|
, { 115200, B115200 }
|
||||||
|
#endif
|
||||||
#if defined(B230400)
|
#if defined(B230400)
|
||||||
, { 230400, B230400 }
|
, { 230400, B230400 }
|
||||||
#endif
|
#endif
|
||||||
@@ -142,6 +146,8 @@ hd_init_serial(Driver *drvthis)
|
|||||||
|
|
||||||
struct termios portset;
|
struct termios portset;
|
||||||
char device[256] = DEFAULT_DEVICE;
|
char device[256] = DEFAULT_DEVICE;
|
||||||
|
unsigned int conf_bitrate;
|
||||||
|
size_t bitrate;
|
||||||
|
|
||||||
/* READ CONFIG FILE */
|
/* READ CONFIG FILE */
|
||||||
|
|
||||||
@@ -173,9 +179,6 @@ hd_init_serial(Driver *drvthis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Get bitrate */
|
/* Get bitrate */
|
||||||
unsigned int conf_bitrate;
|
|
||||||
size_t bitrate;
|
|
||||||
|
|
||||||
conf_bitrate = drvthis->config_get_int(drvthis->name, "Speed", 0, SERIAL_IF.default_bitrate);
|
conf_bitrate = drvthis->config_get_int(drvthis->name, "Speed", 0, SERIAL_IF.default_bitrate);
|
||||||
if (conf_bitrate == 0)
|
if (conf_bitrate == 0)
|
||||||
conf_bitrate = SERIAL_IF.default_bitrate;
|
conf_bitrate = SERIAL_IF.default_bitrate;
|
||||||
|
|||||||
@@ -150,6 +150,7 @@ HD44780_init(Driver *drvthis)
|
|||||||
int if_type = IF_TYPE_UNKNOWN;
|
int if_type = IF_TYPE_UNKNOWN;
|
||||||
int tmp;
|
int tmp;
|
||||||
PrivateData *p;
|
PrivateData *p;
|
||||||
|
char conf_charmap[MAX_CHARMAP_NAME_LENGTH];
|
||||||
|
|
||||||
// Alocate and store private data
|
// Alocate and store private data
|
||||||
p = (PrivateData *) calloc(1, sizeof(PrivateData));
|
p = (PrivateData *) calloc(1, sizeof(PrivateData));
|
||||||
@@ -347,8 +348,6 @@ HD44780_init(Driver *drvthis)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get configured charmap
|
// Get configured charmap
|
||||||
char conf_charmap[MAX_CHARMAP_NAME_LENGTH];
|
|
||||||
|
|
||||||
strncpy(conf_charmap, drvthis->config_get_string(drvthis->name, "charmap", 0, "hd44780_default"), MAX_CHARMAP_NAME_LENGTH);
|
strncpy(conf_charmap, drvthis->config_get_string(drvthis->name, "charmap", 0, "hd44780_default"), MAX_CHARMAP_NAME_LENGTH);
|
||||||
conf_charmap[MAX_CHARMAP_NAME_LENGTH-1] = '\0';
|
conf_charmap[MAX_CHARMAP_NAME_LENGTH-1] = '\0';
|
||||||
p->charmap = 0;
|
p->charmap = 0;
|
||||||
|
|||||||
@@ -31,6 +31,10 @@
|
|||||||
* COPYING file distributed with this package.
|
* COPYING file distributed with this package.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include "config.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
@@ -39,12 +43,10 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <stdint.h>
|
#ifdef HAVE_STDINT_H
|
||||||
#include <math.h>
|
# include <stdint.h>
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
# include "config.h"
|
|
||||||
#endif
|
#endif
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "lcd_lib.h"
|
#include "lcd_lib.h"
|
||||||
|
|||||||
Reference in New Issue
Block a user