]> git.webhop.me Git - lcd4linux.git/commitdiff
GLCD2USB by Till Harbaum
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 4 Mar 2009 04:19:25 +0000 (04:19 +0000)
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>
Wed, 4 Mar 2009 04:19:25 +0000 (04:19 +0000)
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@991 3ae390bd-cb1e-0410-b409-cd5a39f66f1f

configure
drivers.m4
drv_GLCD2USB.c
glcd2usb.h [new file with mode: 0644]
lcd4linux.c

index 79eb2342cc5823085afd64cc990637ba2d64f0a2..36845e8040c2e810b6d45e89b2be7ac3d9daea7d 100755 (executable)
--- a/configure
+++ b/configure
@@ -7695,7 +7695,7 @@ for driver in $drivers; do
          D4D="yes"
          EA232graphic="yes"
          G15="yes"
-         GLCD2USB="no"
+         GLCD2USB="yes"
          HD44780="yes"
         IRLCD="yes"
          LCD2USB="yes"
index f2640ee2b902af3bb3446ee68e1c3fd96fa57efc..7afd347b78d1064ea05d49daeb725a53af275296 100644 (file)
@@ -67,7 +67,7 @@ for driver in $drivers; do
          D4D="yes"
          EA232graphic="yes"
          G15="yes"
-         GLCD2USB="no"
+         GLCD2USB="yes"
          HD44780="yes"
         IRLCD="yes"
          LCD2USB="yes"
index 38a6b31a539ab85beaffad2b514c07d97cc207c1..d4b69ba57b6c275d4edec22a20599420eed1a146 100644 (file)
 #include "drv_generic_graphic.h"
 #include "drv_generic_keypad.h"
 
-#define usbDevice   usb_dev_handle     /* use libusb's device structure */
-#include "usbcalls.h"
+/* Numeric constants for 'reportType' parameters */
+#define USB_HID_REPORT_TYPE_INPUT   1
+#define USB_HID_REPORT_TYPE_OUTPUT  2
+#define USB_HID_REPORT_TYPE_FEATURE 3
+
+/* These are the error codes which can be returned by functions of this
+ * module.
+ */
+#define USB_ERROR_NONE      0
+#define USB_ERROR_ACCESS    1
+#define USB_ERROR_NOTFOUND  2
+#define USB_ERROR_BUSY      16
+#define USB_ERROR_IO        5
+
+/* ------------------------------------------------------------------------ */
 
 #include "glcd2usb.h"
 
@@ -71,7 +84,7 @@
 #define USBRQ_HID_GET_REPORT    0x01
 #define USBRQ_HID_SET_REPORT    0x09
 
-usbDevice_t *dev = NULL;
+usb_dev_handle *dev = NULL;
 
 /* USB message buffer */
 static union {
@@ -82,9 +95,9 @@ static union {
 /* ------------------------------------------------------------------------- */
 
 
-#define IDENT_VENDOR_NUM        0x0403
+#define IDENT_VENDOR_NUM        0x1c40
 #define IDENT_VENDOR_STRING     "www.harbaum.org/till/glcd2usb"
-#define IDENT_PRODUCT_NUM       0xc634
+#define IDENT_PRODUCT_NUM       0x0525
 #define IDENT_PRODUCT_STRING    "GLCD2USB"
 
 static char Name[] = IDENT_PRODUCT_STRING;
@@ -130,7 +143,7 @@ static int usbGetString(usb_dev_handle * dev, int index, char *buf, int buflen)
 
 /* ------------------------------------------------------------------------- */
 
-int usbOpenDevice(usbDevice_t ** device, int vendor, char *vendorName, int product, char *productName)
+int usbOpenDevice(usb_dev_handle ** device, int vendor, char *vendorName, int product, char *productName)
 {
     struct usb_bus *bus;
     struct usb_device *dev;
@@ -217,7 +230,7 @@ int usbOpenDevice(usbDevice_t ** device, int vendor, char *vendorName, int produ
 
 /* ------------------------------------------------------------------------- */
 
-void usbCloseDevice(usbDevice_t * device)
+void usbCloseDevice(usb_dev_handle * device)
 {
     if (device != NULL)
        usb_close(device);
@@ -225,7 +238,7 @@ void usbCloseDevice(usbDevice_t * device)
 
 /* ------------------------------------------------------------------------- */
 
-int usbSetReport(usbDevice_t * device, int reportType, unsigned char *buffer, int len)
+int usbSetReport(usb_dev_handle * device, int reportType, unsigned char *buffer, int len)
 {
     int bytesSent;
 
@@ -256,7 +269,7 @@ int usbSetReport(usbDevice_t * device, int reportType, unsigned char *buffer, in
 
 /* ------------------------------------------------------------------------- */
 
-int usbGetReport(usbDevice_t * device, int reportType, int reportNumber, unsigned char *buffer, int *len)
+int usbGetReport(usb_dev_handle * device, int reportType, int reportNumber, unsigned char *buffer, int *len)
 {
     *len = usb_control_msg(device, USB_TYPE_CLASS | USB_RECIP_INTERFACE |
                           USB_ENDPOINT_IN, USBRQ_HID_GET_REPORT,
@@ -480,7 +493,7 @@ int drv_GLCD2USB_list(void)
 static int drv_GLCD2USB_keypad(const int num)
 {
     int val = 0;
-#if 0
+#if 0                          // keypad support not yet implemented
     /* check for key press event */
     if (num & 0x80)
        val = WIDGET_KEY_PRESSED;
diff --git a/glcd2usb.h b/glcd2usb.h
new file mode 100644 (file)
index 0000000..9ee8813
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * glcd2usb.h - glcd2usb interface definitions
+ */
+
+#ifndef GLCD2USB_H
+#define GLCD2USB_H
+
+#define FLAG_SIX_BIT          (1<<0)
+#define FLAG_VERTICAL_UNITS   (1<<1)
+#define FLAG_BOTTOM_START     (1<<2)
+#define FLAG_VERTICAL_INC     (1<<3)
+#define FLAG_BACKLIGHT        (1<<4)
+
+#define GLCD2USB_RID_GET_INFO      1   /* get display info */
+#define GLCD2USB_RID_SET_ALLOC     2   /* allocate/free display */
+#define GLCD2USB_RID_GET_BUTTONS   3   /* get state of the four buttons */
+#define GLCD2USB_RID_SET_BL        4   /* set backlight brightness */
+#define GLCD2USB_RID_GET_IR        5   /* get last ir message */
+#define GLCD2USB_RID_WRITE         8   /* write some bitmap data to the display */
+#define GLCD2USB_RID_WRITE_4       (GLCD2USB_RID_WRITE+0)
+#define GLCD2USB_RID_WRITE_8       (GLCD2USB_RID_WRITE+1)
+#define GLCD2USB_RID_WRITE_16      (GLCD2USB_RID_WRITE+2)
+#define GLCD2USB_RID_WRITE_32      (GLCD2USB_RID_WRITE+3)
+#define GLCD2USB_RID_WRITE_64      (GLCD2USB_RID_WRITE+4)
+#define GLCD2USB_RID_WRITE_128     (GLCD2USB_RID_WRITE+5)
+
+typedef struct {
+    unsigned char report_id;
+    char name[32];
+    unsigned short width, height;
+    unsigned char flags;
+} __attribute__ ((packed)) display_info_t;
+
+#endif                         // GLCD2USB_H
index 18fc7ce8a688f1edb2135fcadb4f972780177db5..dda62cf2c419b0c29d37c91c6d45c976d35b58e4 100644 (file)
@@ -1,5 +1,4 @@
 /* $Id$
- * $URL$
  * $URL$
  *
  * LCD4Linux