aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drv_LEDMatrix.c12
-rw-r--r--drv_USBHUB.c10
-rw-r--r--drv_generic_graphic.c9
-rw-r--r--font_6x8.h55
-rw-r--r--font_6x8_bold.h53
-rw-r--r--plugin_kvv.c31
6 files changed, 137 insertions, 33 deletions
diff --git a/drv_LEDMatrix.c b/drv_LEDMatrix.c
index 313942d..55234be 100644
--- a/drv_LEDMatrix.c
+++ b/drv_LEDMatrix.c
@@ -1,4 +1,4 @@
-/* $Id: drv_LEDMatrix.c,v 1.8 2006/08/14 05:54:04 reinelt Exp $
+/* $Id: drv_LEDMatrix.c,v 1.9 2006/08/14 19:24:22 harbaum Exp $
*
* LED matrix driver for LCD4Linux
* (see http://www.harbaum.org/till/ledmatrix for hardware)
@@ -23,6 +23,9 @@
*
*
* $Log: drv_LEDMatrix.c,v $
+ * Revision 1.9 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.8 2006/08/14 05:54:04 reinelt
* minor warnings fixed, CFLAGS changed (no-strict-aliasing)
*
@@ -170,7 +173,8 @@ static void drv_LEDMatrix_blit(const int row, const int col, const int height, c
} else {
if ((i == 2) && (reply[0] == DSP_CMD_ACK) && (reply[1] == DSP_CMD_IMAGE)) {
ack = 1;
-// } else if((i > 1) && (reply[0] == DSP_CMD_IR)) {
+ } else if ((i > 1) && (reply[0] == DSP_CMD_IR)) {
+// maybe used later:
// ir_receive(reply+1, i-1);
} else {
info("%s: Unexpected reply message", Name);
@@ -179,6 +183,10 @@ static void drv_LEDMatrix_blit(const int row, const int col, const int height, c
}
timeout--;
} while ((!ack) && (timeout > 0));
+
+ if (timeout == 0) {
+ error("%s: display reply timeout", Name);
+ }
}
static int drv_LEDMatrix_start(const char *section)
diff --git a/drv_USBHUB.c b/drv_USBHUB.c
index 1b68cc0..a98d50f 100644
--- a/drv_USBHUB.c
+++ b/drv_USBHUB.c
@@ -1,4 +1,4 @@
-/* $Id: drv_USBHUB.c,v 1.3 2006/08/14 05:54:04 reinelt Exp $
+/* $Id: drv_USBHUB.c,v 1.4 2006/08/14 19:24:22 harbaum Exp $
*
* new style driver for USBLCD displays
*
@@ -25,6 +25,9 @@
*
*
* $Log: drv_USBHUB.c,v $
+ * Revision 1.4 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.3 2006/08/14 05:54:04 reinelt
* minor warnings fixed, CFLAGS changed (no-strict-aliasing)
*
@@ -182,7 +185,8 @@ static int drv_UH_set(const int num, const int val)
}
-static int drv_UH_start(const char *section, const __attribute__ ((unused)) int quiet)
+static int drv_UH_start(const char *section, const __attribute__ ((unused))
+ int quiet)
{
char *buf;
@@ -278,7 +282,7 @@ int drv_UH_init(const char *section, const int quiet)
int ret;
int i;
- info("%s: %s", Name, "$Revision: 1.3 $");
+ info("%s: %s", Name, "$Revision: 1.4 $");
diff --git a/drv_generic_graphic.c b/drv_generic_graphic.c
index b52f623..746c7c8 100644
--- a/drv_generic_graphic.c
+++ b/drv_generic_graphic.c
@@ -1,4 +1,4 @@
-/* $Id: drv_generic_graphic.c,v 1.33 2006/08/13 09:53:10 reinelt Exp $
+/* $Id: drv_generic_graphic.c,v 1.34 2006/08/14 19:24:22 harbaum Exp $
*
* generic driver helper for graphic displays
*
@@ -23,6 +23,9 @@
*
*
* $Log: drv_generic_graphic.c,v $
+ * Revision 1.34 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.33 2006/08/13 09:53:10 reinelt
* dynamic properties added (used by 'style' of text widget)
*
@@ -350,9 +353,9 @@ static void drv_generic_graphic_render(const int layer, const int row, const int
unsigned char *chr;
if (strcasestr(style, "bold") != NULL) {
- chr = Font_6x8_bold[(int) *txt];
+ chr = Font_6x8_bold[(int) *(unsigned char *) txt];
} else {
- chr = Font_6x8[(int) *txt];
+ chr = Font_6x8[(int) *(unsigned char *) txt];
}
for (y = 0; y < YRES; y++) {
diff --git a/font_6x8.h b/font_6x8.h
index 0bfe7b4..d28610a 100644
--- a/font_6x8.h
+++ b/font_6x8.h
@@ -1,4 +1,4 @@
-/* $Id: font_6x8.h,v 1.3 2005/05/08 04:32:44 reinelt Exp $
+/* $Id: font_6x8.h,v 1.4 2006/08/14 19:24:22 harbaum Exp $
*
* 6x8 font
*
@@ -23,6 +23,9 @@
*
*
* $Log: font_6x8.h,v $
+ * Revision 1.4 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.3 2005/05/08 04:32:44 reinelt
* CodingStyle added and applied
*
@@ -601,10 +604,10 @@ unsigned char Font_6x8[256][8] = {
______},
[0x62] {_O____,
_O____,
- _O____,
_O_OO_,
_OO__O,
_O___O,
+ _O___O,
_OOOO_,
______},
[0x63] {______,
@@ -617,10 +620,10 @@ unsigned char Font_6x8[256][8] = {
______},
[0x64] {_____O,
_____O,
- _____O,
__OO_O,
_O__OO,
_O___O,
+ _O___O,
__OOOO,
______},
[0x65] {______,
@@ -640,13 +643,13 @@ unsigned char Font_6x8[256][8] = {
__O___,
______},
[0x67] {______,
+ ______,
__OOOO,
_O___O,
_O___O,
__OOOO,
_____O,
- __OOO_,
- ______},
+ __OOO_},
[0x68] {_O____,
_O____,
_O_OO_,
@@ -715,18 +718,18 @@ unsigned char Font_6x8[256][8] = {
______,
_OOOO_,
_O___O,
+ _O___O,
_OOOO_,
_O____,
- _O____,
- ______},
+ _O____},
[0x71] {______,
______,
__OO_O,
_O__OO,
+ _O___O,
__OOOO,
_____O,
- _____O,
- ______},
+ _____O},
[0x72] {______,
______,
_O_OO_,
@@ -744,8 +747,8 @@ unsigned char Font_6x8[256][8] = {
_OOOO_,
______},
[0x74] {__O___,
- _OOO__,
__O___,
+ _OOO__,
__O___,
__O___,
__O__O,
@@ -848,4 +851,36 @@ unsigned char Font_6x8[256][8] = {
______,
______,
______},
+ [0xe1] {__O_O_,
+ ______,
+ __OOO_,
+ _____O,
+ __OOOO,
+ _O___O,
+ __OOOO,
+ ______},
+ [0xe2] {__OOO_,
+ _O___O,
+ _OOOO_,
+ _O___O,
+ _O___O,
+ _O_OO_,
+ _O____,
+ ______},
+ [0xef] {__O_O_,
+ ______,
+ __OOO_,
+ _O___O,
+ _O___O,
+ _O___O,
+ __OOO_,
+ ______},
+ [0xf5] {__O_O_,
+ ______,
+ _O___O,
+ _O___O,
+ _O___O,
+ _O__OO,
+ __OO_O,
+ ______},
};
diff --git a/font_6x8_bold.h b/font_6x8_bold.h
index d8dbb15..e0175fb 100644
--- a/font_6x8_bold.h
+++ b/font_6x8_bold.h
@@ -1,4 +1,4 @@
-/* $Id: font_6x8_bold.h,v 1.2 2006/08/13 18:14:03 harbaum Exp $
+/* $Id: font_6x8_bold.h,v 1.3 2006/08/14 19:24:22 harbaum Exp $
*
* 6x8 bold font
*
@@ -23,6 +23,9 @@
*
*
* $Log: font_6x8_bold.h,v $
+ * Revision 1.3 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.2 2006/08/13 18:14:03 harbaum
* Added KVV plugin
*
@@ -627,10 +630,10 @@ unsigned char Font_6x8_bold[256][8] = {
______},
[0x62] {_OO___,
_OO___,
- _OO___,
_OOOO_,
_OO_OO,
_OO_OO,
+ _OO_OO,
_OOOO_,
______},
[0x63] {______,
@@ -643,10 +646,10 @@ unsigned char Font_6x8_bold[256][8] = {
______},
[0x64] {____OO,
____OO,
- ____OO,
__OOOO,
_OO_OO,
_OO_OO,
+ _OO_OO,
__OOOO,
______},
[0x65] {______,
@@ -666,13 +669,13 @@ unsigned char Font_6x8_bold[256][8] = {
__OO__,
______},
[0x67] {______,
+ ______,
__OOOO,
_OO_OO,
_OO_OO,
__OOOO,
____OO,
- __OOO_,
- ______},
+ __OOO_},
[0x68] {_OO___,
_OO___,
_OOOO_,
@@ -741,18 +744,18 @@ unsigned char Font_6x8_bold[256][8] = {
______,
_OOOO_,
_OO_OO,
+ _OO_OO,
_OOOO_,
_OO___,
- _OO___,
- ______},
+ _OO___},
[0x71] {______,
______,
__OOOO,
_OO_OO,
+ _OO_OO,
__OOOO,
____OO,
- ____OO,
- ______},
+ ____OO},
[0x72] {______,
______,
_OO_OO,
@@ -874,4 +877,36 @@ unsigned char Font_6x8_bold[256][8] = {
______,
______,
______},
+ [0xe1] {_OO_OO,
+ ______,
+ __OOO_,
+ ____OO,
+ __OOOO,
+ _OO_OO,
+ __OOOO,
+ ______},
+ [0xe2] {__OOO_,
+ _OO_OO,
+ _OOOO_,
+ _OO_OO,
+ _OO_OO,
+ _OOOO_,
+ _OO___,
+ ______},
+ [0xef] {_OO_OO,
+ ______,
+ __OOO_,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOO_,
+ ______},
+ [0xf5] {_OO_OO,
+ ______,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ _OO_OO,
+ __OOOO,
+ ______},
};
diff --git a/plugin_kvv.c b/plugin_kvv.c
index ec068da..344584b 100644
--- a/plugin_kvv.c
+++ b/plugin_kvv.c
@@ -1,4 +1,4 @@
-/* $Id: plugin_kvv.c,v 1.2 2006/08/13 18:45:25 harbaum Exp $
+/* $Id: plugin_kvv.c,v 1.3 2006/08/14 19:24:22 harbaum Exp $
*
* plugin kvv (karlsruher verkehrsverbund)
*
@@ -23,6 +23,9 @@
*
*
* $Log: plugin_kvv.c,v $
+ * Revision 1.3 2006/08/14 19:24:22 harbaum
+ * Umlaut support, added KVV HTTP-User-Agent
+ *
* Revision 1.2 2006/08/13 18:45:25 harbaum
* Little cleanup ...
*
@@ -68,6 +71,7 @@
/* these can't be configured as it doesn't make sense to change them */
#define HTTP_SERVER "www.init-ka.de"
#define HTTP_REQUEST "/webfgi/StopInfoInplace.aspx?ID=%s"
+#define USER_AGENT "lcd4linux - KVV plugin (http://ssl.bulix.org/projects/lcd4linux/wiki/plugin_kvv)"
#define DEFAULT_STATION_ID "89" // Hauptbahnhof
@@ -283,6 +287,8 @@ static void process_station_string(char *str)
{
char *p, *q;
int last, i;
+
+ /* some strings to replace */
char *repl[] = {
"Hauptbahnhof", "Hbf.",
"Bahnhof", "Bhf.",
@@ -291,12 +297,22 @@ static void process_station_string(char *str)
"Marktplatz", "Marktpl.",
};
- /* erase multiple spaces */
+ /* erase multiple spaces and replace umlauts */
p = q = str;
last = 1; // no leading spaces
while (*p) {
- if ((!last) || (*p != ' '))
- *q++ = *p;
+ if ((!last) || (*p != ' ')) {
+ if (*p == (char) 228) // lower a umlaut
+ *q++ = 0xe1;
+ else if (*p == (char) 223) // sz ligature
+ *q++ = 0xe2;
+ else if (*p == (char) 246) // lower o umlaut
+ *q++ = 0xef;
+ else if (*p == (char) 252) // lower u umlaut
+ *q++ = 0xf5;
+ else
+ *q++ = *p;
+ }
last = (*p == ' ');
p++;
@@ -357,8 +373,9 @@ static void kvv_client(void)
return;
}
// create and set get request
- sprintf(obuffer, "GET http://%s" HTTP_REQUEST " HTTP/1.1\n" "Host: %s\n\n", server_name, station_id,
- server_name);
+ sprintf(obuffer,
+ "GET http://%s" HTTP_REQUEST " HTTP/1.1\n"
+ "Host: %s\n" "User-Agent: " USER_AGENT "\n\n", server_name, station_id, server_name);
info("[KVV] Sending first (GET) request ...");
send(sock, obuffer, strlen(obuffer), 0);
@@ -449,6 +466,7 @@ static void kvv_client(void)
sprintf(obuffer,
"POST http://%s" HTTP_REQUEST " HTTP/1.1\n"
"Host: %s\n"
+ "User-Agent: " USER_AGENT "\n"
"Cookie: %s\n"
"Content-Type: application/x-www-form-urlencoded\n"
"Content-Length: %d\n"
@@ -549,6 +567,7 @@ static void kvv_client(void)
td += td_len + 1;
get_text(td, "td", str, sizeof(str));
+
/* stopname may need further tuning */
process_station_string(str);