summaryrefslogtreecommitdiff
path: root/src/scanner.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/scanner.vala')
-rw-r--r--src/scanner.vala74
1 files changed, 17 insertions, 57 deletions
diff --git a/src/scanner.vala b/src/scanner.vala
index fbcc6c6..67a0d96 100644
--- a/src/scanner.vala
+++ b/src/scanner.vala
@@ -931,7 +931,8 @@ public class Scanner : Object
Sane.I18N ("Flatbed"),
"FlatBed",
"Normal",
- Sane.I18N ("Normal")
+ Sane.I18N ("Normal"),
+ "Document Table" /* Epson scanners, eg. ET-3760 */
};
string[] adf_sources =
@@ -959,6 +960,7 @@ public class Scanner : Object
string[] adf_duplex_sources =
{
"ADF Duplex",
+ "Duplex ADF", /* Brother DS-720, #157 */
Sane.I18N ("ADF Duplex"),
"ADF Duplex - Long-Edge Binding", /* Samsung unified driver. LP: # 892915 */
"ADF Duplex - Short-Edge Binding",
@@ -1004,6 +1006,7 @@ public class Scanner : Object
"Color",
"24bit Color[Fast]", /* brother4 driver, Brother DCP-1622WE, #134 */
"24bit Color", /* Seen in the proprietary brother3 driver */
+ "24-bit Color", /* #161 Lexmark CX310dn */
"Color - 16 Million Colors" /* Samsung unified driver. LP: 892915 */
};
string[] gray_scan_modes =
@@ -1012,6 +1015,7 @@ public class Scanner : Object
"Gray",
"Grayscale",
Sane.I18N ("Grayscale"),
+ "8-bit Grayscale", /* #161 Lexmark CX310dn */
"True Gray", /* Seen in the proprietary brother3 driver */
"Grayscale - 256 Levels" /* Samsung unified driver. LP: 892915 */
};
@@ -1023,7 +1027,7 @@ public class Scanner : Object
Sane.I18N ("LineArt"),
"Black & White",
Sane.I18N ("Black & White"),
- "Binary",
+ "Binary", /* Epson PM-A820 */
Sane.I18N ("Binary"),
"Thresholded",
Sane.VALUE_SCAN_MODE_GRAY,
@@ -1031,8 +1035,10 @@ public class Scanner : Object
"Grayscale",
Sane.I18N ("Grayscale"),
"True Gray", /* Seen in the proprietary brother3 driver */
+ "1-bit Black & White", /* #161 Lexmark CX310dn */
"Black and White - Line Art", /* Samsung unified driver. LP: 892915 */
- "Black and White - Halftone"
+ "Black and White - Halftone",
+ "Monochrome" /* Epson */
};
switch (job.scan_mode)
@@ -1056,6 +1062,8 @@ public class Scanner : Object
/* Duplex */
option = get_option_by_name (handle, "duplex", out index);
+ if (option == null) /* #161 Lexmark CX310dn Duplex */
+ option = get_option_by_name (handle, "scan-both-sides", out index);
if (option != null)
{
if (option.type == Sane.ValueType.BOOL)
@@ -1096,6 +1104,8 @@ public class Scanner : Object
/* Set resolution and bit depth */
option = get_option_by_name (handle, Sane.NAME_SCAN_RESOLUTION, out index);
+ if (option == null) /* #161 Lexmark CX310dn Duplex */
+ option = get_option_by_name (handle, "scan-resolution", out index);
if (option != null)
{
set_fixed_or_int_option (handle, option, index, job.dpi, out job.dpi);
@@ -1283,6 +1293,10 @@ public class Scanner : Object
/* Error displayed when no documents at the start of scanning */
_("Document feeder empty"));
}
+ else if (status == Sane.Status.DEVICE_BUSY)
+ {
+ /* If device is busy don't interrupt, but keep waiting for scanner */
+ }
else
{
warning ("Unable to start device: %s", Sane.strstatus (status));
@@ -1319,10 +1333,6 @@ public class Scanner : Object
info.width = parameters.pixels_per_line;
info.height = parameters.lines;
info.depth = parameters.depth;
- /* Reduce bit depth if requested lower than received */
- // FIXME: This a hack and only works on 8 bit gray to 2 bit gray
- if (parameters.depth == 8 && parameters.format == Sane.Frame.GRAY && job.depth == 2 && job.scan_mode == ScanMode.GRAY)
- info.depth = job.depth;
info.n_channels = parameters.format == Sane.Frame.GRAY ? 1 : 3;
info.dpi = job.dpi; // FIXME: This is the requested DPI, not the actual DPI
info.device = current_device;
@@ -1462,56 +1472,6 @@ public class Scanner : Object
n_used++;
}
- /* Reduce bit depth if requested lower than received */
- // FIXME: This a hack and only works on 8 bit gray to 2 bit gray
- if (parameters.depth == 8 && parameters.format == Sane.Frame.GRAY &&
- job.depth == 2 && job.scan_mode == ScanMode.GRAY)
- {
- uchar block = 0;
- var write_offset = 0;
- var block_shift = 6;
- for (var i = 0; i < line.n_lines; i++)
- {
- var offset = i * line.data_length;
- for (var x = 0; x < line.width; x++)
- {
- var p = line.data[offset + x];
-
- uchar sample;
- if (p >= 192)
- sample = 3;
- else if (p >= 128)
- sample = 2;
- else if (p >= 64)
- sample = 1;
- else
- sample = 0;
-
- block |= sample << block_shift;
- if (block_shift == 0)
- {
- line.data[write_offset] = block;
- write_offset++;
- block = 0;
- block_shift = 6;
- }
- else
- block_shift -= 2;
- }
-
- /* Finish each line on a byte boundary */
- if (block_shift != 6)
- {
- line.data[write_offset] = block;
- write_offset++;
- block = 0;
- block_shift = 6;
- }
- }
-
- line.data_length = (line.width * 2 + 7) / 8;
- }
-
notify_event (new NotifyGotLine (job.id, line));
}
}