Re: [sane-devel] scanimage does not recognize basic long options

2023-02-05 Thread Karl Weber
Hi Ralph,

On Sunday, 5 February 2023 01:22:10 CET Ralph Little wrote:
> @karl, perhaps pull the change and make sure it is good for you?

It is ok for my.

Thank you very much!

Regards
Karl





Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread Ralph Little

Hi,
I have checked in a change to scanimage in master and it should be in 1.2.1.

@karl, perhaps pull the change and make sure it is good for you?

Cheers,
Ralph


On 2023-02-04 11:47, m. allan noah wrote:

I'm ok with breaking code freeze if you want

On Sat, Feb 4, 2023, 2:41 PM Ralph Little  wrote:

Hi,

On 2023-02-04 10:38, Karl Weber wrote:
> Hi Ralf,
>
> On Saturday, 4 February 2023 18:06:41 CET Ralph Little wrote:
>> The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been
removed in
>> version
>>> 1.1.1 and this causes the problem.
>> I'm a bit confused by this comment. I thought that your issue
was caused
>> by the backend sending NULL.
>> Which problem do you believe this causes? Or are you saying
that the
>> NULL options issue is revealed by this change? That is
certainly possible.
> Yes, you may also say that the NULL options issue has been
revealed by this
> change. I didn't know, why this check has been removed and I
don't know why it
> had been there beforehand. I am really new to sane! I started to
look at the
> code two days ago. Before I was only an ignorant user of
scanimage. So please
> excuse me.
>
> But irrespective of the wording, are you going to do something
about it? Or
> where would be the right place to fix this problem? Currently I
have no idea,
> whether hplip-sane is open source and what the chances would be,
to get a fix
> in there, if this would be the right place for a fix. I don't
even know,
> whether it is part of the SANE API specification, that there
must not be NULL
> options.
I suspect that the hpaio backend is doing something improper.
However,
we must deal with it somehow.
I will do a fix.

Cheers,
Ralph



Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread m. allan noah
I'm ok with breaking code freeze if you want

On Sat, Feb 4, 2023, 2:41 PM Ralph Little  wrote:

> Hi,
>
> On 2023-02-04 10:38, Karl Weber wrote:
> > Hi Ralf,
> >
> > On Saturday, 4 February 2023 18:06:41 CET Ralph Little wrote:
> >> The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been removed in
> >> version
> >>> 1.1.1 and this causes the problem.
> >> I'm a bit confused by this comment. I thought that your issue was caused
> >> by the backend sending NULL.
> >> Which problem do you believe this causes? Or are you saying that the
> >> NULL options issue is revealed by this change? That is certainly
> possible.
> > Yes, you may also say that the NULL options issue has been revealed by
> this
> > change. I didn't know, why this check has been removed and I don't know
> why it
> > had been there beforehand. I am really new to sane! I started to look at
> the
> > code two days ago. Before I was only an ignorant user of scanimage. So
> please
> > excuse me.
> >
> > But irrespective of the wording, are you going to do something about it?
> Or
> > where would be the right place to fix this problem? Currently I have no
> idea,
> > whether hplip-sane is open source and what the chances would be, to get
> a fix
> > in there, if this would be the right place for a fix. I don't even know,
> > whether it is part of the SANE API specification, that there must not be
> NULL
> > options.
> I suspect that the hpaio backend is doing something improper. However,
> we must deal with it somehow.
> I will do a fix.
>
> Cheers,
> Ralph
>
>


Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread Ralph Little

Hi,

On 2023-02-04 10:38, Karl Weber wrote:

Hi Ralf,

On Saturday, 4 February 2023 18:06:41 CET Ralph Little wrote:

The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been removed in
version

1.1.1 and this causes the problem.

I'm a bit confused by this comment. I thought that your issue was caused
by the backend sending NULL.
Which problem do you believe this causes? Or are you saying that the
NULL options issue is revealed by this change? That is certainly possible.

Yes, you may also say that the NULL options issue has been revealed by this
change. I didn't know, why this check has been removed and I don't know why it
had been there beforehand. I am really new to sane! I started to look at the
code two days ago. Before I was only an ignorant user of scanimage. So please
excuse me.

But irrespective of the wording, are you going to do something about it? Or
where would be the right place to fix this problem? Currently I have no idea,
whether hplip-sane is open source and what the chances would be, to get a fix
in there, if this would be the right place for a fix. I don't even know,
whether it is part of the SANE API specification, that there must not be NULL
options.
I suspect that the hpaio backend is doing something improper. However, 
we must deal with it somehow.

I will do a fix.

Cheers,
Ralph



Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread Karl Weber
Hi Ralf,

On Saturday, 4 February 2023 18:06:41 CET Ralph Little wrote:
> The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been removed in
> version
> > 1.1.1 and this causes the problem.
> 
> I'm a bit confused by this comment. I thought that your issue was caused
> by the backend sending NULL.
> Which problem do you believe this causes? Or are you saying that the
> NULL options issue is revealed by this change? That is certainly possible.

Yes, you may also say that the NULL options issue has been revealed by this 
change. I didn't know, why this check has been removed and I don't know why it 
had been there beforehand. I am really new to sane! I started to look at the 
code two days ago. Before I was only an ignorant user of scanimage. So please 
excuse me.

But irrespective of the wording, are you going to do something about it? Or 
where would be the right place to fix this problem? Currently I have no idea, 
whether hplip-sane is open source and what the chances would be, to get a fix 
in there, if this would be the right place for a fix. I don't even know, 
whether it is part of the SANE API specification, that there must not be NULL 
options.

But even if it is a bug in hplip-sane, or the scanner-firmware itself, 
couldn't it be wise, to include a check against NULL options in scanimage? If 
my test revealed this problem, couldn't it show up with other backends as 
well? I have absolutely no idea, what and how you test before you release a 
new version of sane.

Regards
Karl





Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread Ralph Little

Hi,

On 2023-02-04 01:15, Karl Weber wrote:

Hi,

On Friday, 3 February 2023 21:11:11 CET Karl Weber wrote:

It is easy, to fix this. After

if (opt->type == SANE_TYPE_GROUP)
 continue;

one may to add

if (opt->name == NULL)
 continue;

The sources that come with my distribution, i.e. version 1.0.32, have the
different check in fetch_options:

/* create command line option only for settable options */
if (!SANE_OPTION_IS_SETTABLE (opt->cap) || opt->type == SANE_TYPE_GROUP)
   continue;

The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been removed in version
1.1.1 and this causes the problem.


I'm a bit confused by this comment. I thought that your issue was caused 
by the backend sending NULL.
Which problem do you believe this causes? Or are you saying that the 
NULL options issue is revealed by this change? That is certainly possible.


That specific change was introduced to avoid readonly options being 
reported as "invalid" which is confusing to the user, as they are 
obviously valid, yet cannot be set.

It now reports that the option is readonly.

Cheers,
Ralph



Re: [sane-devel] scanimage does not recognize basic long options

2023-02-04 Thread Karl Weber
Hi,

On Friday, 3 February 2023 21:11:11 CET Karl Weber wrote:
> It is easy, to fix this. After
> 
> if (opt->type == SANE_TYPE_GROUP)
> continue;
> 
> one may to add
> 
> if (opt->name == NULL)
> continue;

The sources that come with my distribution, i.e. version 1.0.32, have the 
different check in fetch_options:

/* create command line option only for settable options */
if (!SANE_OPTION_IS_SETTABLE (opt->cap) || opt->type == SANE_TYPE_GROUP)
  continue;

The condition on SANE_OPTION_IS_SETTABLE(opt->cap) has been removed in version 
1.1.1 and this causes the problem.

Are you going to change this in version 1.1.1 back to the condition in version 
1.0.32? Should I write a bug report about this? 

Thanks,
Karl





Re: [sane-devel] scanimage does not recognize basic long options

2023-02-03 Thread Karl Weber
On Thursday, 2 February 2023 22:31:47 CET Karl Weber wrote:
> I get
> 
> scanimage: unrecognized option '--format=jpeg'
> 
> The backend used in this case is hpaio.

I know what is wrong and in particular why it works with the test device but 
not with hpaio. I know how to fix it in scanimage, but one might nonetheless 
consider it a bug in libsane-hpaio, not in scanimage. I am using libsane-
hpaio.so.1.0.0 from the openSUSE 15.3 repository.

It goes wrong in function static void fetch_options(SANE_Device * device); In 
this function the call to sane_get_option_descriptor(device, i) returns null-
values, i.e. SANE_Option_Descriptor stucts where name, title, desc, type, size 
and cap all are null values. These are inserted into all_options. I guess, the 
first NULL-entry in this array signals getopt_long the end of the options and 
all options after that are no longer recognized.

It is easy, to fix this. After

if (opt->type == SANE_TYPE_GROUP)
continue;

one may to add

if (opt->name == NULL)
continue;

and it works with hpaio. As I said, one might as well argue, that this has to 
be fixed in libsane-hpaio, but I do not know enough about the SANE API and 
what it requires in this case.

Regards
Karl

Just to give you an impression, here the output of all option processed in 
fetch_options for my scanner ScanJet Pro 4500 fn1:

SANE_Option_Desctiptor: name: mode-group, title: Scan mode, desc: (null), 
type: 5, size: 0, cap: 0
SANE_Option_Desctiptor: name: mode, title: Scan mode, desc: Selects the scan 
mode (e.g., lineart, monochrome, or color)., type: 3, size: 32, cap: 5
SANE_Option_Desctiptor: name: resolution, title: Scan resolution, desc: Sets 
the resolution of the scanned image., type: 1, size: 4, cap: 5
SANE_Option_Desctiptor: name: source, title: Scan source, desc: Selects the 
scan source (such as a document-feeder)., type: 3, size: 32, cap: 5
SANE_Option_Desctiptor: name: advanced-group, title: Advanced, desc: (null), 
type: 5, size: 0, cap: 64
SANE_Option_Desctiptor: name: (null), title: (null), desc: (null), type: 0, 
size: 0, cap: 0
SANE_Option_Desctiptor: name: compression, title: Compression, desc: Selects 
the scanner compression method for faster scans, possibly at the expense of 
image quality., type: 3, size: 32, cap: 69
SANE_Option_Desctiptor: name: jpeg-quality, title: JPEG compression factor, 
desc: Sets the scanner JPEG compression factor. Larger numbers mean better 
compression, and smaller numbers mean better image quality., type: 1, size: 4, 
cap: 101
SANE_Option_Desctiptor: name: geometry-group, title: Geometry, desc: (null), 
type: 5, size: 0, cap: 64
SANE_Option_Desctiptor: name: tl-x, title: Top-left x, desc: Top-left x 
position of scan area., type: 2, size: 4, cap: 5
SANE_Option_Desctiptor: name: tl-y, title: Top-left y, desc: Top-left y 
position of scan area., type: 2, size: 4, cap: 5
SANE_Option_Desctiptor: name: br-x, title: Bottom-right x, desc: Bottom-right 
x position of scan area., type: 2, size: 4, cap: 5
SANE_Option_Desctiptor: name: br-y, title: Bottom-right y, desc: Bottom-right 
y position of scan area., type: 2, size: 4, cap: 5
SANE_Option_Desctiptor: name: multi-pick, title: Multi pick, desc: Select 
multipick option for ESCL protocal based devices, type: 1, size: 4, cap: 69
SANE_Option_Desctiptor: name: (null), title: (null), desc: (null), type: 0, 
size: 0, cap: 0







Re: [sane-devel] scanimage does not recognize basic long options

2023-02-02 Thread Karl Weber
On Thursday, 2 February 2023 22:44:34 CET m. allan noah wrote:
> I bet you are not running the version of scanimage you think you are.

I thought exactly the same :)

So I removed all packages from my openSUSE 15.3 repository, in particular 
sane-backends.

Now I get:

scanimage --version
scanimage (sane-backends) 1.1.1.362-6b588; backend version 1.1.1

sudo ldconfig -v | grep sane
[...]
libsane.so.1 -> libsane.so.1.1.1

So now I think, I do call the version I hope to call. Or not?

Thanks
Karl






Re: [sane-devel] scanimage does not recognize basic long options

2023-02-02 Thread m. allan noah
I bet you are not running the version of scanimage you think you are.

On Thu, Feb 2, 2023 at 4:35 PM Karl Weber  wrote:

> Hi,
>
> I came to the mentioned package through this issue
>
> https://gitlab.com/sane-project/backends/-/issues/440
>
> Meanwhile, I worked with a git clone, however with the same result :(
>
> On Thursday, 2 February 2023 22:01:03 CET Ralph Little wrote:
> > I downloaded and built said package and I don't see the same issue:
> >
> > scanimage --format=tiff -d 'test:0' --resolution 200 -x 210.000 -y
> 296.985
> > --mode Color  --batch="sid-600-%03d.tiff" --source 'Automatic Document
> > Feeder' --batch-count=1
> >
> > This works for me just fine.
>
> Ok. When I enter the command like you did, I get
>
> scanimage: rounded value of br-x from 210 to 200
> scanimage: rounded value of br-y from 296.985 to 200
> Scanning 1 page, incrementing by 1, numbering from 1
> Scanning page 1
> Scanned page 1. (scanner status = 5)
> Batch terminated, 1 page scanned
>
> When I enter
>
> scanimage --format=jpeg --resolution 200 -x 210.000 -y 296.985 --mode
> Color --
> batch="fff-%03d.jpeg" --source ADF --batch-count=3
>
> I get
>
> scanimage: unrecognized option '--format=jpeg'
>
> The backend used in this case is hpaio.
>
> Thanks
> Karl
>
>
>
>
>
>
>
>
>
>
>

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


Re: [sane-devel] scanimage does not recognize basic long options

2023-02-02 Thread Karl Weber
Hi,

I came to the mentioned package through this issue

https://gitlab.com/sane-project/backends/-/issues/440

Meanwhile, I worked with a git clone, however with the same result :(

On Thursday, 2 February 2023 22:01:03 CET Ralph Little wrote:
> I downloaded and built said package and I don't see the same issue:
> 
> scanimage --format=tiff -d 'test:0' --resolution 200 -x 210.000 -y 296.985
> --mode Color  --batch="sid-600-%03d.tiff" --source 'Automatic Document
> Feeder' --batch-count=1
> 
> This works for me just fine.

Ok. When I enter the command like you did, I get

scanimage: rounded value of br-x from 210 to 200
scanimage: rounded value of br-y from 296.985 to 200
Scanning 1 page, incrementing by 1, numbering from 1
Scanning page 1
Scanned page 1. (scanner status = 5)
Batch terminated, 1 page scanned

When I enter

scanimage --format=jpeg --resolution 200 -x 210.000 -y 296.985 --mode Color --
batch="fff-%03d.jpeg" --source ADF --batch-count=3

I get

scanimage: unrecognized option '--format=jpeg'

The backend used in this case is hpaio.

Thanks 
Karl












Re: [sane-devel] scanimage does not recognize basic long options

2023-02-02 Thread Ralph Little
Hi,

On Thu, Feb 2, 2023 at 12:41 PM Karl Weber  wrote:

> Hi,
>
> I downloaded the source code tar ball sane-backends-1.1.1.360-573ca.tar.gz
> and
> built sane simply with
>
> ./configure
> make
> make install
>
> When I execute scanimage, it does not recognize basic long options. I get
> the
> error messages like
>
> scanimage: unrecognized option '--format=jpeg'
>
>
I downloaded and built said package and I don't see the same issue:

scanimage --format=tiff -d 'test:0' --resolution 200 -x 210.000 -y 296.985
--mode Color  --batch="sid-600-%03d.tiff" --source 'Automatic Document
Feeder' --batch-count=1

This works for me just fine.

Cheers,
Ralph