diff options
author | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-03-04 04:19:25 +0000 |
---|---|---|
committer | michael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f> | 2009-03-04 04:19:25 +0000 |
commit | 41243f5e64a2c863dd01b13ce8622502c2cb4d72 (patch) | |
tree | 66d9bca5673aeff1e0e0345027e37fc97185343c | |
parent | de848dfdfa3749688993b19559ab5c5c2b262f00 (diff) | |
download | lcd4linux-41243f5e64a2c863dd01b13ce8622502c2cb4d72.tar.gz |
GLCD2USB by Till Harbaum
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@991 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rwxr-xr-x | configure | 2 | ||||
-rw-r--r-- | drivers.m4 | 2 | ||||
-rw-r--r-- | drv_GLCD2USB.c | 33 | ||||
-rw-r--r-- | glcd2usb.h | 34 | ||||
-rw-r--r-- | lcd4linux.c | 1 |
5 files changed, 59 insertions, 13 deletions
@@ -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" @@ -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" diff --git a/drv_GLCD2USB.c b/drv_GLCD2USB.c index 38a6b31..d4b69ba 100644 --- a/drv_GLCD2USB.c +++ b/drv_GLCD2USB.c @@ -61,8 +61,21 @@ #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 index 0000000..9ee8813 --- /dev/null +++ b/glcd2usb.h @@ -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 diff --git a/lcd4linux.c b/lcd4linux.c index 18fc7ce..dda62cf 100644 --- a/lcd4linux.c +++ b/lcd4linux.c @@ -1,6 +1,5 @@ /* $Id$ * $URL$ - * $URL$ * * LCD4Linux * |