Nov. 3, 2025
4:51 p.m.
On Mon Nov 3 16:51:21 2025 +0000, Bernd Herd wrote: > I'd like to thank Ivan Lyugaev very much for this patch. > However I found a problem with this patch occuring with my test scanner. > That problem results in being unable to change the scan resolution to > anything but 75 DPI. > The scanner has two scan sources ADF and Flatbed. The scan resolutions > for both are different, essentially ADF is limited to 300 DPI. > Setting the scan source changes the resolution to the default 75 DPI. > Even if the value for the scan source has not changed. So even if > setting to Flatbet when Flatbet was already set. > My test scanner is an HP Officejet Pro 8600 N911a . Sane services are > implemented in hplip. On Debian: > ``` > apt source hplip > sed -n '560,563p' hplip-3.22.10+dfsg0/scan/sane/ledm.c > i = session->adf_resolutionList[0] + 1; > while(i--) session->resolutionList[i] = session->adf_resolutionList[i]; > } > ps->currentResolution = session->resolutionList[1]; > ``` > Since the code from this patch always transfers all parameters to the > sane source, and the source has a higher parameter index number than the > resolution, it always overwrites the resolution successfully just set by > setting the scan source immediatly afterwards. So the dialog control > still shows 300 DPI, but the scanner sees resultionList\[1\]=75 DPI. > Since a solution should not only solve the problem for just that one > device, and the parameter indices are different depending on the device > type, a solution to this problem is tricky. > A suggested solution could be to transfer parameters twice: > 1. Set all parameters > 2. Ask for all parameter values and only set those parameters again, > that are different. So resolution would be different (75 DPI) but scan > source would be unchanged from the first run, so not set. So it wouldn't > overwrite resolution again. > Yours > Bernd Herd > :grinning: I guess a general solution that won't loop infinitely in case of impossible combinations could be: * Change only the parameters that are configured differently from their current value. * After changing a parameter, recheck all previous parameters, changing and rechecking the ones before that, if necessary. * Load the values into the dialog after making all parameter changes. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/9184#note_120550