kopia lustrzana https://gitlab.com/sane-project/backends
minor fixes.
rodzic
f607f72921
commit
d3551d4825
|
@ -920,7 +920,7 @@ static void u12hw_StartLampTimer( U12_Device *dev )
|
|||
s.sa_flags = 0;
|
||||
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" );
|
||||
|
||||
sigprocmask( SIG_UNBLOCK, &block, &pause_mask );
|
||||
|
@ -940,10 +940,11 @@ static void u12hw_StartLampTimer( U12_Device *dev )
|
|||
DBG( _DBG_INFO, "Lamp-Timer started (using ITIMER)\n" );
|
||||
}
|
||||
#else
|
||||
dev_xxx = dev;
|
||||
|
||||
alarm( dev->adj.lampOff );
|
||||
DBG( _DBG_INFO, "Lamp-Timer started (using ALARM)\n" );
|
||||
if( 0 != dev->adj.lampOff ) {
|
||||
dev_xxx = dev;
|
||||
alarm( dev->adj.lampOff );
|
||||
DBG( _DBG_INFO, "Lamp-Timer started (using ALARM)\n" );
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -965,7 +966,6 @@ static void u12hw_StopLampTimer( U12_Device *dev )
|
|||
setitimer( ITIMER_REAL, &dev->saveSettings, NULL );
|
||||
#else
|
||||
_VAR_NOT_USED( dev );
|
||||
|
||||
alarm( 0 );
|
||||
#endif
|
||||
DBG( _DBG_INFO, "Lamp-Timer stopped\n" );
|
||||
|
|
|
@ -483,8 +483,11 @@ static SANE_Status u12if_stopScan( U12_Device *dev )
|
|||
#if 0
|
||||
u12motor_ToHomePosition( dev, SANE_FALSE );
|
||||
#else
|
||||
#if 0
|
||||
u12motor_ToHomePosition( dev, SANE_TRUE );
|
||||
u12io_SoftwareReset( dev );
|
||||
#endif
|
||||
u12hw_CancelSequence( dev );
|
||||
#endif
|
||||
u12hw_StartLampTimer( dev );
|
||||
dev->DataInf.dwAppLinesPerArea = 0;
|
||||
|
|
|
@ -80,7 +80,7 @@
|
|||
#include "../include/sane/sanei.h"
|
||||
#include "../include/sane/saneopts.h"
|
||||
|
||||
#define BACKEND_VERSION "0.02-6"
|
||||
#define BACKEND_VERSION "0.02-8"
|
||||
#define BACKEND_NAME u12
|
||||
#include "../include/sane/sanei_backend.h"
|
||||
#include "../include/sane/sanei_config.h"
|
||||
|
@ -322,14 +322,12 @@ static int reader_process( void *args )
|
|||
sigdelset ( &ignore_set, SIGTERM );
|
||||
sigprocmask( SIG_SETMASK, &ignore_set, 0 );
|
||||
|
||||
memset ( &act, 0, sizeof (act));
|
||||
sigaction( SIGTERM, &act, 0 );
|
||||
|
||||
cancelRead = SANE_FALSE;
|
||||
|
||||
/* install the signal handler */
|
||||
sigemptyset(&(act.sa_mask));
|
||||
act.sa_flags = 0;
|
||||
memset( &act, 0, sizeof (act));
|
||||
sigemptyset(&(act.sa_mask));
|
||||
act.sa_flags = 0;
|
||||
|
||||
act.sa_handler = reader_process_sigterm_handler;
|
||||
sigaction( SIGTERM, &act, 0 );
|
||||
|
@ -366,6 +364,9 @@ static int reader_process( void *args )
|
|||
}
|
||||
}
|
||||
|
||||
close( scanner->w_pipe );
|
||||
scanner->w_pipe = -1;
|
||||
|
||||
/* on error, there's no need to clean up, as this is done by the parent */
|
||||
if( SANE_STATUS_GOOD != status ) {
|
||||
DBG( _DBG_ERROR, "read failed, status = %i\n", (int)status );
|
||||
|
@ -406,7 +407,7 @@ static SANE_Status do_cancel( U12_Scanner *scanner, SANE_Bool closepipe )
|
|||
alarm(10);
|
||||
res = sanei_thread_waitpid( scanner->reader_pid, 0 );
|
||||
alarm(0);
|
||||
|
||||
|
||||
if( res != scanner->reader_pid ) {
|
||||
DBG( _DBG_PROC,"sanei_thread_waitpid() failed !\n");
|
||||
|
||||
|
@ -423,6 +424,9 @@ static SANE_Status do_cancel( U12_Scanner *scanner, SANE_Bool closepipe )
|
|||
if( scanner->hw->fd >= 0 ) {
|
||||
u12hw_CancelSequence( scanner->hw );
|
||||
}
|
||||
#ifndef HAVE_SETITIMER
|
||||
u12hw_StartLampTimer( scanner->hw );
|
||||
#endif
|
||||
}
|
||||
|
||||
if( SANE_TRUE == closepipe ) {
|
||||
|
@ -1771,7 +1775,7 @@ SANE_Status sane_read( SANE_Handle handle, SANE_Byte *data,
|
|||
return drvClosePipes(s);
|
||||
}
|
||||
|
||||
/* else force the frontend to try again*/
|
||||
/* else force the frontend to try again*/
|
||||
return SANE_STATUS_GOOD;
|
||||
|
||||
} else {
|
||||
|
@ -1788,12 +1792,13 @@ SANE_Status sane_read( SANE_Handle handle, SANE_Byte *data,
|
|||
if( 0 == nread ) {
|
||||
|
||||
drvClose( s->hw );
|
||||
s->exit_code = sanei_thread_get_status( s->reader_pid );
|
||||
s->exit_code = sanei_thread_get_status( s->reader_pid );
|
||||
|
||||
if( SANE_STATUS_GOOD != s->exit_code ) {
|
||||
drvClosePipes(s);
|
||||
return s->exit_code;
|
||||
}
|
||||
if( SANE_STATUS_GOOD != s->exit_code ) {
|
||||
drvClosePipes(s);
|
||||
return s->exit_code;
|
||||
}
|
||||
s->reader_pid = -1;
|
||||
return drvClosePipes(s);
|
||||
}
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue