Added checks for intervaltimer, to make it compile on OS/2.

merge-requests/1/head
Gerhard Jaeger 2003-10-17 11:14:08 +00:00
rodzic 8e71497aa1
commit 068fba2881
3 zmienionych plików z 38 dodań i 24 usunięć

Wyświetl plik

@ -30,6 +30,7 @@
* - skipping warmup for CIS devices * - skipping warmup for CIS devices
* - 0.46 - fixed problem in usb_GetLampStatus for CIS devices, as we * - 0.46 - fixed problem in usb_GetLampStatus for CIS devices, as we
* read back reg[0x29] to wrong position * read back reg[0x29] to wrong position
* made it compile without itimer definitions
* . * .
* <hr> * <hr>
* This file is part of the SANE package. * This file is part of the SANE package.
@ -71,8 +72,9 @@
* If you do not wish that, delete this exception notice. * If you do not wish that, delete this exception notice.
* <hr> * <hr>
*/ */
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#define DEV_LampReflection 1 #define DEV_LampReflection 1
#define DEV_LampTPA 2 #define DEV_LampTPA 2
@ -1231,11 +1233,11 @@ static void usb_LampTimerIrq( int sig )
} }
/** usb_StartLampTimer /** usb_StartLampTimer
*
*/ */
static void usb_StartLampTimer( pPlustek_Device dev ) static void usb_StartLampTimer( pPlustek_Device dev )
{ {
sigset_t block, pause_mask; #ifdef HAVE_SETITIMER
sigset_t block, pause_mask;
struct sigaction s; struct sigaction s;
struct itimerval interval; struct itimerval interval;
@ -1251,7 +1253,7 @@ static void usb_StartLampTimer( pPlustek_Device dev )
s.sa_handler = usb_LampTimerIrq; s.sa_handler = usb_LampTimerIrq;
if( sigaction( SIGALRM, &s, NULL ) < 0 ) if( sigaction( SIGALRM, &s, NULL ) < 0 )
DBG( _DBG_ERROR, "Can´t setup timer-irq handler\n" ); DBG( _DBG_ERROR, "Can't setup timer-irq handler\n" );
sigprocmask( SIG_UNBLOCK, &block, &pause_mask ); sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
@ -1269,12 +1271,19 @@ static void usb_StartLampTimer( pPlustek_Device dev )
setitimer( ITIMER_REAL, &interval, &dev->saveSettings ); setitimer( ITIMER_REAL, &interval, &dev->saveSettings );
DBG( _DBG_INFO, "Lamp-Timer started\n" ); DBG( _DBG_INFO, "Lamp-Timer started\n" );
} }
#else
dev_xxx = dev;
alarm( dev->usbDev.dwLampOnPeriod );
DBG( _DBG_INFO, "Lamp-Timer not available on this plattform\n" );
#endif
} }
/** usb_StopLampTimer /** usb_StopLampTimer
*/ */
static void usb_StopLampTimer( pPlustek_Device dev ) static void usb_StopLampTimer( pPlustek_Device dev )
{ {
#ifdef HAVE_SETITIMER
sigset_t block, pause_mask; sigset_t block, pause_mask;
/* block SIGALRM */ /* block SIGALRM */
@ -1288,6 +1297,13 @@ static void usb_StopLampTimer( pPlustek_Device dev )
dev_xxx = NULL; dev_xxx = NULL;
DBG( _DBG_INFO, "Lamp-Timer stopped\n" ); DBG( _DBG_INFO, "Lamp-Timer stopped\n" );
#else
_VAR_NOT_USED( dev );
dev_xxx = NULL;
alarm( 0 );
#endif
} }
/** /**

Wyświetl plik

@ -111,11 +111,11 @@
*/ */
#ifdef _AIX #ifdef _AIX
# include <lalloca.h> /* MUST come first for AIX! */ # include "../include/lalloca.h" /* MUST come first for AIX! */
#endif #endif
#include "sane/config.h" #include "../include/sane/config.h"
#include <lalloca.h> #include "../include/lalloca.h"
#include <errno.h> #include <errno.h>
#include <fcntl.h> #include <fcntl.h>
@ -128,24 +128,22 @@
#include <time.h> #include <time.h>
#include <math.h> #include <math.h>
#ifdef HAVE_SYS_TIME_H
#include <sys/time.h> #include <sys/time.h>
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/ioctl.h> #include <sys/ioctl.h>
#include "sane/sane.h" #include "../include/sane/sane.h"
#include "sane/sanei.h" #include "../include/sane/sanei.h"
#include "sane/saneopts.h" #include "../include/sane/saneopts.h"
#define BACKEND_VERSION "0.46-3" #define BACKEND_VERSION "0.46-5"
#define BACKEND_NAME plustek #define BACKEND_NAME plustek
#include "sane/sanei_backend.h" #include "../include/sane/sanei_backend.h"
#include "sane/sanei_config.h" #include "../include/sane/sanei_config.h"
#include "sane/sanei_thread.h" #include "../include/sane/sanei_thread.h"
/** might be used to disable all USB stuff - esp. for OS/2 */
#ifndef HAVE_OS2_H
# define _PLUSTEK_USB
#endif
#include "plustek-usb.h" #include "plustek-usb.h"
#include "plustek.h" #include "plustek.h"

Wyświetl plik

@ -334,7 +334,7 @@ typedef struct Plustek_Device
struct ScanDef scanning; /* here we hold all stuff for */ struct ScanDef scanning; /* here we hold all stuff for */
/* the USB-scanner */ /* the USB-scanner */
struct DeviceDef usbDev; struct DeviceDef usbDev;
#ifdef _PLUSTEK_USB #ifdef HAVE_SETITIMER
struct itimerval saveSettings; /* for lamp timer */ struct itimerval saveSettings; /* for lamp timer */
#endif #endif
/* /*