Merge branch '302-pixma-status-of-pixma-tr-4500-series' into 'master'

Resolve "pixma: Status of PIXMA TR 4500 Series"

Closes #302

See merge request sane-project/backends!485
merge-requests/244/head
Rolf Bensch 2020-07-14 15:57:31 +00:00
commit bc81490996
6 zmienionych plików z 120 dodań i 24 usunięć

Wyświetl plik

@ -92,7 +92,7 @@
*/
#include "pixma_sane_options.h"
#define BUTTON_GROUP_SIZE ( opt_scan_resolution - opt_button_1 + 1 )
#define BUTTON_GROUP_SIZE ( opt_adf_orientation - opt_button_1 + 1 )
#define BUTTON_GROUP_INDEX(x) ( x - opt_button_1 )
typedef struct pixma_sane_t
@ -318,6 +318,9 @@ update_button_state (pixma_sane_t * ss, SANE_Int * info)
OVAL (opt_original).w = GET_EV_ORIGINAL(ev);
OVAL (opt_target).w = GET_EV_TARGET(ev);
OVAL (opt_scan_resolution).w = GET_EV_DPI(ev);
OVAL (opt_document_type).w = GET_EV_DOC(ev);
OVAL (opt_adf_status).w = GET_EV_STAT(ev);
OVAL (opt_adf_orientation).w = GET_EV_ORIENT(ev);
}
mark_all_button_options_cached(ss);
}
@ -749,6 +752,9 @@ control_option (pixma_sane_t * ss, SANE_Int n,
case opt_original:
case opt_target:
case opt_scan_resolution:
case opt_document_type:
case opt_adf_status:
case opt_adf_orientation:
/* poll scanner if option is not cached */
if (! ss->button_option_is_cached[ BUTTON_GROUP_INDEX(n) ] )
update_button_state (ss, info);
@ -2212,6 +2218,21 @@ type int scan-resolution
title Scan resolution
cap soft_detect advanced
type int document-type
default 0
title Document type
cap soft_detect advanced
type int adf-status
default 0
title ADF status
cap soft_detect advanced
type int adf-orientation
default 0
title ADF orientation
cap soft_detect advanced
rem -------------------------------------------
type group
title Extras

Wyświetl plik

@ -171,13 +171,19 @@ typedef uint32_t uint32_t;
#define PIXMA_EV_ACTION_MASK (0xffffff)
#define PIXMA_EV_BUTTON1 (1 << 24)
#define PIXMA_EV_BUTTON2 (2 << 24)
#define PIXMA_EV_TARGET_MASK (0xff)
#define PIXMA_EV_ORIGINAL_MASK (0xff00)
#define PIXMA_EV_DPI_MASK (0xff0000)
#define PIXMA_EV_TARGET_MASK (0x0f)
#define PIXMA_EV_ORIGINAL_MASK (0x0f00)
#define PIXMA_EV_DPI_MASK (0x0f0000)
#define PIXMA_EV_DOC_MASK (0xf000)
#define PIXMA_EV_STAT_MASK (0xf00000)
#define PIXMA_EV_ORIENT_MASK (0xf0)
#define GET_EV_TARGET(x) (x & PIXMA_EV_TARGET_MASK)
#define GET_EV_ORIGINAL(x) ( (x & PIXMA_EV_ORIGINAL_MASK) >> 8 )
#define GET_EV_DPI(x) ( (x & PIXMA_EV_DPI_MASK) >> 16 )
#define GET_EV_DOC(x) ( (x & PIXMA_EV_DOC_MASK) >> 12 )
#define GET_EV_STAT(x) ( (x & PIXMA_EV_STAT_MASK) >> 20 )
#define GET_EV_ORIENT(x) ( (x & PIXMA_EV_ORIENT_MASK) >> 4 )
/**@}*/
/** @} end of API group */

Wyświetl plik

@ -914,7 +914,8 @@ handle_interrupt (pixma_t * s, int timeout)
|| s->cfg->pid == MX920_PID
|| s->cfg->pid == MB2300_PID
|| s->cfg->pid == MB5000_PID
|| s->cfg->pid == MB5400_PID)
|| s->cfg->pid == MB5400_PID
|| s->cfg->pid == TR4500_PID)
/* button no. in buf[7]
* size in buf[10] 01=A4; 02=Letter; 08=10x15; 09=13x18; 0b=auto
* format in buf[11] 01=JPEG; 02=TIFF; 03=PDF; 04=Kompakt-PDF
@ -922,9 +923,28 @@ handle_interrupt (pixma_t * s, int timeout)
* target = format; original = size; scan-resolution = dpi */
{
if (buf[7] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[11] | buf[10]<<8 | buf[12]<<16; /* color scan */
{
/* color scan */
s->events = PIXMA_EV_BUTTON1 | (buf[11] & 0x0f) | (buf[10] & 0x0f) << 8
| (buf[12] & 0x0f) << 16;
}
if (buf[7] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[11] | buf[10]<<8 | buf[12]<<16; /* b/w scan */
{
/* b/w scan */
s->events = PIXMA_EV_BUTTON2 | (buf[11] & 0x0f) | (buf[10] & 0x0f) << 8
| (buf[12] & 0x0f) << 16;
}
/* some scanners provide additional information:
* document type in buf[6] 01=Document; 02=Photo; 03=Auto Scan
* ADF status in buf[8] 01 = ADF empty; 02 = ADF filled
* ADF orientation in buf[16] 01=Portrait; 02=Landscape */
if (s->cfg->pid == TR4500_PID)
{
s->events |= (buf[6] & 0x0f) << 12;
s->events |= (buf[8] & 0x0f) << 20;
s->events |= (buf[16] & 0x0f) << 4;
}
}
else if (s->cfg->pid == LIDE300_PID
|| s->cfg->pid == LIDE400_PID)
@ -932,10 +952,16 @@ handle_interrupt (pixma_t * s, int timeout)
* target in buf[0x13] 01=copy; 02=auto; 03=send; 05=start PDF; 06=finish PDF
* "Finish PDF" is Button-2, all others are Button-1 */
{
if (buf[0x13] == 0x06)
s->events = PIXMA_EV_BUTTON2 | buf[0x13]; /* button 2 = cancel / end scan */
else if (buf[0x13])
s->events = PIXMA_EV_BUTTON1 | buf[0x13]; /* button 1 = start scan */
if (buf[0x13] == 0x06)
{
/* button 2 = cancel / end scan */
s->events = PIXMA_EV_BUTTON2 | (buf[0x13] & 0x0f);
}
else if (buf[0x13])
{
/* button 1 = start scan */
s->events = PIXMA_EV_BUTTON1 | (buf[0x13] & 0x0f);
}
}
else
/* button no. in buf[0]
@ -951,9 +977,15 @@ handle_interrupt (pixma_t * s, int timeout)
if (buf[9] & 2)
query_status (s);
if (buf[0] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
{
/* b/w scan */
s->events = PIXMA_EV_BUTTON2 | (buf[1] & 0x0f) | (buf[0] & 0xf0) << 4;
}
if (buf[0] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
{
/* color scan */
s->events = PIXMA_EV_BUTTON1 | (buf[1] & 0x0f) | ((buf[0] & 0xf0) << 4);
}
}
return 1;
}
@ -1825,7 +1857,7 @@ const pixma_config_t pixma_mp150_devices[] = {
DEVICE ("Canon PIXMA TR7530 Series", "TR7530", TR7530_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXUS XK50 Series", "XK50", XK50_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXUS XK70 Series", "XK70", XK70_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA TR4500 Series", "TR4500", TR4500_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA TR4500 Series", "TR4500", TR4500_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF | PIXMA_CAP_ADF_JPEG), /* ToDo: max. scan resolution = 600x1200dpi */
DEVICE ("Canon PIXMA E4200 Series", "E4200", E4200_PID, 0, 600, 0, 0, 638, 877, PIXMA_CAP_CIS | PIXMA_CAP_ADF),
DEVICE ("Canon PIXMA TS6200 Series", "TS6200", TS6200_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),
DEVICE ("Canon PIXMA TS6280 Series", "TS6280", TS6280_PID, 0, 1200, 0, 0, 638, 877, PIXMA_CAP_CIS),

Wyświetl plik

@ -1172,9 +1172,17 @@ static int handle_interrupt (pixma_t * s, int timeout)
* target = format; original = size; scan-resolution = dpi */
{
if (buf[7] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[11] | buf[10]<<8 | buf[12]<<16; /* color scan */
{
/* color scan */
s->events = PIXMA_EV_BUTTON1 | (buf[11] & 0x0f) | (buf[10] & 0x0f) << 8
| (buf[12] & 0x0f) << 16;
}
if (buf[7] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[11] | buf[10]<<8 | buf[12]<<16; /* b/w scan */
{
/* b/w scan */
s->events = PIXMA_EV_BUTTON2 | (buf[11] & 0x0f) | (buf[10] & 0x0f) << 8
| (buf[12] & 0x0f) << 16;
}
}
else if (s->cfg->pid == CS8800F_PID
|| s->cfg->pid == CS9000F_PID
@ -1185,9 +1193,15 @@ static int handle_interrupt (pixma_t * s, int timeout)
{
if ((s->cfg->pid == CS8800F_PID && buf[1] == 0x70)
|| (s->cfg->pid != CS8800F_PID && buf[1] == 0x50))
s->events = PIXMA_EV_BUTTON2 | buf[1] >> 4; /* button 2 = cancel / end scan */
{
/* button 2 = cancel / end scan */
s->events = PIXMA_EV_BUTTON2 | buf[1] >> 4;
}
else
s->events = PIXMA_EV_BUTTON1 | buf[1] >> 4; /* button 1 = start scan */
{
/* button 1 = start scan */
s->events = PIXMA_EV_BUTTON1 | buf[1] >> 4;
}
}
else
/* button no. in buf[0]
@ -1204,9 +1218,15 @@ static int handle_interrupt (pixma_t * s, int timeout)
query_status (s);
if (buf[0] & 2)
s->events = PIXMA_EV_BUTTON2 | buf[1] | ((buf[0] & 0xf0) << 4); /* b/w scan */
{
/* b/w scan */
s->events = PIXMA_EV_BUTTON2 | (buf[1] & 0x0f) | (buf[0] & 0xf0) << 4;
}
if (buf[0] & 1)
s->events = PIXMA_EV_BUTTON1 | buf[1] | ((buf[0] & 0xf0) << 4); /* color scan */
{
/* color scan */
s->events = PIXMA_EV_BUTTON1 | (buf[1] & 0x0f) | (buf[0] & 0xf0) << 4;
}
}
return 1;
}

Wyświetl plik

@ -866,8 +866,8 @@
:model "PIXMA TR4500 Series"
:interface "USB WiFi"
:usbid "0x04a9" "0x1854"
:status :untested
:comment "Testers needed!"
:status :complete
:comment "Flatbed and ADF scan. All resolutions supported (up to 600DPI)"
:model "PIXMA TR7500 Series"
:interface "USB WiFi"

Wyświetl plik

@ -51,6 +51,8 @@ PIXMA MX410, MX420, MX470, MX510, MX520, MX530, MX700, MX720
.br
PIXMA MX850, MX860, MX870, MX882, MX885, MX890, MX920, MX7600
.br
PIXMA TR4500
.br
PIXMA TS3100, TS3300, TS5000, TS5100, TS6100, TS6200, TS8000
.br
PIXMA TS8200
@ -113,7 +115,7 @@ PIXMA MX320, MX390, MX430, MX450, MX490, MX710
.br
PIXMA G3000, G3010, G4010, G6000, G6080, G7000, GM4000
.br
PIXMA TR4500, TR7500, TR7530, TR8500, TR8530, TR8580, TR9530
PIXMA TR7500, TR7530, TR8500, TR8530, TR8580, TR9530
.br
PIXMA TS6000, TS6130, TS6180, TS6230, TS6280, TS6300, TS6330
.br
@ -238,10 +240,25 @@ or 1 = JPEG, 2 = TIFF, 3 = PDF, 4 = Compact PDF. For some scanners this value
is equivalent to the number of the pressed button. Not all scanners can provide
this data.
.TP
.I scan-resolution
.I scan\-resolution
(read only) Returns the resolution of the scan operation if the scanner
provides that data. Known values: 1 = 75 dpi, 2 = 150 dpi, 3 = 300 dpi,
4 = 600 dpi. Not all scanners can provide this data.
.TP
.I document\-type
(read only) Returns the type of the scanned document if the scanner provides
that data. Known values: 1 = Document, 2 = Photo, 3 = Auto scan. Not all scanners
can provide this data.
.TP
.I adf\-status
(read only) Returns the status of the document feeder if the scanner provides
that data. Known values: 1 = ADF empty, 2 = ADF filled. Not all scanners can
provide this data.
.TP
.I adf\-orientation
(read only) Returns the scan orientation of the medium scanned from ADF if the
scanner provides that data. Known values: 1 = Portrait, 2 = Landscape. Not all
scanners can provide this data.
.SH FILES
.TP
.I @LIBDIR@/libsane\-pixma.a