From: Ilia Docin ilya.docin@contentai.ru
--- dlls/sane.ds/capability.c | 22 +++++++++++++++------- dlls/sane.ds/options.c | 6 +----- dlls/sane.ds/unixlib.c | 1 - dlls/sane.ds/unixlib.h | 1 - 4 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/dlls/sane.ds/capability.c b/dlls/sane.ds/capability.c index bfd9aa6a2de..c75c7d36e7f 100644 --- a/dlls/sane.ds/capability.c +++ b/dlls/sane.ds/capability.c @@ -298,7 +298,7 @@ static TW_UINT16 find_value_pos(const char* value, const char* values, TW_UINT16 { if (!strcmp(value, values)) return index; - value += buf_len; + values += buf_len; } return buf_count; } @@ -313,9 +313,13 @@ static TW_UINT16 SANE_ICAPPixelType (pTW_CAPABILITY pCapability, TW_UINT16 actio TW_UINT16 current_pixeltype = TWPT_BW; enum { buf_len = 64, buf_count = 3 }; char color_modes[buf_len * buf_count] = {'\0'}, current_mode[buf_len] = {'\0'}, *output = 0; - static const WCHAR* bw[] = {L"Lineart", L"Black", L"Binary", L"Threshold", L"Mono", 0}; - static const WCHAR* gray[] = {L"Gray", L"gray", 0}; - static const WCHAR* rgb[] = {L"Color", 0}; + /* most of the values are taken from https://gitlab.gnome.org/GNOME/simple-scan/-/blob/master/src/scanner.vala */ + static const WCHAR* bw[] = {L"Lineart", L"LineArt", L"Black & White", L"Binary", L"Thresholded", + L"1-bit Black & White", L"Black and White - Line Art", L"Black and White - Halftone", L"Monochrome", L"bw", 0}; + static const WCHAR* gray[] = {L"Gray", L"Grayscale", L"True Gray", L"8-bit Grayscale", L"Grayscale - 256 Levels", + L"gray", 0}; + static const WCHAR* rgb[] = {L"Color", L"24bit Color[Fast]", L"24bit Color", L"24 bit Color", + L"Color - 16 Million Colors", L"color", 0}; static const WCHAR* const* filter[] = {bw, gray, rgb, 0};
TRACE("ICAP_PIXELTYPE\n"); @@ -950,8 +954,12 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac TW_BOOL enabled; enum { buf_len = 64, buf_count = 2 }; char paper_sources[buf_len * buf_count] = {'\0'}, current_source[buf_len] = {'\0'}, *output = 0; - static const WCHAR* flatbed[] = {L"Flatbed", L"FlatBed", L"Platen", 0}; - static const WCHAR* autofeeder[] = {L"ADF", L"DP", L"Auto"}; + /* most of the values are taken from https://gitlab.gnome.org/GNOME/simple-scan/-/blob/master/src/scanner.vala */ + static const WCHAR* flatbed[] = {L"Flatbed", L"FlatBed", L"Platen", L"Normal", L"Document Table", 0}; + static const WCHAR* autofeeder[] = {L"Auto", L"ADF", L"ADF Front", L"ADF Back", L"adf", + L"Automatic Document Feeder", L"Automatic Document Feeder(centrally aligned)", + L"Automatic Document Feeder(center aligned)", L"Automatic Document Feeder(left aligned)", + L"ADF Simplex" L"DP", 0}; static const WCHAR* const* filter[] = {flatbed, autofeeder, 0};
TRACE("CAP_FEEDERENABLED\n"); @@ -1008,7 +1016,7 @@ static TW_UINT16 SANE_CAPFeederEnabled (pTW_CAPABILITY pCapability, TW_UINT16 ac break;
case MSG_RESET: - val = *(paper_sources + buf_len) ? 1 : 0; + val = *(paper_sources + buf_len) ? 1 : 0; // set to Auto/ADF if it's supported output = paper_sources + val * buf_len; TRACE("Resetting paper source to %lu: %s\n", val, output); twCC = set_option_value("source", output); diff --git a/dlls/sane.ds/options.c b/dlls/sane.ds/options.c index be3c61ffdde..fd80efb4145 100644 --- a/dlls/sane.ds/options.c +++ b/dlls/sane.ds/options.c @@ -59,7 +59,6 @@ TW_UINT16 sane_option_set_int(const char *option_name, int val, BOOL *needs_relo { struct option_descriptor opt; TW_UINT16 rc = sane_find_option(option_name, TYPE_INT, &opt); - if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, &val, needs_reload ); return rc; @@ -78,7 +77,6 @@ TW_UINT16 sane_option_set_bool(const char *option_name, int val ) { struct option_descriptor opt; TW_UINT16 rc = sane_find_option(option_name, TYPE_BOOL, &opt); - if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, &val, NULL ); return rc; @@ -104,7 +102,6 @@ TW_UINT16 sane_option_set_str(const char *option_name, char *val, BOOL *needs_re { struct option_descriptor opt; TW_UINT16 rc = sane_find_option(option_name, TYPE_STRING, &opt); - if (!opt.is_settable) return TWCC_OPERATIONERROR;
if (rc == TWCC_SUCCESS) rc = sane_option_set_value( opt.optno, val, needs_reload ); return rc; @@ -124,7 +121,7 @@ static TW_UINT32 sane_categorize_value(const WCHAR* value, const WCHAR* const* f { for(j=0; filter[i][j]; ++j) { - if (wcsstr(value, filter[i][j])) + if (!wcscmp(value, filter[i][j])) { wcstombs(categories, value, buf_len); return i; @@ -144,7 +141,6 @@ TW_UINT16 sane_option_probe_str(const char* option_name, const WCHAR* const* fil
if (rc != TWCC_SUCCESS) return rc; if (opt.size > buf_len) return TWCC_BADVALUE; - if (rc != TWCC_SUCCESS) return rc;
if (opt.constraint_type == CONSTRAINT_STRING_LIST) { diff --git a/dlls/sane.ds/unixlib.c b/dlls/sane.ds/unixlib.c index 69f085450a8..897aa09e5ef 100644 --- a/dlls/sane.ds/unixlib.c +++ b/dlls/sane.ds/unixlib.c @@ -159,7 +159,6 @@ static void map_descr( struct option_descriptor *descr, const SANE_Option_Descri descr->constraint_type = map_constraint_type( opt->constraint_type ); descr->size = opt->size; descr->is_active = SANE_OPTION_IS_ACTIVE( opt->cap ); - descr->is_settable = SANE_OPTION_IS_SETTABLE( opt->cap ); if (opt->title) len = ntdll_umbstowcs( opt->title, strlen(opt->title), descr->title, ARRAY_SIZE(descr->title) ); descr->title[len] = 0; diff --git a/dlls/sane.ds/unixlib.h b/dlls/sane.ds/unixlib.h index 34e7a9a9796..d3ffbf1878d 100644 --- a/dlls/sane.ds/unixlib.h +++ b/dlls/sane.ds/unixlib.h @@ -39,7 +39,6 @@ struct option_descriptor int optno; int size; int is_active; - int is_settable; enum { TYPE_BOOL, TYPE_INT, TYPE_FIXED, TYPE_STRING, TYPE_BUTTON, TYPE_GROUP } type; enum { UNIT_NONE, UNIT_PIXEL, UNIT_BIT, UNIT_MM, UNIT_DPI, UNIT_PERCENT, UNIT_MICROSECOND } unit; enum { CONSTRAINT_NONE, CONSTRAINT_RANGE, CONSTRAINT_WORD_LIST, CONSTRAINT_STRING_LIST } constraint_type;