Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
28b708ca
Commit
28b708ca
authored
Mar 05, 2009
by
Jeremy White
Committed by
Alexandre Julliard
Mar 06, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
sane.ds: Add support for CAP_FEEDERENABLED.
parent
513b2b54
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
105 additions
and
1 deletion
+105
-1
capability.c
dlls/sane.ds/capability.c
+86
-1
options.c
dlls/sane.ds/options.c
+15
-0
sane_i.h
dlls/sane.ds/sane_i.h
+1
-0
dsm.c
dlls/twain_32/tests/dsm.c
+3
-0
No files found.
dlls/sane.ds/capability.c
View file @
28b708ca
...
...
@@ -166,7 +166,7 @@ static TW_UINT16 TWAIN_GetSupportedCaps(pTW_CAPABILITY pCapability)
{
TW_ARRAY
*
a
;
static
const
UINT16
supported_caps
[]
=
{
CAP_SUPPORTEDCAPS
,
CAP_XFERCOUNT
,
CAP_UICONTROLLABLE
,
CAP_AUTOFEED
,
CAP_AUTOFEED
,
CAP_FEEDERENABLED
,
ICAP_XFERMECH
,
ICAP_PIXELTYPE
,
ICAP_UNITS
,
ICAP_BITDEPTH
,
ICAP_COMPRESSION
,
ICAP_PIXELFLAVOR
,
ICAP_XRESOLUTION
,
ICAP_YRESOLUTION
,
ICAP_PHYSICALHEIGHT
,
ICAP_PHYSICALWIDTH
};
...
...
@@ -881,6 +881,80 @@ static TW_UINT16 SANE_CAPAutofeed (pTW_CAPABILITY pCapability, TW_UINT16 action)
return
twCC
;
}
/* CAP_FEEDERENABLED */
static
TW_UINT16
SANE_CAPFeederEnabled
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
)
{
TW_UINT16
twCC
=
TWCC_BADCAP
;
#ifdef SONAME_LIBSANE
TW_UINT32
val
;
TW_BOOL
enabled
;
SANE_Status
status
;
SANE_Char
source
[
64
];
TRACE
(
"CAP_FEEDERENABLED
\n
"
);
if
(
sane_option_get_str
(
activeDS
.
deviceHandle
,
SANE_NAME_SCAN_SOURCE
,
source
,
sizeof
(
source
),
NULL
)
!=
SANE_STATUS_GOOD
)
return
TWCC_BADCAP
;
if
(
strcmp
(
source
,
"Auto"
)
==
0
||
strcmp
(
source
,
"ADF"
)
==
0
)
enabled
=
TRUE
;
else
enabled
=
FALSE
;
switch
(
action
)
{
case
MSG_QUERYSUPPORT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_INT32
,
TWQC_GET
|
TWQC_SET
|
TWQC_GETDEFAULT
|
TWQC_GETCURRENT
|
TWQC_RESET
);
break
;
case
MSG_GET
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_BOOL
,
enabled
);
break
;
case
MSG_SET
:
twCC
=
msg_set
(
pCapability
,
&
val
);
if
(
twCC
==
TWCC_SUCCESS
)
{
if
(
val
)
enabled
=
TRUE
;
else
enabled
=
FALSE
;
strcpy
(
source
,
"ADF"
);
status
=
sane_option_set_str
(
activeDS
.
deviceHandle
,
SANE_NAME_SCAN_SOURCE
,
source
,
NULL
);
if
(
status
!=
SANE_STATUS_GOOD
)
{
strcpy
(
source
,
"Auto"
);
status
=
sane_option_set_str
(
activeDS
.
deviceHandle
,
SANE_NAME_SCAN_SOURCE
,
source
,
NULL
);
}
if
(
status
!=
SANE_STATUS_GOOD
)
{
ERR
(
"Error %s: Could not set source to either ADF or Auto
\n
"
,
psane_strstatus
(
status
));
return
sane_status_to_twcc
(
status
);
}
}
break
;
case
MSG_GETDEFAULT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_BOOL
,
TRUE
);
break
;
case
MSG_RESET
:
strcpy
(
source
,
"Auto"
);
if
(
sane_option_set_str
(
activeDS
.
deviceHandle
,
SANE_NAME_SCAN_SOURCE
,
source
,
NULL
)
==
SANE_STATUS_GOOD
)
enabled
=
TRUE
;
twCC
=
TWCC_SUCCESS
;
/* .. fall through intentional .. */
case
MSG_GETCURRENT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_BOOL
,
enabled
);
break
;
}
#endif
return
twCC
;
}
TW_UINT16
SANE_SaneCapability
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
)
...
...
@@ -910,6 +984,10 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
twCC
=
SANE_CAPAutofeed
(
pCapability
,
action
);
break
;
case
CAP_FEEDERENABLED
:
twCC
=
SANE_CAPFeederEnabled
(
pCapability
,
action
);
break
;
case
ICAP_PIXELTYPE
:
twCC
=
SANE_ICAPPixelType
(
pCapability
,
action
);
break
;
...
...
@@ -974,5 +1052,12 @@ TW_UINT16 SANE_SaneSetDefaults (void)
if
(
SANE_SaneCapability
(
&
cap
,
MSG_RESET
)
==
TWCC_SUCCESS
)
GlobalFree
(
cap
.
hContainer
);
memset
(
&
cap
,
0
,
sizeof
(
cap
));
cap
.
Cap
=
CAP_FEEDERENABLED
;
cap
.
ConType
=
TWON_DONTCARE16
;
if
(
SANE_SaneCapability
(
&
cap
,
MSG_RESET
)
==
TWCC_SUCCESS
)
GlobalFree
(
cap
.
hContainer
);
return
TWCC_SUCCESS
;
}
dlls/sane.ds/options.c
View file @
28b708ca
...
...
@@ -111,6 +111,21 @@ SANE_Status sane_option_set_bool(SANE_Handle h, const char *option_name, SANE_Bo
return
psane_control_option
(
h
,
optno
,
SANE_ACTION_SET_VALUE
,
(
void
*
)
&
val
,
status
);
}
SANE_Status
sane_option_get_str
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_String
val
,
size_t
len
,
SANE_Int
*
status
)
{
SANE_Status
rc
;
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
rc
=
sane_find_option
(
h
,
option_name
,
&
opt
,
&
optno
,
SANE_TYPE_STRING
);
if
(
rc
!=
SANE_STATUS_GOOD
)
return
rc
;
if
(
opt
->
size
<
len
)
return
psane_control_option
(
h
,
optno
,
SANE_ACTION_GET_VALUE
,
(
void
*
)
val
,
status
);
else
return
SANE_STATUS_NO_MEM
;
}
/* Important: SANE has the side effect of of overwriting val with the returned value */
SANE_Status
sane_option_set_str
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_String
val
,
SANE_Int
*
status
)
...
...
dlls/sane.ds/sane_i.h
View file @
28b708ca
...
...
@@ -224,6 +224,7 @@ HWND ScanningDialogBox(HWND dialog, LONG progress);
#ifdef SONAME_LIBSANE
SANE_Status
sane_option_get_int
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Int
*
val
);
SANE_Status
sane_option_set_int
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Int
val
,
SANE_Int
*
status
);
SANE_Status
sane_option_get_str
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_String
val
,
size_t
len
,
SANE_Int
*
status
);
SANE_Status
sane_option_set_str
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_String
val
,
SANE_Int
*
status
);
SANE_Status
sane_option_probe_resolution
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Int
*
minval
,
SANE_Int
*
maxval
,
SANE_Int
*
quant
);
SANE_Status
sane_option_probe_mode
(
SANE_Handle
h
,
SANE_String_Const
**
choices
,
char
*
current
,
int
current_size
);
...
...
dlls/twain_32/tests/dsm.c
View file @
28b708ca
...
...
@@ -583,6 +583,9 @@ static void test_single_source(TW_IDENTITY *appid, TW_IDENTITY *source)
if
(
capabilities
[
CAP_AUTOFEED
])
test_onevalue_cap
(
appid
,
source
,
CAP_AUTOFEED
,
TWTY_BOOL
,
TWQC_GET
|
TWQC_SET
|
TWQC_GETDEFAULT
|
TWQC_GETCURRENT
|
TWQC_RESET
);
if
(
capabilities
[
CAP_FEEDERENABLED
])
test_onevalue_cap
(
appid
,
source
,
CAP_FEEDERENABLED
,
TWTY_BOOL
,
TWQC_GET
|
TWQC_SET
|
TWQC_GETDEFAULT
|
TWQC_GETCURRENT
|
TWQC_RESET
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment