Re: [sane-devel] epsonds backend ADF size with ES-50

2022-09-04 Thread Sean Greenslade
On Thu, Sep 01, 2022 at 03:51:00PM -0700, Ralph Little wrote:
> Typically, SANE options are adjusted by amendments to others.
> So if you change the resolution or source, other options and/or their
> respective limits are amended accordingly. So, for example, if you change
> the res to 600dpi, then upper limit on height would change to the lower
> limit and if the currently selected value for height exceeded that limit it
> would be adjusted downward.
> 
> There are specific flags in the option definitions to indicate this to the
> frontend as well. So if an option is changed that affects other options, a
> flag is set to information the frontend to re-acquire values and attributes
> of the other options to get any changes.

Thanks for the hints. I started digging in to the epsonds backend and it
was pretty easy to graft on an adjustment to the ADF scan area when the
DPI value is changed by the frontend. I've submitted a merge request
with my code changes:

https://gitlab.com/sane-project/backends/-/merge_requests/753

It would still be nice to know if the relationship between AREA / AMAX
and DPI can be queried out of some / all epson scanner models. My fix
baked in the assumption that the AMAX size only works on the smallest
DPI setting.

--Sean




Re: [sane-devel] epsonds backend ADF size with ES-50

2022-09-01 Thread Ralph Little
Hi,

On Wed, Aug 31, 2022 at 12:26 PM Sean Greenslade 
wrote:

> On Wed, Aug 31, 2022 at 09:34:55AM -0700, Ralph Little wrote:
> > Hi,
> >
> > On Tue, Aug 30, 2022 at 10:36 PM Sean Greenslade <
> s...@seangreenslade.com>
> > wrote:
> > ...
> > Document size:
> > Maximum: 8.5 × 72 inches (215.9 × 1828.8 mm)
> > Documents scanned at 301 dpi or more: up to 8.5 × 14 inches (215.9 ×
> 355.6 mm)
> > Minimum: 2 × 2 inches (50.8 × 50.8 mm)
>
> So Allan's point in his reply is probably valid: the AMAX is only usable
> at the 200 dpi resolution. And indeed, I just tried a large scan at 600
> dpi with my patch and it fails once the paper exceeds 14 inches. So this
> is indeed more complicated than my simple patch.
>
> Does anyone know offhand if there are facilities in the sane APIs for
> different scan sizes per supported resolution? I see the TL_X/Y and
> BR_X/Y, but it seems like the API assumes that those values are fixed
> for a given scanner.
>
>
Typically, SANE options are adjusted by amendments to others.
So if you change the resolution or source, other options and/or their
respective limits are amended accordingly. So, for example, if you change
the res to 600dpi, then upper limit on height would change to the lower
limit and if the currently selected value for height exceeded that limit it
would be adjusted downward.

There are specific flags in the option definitions to indicate this to the
frontend as well. So if an option is changed that affects other options, a
flag is set to information the frontend to re-acquire values and attributes
of the other options to get any changes.

Cheers,
Ralph


Re: [sane-devel] epsonds backend ADF size with ES-50

2022-08-31 Thread Sean Greenslade
On Wed, Aug 31, 2022 at 09:34:55AM -0700, Ralph Little wrote:
> Hi,
> 
> On Tue, Aug 30, 2022 at 10:36 PM Sean Greenslade 
> wrote:
> 
> > Hi, all. I recently picked up an Epson ES-50 sheet-feed scanner. My
> > intent is to use it for receipt scanning, so I tried it out with a
> > ~700 mm long receipt and found that it would error out at around 450 mm
> > into the scan. The manual claims the scanner is capable of a max of 72
> > inch document length, so I started poking around in the epsonds backend
> > code.  Something that jumped out at me was the eds_set_adf_area
> > function. It seems that for this particular scanner, three ADF size
> > values are reported: AREA, AMIN, and AMAX (in epsonds-cmd.c around line
> > 445 on current git master). The eds_set_adf_area function is called with
> > the values from AREA, which limits the document length to 14 inches. I'm
> > assuming AREA is just meant to be a default value, but if anyone has any
> > deeper insight into the meaning, I'd be interested to know.
> >
> 
> Looking at that code, AMIN and AMAX are pretty much ignored.
> What do you get for all of the AREA/AMIN/AMAX parameters?
> Perhaps we can figure out what they mean and code up something a little
> better?

Here's the relevant debug output (with my patch applied):

[22:18:10.862326] [epsonds] = gathering device information
[22:18:10.863632] [epsonds]  ADF: sheet feed type
[22:18:10.863650] [epsonds]  ADF: order is 1 to N
[22:18:10.863660] [epsonds]  ADF: auto pre-feed
[22:18:10.863670] [epsonds]  ADF: left aligned
[22:18:10.863683] [epsonds]  ADF: auto scan
[22:18:10.863699] [epsonds]  ADF: area 850x1400 @ 100dpi
[22:18:10.863716] [epsonds]  ADF: min 200x200 @ 100dpi
[22:18:10.863731] [epsonds]  ADF: max 850x7200 @ 100dpi
[22:18:10.863743] [epsonds] eds_set_adf_area: 0.00,0.00 
215.84,1828.799988 100 [mm]
[22:18:10.863760] [epsonds]  ADF: basic resolution is 600 dpi
[22:18:10.863770] [epsonds]  ADF: auto recovery

The interesting thing is that these min and max values perfectly match
what is reported in the user's guide for this scanner:

> Document size:
> Maximum: 8.5 × 72 inches (215.9 × 1828.8 mm)
> Documents scanned at 301 dpi or more: up to 8.5 × 14 inches (215.9 × 355.6 mm)
> Minimum: 2 × 2 inches (50.8 × 50.8 mm)

So Allan's point in his reply is probably valid: the AMAX is only usable
at the 200 dpi resolution. And indeed, I just tried a large scan at 600
dpi with my patch and it fails once the paper exceeds 14 inches. So this
is indeed more complicated than my simple patch.

Does anyone know offhand if there are facilities in the sane APIs for
different scan sizes per supported resolution? I see the TL_X/Y and
BR_X/Y, but it seems like the API assumes that those values are fixed
for a given scanner.

> I don't believe that we have a current maintainer for this backend although
> we do get some submissions from Epson Japan now and then for new models. I
> wonder if they would be willing to shed some light on this or provide us
> some documentation on this aspect of the protocol?

Yeah, it would be nice to know if the resolution / scan area
relationship can be queried out of the scanner, or if this will need to
be special-cased per model in the sane code.

Thanks,

--Sean




Re: [sane-devel] epsonds backend ADF size with ES-50

2022-08-31 Thread m. allan noah
With some brands of scanners, there can be limitations in things like
resolution or bit depth when you enable larger size scans. So, be careful
assuming you want to always use that mode.

allan

On Wed, Aug 31, 2022 at 12:58 PM Ralph Little  wrote:

> Hi,
>
> On Tue, Aug 30, 2022 at 10:36 PM Sean Greenslade 
> wrote:
>
>> Hi, all. I recently picked up an Epson ES-50 sheet-feed scanner. My
>> intent is to use it for receipt scanning, so I tried it out with a
>> ~700 mm long receipt and found that it would error out at around 450 mm
>> into the scan. The manual claims the scanner is capable of a max of 72
>> inch document length, so I started poking around in the epsonds backend
>> code.  Something that jumped out at me was the eds_set_adf_area
>> function. It seems that for this particular scanner, three ADF size
>> values are reported: AREA, AMIN, and AMAX (in epsonds-cmd.c around line
>> 445 on current git master). The eds_set_adf_area function is called with
>> the values from AREA, which limits the document length to 14 inches. I'm
>> assuming AREA is just meant to be a default value, but if anyone has any
>> deeper insight into the meaning, I'd be interested to know.
>>
>
> Looking at that code, AMIN and AMAX are pretty much ignored.
> What do you get for all of the AREA/AMIN/AMAX parameters?
> Perhaps we can figure out what they mean and code up something a little
> better?
>
>
>>
>> The AMAX values reported seemed to match the manual's reported 72-inch
>> maximum, so on a whim, I just moved the eds_set_adf_area call to the
>> AMAX section. After recompiling, I was able to scan my long receipt no
>> problem.
>>
>> Now I'm wondering if there is any downside to using the max ADF size? If
>> not, would you consider the attached patch?
>>
>>
> I don't believe that we have a current maintainer for this backend
> although we do get some submissions from Epson Japan now and then for new
> models. I wonder if they would be willing to shed some light on this or
> provide us some documentation on this aspect of the protocol?
>
> Cheers,
> Ralph
>


-- 
"well, I stand up next to a mountain- and I chop it down with the edge of
my hand"


Re: [sane-devel] epsonds backend ADF size with ES-50

2022-08-31 Thread Ralph Little
Hi,

On Tue, Aug 30, 2022 at 10:36 PM Sean Greenslade 
wrote:

> Hi, all. I recently picked up an Epson ES-50 sheet-feed scanner. My
> intent is to use it for receipt scanning, so I tried it out with a
> ~700 mm long receipt and found that it would error out at around 450 mm
> into the scan. The manual claims the scanner is capable of a max of 72
> inch document length, so I started poking around in the epsonds backend
> code.  Something that jumped out at me was the eds_set_adf_area
> function. It seems that for this particular scanner, three ADF size
> values are reported: AREA, AMIN, and AMAX (in epsonds-cmd.c around line
> 445 on current git master). The eds_set_adf_area function is called with
> the values from AREA, which limits the document length to 14 inches. I'm
> assuming AREA is just meant to be a default value, but if anyone has any
> deeper insight into the meaning, I'd be interested to know.
>

Looking at that code, AMIN and AMAX are pretty much ignored.
What do you get for all of the AREA/AMIN/AMAX parameters?
Perhaps we can figure out what they mean and code up something a little
better?


>
> The AMAX values reported seemed to match the manual's reported 72-inch
> maximum, so on a whim, I just moved the eds_set_adf_area call to the
> AMAX section. After recompiling, I was able to scan my long receipt no
> problem.
>
> Now I'm wondering if there is any downside to using the max ADF size? If
> not, would you consider the attached patch?
>
>
I don't believe that we have a current maintainer for this backend although
we do get some submissions from Epson Japan now and then for new models. I
wonder if they would be willing to shed some light on this or provide us
some documentation on this aspect of the protocol?

Cheers,
Ralph


[sane-devel] epsonds backend ADF size with ES-50

2022-08-30 Thread Sean Greenslade
Hi, all. I recently picked up an Epson ES-50 sheet-feed scanner. My
intent is to use it for receipt scanning, so I tried it out with a 
~700 mm long receipt and found that it would error out at around 450 mm
into the scan. The manual claims the scanner is capable of a max of 72
inch document length, so I started poking around in the epsonds backend
code.  Something that jumped out at me was the eds_set_adf_area
function. It seems that for this particular scanner, three ADF size
values are reported: AREA, AMIN, and AMAX (in epsonds-cmd.c around line
445 on current git master). The eds_set_adf_area function is called with
the values from AREA, which limits the document length to 14 inches. I'm
assuming AREA is just meant to be a default value, but if anyone has any
deeper insight into the meaning, I'd be interested to know.

The AMAX values reported seemed to match the manual's reported 72-inch
maximum, so on a whim, I just moved the eds_set_adf_area call to the
AMAX section. After recompiling, I was able to scan my long receipt no
problem.

Now I'm wondering if there is any downside to using the max ADF size? If
not, would you consider the attached patch?

Thanks,

--Sean

diff --git a/backend/epsonds-cmd.c b/backend/epsonds-cmd.c
index d1cba0915..6685b3699 100644
--- a/backend/epsonds-cmd.c
+++ b/backend/epsonds-cmd.c
@@ -448,7 +448,6 @@ static SANE_Status info_cb(void *userdata, char *token, int 
len)
int max = decode_value(value + 4 + 8, 8);
 
DBG(1, " ADF: area %dx%d @ 100dpi\n", min, 
max);
-   eds_set_adf_area(s->hw, min, max, 100);
}
 
if (strncmp("AMIN", value, 4) == 0) {
@@ -465,6 +464,7 @@ static SANE_Status info_cb(void *userdata, char *token, int 
len)
int max = decode_value(value + 4 + 8, 8);
 
DBG(1, " ADF: max %dx%d @ 100dpi\n", min, 
max);
+   eds_set_adf_area(s->hw, min, max, 100);
}
}
 
@@ -481,8 +481,6 @@ static SANE_Status info_cb(void *userdata, char *token, int 
len)
int max = decode_value(value + 4 + 4, 8);
 
DBG(1, " ADF: area %dx%d @ 100dpi\n", min, 
max);
-
-   eds_set_adf_area(s->hw, min, max, 100);
}
 
if (strncmp("AMAX", value, 4) == 0) {
@@ -493,6 +491,7 @@ static SANE_Status info_cb(void *userdata, char *token, int 
len)
int max = decode_value(value + 4 + 4, 8);
 
DBG(1, " ADF: max %dx%d @ 100dpi\n", min, 
max);
+   eds_set_adf_area(s->hw, min, max, 100);
}
}