some fixes from Sascha Plazar

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1178 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
michael
2012-02-23 06:36:53 +00:00
parent eafd9557e5
commit 88dde26adb
5 changed files with 1447 additions and 3044 deletions
+35 -59
View File
@@ -1,9 +1,9 @@
# Makefile.in generated by automake 1.11.3 from Makefile.am.
# Makefile.in generated by automake 1.11.1 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
# Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -97,16 +97,12 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
if test -d "$(distdir)"; then \
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -rf "$(distdir)" \
|| { sleep 5 && rm -rf "$(distdir)"; }; \
else :; fi
{ test ! -d "$(distdir)" \
|| { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
&& rm -fr "$(distdir)"; }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -127,7 +123,6 @@ DBUS_CFLAGS = @DBUS_CFLAGS@
DBUS_LIBS = @DBUS_LIBS@
DEFS = @DEFS@
DEPDIR = @DEPDIR@
DLLTOOL = @DLLTOOL@
DRIVERS = @DRIVERS@
DRVLIBS = @DRVLIBS@
DSYMUTIL = @DSYMUTIL@
@@ -155,7 +150,6 @@ LN_S = @LN_S@
LTLIBICONV = @LTLIBICONV@
LTLIBOBJS = @LTLIBOBJS@
MAKEINFO = @MAKEINFO@
MANIFEST_TOOL = @MANIFEST_TOOL@
MKDIR_P = @MKDIR_P@
NM = @NM@
NMEDIT = @NMEDIT@
@@ -199,7 +193,6 @@ abs_builddir = @abs_builddir@
abs_srcdir = @abs_srcdir@
abs_top_builddir = @abs_top_builddir@
abs_top_srcdir = @abs_top_srcdir@
ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__include = @am__include@
@@ -232,6 +225,7 @@ libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
localstatedir = @localstatedir@
lt_ECHO = @lt_ECHO@
mandir = @mandir@
mkdir_p = @mkdir_p@
oldincludedir = @oldincludedir@
@@ -429,7 +423,7 @@ all: config.h
.SUFFIXES:
.SUFFIXES: .c .lo .o .obj
am--refresh: Makefile
am--refresh:
@:
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
@@ -465,8 +459,10 @@ $(ACLOCAL_M4): $(am__aclocal_m4_deps)
$(am__aclocal_m4_deps):
config.h: stamp-h1
@if test ! -f $@; then rm -f stamp-h1; else :; fi
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
@if test ! -f $@; then \
rm -f stamp-h1; \
$(MAKE) $(AM_MAKEFLAGS) stamp-h1; \
else :; fi
stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
@rm -f stamp-h1
@@ -521,7 +517,7 @@ clean-binPROGRAMS:
list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
echo " rm -f" $$list; \
rm -f $$list
lcd4linux$(EXEEXT): $(lcd4linux_OBJECTS) $(lcd4linux_DEPENDENCIES) $(EXTRA_lcd4linux_DEPENDENCIES)
lcd4linux$(EXEEXT): $(lcd4linux_OBJECTS) $(lcd4linux_DEPENDENCIES)
@rm -f lcd4linux$(EXEEXT)
$(lcd4linux_LINK) $(lcd4linux_OBJECTS) $(lcd4linux_LDADD) $(LIBS)
@@ -787,11 +783,7 @@ dist-gzip: distdir
$(am__remove_distdir)
dist-bzip2: distdir
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzip: distdir
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-lzma: distdir
@@ -799,7 +791,7 @@ dist-lzma: distdir
$(am__remove_distdir)
dist-xz: distdir
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz
$(am__remove_distdir)
dist-tarZ: distdir
@@ -830,8 +822,6 @@ distcheck: dist
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
*.tar.lzma*) \
lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
*.tar.lz*) \
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
*.tar.xz*) \
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
*.tar.Z*) \
@@ -851,7 +841,6 @@ distcheck: dist
&& am__cwd=`pwd` \
&& $(am__cd) $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -880,16 +869,8 @@ distcheck: dist
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
distuninstallcheck:
@test -n '$(distuninstallcheck_dir)' || { \
echo 'ERROR: trying to run $@ with an empty' \
'$$(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
$(am__cd) '$(distuninstallcheck_dir)' || { \
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
exit 1; \
}; \
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
@$(am__cd) '$(distuninstallcheck_dir)' \
&& test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
@@ -922,15 +903,10 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
if test -z '$(STRIP)'; then \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
install; \
else \
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
fi
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
`test -z '$(STRIP)' || \
echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
@@ -1020,20 +996,20 @@ uninstall-am: uninstall-binPROGRAMS
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool ctags dist \
dist-all dist-bzip2 dist-gzip dist-lzip dist-lzma dist-shar \
dist-tarZ dist-xz dist-zip distcheck distclean \
distclean-compile distclean-generic distclean-hdr \
distclean-libtool distclean-tags distcleancheck distdir \
distuninstallcheck dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags uninstall uninstall-am uninstall-binPROGRAMS
dist-all dist-bzip2 dist-gzip dist-lzma dist-shar dist-tarZ \
dist-xz dist-zip distcheck distclean distclean-compile \
distclean-generic distclean-hdr distclean-libtool \
distclean-tags distcleancheck distdir distuninstallcheck dvi \
dvi-am html html-am info info-am install install-am \
install-binPROGRAMS install-data install-data-am install-dvi \
install-dvi-am install-exec install-exec-am install-html \
install-html-am install-info install-info-am install-man \
install-pdf install-pdf-am install-ps install-ps-am \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
pdf pdf-am ps ps-am tags uninstall uninstall-am \
uninstall-binPROGRAMS
# create subversion version
Vendored
+869 -1542
View File
File diff suppressed because it is too large Load Diff
Vendored
+475 -1333
View File
File diff suppressed because it is too large Load Diff
+68 -24
View File
@@ -38,16 +38,8 @@
#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>
@@ -55,18 +47,70 @@
#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"
// Drivername for verbose output
static char Name[] = "SamsungSPF";
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;
unsigned long int size;
} jpegImage;
/****************************************/
@@ -107,7 +151,7 @@ int convert2JPG()
/* Finish compression and free internal memory */
jpeg_finish_compress(&cinfo);
jpeg_destroy(&cinfo);
jpeg_destroy_compress(&cinfo);
return 0;
}
@@ -200,9 +244,9 @@ static int drv_SamsungSPF_open()
/* dummy function that sends something to the display */
static int drv_SamsungSPF_send(unsigned char *data, unsigned int len)
static int drv_SamsungSPF_send(char *data, unsigned int len)
{
char usb_hdr[USB_HDR_LEN] = { 0xa5, 0x5a, 0x18, 0x04, 0xff, 0xff,
char usb_hdr[12] = { 0xa5, 0x5a, 0x18, 0x04, 0xff, 0xff,
0xff, 0xff, 0x48, 0x00, 0x00, 0x00
};
char buffer[1] = { 0x0 };
@@ -212,7 +256,7 @@ static int drv_SamsungSPF_send(unsigned char *data, unsigned int len)
*(int *) (usb_hdr + 4) = len;
debug("bytes_to_send: %d, offset: %d", len, USB_HDR_LEN);
debug("bytes_to_send: %d, offset: %d", len, 12);
/* Send USB header */
if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, usb_hdr, 12, usb_timeout)) < 0) {
@@ -222,7 +266,7 @@ static int drv_SamsungSPF_send(unsigned char *data, unsigned int len)
}
/* Send JPEG image */
if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, (char *) jpegImage.buf, len, usb_timeout)) < 0) {
if ((ret = usb_bulk_write(myDevHandle, usb_endpoint, data, 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;
@@ -267,7 +311,7 @@ static void drv_SamsungSPF_timer( __attribute__ ((unused))
convert2JPG();
/* Sent image to display */
if ((drv_SamsungSPF_send(jpegImage.buf, jpegImage.size)) != 0) {
if ((drv_SamsungSPF_send((char *) jpegImage.buf, jpegImage.size)) != 0) {
error("%s: Error occurred while sending jpeg image to device.", Name);
}
/* Clean dirty bit */
@@ -285,7 +329,7 @@ static void drv_SamsungSPF_timer( __attribute__ ((unused))
/* start graphic display */
static int drv_SamsungSPF_start(const char *section)
{
unsigned int timerInterval = 1000;
int timerInterval = 1000;
char *s;
cfg_number(section, "update", timerInterval, 0, -1, &timerInterval);
@@ -379,7 +423,7 @@ int drv_SamsungSPF_init(const char *section, const int quiet)
}
// Look for specified device
for (i = 0; i < numFrames; i++) {
if (strcasecmp(s, spfDevices[i].type) == NULL) {
if (strcasecmp(s, spfDevices[i].type) == 0) {
myFrame = &spfDevices[i];
info("%s: Configured for model %s.", Name, spfDevices[i].type);
break;
@@ -450,7 +494,7 @@ int drv_SamsungSPF_quit(const int quiet)
debug("closing connection");
printf("%s: Closing driver...\n", Name);
usb_close(myDev);
usb_close(myDevHandle);
free(myDev);
free(myDevHandle);
-86
View File
@@ -1,86 +0,0 @@
/* $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;