Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
513b2b54
Commit
513b2b54
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 suport for CAP_AUTOFEED, make batch scans the default.
parent
eae4ac9e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
130 additions
and
4 deletions
+130
-4
capability.c
dlls/sane.ds/capability.c
+85
-0
options.c
dlls/sane.ds/options.c
+27
-0
sane_i.h
dlls/sane.ds/sane_i.h
+3
-0
sane_main.c
dlls/sane.ds/sane_main.c
+9
-4
dsm.c
dlls/twain_32/tests/dsm.c
+6
-0
No files found.
dlls/sane.ds/capability.c
View file @
513b2b54
...
...
@@ -166,6 +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
,
ICAP_XFERMECH
,
ICAP_PIXELTYPE
,
ICAP_UNITS
,
ICAP_BITDEPTH
,
ICAP_COMPRESSION
,
ICAP_PIXELFLAVOR
,
ICAP_XRESOLUTION
,
ICAP_YRESOLUTION
,
ICAP_PHYSICALHEIGHT
,
ICAP_PHYSICALWIDTH
};
...
...
@@ -815,6 +816,72 @@ static TW_UINT16 SANE_ICAPPixelFlavor (pTW_CAPABILITY pCapability, TW_UINT16 act
return
twCC
;
}
/* CAP_AUTOFEED */
static
TW_UINT16
SANE_CAPAutofeed
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
)
{
TW_UINT16
twCC
=
TWCC_BADCAP
;
#ifdef SONAME_LIBSANE
TW_UINT32
val
;
SANE_Bool
autofeed
;
SANE_Status
status
;
TRACE
(
"CAP_AUTOFEED
\n
"
);
if
(
sane_option_get_bool
(
activeDS
.
deviceHandle
,
"batch-scan"
,
&
autofeed
,
NULL
)
!=
SANE_STATUS_GOOD
)
return
TWCC_BADCAP
;
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
,
autofeed
);
break
;
case
MSG_SET
:
twCC
=
msg_set
(
pCapability
,
&
val
);
if
(
twCC
==
TWCC_SUCCESS
)
{
if
(
val
)
autofeed
=
SANE_TRUE
;
else
autofeed
=
SANE_FALSE
;
status
=
sane_option_set_bool
(
activeDS
.
deviceHandle
,
"batch-scan"
,
autofeed
,
NULL
);
if
(
status
!=
SANE_STATUS_GOOD
)
{
ERR
(
"Error %s: Could not set batch-scan to %d
\n
"
,
psane_strstatus
(
status
),
autofeed
);
return
sane_status_to_twcc
(
status
);
}
}
break
;
case
MSG_GETDEFAULT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_BOOL
,
SANE_TRUE
);
break
;
case
MSG_RESET
:
autofeed
=
SANE_TRUE
;
status
=
sane_option_set_bool
(
activeDS
.
deviceHandle
,
"batch-scan"
,
autofeed
,
NULL
);
if
(
status
!=
SANE_STATUS_GOOD
)
{
ERR
(
"Error %s: Could not reset batch-scan to SANE_TRUE
\n
"
,
psane_strstatus
(
status
));
return
sane_status_to_twcc
(
status
);
}
/* .. fall through intentional .. */
case
MSG_GETCURRENT
:
twCC
=
set_onevalue
(
pCapability
,
TWTY_BOOL
,
autofeed
);
break
;
}
#endif
return
twCC
;
}
TW_UINT16
SANE_SaneCapability
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
)
{
...
...
@@ -839,6 +906,10 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
twCC
=
SANE_CAPUiControllable
(
pCapability
,
action
);
break
;
case
CAP_AUTOFEED
:
twCC
=
SANE_CAPAutofeed
(
pCapability
,
action
);
break
;
case
ICAP_PIXELTYPE
:
twCC
=
SANE_ICAPPixelType
(
pCapability
,
action
);
break
;
...
...
@@ -891,3 +962,17 @@ TW_UINT16 SANE_SaneCapability (pTW_CAPABILITY pCapability, TW_UINT16 action)
return
twCC
;
}
TW_UINT16
SANE_SaneSetDefaults
(
void
)
{
TW_CAPABILITY
cap
;
memset
(
&
cap
,
0
,
sizeof
(
cap
));
cap
.
Cap
=
CAP_AUTOFEED
;
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 @
513b2b54
...
...
@@ -85,6 +85,33 @@ SANE_Status sane_option_set_int(SANE_Handle h, const char *option_name, SANE_Int
return
psane_control_option
(
h
,
optno
,
SANE_ACTION_SET_VALUE
,
(
void
*
)
&
val
,
status
);
}
SANE_Status
sane_option_get_bool
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Bool
*
val
,
SANE_Int
*
status
)
{
SANE_Status
rc
;
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
rc
=
sane_find_option
(
h
,
option_name
,
&
opt
,
&
optno
,
SANE_TYPE_BOOL
);
if
(
rc
!=
SANE_STATUS_GOOD
)
return
rc
;
return
psane_control_option
(
h
,
optno
,
SANE_ACTION_GET_VALUE
,
(
void
*
)
val
,
status
);
}
SANE_Status
sane_option_set_bool
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Bool
val
,
SANE_Int
*
status
)
{
SANE_Status
rc
;
int
optno
;
const
SANE_Option_Descriptor
*
opt
;
rc
=
sane_find_option
(
h
,
option_name
,
&
opt
,
&
optno
,
SANE_TYPE_BOOL
);
if
(
rc
!=
SANE_STATUS_GOOD
)
return
rc
;
return
psane_control_option
(
h
,
optno
,
SANE_ACTION_SET_VALUE
,
(
void
*
)
&
val
,
status
);
}
/* 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 @
513b2b54
...
...
@@ -85,6 +85,7 @@ struct tagActiveDS
/* Helper functions */
extern
TW_UINT16
SANE_SaneCapability
(
pTW_CAPABILITY
pCapability
,
TW_UINT16
action
);
extern
TW_UINT16
SANE_SaneSetDefaults
(
void
);
/* Implementation of operation triplets
* From Application to Source (Control Information) */
...
...
@@ -228,6 +229,8 @@ SANE_Status sane_option_probe_resolution(SANE_Handle h, const char *option_name,
SANE_Status
sane_option_probe_mode
(
SANE_Handle
h
,
SANE_String_Const
**
choices
,
char
*
current
,
int
current_size
);
SANE_Status
sane_option_probe_scan_area
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Fixed
*
val
,
SANE_Unit
*
unit
,
SANE_Fixed
*
min
,
SANE_Fixed
*
max
,
SANE_Fixed
*
quant
);
SANE_Status
sane_option_get_bool
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Bool
*
val
,
SANE_Int
*
status
);
SANE_Status
sane_option_set_bool
(
SANE_Handle
h
,
const
char
*
option_name
,
SANE_Bool
val
,
SANE_Int
*
status
);
#endif
...
...
dlls/sane.ds/sane_main.c
View file @
513b2b54
...
...
@@ -661,11 +661,16 @@ static TW_UINT16 SANE_OpenDS( pTW_IDENTITY pOrigin, pTW_IDENTITY self) {
}
status
=
psane_open
(
sane_devlist
[
i
]
->
name
,
&
activeDS
.
deviceHandle
);
if
(
status
==
SANE_STATUS_GOOD
)
{
activeDS
.
currentState
=
4
;
activeDS
.
twCC
=
TWRC_SUCCESS
;
return
TWRC_SUCCESS
;
activeDS
.
twCC
=
SANE_SaneSetDefaults
();
if
(
activeDS
.
twCC
==
TWCC_SUCCESS
)
{
activeDS
.
currentState
=
4
;
return
TWRC_SUCCESS
;
}
else
psane_close
(
activeDS
.
deviceHandle
);
}
ERR
(
"sane_open(%s): %s
\n
"
,
sane_devlist
[
i
]
->
name
,
psane_strstatus
(
status
));
else
ERR
(
"sane_open(%s): %s
\n
"
,
sane_devlist
[
i
]
->
name
,
psane_strstatus
(
status
));
return
TWRC_FAILURE
;
}
#endif
dlls/twain_32/tests/dsm.c
View file @
513b2b54
...
...
@@ -578,6 +578,12 @@ static void test_single_source(TW_IDENTITY *appid, TW_IDENTITY *source)
if
(
capabilities
[
ICAP_YRESOLUTION
])
test_resolution
(
appid
,
source
,
ICAP_YRESOLUTION
,
TWQC_GET
|
TWQC_SET
|
TWQC_GETDEFAULT
|
TWQC_GETCURRENT
|
TWQC_RESET
);
/* Optional capabilities */
if
(
capabilities
[
CAP_AUTOFEED
])
test_onevalue_cap
(
appid
,
source
,
CAP_AUTOFEED
,
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