Lines Matching defs:scanner
2 * @brief SANE backend for USB scanner, based on Plusteks' ASIC P98003 and
90 #include "u12-scanner.h"
217 * @param scanner -
220 static SANE_Status drvClosePipes( U12_Scanner *scanner )
222 if( scanner->r_pipe >= 0 ) {
225 close( scanner->r_pipe );
226 scanner->r_pipe = -1;
228 if( scanner->w_pipe >= 0 ) {
231 close( scanner->w_pipe );
232 scanner->w_pipe = -1;
241 static pModeParam getModeList( U12_Scanner *scanner )
247 if( 0 != scanner->val[OPT_EXT_MODE].w ) {
309 U12_Scanner *scanner = (U12_Scanner *)args;
313 close( scanner->r_pipe );
314 scanner->r_pipe = -1;
339 data_length = scanner->params.lines * scanner->params.bytes_per_line;
343 DBG( _DBG_PROC, "buf = 0x%08lx\n", (unsigned long)scanner->buf );
345 if( NULL == scanner->buf ) {
350 /* here we read all data from the scanner... */
351 buf = scanner->buf;
352 status = u12if_prepare( scanner->hw );
356 for( line = 0; line < scanner->params.lines; line++ ) {
358 status = u12if_readLine( scanner->hw, buf );
363 write( scanner->w_pipe, buf, scanner->params.bytes_per_line );
364 buf += scanner->params.bytes_per_line;
368 close( scanner->w_pipe );
369 scanner->w_pipe = -1;
383 static SANE_Status do_cancel( U12_Scanner *scanner, SANE_Bool closepipe )
390 scanner->scanning = SANE_FALSE;
392 if( sanei_thread_is_valid (scanner->reader_pid) ) {
405 sanei_thread_sendsig( scanner->reader_pid, SIGUSR1 );
409 res = sanei_thread_waitpid( scanner->reader_pid, 0 );
412 if( res != scanner->reader_pid ) {
417 sanei_thread_kill( scanner->reader_pid );
419 sanei_thread_sendsig( scanner->reader_pid, SIGKILL );
422 sanei_thread_invalidate( scanner->reader_pid );
425 if( scanner->hw->fd >= 0 ) {
426 u12hw_CancelSequence( scanner->hw );
429 u12hw_StartLampTimer( scanner->hw );
434 drvClosePipes( scanner );
437 drvClose( scanner->hw );
849 dev->sane.type = SANE_I18N ("flatbed scanner");
857 /* go ahead and open the scanner device */
1576 /* open the driver and get some information about the scanner
1597 /* All ready to go. Set image def and see what the scanner