Re: HD44780 serial driver

"Matthias Kirchner" <[email protected]>
Newsgroups gmane.comp.sysutils.lcdproc
Message-ID <[email protected]>
Hi!

>> I made a patch for the HD44780 serial driver, because LoS-Panel's 
>> keypad function did not work properly.
>> A `diff` against the original hd44780-serial.c from lcdproc 0.5.4:
>> ...

>    1. Use unified diff format (diff -u)
>    2. Attach the result as a file to your mail, not within the text part
>       of your message.
> 

OK, here it comes (again, because of the wrong recipient)

Greetz
Matthias




-- 
NEU: FreePhone - 0ct/min Handyspartarif mit Geld-zurück-Garantie!		
Jetzt informieren: http://www.gmx.net/de/go/freephone

_______________________________________________
LCDproc mailing list
[email protected]
http://lists.omnipotent.net/mailman/listinfo/lcdproc
hd44780-serial.patch (text/x-diff, 667 B)
--- hd44780-serial.c.old	2011-10-02 18:48:36.000000000 +0200
+++ hd44780-serial.c	2011-10-02 18:49:05.000000000 +0200
@@ -312,13 +312,20 @@
 {
 
 	unsigned char buffer = 0;
+	unsigned char i,retval;
 	char hangcheck = 100;
 	read(p->fd, &buffer, 1);
-	if (buffer == SERIAL_IF.keypad_escape) {
+	if (buffer == (SERIAL_IF.keypad_escape & 0xFF)) {
 		while (hangcheck > 0) {
 			/* Check if I can read another byte */
 			if (read(p->fd, &buffer, 1) == 1) {
-				return buffer;
+				for ( i=3 ; i>=0 ; i-- ) {
+					if (( buffer % ( 1<<i )) == 0 ) {
+					retval = ((i<<4) + (buffer>>4))+0x11;
+					break;
+					}
+				}
+				return retval;
 			}
 			hangcheck--;
 		}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.