[Hp5400backend-cvs-update] hp5400/hp5400 hp5400_sane.c,NONE,1.1 Makefile,1.6,1.7 hp5400.c,1.23,1.24
Status: Alpha
Brought to you by:
soumarmt
Update of /cvsroot/hp5400backend/hp5400/hp5400 In directory sc8-pr-cvs1:/tmp/cvs-serv4809 Modified Files: Makefile hp5400.c hp5400.conf hp5400_debug.c hp5400_debug.h hp5400_internal.c Added Files: hp5400_sane.c Log Message: *Finally synched sourceforge with SANE CVS\n*A big problem was with DBG and DBG_LOCAL, in Makefile we use DEBUG_NOT_STATIC to solve that.\n*Installation is changed to install lib into /usr/local/lib/sane/ --- NEW FILE: hp5400_sane.c --- /* sane - Scanner Access Now Easy. Copyright (C) 2003 Martijn van Oosterhout <kl...@sv...> Copyright (C) 2003 Thomas Soumarmon <tho...@co...> Originally copied from HP3300 testtools. Original notice follows: Copyright (C) 2001 Bertrik Sikken (be...@zo...) This file is part of the SANE package. This program 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 of the License, or (at your option) any later version. This program 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. [...966 lines suppressed...] if (m) { return SANE_STATUS_UNSUPPORTED; } return SANE_STATUS_GOOD; } SANE_Status sane_get_select_fd (SANE_Handle h, SANE_Int * fd) { HP5400_DBG (DBG_MSG, "sane_select_fd\n"); /* prevent compiler from complaining about unused parameters */ h = h; fd = fd; return SANE_STATUS_UNSUPPORTED; } Index: Makefile =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/Makefile,v retrieving revision 1.6 retrieving revision 1.7 diff -C2 -d -r1.6 -r1.7 *** Makefile 26 May 2003 13:46:15 -0000 1.6 --- Makefile 4 Jun 2003 19:25:01 -0000 1.7 *************** *** 7,11 **** # path for sane-backend source (to find the includes needed) # ! SANE_BACKEND_SRC=/usr/local/src/sane/sane-backends-1.0.12 #SANE_BACKEND_SRC=/home/kleptog/debian/sane-backends-1.0.10 --- 7,12 ---- # path for sane-backend source (to find the includes needed) # ! #SANE_BACKEND_SRC=/usr/local/src/sane/sane-backends-1.0.12 ! SANE_BACKEND_SRC=/usr/local/src/sane/sane-cvs/sane-backends #SANE_BACKEND_SRC=/home/kleptog/debian/sane-backends-1.0.10 *************** *** 15,25 **** #SANE_LIBS_DIR =/usr/local/lib/sane SANE_LIBS_DIR=/usr/lib/sane # Compiler and compiler flags CC = gcc ! CFLAGS = -Wall -O2 -g -DV_MAJOR=1 -DV_MINOR=0 -fPIC -I$(SANE_BACKEND_SRC)/include ! LDFLAGS = -lm -I$(SANE_BACKEND_SRC)/include ! #LDFLAGS = -lm fPIC -I$(SANE_BACKEND_SRC)/include # uncomment this line if you want to remove the version string match test --- 16,43 ---- #SANE_LIBS_DIR =/usr/local/lib/sane SANE_LIBS_DIR=/usr/lib/sane + SANE_LOCAL_LIBS_DIR=/usr/local/lib/sane + + # Package definitions + PKG_NAME = hp5400 + + #version of the backend + V_MAJOR =1 + V_MINOR =0 + BUILD =3 + + + #for distribution tag + DATE = $$(date +%Y%m%d) + # Compiler and compiler flags CC = gcc ! CFLAGS = -Wall -O2 -g -fPIC -DPIC -ansi -pedantic \ ! -DBACKEND_NAME=$(PKG_NAME) \ ! -DV_MAJOR=$(V_MAJOR) -DV_MINOR=$(V_MINOR) -DBUILD=$(BUILD) \ ! -DDEBUG_NOT_STATIC -DDEBUG_DECLARE_ONLY \ ! -I$(SANE_BACKEND_SRC)/include ! # uncomment this line if you want to remove the version string match test *************** *** 27,44 **** #CFLAGS = $(CFLAGS) -DNO_STRING_VERSION_MATCH # Other utilities RM = rm -f ! # Package definitions ! PKG_NAME = hp5400 ! DATE = $$(date +%Y%m%d) EXEC = $(PKG_NAME) - LIBTARGET = sane-$(PKG_NAME).so - SANE_PKG_LIB = libsane-$(PKG_NAME).so.1 - SANE_FLAGS=-DBACKEND_NAME=$(PKG_NAME) -DV_MAJOR=1 -DV_MINOR=0 -DBUILD=2 ! OBJECTS = $(PKG_NAME)_debug.c $(PKG_NAME)_internal.c $(PKG_NAME)_scanner.c $(PKG_NAME).c ! LIB_OBJECTS = $(PKG_NAME)_debug.c $(PKG_NAME)_internal.c sane-$(PKG_NAME).c $(PKG_NAME)_sanei.c all: $(EXEC) $(LIBTARGET) --- 45,84 ---- #CFLAGS = $(CFLAGS) -DNO_STRING_VERSION_MATCH + + #linker flag + LDFLAGS = -lm -lnsl -lm /usr/lib/libjpeg.so -ldl -lusb + + + # Other utilities RM = rm -f ! ! #target filenames ! SANE_PKG_LIB = libsane-$(PKG_NAME).so.$(V_MAJOR) ! LIBTARGET = $(SANE_PKG_LIB) EXEC = $(PKG_NAME) ! #special flags for compilation and linking ! SANE_FLAGS = -shared -Wl,-soname -Wl,libsane.so.1 ! STANDALONE_FLAGS = -DSTANDALONE ! ! #objects from SANE to link to ! BACKEND = $(SANE_BACKEND_SRC)/backend ! SANE_LIB_OBJ = $(BACKEND)/.libs/sane_strstatus.o $(BACKEND)/../sanei/.libs/sanei_init_debug.o \ ! $(BACKEND)/../sanei/.libs/sanei_config.o $(BACKEND)/../sanei/.libs/sanei_usb.o \ ! $(BACKEND)/../sanei/.libs/sanei_config2.o ! ! ! #source files ! EXEC_OBJECTS = $(PKG_NAME)_debug.c $(PKG_NAME)_internal.c $(PKG_NAME)_scanner.c ! LIB_OBJECTS = $(PKG_NAME)_debug.c $(PKG_NAME)_internal.c $(PKG_NAME)_sane.c \ ! $(PKG_NAME)_sanei.c ! ! ! # ! # RULES ! # all: $(EXEC) $(LIBTARGET) *************** *** 46,57 **** all_root: all install - $(EXEC): $(OBJECTS) - $(CC) $(LDFLAGS) -DSTANDALONE -o $(EXEC) $(OBJECTS) $(LIBTARGET): $(LIB_OBJECTS) ! $(CC) $(LDFLAGS) $(SANE_FLAGS) -shared -fPIC -Wl,-soname -Wl,libsane.so.1 -o $(LIBTARGET) $< .PHONY: clean dist: clean cd .. && tar --exclude={CVS,cvs} -czvf $(PKG_NAME)-$(DATE).tar.gz $(PKG_NAME) --- 86,104 ---- all_root: all install + # SANE library (We remove the .o to be sure they are compiled with the right flags) + $(EXEC): $(EXEC_OBJECTS) + $(RM) *.o + $(CC) $(LDFLAGS) $(CFLAGS) $(STANDALONE_FLAGS) -o $(EXEC) $(EXEC_OBJECTS) + + # SANE library (We remove the .o to be sure they are compiled with the right flags) $(LIBTARGET): $(LIB_OBJECTS) ! $(RM) *.o ! $(CC) $(LDFLAGS) $(CFLAGS) $(SANE_FLAGS) -o $(SANE_PKG_LIB) $(LIB_OBJECTS) $(SANE_LIB_OBJ) ! .PHONY: clean + # make distribution tar.gz file and tag it with the date dist: clean cd .. && tar --exclude={CVS,cvs} -czvf $(PKG_NAME)-$(DATE).tar.gz $(PKG_NAME) *************** *** 62,74 **** - hp5400.o: hp5400.c hp5400.h hp5400_xfer.h - hp5400_scanner.o: hp5400_scanner.c hp5400_xfer.h - sane-hp5400.o: sane-hp5400.c hp5400.h hp5400_xfer.h hp5400.c hp5400_scanner.c - install: $(LIBTARGET) ! rm -f $(SANE_LIBS_DIR)/$(SANE_PKG_LIB) ! ln `pwd`/$(LIBTARGET) $(SANE_LIBS_DIR)/$(SANE_PKG_LIB) debug_xsane: SANE_DEBUG_HP5400=255 xsane 2> xsane.log --- 109,128 ---- install: $(LIBTARGET) ! if [ -f $(SANE_LIBS_DIR)/$(SANE_PKG_LIB) ]; then \ ! rm -f $(SANE_LIBS_DIR)/$(SANE_PKG_LIB); \ ! fi ! if [ -f $(SANE_LOCAL_LIBS_DIR)/$(SANE_PKG_LIB) ]; then \ ! rm -f $(SANE_LOCAL_LIBS_DIR)/$(SANE_PKG_LIB); \ ! fi ! if [ ! -d $(SANE_LOCAL_LIBS_DIR) ]; then \ ! mkdir -p $(SANE_LOCAL_LIBS_DIR); \ ! fi ! cp $(LIBTARGET) $(SANE_LOCAL_LIBS_DIR)/; ! debug_xsane: SANE_DEBUG_HP5400=255 xsane 2> xsane.log + put_to_sane: + cp $(LIB_OBJECTS) $(SANE_BACKEND_SRC)/backend/ Index: hp5400.c =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400.c,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** hp5400.c 26 May 2003 13:46:15 -0000 1.23 --- hp5400.c 4 Jun 2003 19:25:01 -0000 1.24 *************** *** 55,59 **** #include "hp5400_debug.h" - #ifndef STANDALONE #include "sane/config.h" #include "sane/sane.h" --- 55,58 ---- *************** *** 62,68 **** #include "sane/sanei_config.h" #include "sane/saneopts.h" - #else - #include "sane/saneopts.h" - #endif --- 61,64 ---- *************** *** 74,98 **** #define HP5400_CONFIG_FILE "hp5400.conf" ! /* (source) includes for data transfer methods */ ! #include "hp5400_internal.h" ! #include "hp5400_sanei.h" ! ! ! /* other definitions */ ! #define TRUE 1 ! #define FALSE 0 ! ! #define MM_TO_PIXEL(_mm_, _dpi_) ((_mm_) * (_dpi_) / 25.4) ! #define PIXEL_TO_MM(_pixel_, _dpi_) ((_pixel_) * 25.4 / (_dpi_)) ! ! #define NUM_GAMMA_ENTRIES 65536 ! ! /* Device filename for USB access */ ! static char *usb_devfile = "/dev/usb/scanner0"; ! ! ! --- 70,80 ---- #define HP5400_CONFIG_FILE "hp5400.conf" ! #define BUILD 2 /* (source) includes for data transfer methods */ ! #include "hp5400_debug.c" ! #include "hp5400_internal.c" ! #include "hp5400_sane.c" ! #include "hp5400_sanei.c" Index: hp5400.conf =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400.conf,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** hp5400.conf 26 May 2003 13:46:15 -0000 1.2 --- hp5400.conf 4 Jun 2003 19:25:02 -0000 1.3 *************** *** 12,14 **** # Uncomment the following line if autodetection fails # ! #/dev/usbscanner --- 12,14 ---- # Uncomment the following line if autodetection fails # ! /dev/usbscanner Index: hp5400_debug.c =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400_debug.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hp5400_debug.c 26 May 2003 13:46:15 -0000 1.1 --- hp5400_debug.c 4 Jun 2003 19:25:02 -0000 1.2 *************** *** 48,53 **** ! #ifdef LOCAL_DBG ! /* Debug messages levels */ #include <stdio.h> --- 48,53 ---- ! #ifdef STANDALONE ! #include <stdio.h> *************** *** 56,71 **** FILE *DBG_MSG = NULL; - - #endif - - - void hp5400_dbg_start() { - #ifdef LOCAL_DBG DBG_MSG = stdout; DBG_ERR = stderr; DBG_ASSERT = stderr; - #endif } --- 56,72 ---- FILE *DBG_MSG = NULL; void hp5400_dbg_start() { DBG_MSG = stdout; DBG_ERR = stderr; DBG_ASSERT = stderr; } + + #else + + #undef DEBUG_DECLARE_ONLY + #undef _SANEI_DEBUG_H + #include <sane/sanei_debug.h> + + #endif Index: hp5400_debug.h =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400_debug.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hp5400_debug.h 26 May 2003 13:46:15 -0000 1.1 --- hp5400_debug.h 4 Jun 2003 19:25:02 -0000 1.2 *************** *** 49,55 **** */ - #ifndef STANDALONE #include <sane/sanei_debug.h> --- 49,55 ---- */ #ifndef STANDALONE + #define DEBUG_DECLARE_ONLY #include <sane/sanei_debug.h> *************** *** 68,74 **** extern FILE *DBG_MSG; #endif - void hp5400_dbg_start(); --- 68,75 ---- extern FILE *DBG_MSG; + void hp5400_dbg_start(); + #endif Index: hp5400_internal.c =================================================================== RCS file: /cvsroot/hp5400backend/hp5400/hp5400/hp5400_internal.c,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** hp5400_internal.c 31 May 2003 17:23:16 -0000 1.1 --- hp5400_internal.c 4 Jun 2003 19:25:02 -0000 1.2 *************** *** 56,60 **** #include <stdlib.h> /* for exit */ #include <assert.h> - /*#include <stdint.h>*/ #include <errno.h> #include <string.h> --- 56,59 ---- *************** *** 92,96 **** const char MatchVersion[] = "SilitekIBlizd C3 ScannerV0.84"; const char MatchVersion2[] = "SilitekIBlizd C3 ScannerV0.86"; - /*extern char *usb_devfile;*/ /* Is name of device to link to */ static TScannerModel Model_HP54xx = --- 91,94 ---- *************** *** 297,300 **** --- 295,299 ---- int bpp, int iMisAlignment, int blksize, int iTransferSize) { + iHandle = iHandle; /* to avoid compilation warning */ p->buffersize = max (BUFFER_SIZE, 3 * blksize); *************** *** 398,402 **** res = hp5400_bulk_read_block (iHandle, CMD_INITBULK3, cmd, sizeof (cmd), ! p->buffer + p->bufend, p->blksize); if (res != p->blksize) { --- 397,401 ---- res = hp5400_bulk_read_block (iHandle, CMD_INITBULK3, cmd, sizeof (cmd), ! p->buffer + p->bufend, p->blksize); if (res != p->blksize) { *************** *** 545,548 **** --- 544,548 ---- hp5400_test_scan_response (struct ScanResponse *resp, struct ScanRequest *req) { + req = req; /* to avoid compilation warning */ HP5400_DBG (DBG_MSG, "Scan response:\n"); HP5400_DBG (DBG_MSG, " transfersize=%d htonl-> %d\n", resp->transfersize, *************** *** 622,625 **** --- 622,627 ---- int i; + code = code; /*to avoid compilation warning*/ + if (res == NULL) res = &res_temp; *************** *** 799,802 **** --- 801,806 ---- int result; + pHWParams = pHWParams; /*to avoid compilation warning*/ + HP5400_DBG (DBG_MSG, "\n"); HP5400_DBG (DBG_MSG, "Scanning :\n"); *************** *** 1069,1073 **** HP5400_DBG (DBG_MSG, "Scan request: \n "); { ! int i; for (i = 0; i < sizeof (*req); i++) { --- 1073,1077 ---- HP5400_DBG (DBG_MSG, "Scan request: \n "); { ! size_t i; for (i = 0; i < sizeof (*req); i++) { *************** *** 1105,1109 **** HP5400_DBG (DBG_MSG, "Scan response: \n "); { ! int i; for (i = 0; i < sizeof (res); i++) { --- 1109,1113 ---- HP5400_DBG (DBG_MSG, "Scan response: \n "); { ! size_t i; for (i = 0; i < sizeof (res); i++) { |