aboutsummaryrefslogtreecommitdiff
path: root/devel/libg19/files
diff options
context:
space:
mode:
authorMartin Wilke <miwi@FreeBSD.org>2011-11-10 02:23:05 +0000
committerMartin Wilke <miwi@FreeBSD.org>2011-11-10 02:23:05 +0000
commitf4e955dd2b5fb3da649b118c6f34aca3fbba7bae (patch)
treecb172d2f024d97b199d289f3b28c6063812fa196 /devel/libg19/files
parenta9c79321eb54a88571f02a4b360d75d183c023cb (diff)
downloadports-f4e955dd2b5fb3da649b118c6f34aca3fbba7bae.tar.gz
ports-f4e955dd2b5fb3da649b118c6f34aca3fbba7bae.zip
Notes
Diffstat (limited to 'devel/libg19/files')
-rw-r--r--devel/libg19/files/patch-configure39
-rw-r--r--devel/libg19/files/patch-libg19.c107
-rw-r--r--devel/libg19/files/patch-libg19.h90
3 files changed, 236 insertions, 0 deletions
diff --git a/devel/libg19/files/patch-configure b/devel/libg19/files/patch-configure
new file mode 100644
index 000000000000..96de0d7ee22b
--- /dev/null
+++ b/devel/libg19/files/patch-configure
@@ -0,0 +1,39 @@
+--- configure.orig 2011-04-15 10:36:10.000000000 +0200
++++ configure 2011-04-15 15:27:11.000000000 +0200
+@@ -20067,35 +20067,11 @@
+
+ if test -n "$libg19_CFLAGS"; then
+ pkg_cv_libg19_CFLAGS="$libg19_CFLAGS"
+- elif test -n "$PKG_CONFIG"; then
+- if test -n "$PKG_CONFIG" && \
+- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\"") >&5
+- ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; then
+- pkg_cv_libg19_CFLAGS=`$PKG_CONFIG --cflags "libusb-1.0" 2>/dev/null`
+-else
+- pkg_failed=yes
+-fi
+- else
+- pkg_failed=untried
+ fi
+ if test -n "$libg19_LIBS"; then
+ pkg_cv_libg19_LIBS="$libg19_LIBS"
+- elif test -n "$PKG_CONFIG"; then
+- if test -n "$PKG_CONFIG" && \
+- { ($as_echo "$as_me:$LINENO: \$PKG_CONFIG --exists --print-errors \"libusb-1.0\"") >&5
+- ($PKG_CONFIG --exists --print-errors "libusb-1.0") 2>&5
+- ac_status=$?
+- $as_echo "$as_me:$LINENO: \$? = $ac_status" >&5
+- (exit $ac_status); }; then
+- pkg_cv_libg19_LIBS=`$PKG_CONFIG --libs "libusb-1.0" 2>/dev/null`
+ else
+- pkg_failed=yes
+-fi
+- else
+- pkg_failed=untried
++ pkg_cv_libg19_LIBS="-lusb"
+ fi
+
+
diff --git a/devel/libg19/files/patch-libg19.c b/devel/libg19/files/patch-libg19.c
new file mode 100644
index 000000000000..08ddda41b265
--- /dev/null
+++ b/devel/libg19/files/patch-libg19.c
@@ -0,0 +1,107 @@
+--- libg19.c.orig 2010-04-13 04:13:54.000000000 +0200
++++ libg19.c 2011-04-16 08:25:58.000000000 +0200
+@@ -20,6 +20,7 @@
+ #include <libusb.h>
+ #include <pthread.h>
+ #include <stdio.h>
++#include <stdlib.h>
+ #include <string.h>
+ #include <unistd.h>
+
+@@ -353,52 +354,54 @@
+ }
+
+ /**
+- * Sends raw data to the lcd without formatting
++ * Sends the data to screen
+ *
+ * @param data pointer to the screen data
+- * @param len amount of data to be written in bytes
++ * @param size size of the data to be written in bytes
++ * @param flags options for the function to use for updating
+ **/
+-void g19_update_lcd(unsigned char * data, int len)
++void g19_update_lcd(unsigned char * data, size_t size, unsigned int flags)
+ {
+- struct libusb_transfer * lcd_transfer = libusb_alloc_transfer(0);
+- lcd_transfer -> flags = LIBUSB_TRANSFER_FREE_TRANSFER;
+-
+- libusb_fill_bulk_transfer(lcd_transfer, g19_devh, 0x02, data, len, NULL, NULL, 0);
+- libusb_submit_transfer(lcd_transfer);
+-}
+-
+-/**
+- * Prepends the header data to the screen data
+- * Formats the bitmap data
+- * Writes the result to the screen
+- *
+- * @param data pointer to the bitmap data
+- * @param len amount of data to be written in bytes
+- **/
+-void g19_update_lcd_bmp(unsigned char * data, int len)
+-{
+- unsigned char bits[G19_BMP_SIZE];
+-
+- if(g19_devh == NULL)
++ if((g19_devh == NULL) || (size < 1))
+ return;
+
+- memset(&bits, 0x00, sizeof(bits));
+- memcpy(&bits, &hdata, sizeof(hdata));
++ struct libusb_transfer * lcd_transfer;
++ size_t bsize = G19_BMP_SIZE;
++ unsigned char * bits = malloc(bsize);
+
++ lcd_transfer = libusb_alloc_transfer(0);
++ lcd_transfer -> flags = LIBUSB_TRANSFER_FREE_TRANSFER;
+
+- int i, d;
+- unsigned int color;
++ memset(bits, 0x00, bsize);
+
+- for(i = sizeof(hdata); (i < G19_BMP_SIZE) && (d < len); i += 2, d += 4)
++ if((flags & G19_PREPEND_HDATA) || (flags & G19_DATA_TYPE_BMP))
+ {
+- color = (data[d] / 8) << 11;
+- color |= (data[d + 1] / 4) << 5;
+- color |= data[d + 2] / 8;
++ lcd_transfer -> flags |= LIBUSB_TRANSFER_FREE_BUFFER;
++ memcpy(bits, hdata, sizeof(hdata));
++
++ if(flags & G19_DATA_TYPE_BMP)
++ {
++ int i, d;
++ unsigned int color;
++
++ for(i = sizeof(hdata), d = 0; (i < bsize) && (d < size); i += 2, d += 4)
++ {
++ color = (data[d] / 8) << 11;
++ color |= (data[d + 1] / 4) << 5;
++ color |= data[d + 2] / 8;
++
++ memcpy(bits + i, &color, 2);
++ }
++ }
++ else if(flags & G19_PREPEND_HDATA)
++ memcpy(bits + sizeof(hdata), data, ((size + sizeof(hdata)) > bsize) ? (bsize - sizeof(hdata)) : size);
+
+- memcpy(bits + i, &color, 2);
++ libusb_fill_bulk_transfer(lcd_transfer, g19_devh, 0x02, bits, bsize, NULL, NULL, 0);
+ }
++ else
++ libusb_fill_bulk_transfer(lcd_transfer, g19_devh, 0x02, data, size, NULL, NULL, 0);
+
+- g19_update_lcd(bits, G19_BMP_SIZE);
++ libusb_submit_transfer(lcd_transfer);
+ }
+
+ /**
+@@ -410,7 +413,7 @@
+ *
+ * @return non zero on error
+ **/
+-int g19_set_backlight(int r, int g, int b)
++int g19_set_backlight(unsigned char r, unsigned char g, unsigned char b)
+ {
+ if(g19_devh == NULL)
+ return -1;
diff --git a/devel/libg19/files/patch-libg19.h b/devel/libg19/files/patch-libg19.h
new file mode 100644
index 000000000000..8fe0862b36a0
--- /dev/null
+++ b/devel/libg19/files/patch-libg19.h
@@ -0,0 +1,90 @@
+--- libg19.h.orig 2010-04-12 21:56:18.000000000 +0200
++++ libg19.h 2011-04-16 08:25:58.000000000 +0200
+@@ -20,15 +20,21 @@
+ #define G19_H
+
+ #include <stdint.h>
++#include <string.h>
+
+ #ifdef __cplusplus
+ extern "C"
+ {
+ #endif
+
+-#define LIBG19_VERSION "1.1.1"
++#define LIBG19_VERSION_MAJOR 1
++#define LIBG19_VERSION_MINOR 2
++#define LIBG19_VERSION_MICRO 0
++
++#define LIBG19_VERSION "1.2.0"
+
+ #define G19_BMP_SIZE 154112
++#define G19_BMP_DSIZE 153600
+
+ typedef struct
+ {
+@@ -38,7 +44,32 @@
+ }
+ G19Device;
+
+-enum
++enum G19UpdateFlags
++{
++ /*
++ * Flags the screen to be
++ * used and as of right now
++ * there is only one which is
++ * the G19.
++ */
++ G19_SCREEN_DEFAULT = 1 << 0,
++
++ /* Flags to prepend header data */
++ G19_PREPEND_HDATA = 1 << 1,
++
++ /* Flags not to parse the data
++ * and format it
++ */
++ G19_DATA_TYPE_RAW = 1 << 2,
++
++ /* Flags to format a bitmap with
++ * with just bitmap data that has
++ * 4 bytes per pixel. (RGBA)
++ */
++ G19_DATA_TYPE_BMP = 1 << 3
++};
++
++enum G19Keys
+ {
+ G19_KEY_G1 = 1 << 0,
+ G19_KEY_G2 = 1 << 1,
+@@ -104,19 +135,9 @@
+ * Sends raw data to the lcd without formatting
+ *
+ * @param data pointer to the screen data
+- * @param len amount of data to be written in bytes
+- **/
+-void g19_update_lcd(unsigned char * data, int len);
+-
+-/**
+- * Prepends the header data to the screen data
+- * Formats the bitmap data
+- * Writes the result to the screen
+- *
+- * @param data pointer to the bitmap data
+- * @param len amount of data to be written in bytes
++ * @param size size of the data to be written in bytes
+ **/
+-void g19_update_lcd_bmp(unsigned char * data, int len);
++void g19_update_lcd(unsigned char * data, size_t size, unsigned int flags);
+
+ /**
+ * Sets the backlighting color
+@@ -127,7 +148,7 @@
+ *
+ * @return non zero on error
+ **/
+-int g19_set_backlight(int r, int g, int b);
++int g19_set_backlight(unsigned char r, unsigned char g, unsigned char b);
+
+ /**
+ * Sets the M-Key lights