Index: drv_picoLCDGraphic.c
===================================================================
--- drv_picoLCDGraphic.c	(revision 982)
+++ drv_picoLCDGraphic.c	(working copy)
@@ -6,7 +6,7 @@
  * Copyright (C) 2005 Michael Reinelt <michael@reinelt.co.at>
  * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
  *
- * Copyright (C) 2008 Nicu Pavel, Mini-Box.com <npavel@mini-box.com>
+ * Copyright (C) 2009 Nicu Pavel, Mini-Box.com <npavel@mini-box.com>
  *
  * This file is part of LCD4Linux.
  *
@@ -98,9 +98,10 @@
 static char *BufPtr;
 
 static usb_dev_handle *lcd;
+//extern int usb_debug;
+int usb_debug;
 
 
-
 /****************************************/
 /***  hardware dependant functions    ***/
 /****************************************/
@@ -119,7 +120,7 @@
 
     info("%s: scanning for picoLCD 256x64...", Name);
 
-    usb_set_debug(0);
+    usb_debug = 0;
 
     usb_init();
     usb_find_busses();
@@ -169,7 +170,12 @@
     return -1;
 }
 
+static int drv_pLG_read(unsigned char *data, int size)
+{
+    return usb_interrupt_read(lcd, USB_ENDPOINT_IN + 1, (char *) data, size, 1000);
+}
 
+
 static void drv_pLG_send(unsigned char *data, int size)
 {
     int ret;
@@ -388,6 +394,22 @@
     return backlight;
 }
 
+#define _USBLCD_MAX_DATA_LEN          24
+#define IN_REPORT_KEY_STATE           0x11
+static int drv_pLG_gpi( __attribute__ ((unused))
+		       int num)
+{
+    int ret;
+    unsigned char read_packet[_USBLCD_MAX_DATA_LEN];
+    ret = drv_pLG_read(read_packet, _USBLCD_MAX_DATA_LEN);
+    if ((ret > 0) && (read_packet[0] == IN_REPORT_KEY_STATE)) {
+	debug("picoLCD: pressed key= 0x%02x\n", read_packet[1]);
+	return read_packet[1];
+    }
+    return 0;
+}
+
+
 static int drv_pLG_gpo(int num, int val)
 {
     unsigned char cmd[2] = { 0x81 };	/* set GPO */
@@ -409,7 +431,7 @@
 	gpo &= ~(1 << num);
 
     cmd[1] = gpo;
-    //drv_pLG_send(cmd, 2);
+    drv_pLG_send(cmd, 2);
 
     return val;
 }
@@ -549,10 +571,13 @@
     XRES = 6;			/* pixel width of one char  */
     YRES = 8;			/* pixel height of one char  */
     GPOS = 8;
-
+    GPIS = 1;
     /* real worker functions */
     drv_generic_graphic_real_blit = drv_pLG_blit;
+    drv_generic_gpio_real_set = drv_pLG_gpo;
+    drv_generic_gpio_real_get = drv_pLG_gpi;
 
+
     /* start display */
     if ((ret = drv_pLG_start(section, quiet)) != 0)
 	return ret;
