[sane-devel] patches for epjitsu backend
Peter Marschall
peter at adpm.de
Sun Nov 16 20:14:19 UTC 2014
Hi,
please have a look at my patches against epjitsu v26 on github:
https://github.com/marschap/sane-backends/tree/epjitsu-patches
and consider them parts for inclusion into sane-backends.
Here's the list of commit message together with additional comments
* epjitsu: read page_width pixels from scanner
* epjitsu: run change_params after changing page_width
* epjitsu: do not hardcode user-changeable options in change_params()
In addition, add a sanity check for tl_y.
These 3 commits revert some of the changes in epjitsu v26
that broke setting the width of a scanned page.
(epjitsu v26 always scans with the full scanner width, which may be OK for
flatbed, but is a tad silly for ADF)
* epjitsu: enforce range.max >= range.min in option descriptors
In the option descriptor definitions of tl_x, tl_y, br_x & br_y
make sure the the maximal value of the range is not smaller than
the minimal value.
Defensive programming: it hurt me once, so I fixed it ;-)
* epjitsu: sane_start() - get hardware status at least once
It seems, the S1300i does not work without get_hardware_status() being
called at least once. Call it in sane_open() to make the S1300i happy.
Without this change, the S1300i cannot be used with scanimage,
scanadf, ...
I did not find any other way of making my S1300i work reliably.
* epjitsu: refactor attach_one() - split out init_user()
The user defaults used are for DIN A4 with 600dpi scans.
This is what the S1300i supports.
* epjitsu: refactor attach_one() - split out init_model()
* epjitsu: refactor attach_one() - split out init_options()
No functional changes.
Shorten attach_one() by splitting it into multiple functions.
(original idea by m. allan noah in a patchset for initial S1300i/S1100
support)
* epjitsu: fix start & finish DBG() calls in coarsecal*()
Adapt levels for start & finish logging to match the documentation
and the other functions.
* epjitsu: instrument finecal_send_cal() & finecal_get_line() with DBG() calls
No functional changes.
Consistency with other functions: correct call graphs when debugging
* epjitsu.c: fix typo
* constrain -> contraints
The commit message says it all
* epjitsu: refactor sane_get_devices()
* flexibilize config file format
- allow initial spaces
- accept firmware filename with and without quotes
* change logic for 'global_firmware_filename'
- make it a pointer instead of an array [for sanei_config_get_string()]
- make it static: only use is in epjitsu.c
* report missing firmware name using DBG()
* space police: remove trailing spaces
* be explicit about (in)equality to NULL, 0, or '\0'
* code harmonization
- consistent 4-spaces indent
- spaces around operators, after commas and keywords
- no space between function name and braces aaround arguments
safer, more flexible, more easily readable
* epjitsu: introduce & use MAX() & MIN()
shorter code; make the intentions a lot more clearer than if..then..else..
* epjitsu: use ternary ?: operator in some functions
* epjitsu: make assignments clearer by using the ?: operator
Make single assignments that depend on conditions clearer by
converting them from the longer
if (condition) {
variable = value-if-true;
} else {
variable = value-if-false;
}
to
variable = (condition) ? value-if-true : value-if-false;
Better readability: make the intensions clearer, shorter code
* epjitsu: simplify calls to do_cmd()
* do not re-use cmd array by changing elements and/or length,
instead declare specific *_cmd arrays for each individual do_cmd() call
* do not unnecessarily declare cmdLen variables for the length of cmd,
instead use sizeof(cmd) wherever possible
* replace "magic" size values by sizeof()
The commit message says it: better readability, less chances for errors,
let the computer do the mundane tasks itself.
Thanks for considering the inclusion into sane-backends
Peter
--
Peter Marschall
peter at adpm.de
More information about the sane-devel
mailing list