1
--- a/scan/sane/bb_ledm.c
2
+++ b/scan/sane/bb_ledm.c
7
-<CompressionQFactor>15</CompressionQFactor>\
8
+<CompressionQFactor>0</CompressionQFactor>\
9
<ColorSpace>%s</ColorSpace>\
10
<BitDepth>%d</BitDepth>\
11
<InputSource>%s</InputSource>\
13
# define JOBSTATE_COMPLETED "<j:JobState>Completed</j:JobState>"
14
# define PRESCANPAGE "<PreScanPage>"
16
+static int parse_status_elements(const char *payload, int size, struct wscn_create_scan_job_response *resp)
20
+ char *tail=(char *)payload;
24
+ get_tag(tail, size-(tail-payload), tag, sizeof(tag), &tail);
29
+ if (strncmp(tag, "ImageWidth", 10) == 0)
31
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
32
+ resp->pixels_per_line = strtol(value, NULL, 10);
34
+ else if (strncmp(tag, "ImageHeight", 11) == 0)
36
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
37
+ resp->lines = strtol(value, NULL, 10);
39
+ else if (strncmp(tag, "BytesPerLine", 12) == 0)
41
+ get_element(tail, size-(tail-payload), value, sizeof(value), &tail);
42
+ resp->bytes_per_line = strtol(value, NULL, 10);
48
static int parse_scan_elements(const char *payload, int size, struct wscn_scan_elements *elements)
52
if (ps->currentCompression == SF_RAW && ps->currentScanMode != CE_GRAY8)
54
/* Set scan parameters based on scan job response values */
55
- //pp->lines = pbb->job.lines;
56
- pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
57
+ pp->lines = pbb->job.lines;
58
pp->pixels_per_line = pbb->job.pixels_per_line;
59
pp->bytes_per_line = pbb->job.bytes_per_line;
63
case SPO_BEST_GUESS: /* called by xsane & sane_start */
64
/* Set scan parameters based on best guess. */
65
- pp->lines = (int)round(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
66
- pp->pixels_per_line = (int)round(SANE_UNFIX(ps->effectiveBrx -ps->effectiveTlx)/MM_PER_INCH*ps->currentResolution);
67
+ pp->lines = (int)(SANE_UNFIX(ps->effectiveBry - ps->effectiveTly)/MM_PER_INCH*ps->currentResolution);
68
+ pp->pixels_per_line = ps->image_traits.iPixelsPerRow;
69
pp->bytes_per_line = BYTES_PER_LINE(pp->pixels_per_line, pp->depth * factor);
73
(int) ((ps->currentBrx / 5548.7133) - (ps->currentTlx / 5548.7133)),//<Width>
74
(int) (ps->currentTly / 5548.7133),//<YStart>
75
(int) ((ps->currentBry / 5548.7133) - (ps->currentTly / 5548.7133)),//<Height>
77
+ (ps->currentCompression == SF_RAW) ? "Raw" : "Jpeg", //<Format>
78
(! strcmp(ce_element[ps->currentScanMode], "Color8")) ? "Color" : (! strcmp(ce_element[ps->currentScanMode], "Gray8")) ? "Gray" : "Gray",//<ColorSpace>
79
((! strcmp(ce_element[ps->currentScanMode], "Color8")) || (! strcmp(ce_element[ps->currentScanMode], "Gray8"))) ? 8: 8,//<BitDepth>
80
ps->currentInputSource == IS_PLATEN ? is_element[1] : is_element[2],//<InputSource>
82
_DBG("bb_start_scan() read_http_payload FAILED len=%d buf=%s\n", len, buf);
86
//For a new scan, buf must contain <PreScanPage>.
87
if (NULL == strstr(buf,PRESCANPAGE))
88
{ //i.e Paper is not present in Scanner
90
stat = SANE_STATUS_GOOD;
94
+ parse_status_elements(buf, len, &pbb->job);
96
usleep(500000);//0.5 sec delay
99
--- a/scan/sane/ledm.c
100
+++ b/scan/sane/ledm.c
101
@@ -170,11 +170,11 @@
105
-// ps->compressionList[j] = STR_COMPRESSION_NONE;
106
-// ps->compressionMap[j++] = SF_RAW;
107
+ ps->compressionList[j] = STR_COMPRESSION_NONE;
108
+ ps->compressionMap[j++] = SF_RAW;
109
ps->compressionList[j] = STR_COMPRESSION_JPEG;
110
ps->compressionMap[j++] = SF_JPEG;
111
- ps->currentCompression = SF_JPEG;
112
+ ps->currentCompression = SF_RAW;
113
ps->option[LEDM_OPTION_JPEG_QUALITY].cap |= SANE_CAP_SOFT_SELECT; /* enable jpeg quality */
120
- ps->currentCompression = SF_JPEG;
121
+ ps->currentCompression = SF_RAW;
122
stat = SANE_STATUS_GOOD;
129
- ipGetImageTraits(ps->ip_handle, NULL, &ps->image_traits); /* get valid image traits */
131
+ ipGetOutputTraits(ps->ip_handle, &ps->image_traits); /* get valid image traits */
134
stat = SANE_STATUS_GOOD;