aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2012-02-22 03:11:31 +0000
committermichael <michael@3ae390bd-cb1e-0410-b409-cd5a39f66f1f>2012-02-22 03:11:31 +0000
commiteafd9557e50a4916f528cfce6f3755d8aa9e3ddf (patch)
tree39ba96390d907007f3cdece6cc93b7d7abf85861
parentc5fc726e3be16f316da9c0e2dae97ae633d33c61 (diff)
downloadlcd4linux-eafd9557e50a4916f528cfce6f3755d8aa9e3ddf.tar.gz
driver for Samsung SPF by Sascha Plazar
git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1177 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
Diffstat (limited to '')
-rw-r--r--Makefile.am1
-rw-r--r--Makefile.in2
-rw-r--r--config.h.in6
-rwxr-xr-xconfigure47
-rw-r--r--configure.in3
-rw-r--r--drivers.m427
-rw-r--r--drv.c4
-rw-r--r--drv_SamsungSPF.c467
-rw-r--r--drv_SamsungSPF.h86
-rwxr-xr-xsmoketest.sh2
10 files changed, 642 insertions, 3 deletions
diff --git a/Makefile.am b/Makefile.am
index 3e422af..b6ab9b8 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -110,6 +110,7 @@ drv_picoLCD.c \
drv_picoLCDGraphic.c \
drv_RouterBoard.c \
drv_Sample.c \
+drv_SamsungSPF.c \
drv_st2205.c \
drv_serdisplib.c \
drv_ShuttleVFD.c \
diff --git a/Makefile.in b/Makefile.in
index 84602ee..a8c264a 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -346,6 +346,7 @@ drv_picoLCD.c \
drv_picoLCDGraphic.c \
drv_RouterBoard.c \
drv_Sample.c \
+drv_SamsungSPF.c \
drv_st2205.c \
drv_serdisplib.c \
drv_ShuttleVFD.c \
@@ -568,6 +569,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Pertelian.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_RouterBoard.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_Sample.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_SamsungSPF.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_ShuttleVFD.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_SimpleLCD.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/drv_T6963.Po@am__quote@
diff --git a/config.h.in b/config.h.in
index a7ba52a..a8da110 100644
--- a/config.h.in
+++ b/config.h.in
@@ -67,6 +67,9 @@
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
+/* Define to 1 if you have the <jpeglib.h> header file. */
+#undef HAVE_JPEGLIB_H
+
/* Define to 1 if you have the <libdpf/libdpf.h> header file. */
#undef HAVE_LIBDPF_LIBDPF_H
@@ -606,6 +609,9 @@
/* Sample driver */
#undef WITH_SAMPLE
+/* SamsungSPF driver */
+#undef WITH_SAMSUNGSPF
+
/* serdisplib driver */
#undef WITH_SERDISPLIB
diff --git a/configure b/configure
index a709b17..3f3e1b3 100755
--- a/configure
+++ b/configure
@@ -1448,7 +1448,7 @@ Optional Packages:
LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,
Newhaven, Noritake, NULL, Pertelian, PHAnderson,
PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,
- Sample, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,
+ Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,
TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11
--with-plugins=<list> choose which plugins to compile.
type --with-plugins=list for a list
@@ -5596,6 +5596,22 @@ fi
done
+# check for jpeglib.h
+for ac_header in jpeglib.h
+do :
+ ac_fn_c_check_header_mongrel "$LINENO" "jpeglib.h" "ac_cv_header_jpeglib_h" "$ac_includes_default"
+if test "x$ac_cv_header_jpeglib_h" = xyes; then :
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_JPEGLIB_H 1
+_ACEOF
+ has_jpeglib="true"
+else
+ has_jpeglib="false"
+fi
+
+done
+
+
# check for sys/io.h (RouterBoard driver)
for ac_header in sys/io.h
do :
@@ -6313,6 +6329,7 @@ for driver in $drivers; do
PPM="yes"
ROUTERBOARD="yes"
SAMPLE="yes"
+ SAMSUNGSPF="yes"
ST2205="yes"
SERDISPLIB="yes"
SHUTTLEVFD="yes"
@@ -6450,6 +6467,9 @@ for driver in $drivers; do
Sample)
SAMPLE=$val
;;
+ SamsungSPF)
+ SAMSUNGSPF=$val
+ ;;
serdisplib)
SERDISPLIB=$val;
;;
@@ -7035,6 +7055,26 @@ $as_echo "$as_me: WARNING: asm/io.h or {linux/parport.h and linux/ppdev.h} not f
fi
fi
+if test "$SAMSUNGSPF" = "yes"; then
+ if test "$has_usb" = "true"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_SamsungSPF.o"
+ LIBUSB="yes"
+ LIBJPEG="yes"
+
+$as_echo "#define WITH_SAMSUNGSPF 1" >>confdefs.h
+
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: jpeglib.h not found: SamsungSPF driver disabled" >&5
+$as_echo "$as_me: WARNING: jpeglib.h not found: SamsungSPF driver disabled" >&2;}
+ fi
+ else
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: usb.h not found: SamsungSPF driver disabled" >&5
+$as_echo "$as_me: WARNING: usb.h not found: SamsungSPF driver disabled" >&2;}
+ fi
+fi
+
if test "$SERDISPLIB" = "yes"; then
if test "$has_serdisplib" = "true"; then
GRAPHIC="yes"
@@ -7278,6 +7318,11 @@ if test "$KEYPAD" = "yes"; then
DRIVERS="$DRIVERS drv_generic_keypad.o"
fi
+# libjpeg
+if test "$LIBJPEG" = "yes"; then
+ DRVLIBS="$DRVLIBS -ljpeg"
+fi
+
# libusb
if test "$LIBUSB" = "yes"; then
DRVLIBS="$DRVLIBS -lusb"
diff --git a/configure.in b/configure.in
index 23aff72..e6fb646 100644
--- a/configure.in
+++ b/configure.in
@@ -66,6 +66,9 @@ fi
# check for gd.h
AC_CHECK_HEADERS(gd/gd.h gd.h, [has_gd="true"; break], [has_gd="false"])
+# check for jpeglib.h
+AC_CHECK_HEADERS(jpeglib.h, [has_jpeglib="true"], [has_jpeglib="false"])
+
# check for sys/io.h (RouterBoard driver)
AC_CHECK_HEADERS(sys/io.h, [has_io_h="true"], [has_io_h="false"])
diff --git a/drivers.m4 b/drivers.m4
index a7ed545..e016529 100644
--- a/drivers.m4
+++ b/drivers.m4
@@ -38,7 +38,7 @@ AC_ARG_WITH(
[ LW_ABP, M50530, MatrixOrbital, MatrixOrbitalGX, MilfordInstruments, MDM166A,]
[ Newhaven, Noritake, NULL, Pertelian, PHAnderson,]
[ PICGraphic, picoLCD, picoLCDGraphic, PNG, PPM, RouterBoard,]
- [ Sample, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,]
+ [ Sample, SamsungSPF, serdisplib, ShuttleVFD, SimpleLCD, st2205, T6963,]
[ TeakLCM, Trefon, ULA200, USBHUB, USBLCD, VNC, WincorNixdorf, X11],
drivers=$withval,
drivers=all
@@ -101,6 +101,7 @@ for driver in $drivers; do
PPM="yes"
ROUTERBOARD="yes"
SAMPLE="yes"
+ SAMSUNGSPF="yes"
ST2205="yes"
SERDISPLIB="yes"
SHUTTLEVFD="yes"
@@ -238,6 +239,9 @@ for driver in $drivers; do
Sample)
SAMPLE=$val
;;
+ SamsungSPF)
+ SAMSUNGSPF=$val
+ ;;
serdisplib)
SERDISPLIB=$val;
;;
@@ -717,6 +721,22 @@ if test "$SAMPLE" = "yes"; then
fi
fi
+if test "$SAMSUNGSPF" = "yes"; then
+ if test "$has_usb" = "true"; then
+ if test "$has_usb" = "true"; then
+ GRAPHIC="yes"
+ DRIVERS="$DRIVERS drv_SamsungSPF.o"
+ LIBUSB="yes"
+ LIBJPEG="yes"
+ AC_DEFINE(WITH_SAMSUNGSPF,1,[SamsungSPF driver])
+ else
+ AC_MSG_WARN(jpeglib.h not found: SamsungSPF driver disabled)
+ fi
+ else
+ AC_MSG_WARN(usb.h not found: SamsungSPF driver disabled)
+ fi
+fi
+
if test "$SERDISPLIB" = "yes"; then
if test "$has_serdisplib" = "true"; then
GRAPHIC="yes"
@@ -915,6 +935,11 @@ if test "$KEYPAD" = "yes"; then
DRIVERS="$DRIVERS drv_generic_keypad.o"
fi
+# libjpeg
+if test "$LIBJPEG" = "yes"; then
+ DRVLIBS="$DRVLIBS -ljpeg"
+fi
+
# libusb
if test "$LIBUSB" = "yes"; then
DRVLIBS="$DRVLIBS -lusb"
diff --git a/drv.c b/drv.c
index b5feeff..b1b5a17 100644
--- a/drv.c
+++ b/drv.c
@@ -86,6 +86,7 @@ extern DRIVER drv_picoLCD;
extern DRIVER drv_picoLCDGraphic;
extern DRIVER drv_RouterBoard;
extern DRIVER drv_Sample;
+extern DRIVER drv_SamsungSPF;
extern DRIVER drv_st2205;
extern DRIVER drv_serdisplib;
extern DRIVER drv_ShuttleVFD;
@@ -226,6 +227,9 @@ DRIVER *Driver[] = {
#ifdef WITH_SAMPLE
&drv_Sample,
#endif
+#ifdef WITH_SAMSUNGSPF
+ &drv_SamsungSPF,
+#endif
#ifdef WITH_ST2205
&drv_st2205,
#endif
diff --git a/drv_SamsungSPF.c b/drv_SamsungSPF.c
new file mode 100644
index 0000000..f2e432d
--- /dev/null
+++ b/drv_SamsungSPF.c
@@ -0,0 +1,467 @@
+/* $Id: drv_SamsungSPF 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_SamsungSPF.c $
+ *
+ * SamsungSPF lcd4linux driver
+ *
+ * Copyright (C) 2012 Sascha Plazar <sascha@plazar.de>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This driver is based on playusb.c created on Aug 2, 2010 by Andre Puschmann
+ * which is in turn based on code from Grace Woo:
+ * http://web.media.mit.edu/~gracewoo/stuff/picframe
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+/*
+ *
+ * exported fuctions:
+ *
+ * struct DRIVER drv_SamsungSPF
+ *
+ */
+
+#include "config.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+#include <errno.h>
+
+#include <fcntl.h>
+#include <signal.h>
+#include <time.h>
+#include <getopt.h>
+
+#include <usb.h>
+#include <jpeglib.h>
+
+#include "debug.h"
+#include "cfg.h"
+#include "qprintf.h"
+#include "udelay.h"
+#include "plugin.h"
+#include "timer.h"
+#include "widget.h"
+#include "widget_text.h"
+#include "widget_icon.h"
+#include "widget_bar.h"
+#include "drv.h"
+
+/* graphic display? */
+#include "drv_generic_graphic.h"
+#include "drv_SamsungSPF.h"
+
+
+/****************************************/
+/*** hardware dependant functions ***/
+/****************************************/
+
+
+/* please note that in-memory compression doesn't work satisfactory */
+int convert2JPG()
+{
+ struct jpeg_compress_struct cinfo;
+ struct jpeg_error_mgr jerr;
+ int row_stride; /* physical row width in buffer */
+ JSAMPROW row_pointer[1]; /* pointer to a single row */
+
+ /* Initialize compression frame */
+ cinfo.err = jpeg_std_error(&jerr);
+ jpeg_create_compress(&cinfo);
+ jpeg_mem_dest(&cinfo, &jpegImage.buf, &jpegImage.size);
+
+ cinfo.image_width = myFrame->xRes;
+ cinfo.image_height = myFrame->yRes;
+ cinfo.input_components = sizeof(RGB);
+ cinfo.in_color_space = JCS_RGB;
+
+ /* call some jpeg helpers */
+ jpeg_set_defaults(&cinfo);
+ jpeg_set_quality(&cinfo, 100, 1); /*set the quality [0..100] */
+ jpeg_start_compress(&cinfo, 1);
+
+ row_stride = cinfo.image_width;
+
+ /* Convert line by line */
+ while (cinfo.next_scanline < cinfo.image_height) {
+ row_pointer[0] = (JSAMPROW) (image.buf + (cinfo.next_scanline * row_stride));
+ jpeg_write_scanlines(&cinfo, row_pointer, 1);
+ }
+
+ /* Finish compression and free internal memory */
+ jpeg_finish_compress(&cinfo);
+ jpeg_destroy(&cinfo);
+
+ return 0;
+}
+
+
+// Find specific Samsung device
+static void drv_SamsungSPF_find()
+{
+ info("%s: Searching SPF.", Name);
+
+ /* open USB device */
+ struct usb_bus *bus;
+ struct usb_device *dev;
+
+ usb_init();
+ usb_find_busses();
+ usb_find_devices();
+
+ for (bus = usb_busses; bus; bus = bus->next) {
+ for (dev = bus->devices; dev; dev = dev->next) {
+ if (dev->descriptor.idVendor == myFrame->vendorID) {
+ if (dev->descriptor.idProduct == myFrame->productID.storageMode) {
+
+ info("Samsung photoframe in Mass Storage mode found.");
+ myDev = dev;
+
+ return;
+ } else if (dev->descriptor.idProduct == myFrame->productID.monitorMode) {
+
+ info("Samsung photoframe in Custom Product mode found.");
+ myDev = dev;
+
+ return;
+ }
+ }
+ }
+ }
+
+ free(bus);
+ myDev = 0;
+}
+
+
+static int drv_SamsungSPF_open()
+{
+ if (!myDev) {
+ error("%s: No device specified!", Name);
+ return -1;
+ }
+
+ int res = -1;
+ char buf[256];
+
+ if (myDev->descriptor.idProduct == myFrame->productID.storageMode) {
+ info("%s: Opening device and switching to monitor mode", Name);
+
+ myDevHandle = usb_open(myDev);
+
+ setuid(getuid());
+
+ strcpy(buf, "** no string **");
+ res = usb_get_string_simple(myDevHandle, myDev->descriptor.iManufacturer, buf, sizeof(buf));
+ debug("usb_get_string_simple => %d, %s", res, buf);
+
+ memset(buf, 0, 256);
+
+ res = usb_control_msg(myDevHandle, USB_TYPE_STANDARD | USB_ENDPOINT_IN,
+ USB_REQ_GET_DESCRIPTOR, 0xfe, 0xfe, buf, 0xfe, 1000);
+ /* usb_close( myDev ); */
+ // Sleep some time before research
+ sleep(1);
+ drv_SamsungSPF_find();
+ } else
+ info("%s: No device in storage mode found", Name);
+
+ if (myDev->descriptor.idProduct == myFrame->productID.storageMode) {
+ error("%s: Was not able to switch to monitor mode!", Name);
+ return -1;
+ }
+
+ if (myDev->descriptor.idProduct == myFrame->productID.monitorMode) {
+ info("%s: Device '%s' is now in monitor mode.", Name, myFrame->type);
+ myDevHandle = usb_open(myDev);
+ return 0;
+ }
+
+ error("Unknown error: usb_control_msg() = %d", res);
+ return -1;
+}
+
+
+/* dummy function that sends something to the display */
+static int drv_SamsungSPF_send(unsigned char *data, unsigned int len)
+{
+ char usb_hdr[USB_HDR_LEN] = { 0xa5, 0x5a, 0x18, 0x04, 0xff, 0xff,
+ 0xff, 0xff, 0x48, 0x00, 0x00, 0x00
+ };
+ char buffer[1] = { 0x0 };
+ int usb_timeout = 1000;
+ int usb_endpoint = 0x2;
+ int ret;
+
+ *(int *) (usb_hdr + 4) = len;
+
+ debug("bytes_to_send: %d, offset: %d", len, USB_HDR_LEN);
+
+ /* Send USB header */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, usb_hdr, 12, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ /* Send JPEG image */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, (char *) jpegImage.buf, len, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ /* Finish transmission by sending zero */
+ if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, buffer, 1, usb_timeout)) < 0) {
+ error("%s: Error occurred while writing data to device.", Name);
+ error("%s: usb_bulk_write returned: %d", Name, ret);
+ return -1;
+ }
+
+ return 0;
+}
+
+
+/* for graphic displays only */
+static void drv_SamsungSPF_blit(const int row, const int col, const int height, const int width)
+{
+ int r, c;
+
+ for (r = row; r < row + height; r++) {
+ for (c = col; c < col + width; c++) {
+ RGB p1 = image.buf[r * myFrame->xRes + c];
+ RGBA p2 = drv_generic_graphic_rgb(r, c);
+ if (p1.R != p2.R || p1.G != p2.G || p1.B != p2.B) {
+ image.buf[r * myFrame->xRes + c].R = p2.R;
+ image.buf[r * myFrame->xRes + c].G = p2.G;
+ image.buf[r * myFrame->xRes + c].B = p2.B;
+ image.dirty = 1;
+ }
+ }
+ }
+}
+
+
+static void drv_SamsungSPF_timer( __attribute__ ((unused))
+ void *notused)
+{
+ if (image.dirty) {
+ debug("FB dirty, writing jpeg...");
+ convert2JPG();
+
+ /* Sent image to display */
+ if ((drv_SamsungSPF_send(jpegImage.buf, jpegImage.size)) != 0) {
+ error("%s: Error occurred while sending jpeg image to device.", Name);
+ }
+ /* Clean dirty bit */
+ image.dirty = 0;
+
+ /* Free JPEG buffer since a new is allocated each time an image is
+ compressed */
+ if (jpegImage.size)
+ free(jpegImage.buf);
+ jpegImage.size = 0;
+ }
+}
+
+
+/* start graphic display */
+static int drv_SamsungSPF_start(const char *section)
+{
+ unsigned int timerInterval = 1000;
+ char *s;
+
+ cfg_number(section, "update", timerInterval, 0, -1, &timerInterval);
+ debug("Updating display every %dms", timerInterval);
+
+ DROWS = myFrame->yRes;
+ DCOLS = myFrame->xRes;
+ info("%s: Using SPF with %dx%d pixels.", Name, DCOLS, DROWS);
+
+ s = cfg_get(section, "Font", "6x8");
+ if (s == NULL || *s == '\0') {
+ error("%s: no '%s.Font' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+
+ XRES = -1;
+ YRES = -1;
+ if (sscanf(s, "%dx%d", &XRES, &YRES) != 2 || XRES < 1 || YRES < 1) {
+ error("%s: bad Font '%s' from %s", Name, s, cfg_source());
+ return -1;
+ }
+
+ if (XRES < 6 || YRES < 8) {
+ error("%s: bad Font '%s' from %s (must be at least 6x8)", Name, s, cfg_source());
+ return -1;
+ }
+ free(s);
+
+ /* Allocate framebuffer */
+ image.fbsize = myFrame->xRes * myFrame->yRes * sizeof(RGB);
+ image.buf = malloc(image.fbsize);
+ memset(image.buf, 128, image.fbsize);
+ image.dirty = 0;
+
+ /* JPEG buffer is allocated by jpeglib */
+ jpegImage.buf = 0;
+ jpegImage.size = 0;
+
+ /* regularly transmit the image */
+ timer_add(drv_SamsungSPF_timer, NULL, timerInterval, 0);
+
+ return 0;
+}
+
+
+
+/****************************************/
+/*** exported functions ***/
+/****************************************/
+
+
+/* list models */
+int drv_SamsungSPF_list(void)
+{
+ int i;
+
+ printf("SamsungSPF driver, supported models [");
+ for (i = 0; i < numFrames; i++) {
+ printf(spfDevices[i].type);
+ if (i < numFrames - 1)
+ printf(", ");
+ }
+ printf("]\n");
+
+ return 0;
+}
+
+
+/* initialize driver & display */
+/* use this function for a graphic display */
+int drv_SamsungSPF_init(const char *section, const int quiet)
+{
+ info("%s: Initializing SPF.", Name);
+
+ char *s;
+ int i;
+
+ myDev = 0;
+ myFrame = 0;
+
+ // Look for model entry in config
+ s = cfg_get(section, "Model", NULL);
+ if (s == NULL || *s != '\0') {
+ s = cfg_get(section, "Model", NULL);
+ if (s == NULL || *s == '\0') {
+
+ drv_SamsungSPF_list();
+ error("%s: no '%s.Model' entry from %s", Name, section, cfg_source());
+ return -1;
+ }
+ }
+ // Look for specified device
+ for (i = 0; i < numFrames; i++) {
+ if (strcasecmp(s, spfDevices[i].type) == NULL) {
+ myFrame = &spfDevices[i];
+ info("%s: Configured for model %s.", Name, spfDevices[i].type);
+ break;
+ }
+ }
+
+ if (!myFrame) {
+ drv_SamsungSPF_list();
+ error("%s: unknown model '%s'!", Name, s);
+ return -1;
+ }
+
+ free(s);
+
+ /* try to open USB device */
+ drv_SamsungSPF_find();
+ if (!myDev) {
+ error("%s: No Samsung '%s' found!", Name, myFrame->type);
+ return -1;
+ }
+
+ /* open display and switch to monitor mode if necessary */
+ if (drv_SamsungSPF_open() == -1)
+ return -1;
+
+ int ret;
+
+ /* real worker functions */
+ drv_generic_graphic_real_blit = drv_SamsungSPF_blit;
+
+ /* start display */
+ if ((ret = drv_SamsungSPF_start(section)) != 0)
+ return ret;
+
+ /* initialize generic graphic driver */
+ if ((ret = drv_generic_graphic_init(section, Name)) != 0)
+ return ret;
+
+ if (!quiet) {
+ char buffer[40];
+ qprintf(buffer, sizeof(buffer), "%s %dx%d", Name, DCOLS, DROWS);
+ if (drv_generic_graphic_greet(buffer, NULL)) {
+ sleep(3);
+ drv_generic_graphic_clear();
+ }
+ }
+
+ return 0;
+}
+
+
+/* close driver & display */
+/* use this function for a graphic display */
+int drv_SamsungSPF_quit(const int quiet)
+{
+
+ info("%s: shutting down.", Name);
+
+ /* clear display */
+ drv_generic_graphic_clear();
+
+ /* say goodbye... */
+ if (!quiet) {
+ drv_generic_graphic_greet("goodbye!", NULL);
+ }
+
+ drv_generic_graphic_quit();
+
+ debug("closing connection");
+ printf("%s: Closing driver...\n", Name);
+ usb_close(myDev);
+ free(myDev);
+ free(myDevHandle);
+
+ return (0);
+}
+
+
+/* use this one for a graphic display */
+DRIVER drv_SamsungSPF = {
+ .name = Name,
+ .list = drv_SamsungSPF_list,
+ .init = drv_SamsungSPF_init,
+ .quit = drv_SamsungSPF_quit,
+};
diff --git a/drv_SamsungSPF.h b/drv_SamsungSPF.h
new file mode 100644
index 0000000..3746464
--- /dev/null
+++ b/drv_SamsungSPF.h
@@ -0,0 +1,86 @@
+/* $Id: drv_SamsungSPF 975 2009-01-18 11:16:20Z michael $
+ * $URL: https://ssl.bulix.org/svn/lcd4linux/trunk/drv_SamsungSPF.c $
+ *
+ * sample lcd4linux driver
+ *
+ * Copyright (C) 2012 Sascha Plazar <sascha@plazar.de>
+ * Copyright (C) 2005, 2006, 2007 The LCD4Linux Team <lcd4linux-devel@users.sourceforge.net>
+ *
+ * This file is part of LCD4Linux.
+ *
+ * LCD4Linux is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * LCD4Linux is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+// Drivername for verbose output
+static char Name[] = "SamsungSPF";
+
+#define USB_HDR_LEN 12
+
+struct SPFdev {
+ const char type[64];
+ const int vendorID;
+ struct {
+ const int storageMode;
+ const int monitorMode;
+ } productID;
+ const unsigned int xRes;
+ const unsigned int yRes;
+};
+
+static struct SPFdev spfDevices[] = {
+ {
+ .type = "SPF-75H",
+ .vendorID = 0x04e8,
+ .productID = {0x200e, 0x200f},
+ .xRes = 800,
+ .yRes = 480,
+ },
+ {
+ .type = "SPF-85H",
+ .vendorID = 0x04e8,
+ .productID = {0x2012, 0x2013},
+ .xRes = 800,
+ .yRes = 600,
+ },
+ {
+ .type = "SPF-107H",
+ .vendorID = 0x04e8,
+ .productID = {0x2027, 0x2028},
+ .xRes = 1024,
+ .yRes = 600,
+ },
+};
+
+static int numFrames = sizeof(spfDevices) / sizeof(spfDevices[0]);
+
+struct usb_device *myDev;
+usb_dev_handle *myDevHandle;
+struct SPFdev *myFrame;
+
+typedef struct {
+ unsigned char R, G, B;
+} RGB;
+
+static struct {
+ RGB *buf;
+ int dirty;
+ int fbsize;
+} image;
+
+static struct {
+ unsigned char *buf;
+ long int size;
+} jpegImage;
diff --git a/smoketest.sh b/smoketest.sh
index 3ac632f..db3d569 100755
--- a/smoketest.sh
+++ b/smoketest.sh
@@ -9,7 +9,7 @@ rm -f smoketest.log lcd4linux
make distclean
./bootstrap
-for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D DPF EA232graphic EFN FutabaVFD G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample serdisplib SimpleLCD T6963 TeakLCM Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do
+for driver in ASTUSB BeckmannEgle BWCT CrystalFontz Curses Cwlinux D4D DPF EA232graphic EFN FutabaVFD G15 GLCD2USB HD44780 IRLCD LCD2USB LCDLinux LCDTerm LEDMatrix LPH7508 LUIse LW_ABP M50530 MatrixOrbital MatrixOrbitalGX MilfordInstruments Noritake NULL Pertelian PHAnderson picoLCD picoLCDGraphic PNG PPM RouterBoard Sample SamsungSPF serdisplib SimpleLCD T6963 TeakLCM Trefon ULA200 USBHUB USBLCD WincorNixdorf X11; do
make distclean
./configure --with-drivers=$driver