hd44780: Add keystring array boundary check. Have all subdrivers close

previously opened devices.
This commit is contained in:
mmdolze
2010-01-10 17:07:48 +00:00
parent 97a2b20b0d
commit 6fba5cef68
5 changed files with 43 additions and 5 deletions
+14
View File
@@ -48,6 +48,7 @@ extern unsigned int **bitrate_conversion;
extern int convert_bitrate(unsigned int conf_bitrate, size_t *bitrate);
void lis2_HD44780_senddata(PrivateData *p, unsigned char displayID, unsigned char flags, unsigned char ch);
void lis2_HD44780_close(PrivateData *p);
static void clearScreen(int fd);
static void gotoXY(int fd, unsigned char x, unsigned char y);
@@ -131,6 +132,7 @@ int hd_init_lis2(Driver *drvthis)
tcsetattr(p->fd, TCSANOW, &portset);
p->hd44780_functions->senddata = lis2_HD44780_senddata;
p->hd44780_functions->close = lis2_HD44780_close;
common_init(p, IF_8BIT);
@@ -138,6 +140,18 @@ int hd_init_lis2(Driver *drvthis)
}
/**
* Close the device.
* \param p Pointer to driver's private data structure.
*/
void
lis2_HD44780_close(PrivateData *p) {
if (p->fd >= 0) {
close(p->fd);
}
}
/**
* Send data or commands to the display.
* \param p Pointer to driver's private data structure.