canon_dr v40: DR-9050, 7550, 6050 and 3010 support

merge-requests/1/head
m. allan noah 2012-11-28 21:12:24 -05:00
rodzic ed7a5f227d
commit f7fe42c33e
4 zmienionych plików z 136 dodań i 13 usunięć

Wyświetl plik

@ -299,7 +299,7 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define GET_SCAN_MODE_code 0xd5
#define GET_SCAN_MODE_len 6
#define set_GSM_unkown(sb, val) sb[0x01] = val
#define set_GSM_unknown(sb, val) sb[0x01] = val
#define set_GSM_page_code(sb, val) sb[0x02] = val
#define set_GSM_len(sb, val) sb[0x04] = val
@ -382,6 +382,20 @@ putnbyte (unsigned char *pnt, unsigned int value, unsigned int nbytes)
#define set_CC_exp_b_g2(sb, val) putnbyte(sb + 0x1c, val, 2)
#define set_CC_exp_b_b2(sb, val) putnbyte(sb + 0x1e, val, 2)
/* ==================================================================== */
/* SET SCAN MODE 2 */
#define SET_SCAN_MODE2_code 0xe5
#define SET_SCAN_MODE2_len 10
#define set_SSM2_page_code(sb, val) sb[0x02] = val
#define set_SSM2_pay_len(sb, val) sb[0x08] = val
/* the payload */
#define SSM2_PAY_len 0x10
#define set_SSM2_unk(sb, val) sb[0x02] = val
#define set_SSM2_unk2(sb, val) sb[0x03] = val
#define set_SSM2_unk3(sb, val) sb[0x04] = val
/* ==================================================================== */
/* window descriptor macros for SET_WINDOW and GET_WINDOW */

Wyświetl plik

@ -274,6 +274,8 @@
- automatically disable read/send_panel if unsupported
v39 2011-11-01, MAN
- DR-2580C pads the backside of duplex scans
v40 2012-11-01, MAN
- initial DR-9050C, DR-7550C, DR-6050C and DR-3010C support
SANE FLOW DIAGRAM
@ -322,7 +324,7 @@
#include "canon_dr.h"
#define DEBUG 1
#define BUILD 39
#define BUILD 40
/* values for SANE_DEBUG_CANON_DR env var:
- errors 5
@ -824,14 +826,14 @@ connect_fd (struct scanner *s)
ret = SANE_STATUS_GOOD;
}
else if (s->connection == CONNECTION_USB) {
DBG (15, "connect_fd: opening USB device\n");
DBG (15, "connect_fd: opening USB device (%s)\n", s->device_name);
ret = sanei_usb_open (s->device_name, &(s->fd));
if(!ret){
ret = sanei_usb_clear_halt(s->fd);
}
}
else {
DBG (15, "connect_fd: opening SCSI device\n");
DBG (15, "connect_fd: opening SCSI device (%s)\n", s->device_name);
ret = sanei_scsi_open_extended (s->device_name, &(s->fd), sense_handler, s,
&s->buffer_size);
if(!ret && buffer_size != s->buffer_size){
@ -1130,6 +1132,7 @@ init_model (struct scanner *s)
s->has_buffer = 1;
s->can_read_panel = 1;
s->can_write_panel = 1;
s->has_ssm = 1;
s->brightness_steps = 255;
s->contrast_steps = 255;
@ -1161,6 +1164,31 @@ init_model (struct scanner *s)
s->has_flatbed = 1;
}
else if (strstr (s->model_name,"DR-9050")
|| strstr (s->model_name,"DR-7550")
|| strstr (s->model_name,"DR-6050")){
/*missing*/
s->std_res_x[DPI_100]=1;
s->std_res_y[DPI_100]=1;
s->std_res_x[DPI_150]=1;
s->std_res_y[DPI_150]=1;
s->std_res_x[DPI_200]=1;
s->std_res_y[DPI_200]=1;
s->std_res_x[DPI_240]=1;
s->std_res_y[DPI_240]=1;
s->std_res_x[DPI_300]=1;
s->std_res_y[DPI_300]=1;
s->std_res_x[DPI_400]=1;
s->std_res_y[DPI_400]=1;
s->std_res_x[DPI_600]=1;
s->std_res_y[DPI_600]=1;
/*weirdness*/
s->has_ssm = 0;
s->has_ssm2 = 1;
}
else if (strstr (s->model_name,"DR-4080")
|| strstr (s->model_name,"DR-4580")
|| strstr (s->model_name,"DR-7080")){
@ -1215,6 +1243,36 @@ init_model (struct scanner *s)
s->can_monochrome=0;
}
/* copied from 2510, possibly incorrect */
else if (strstr (s->model_name,"DR-3010")){
s->rgb_format = 1;
s->always_op = 0;
s->unknown_byte2 = 0x80;
s->fixed_width = 1;
s->valid_x = 8.5 * 1200;
s->gray_interlace[SIDE_FRONT] = GRAY_INTERLACE_2510;
s->gray_interlace[SIDE_BACK] = GRAY_INTERLACE_2510;
s->color_interlace[SIDE_FRONT] = COLOR_INTERLACE_2510;
s->color_interlace[SIDE_BACK] = COLOR_INTERLACE_2510;
s->duplex_interlace = DUPLEX_INTERLACE_2510;
s->duplex_offset = 400;
s->need_ccal = 1;
s->need_fcal = 1;
s->sw_lut = 1;
s->invert_tly = 1;
/*only in Y direction, so we trash them in X*/
s->std_res_x[DPI_100]=0;
s->std_res_x[DPI_150]=0;
s->std_res_x[DPI_200]=0;
s->std_res_x[DPI_240]=0;
s->std_res_x[DPI_400]=0;
/*lies*/
s->can_halftone=0;
s->can_monochrome=0;
}
else if (strstr (s->model_name,"DR-2050")
|| strstr (s->model_name,"DR-2080")){
s->can_write_panel = 0;
@ -2720,6 +2778,11 @@ ssm_buffer (struct scanner *s)
DBG (10, "ssm_buffer: start\n");
if(!s->has_ssm){
DBG (10, "ssm_buffer: unsupported\n");
return ret;
}
memset(cmd,0,cmdLen);
set_SCSI_opcode(cmd, SET_SCAN_MODE_code);
set_SSM_pf(cmd, 1);
@ -2770,7 +2833,7 @@ ssm_df (struct scanner *s)
DBG (10, "ssm_df: start\n");
if(!s->has_df){
if(!s->has_ssm || !s->has_df){
DBG (10, "ssm_df: unsupported, finishing\n");
return ret;
}
@ -2829,7 +2892,7 @@ ssm_do (struct scanner *s)
DBG (10, "ssm_do: start\n");
if(!s->can_color){
if(!s->has_ssm || !s->can_color){
DBG (10, "ssm_do: unsupported, finishing\n");
return ret;
}
@ -2911,6 +2974,50 @@ ssm_do (struct scanner *s)
return ret;
}
/* used by recent scanners. meaning of payloads unknown */
static SANE_Status
ssm2 (struct scanner *s)
{
SANE_Status ret = SANE_STATUS_GOOD;
unsigned char cmd[SET_SCAN_MODE2_len];
size_t cmdLen = SET_SCAN_MODE2_len;
unsigned char out[SSM2_PAY_len];
size_t outLen = SSM2_PAY_len;
DBG (10, "ssm2:start\n");
if(!s->has_ssm2){
DBG (10, "ssm2: unsupported, finishing\n");
return ret;
}
memset(cmd,0,cmdLen);
set_SCSI_opcode(cmd, SET_SCAN_MODE2_code);
/*FIXME: set this correctly */
set_SSM2_page_code(cmd, 0);
set_SSM2_pay_len(cmd, outLen);
/*FIXME: set these correctly */
memset(out,0,outLen);
set_SSM2_unk(out, 0);
set_SSM2_unk2(out, 0);
set_SSM2_unk3(out, 0);
/*
ret = do_cmd (
s, 1, 0,
cmd, cmdLen,
out, outLen,
NULL, NULL
);*/
DBG (10, "ssm2: finish\n");
return ret;
}
static SANE_Status
read_panel(struct scanner *s,SANE_Int option)
{

Wyświetl plik

@ -177,6 +177,8 @@ struct scanner
int has_buffer;
int has_df;
int has_btc;
int has_ssm; /* older scanners use this set scan mode command */
int has_ssm2; /* newer scanners user this similar command */
int can_read_panel;
int can_write_panel;
int rgb_format; /* meaning unknown */

Wyświetl plik

@ -119,8 +119,8 @@
:model "DR-3010C"
:interface "USB"
:usbid "0x1083" "0x161d"
:status :untested
:comment "Please test!"
:status :good
:comment "Minimal testing, settings copied from DR-2510C"
:model "DR3020"
:interface "SCSI"
@ -202,8 +202,8 @@
:model "DR-6050C"
:interface "USB SCSI"
:usbid "0x1083" "0x1624"
:status :untested
:comment "Please test!"
:status :good
:comment "Simplex, duplex, all resolutions, binary/ht/gray working. Can't wake from stand-by mode"
:model "DR-6080"
:interface "USB SCSI"
@ -227,7 +227,7 @@
:interface "USB SCSI"
:usbid "0x1083" "0x1623"
:status :untested
:comment "Please test!"
:comment "Assumed compatible with DR-6050C"
:model "DR-7580"
:interface "USB SCSI"
@ -238,8 +238,8 @@
:model "DR-9050C"
:interface "USB SCSI"
:usbid "0x1083" "0x1622"
:status :untested
:comment "Please test!"
:status :good
:comment "Simplex, duplex, all resolutions, binary/ht/gray working. Can't wake from stand-by mode"
:model "DR-9080C"
:interface "USB SCSI"