* backend/canon_dr.[ch], backend/canon_dr-cmd.h: backend v11

- send_panel() can disable too
- add cancel() to send d8 command
- call cancel() only after final read from scanner
- stop button reqests cancel
merge-requests/1/head
m. allan noah 2009-01-10 23:39:54 +00:00
rodzic 887f79a6a4
commit b900ffd2a3
4 zmienionych plików z 55 dodań i 51 usunięć

Wyświetl plik

@ -1,6 +1,14 @@
2009-01-10 m. allan noah <kitno455 a t gmail d o t com>
* backend/canon_dr.[ch], backend/canon_dr-cmd.h: backend v11
- send_panel() can disable too
- add cancel() to send d8 command
- call cancel() only after final read from scanner
- stop button reqests cancel
2009-01-10 Jeremy Johnson <jeremy a t acjlaw dot net> 2009-01-10 Jeremy Johnson <jeremy a t acjlaw dot net>
*backend/hs2p.c replaced ulong with u_long, * backend/hs2p.c: replaced ulong with u_long,
added static keyword for SANE_Status update_hs2p_data() added static keyword for SANE_Status update_hs2p_data()
2009-01-06 Jonathan Bravo Lopez <jkdsoft@gmail.com> 2009-01-06 Jonathan Bravo Lopez <jkdsoft@gmail.com>
* backend/hp3900_sane.c, backend/hp3900_config.c, * backend/hp3900_sane.c, backend/hp3900_config.c,
backend/hp3900_types.c, backend/hp3900.conf.in, doc/sane-hp3900.man, backend/hp3900_types.c, backend/hp3900.conf.in, doc/sane-hp3900.man,

Wyświetl plik

@ -317,7 +317,7 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define set_SSM_DF_len(sb, val) setbitfield(sb+7, 1, 0, val) #define set_SSM_DF_len(sb, val) setbitfield(sb+7, 1, 0, val)
#define set_SSM_DF_textdir(sb, val) setbitfield(sb+9, 0xf, 0, val) #define set_SSM_DF_textdir(sb, val) setbitfield(sb+9, 0xf, 0, val)
/* for DUPLEX page */ /* for BUFFER page */
#define set_SSM_BUFF_duplex(sb, val) sb[0x06] = val #define set_SSM_BUFF_duplex(sb, val) sb[0x06] = val
#define set_SSM_BUFF_async(sb, val) sb[0x0a] = val #define set_SSM_BUFF_async(sb, val) sb[0x0a] = val
@ -333,6 +333,11 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define set_SSM_DO_f_en(sb, val) sb[0x0d] = val #define set_SSM_DO_f_en(sb, val) sb[0x0d] = val
#define set_SSM_DO_b_en(sb, val) sb[0x0e] = val #define set_SSM_DO_b_en(sb, val) sb[0x0e] = val
/* ==================================================================== */
/* Cancel */
#define CANCEL_code 0xd8
#define CANCEL_len 6
/* ==================================================================== */ /* ==================================================================== */
/* window descriptor macros for SET_WINDOW and GET_WINDOW */ /* window descriptor macros for SET_WINDOW and GET_WINDOW */

Wyświetl plik

@ -116,6 +116,11 @@
- add all documented request sense codes to sense_handler() - add all documented request sense codes to sense_handler()
- fix color jpeg (remove unneeded BGR to RGB swapping code) - fix color jpeg (remove unneeded BGR to RGB swapping code)
- add macros for LUT data - add macros for LUT data
v11 2009-01-10, MAN
- send_panel() can disable too
- add cancel() to send d8 command
- call cancel() only after final read from scanner
- stop button reqests cancel
SANE FLOW DIAGRAM SANE FLOW DIAGRAM
@ -951,6 +956,7 @@ init_panel (struct scanner *s)
DBG (10, "init_panel: start\n"); DBG (10, "init_panel: start\n");
ret = read_panel(s); ret = read_panel(s);
s->panel_enable_led = 1;
ret = send_panel(s); ret = send_panel(s);
DBG (10, "init_panel: finish\n"); DBG (10, "init_panel: finish\n");
@ -2605,7 +2611,7 @@ send_panel(struct scanner *s)
set_S_xfer_length (cmd, outLen); set_S_xfer_length (cmd, outLen);
memset(out,0,outLen); memset(out,0,outLen);
set_S_PANEL_enable_led(out,1); set_S_PANEL_enable_led(out,s->panel_enable_led);
set_S_PANEL_counter(out,s->panel_counter); set_S_PANEL_counter(out,s->panel_counter);
ret = do_cmd ( ret = do_cmd (
@ -2755,9 +2761,6 @@ sane_start (SANE_Handle handle)
/* undo any prior sane_cancel calls */ /* undo any prior sane_cancel calls */
s->cancelled=0; s->cancelled=0;
/* protect this block from sane_cancel */
s->reading=1;
/* not finished with current side, error */ /* not finished with current side, error */
if (s->started && s->bytes_tx[s->side] != s->bytes_tot[s->side]) { if (s->started && s->bytes_tx[s->side] != s->bytes_tot[s->side]) {
DBG(5,"sane_start: previous transfer not finished?"); DBG(5,"sane_start: previous transfer not finished?");
@ -2902,12 +2905,6 @@ sane_start (SANE_Handle handle)
DBG (15, "started=%d, side=%d, source=%d\n", s->started, s->side, s->source); DBG (15, "started=%d, side=%d, source=%d\n", s->started, s->side, s->source);
/* check if user cancelled during this start */
ret = check_for_cancel(s);
/* unprotect this block from sane_cancel */
s->reading=0;
DBG (10, "sane_start: finish %d\n", ret); DBG (10, "sane_start: finish %d\n", ret);
return ret; return ret;
@ -3161,39 +3158,37 @@ start_scan (struct scanner *s)
return ret; return ret;
} }
/* checks started and cancelled flags in scanner struct, /* sends cancel command to scanner, clears s->started. don't call
* sends cancel command to scanner if required. don't call * this function asyncronously, wait for scan to complete */
* this function asyncronously, wait for pending operation */
static SANE_Status static SANE_Status
check_for_cancel(struct scanner *s) cancel(struct scanner *s)
{ {
SANE_Status ret=SANE_STATUS_GOOD; SANE_Status ret = SANE_STATUS_GOOD;
DBG (10, "check_for_cancel: start\n"); unsigned char cmd[CANCEL_len];
size_t cmdLen = CANCEL_len;
if(s->started && s->cancelled){ DBG (10, "cancel: start\n");
DBG (15, "check_for_cancel: cancelling\n");
/* cancel scan */ memset(cmd,0,cmdLen);
/*ret = scanner_control(s, SC_function_cancel);*/ set_SCSI_opcode(cmd, CANCEL_code);
if (ret == SANE_STATUS_GOOD) {
ret = SANE_STATUS_CANCELLED;
}
else{
DBG (5, "check_for_cancel: ERROR: cannot cancel\n");
}
s->started = 0; ret = do_cmd (
s->cancelled = 0; s, 1, 0,
} cmd, cmdLen,
else if(s->cancelled){ NULL, 0,
DBG (15, "check_for_cancel: already cancelled\n"); NULL, NULL
ret = SANE_STATUS_CANCELLED; );
s->cancelled = 0;
if(!object_position(s,SANE_FALSE)){
DBG (5, "cancel: ignoring bad eject\n");
} }
DBG (10, "check_for_cancel: finish %d\n",ret); s->started = 0;
return ret;
DBG (10, "cancel: finish\n");
return SANE_STATUS_CANCELLED;
} }
/* /*
@ -3232,9 +3227,6 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int * len
return SANE_STATUS_EOF; return SANE_STATUS_EOF;
} }
/* protect this block from sane_cancel */
s->reading = 1;
/* alternating pnm interlacing */ /* alternating pnm interlacing */
if(s->source == SOURCE_ADF_DUPLEX if(s->source == SOURCE_ADF_DUPLEX
&& s->duplex_interlace == DUPLEX_INTERLACE_ALT){ && s->duplex_interlace == DUPLEX_INTERLACE_ALT){
@ -3285,11 +3277,15 @@ sane_read (SANE_Handle handle, SANE_Byte * buf, SANE_Int max_len, SANE_Int * len
/* copy a block from buffer to frontend */ /* copy a block from buffer to frontend */
ret = read_from_buffer(s,buf,max_len,len,s->side); ret = read_from_buffer(s,buf,max_len,len,s->side);
/* check if user cancelled during this read */ /* we've read everything, and user cancelled */
ret = check_for_cancel(s); /* tell scanner to stop */
if(s->bytes_rx[s->side] == s->bytes_tot[s->side]
/* unprotect this block from sane_cancel */ &&
s->reading = 0; (s->cancelled || (!read_panel(s) && s->panel_stop))
){
DBG(5,"sane_read: user cancelled\n");
return cancel(s);
}
DBG (10, "sane_read: finish %d\n", ret); DBG (10, "sane_read: finish %d\n", ret);
return ret; return ret;
@ -3554,11 +3550,6 @@ sane_cancel (SANE_Handle handle)
DBG (10, "sane_cancel: start\n"); DBG (10, "sane_cancel: start\n");
s->cancelled = 1; s->cancelled = 1;
/* if there is no other running function to check, we do it */
if(!s->reading)
check_for_cancel(s);
DBG (10, "sane_cancel: finish\n"); DBG (10, "sane_cancel: finish\n");
} }

Wyświetl plik

@ -448,7 +448,7 @@ static SANE_Status send_panel(struct scanner *s);
static SANE_Status start_scan (struct scanner *s); static SANE_Status start_scan (struct scanner *s);
static SANE_Status check_for_cancel(struct scanner *s); static SANE_Status cancel(struct scanner *s);
static SANE_Status read_from_scanner(struct scanner *s, int side); static SANE_Status read_from_scanner(struct scanner *s, int side);