Within the TWAIN
specification, there is room for what they call "custom capabilities" or "custom
cap". This is a range of TWAIN Capability id's that are reserved to allow each
scanner manufacturer a place to put access to features that fall outside the
normal, spec-defined features in TWAIN.
TWAIN Custom capabilities are from 0x8000-0x8FFF
Some scanner manufacturers publish their custom capability ids and
functions, but most do not. So while DotTwain gives you the ability to get/set
custom caps (see Q10124 - FAQ: Can
DotTwain access custom capabilities? for the specifics on HOW to use them
once you've found them)
However, all is not lost.
If you have the actual scanner in question available, then you may be
able to find out the custom CAP ID for a feature you're interested in... this is
not a guarantee as the scanner must actually provide a means to set the feature
in its UI and must expose that feature as a TWAIN capability.
First, download Twister:
http://www.eztwain.com/twister.htm
Now, use it to run a report... if the capability you're looking for is of a
known type - let's say Boolean, then by looking at the report and finding all
the 0x8FFF caps that have a BOOLEAN type, you're partway there. Here's an
example from a recent case where a customer had a Canon DR-G1100 scanner, and
they were looking for a DoubleFeedDetection feature (which is likely a simple
Boolean value)
They ran Twister and it came back with a list of supported Caps:
CAP_SUPPORTEDCAPS:
GET.............uint16 ARRAY[ CAP_0x8101, CAP_0x8100,
CAP_AUTOFEED,
CAP_AUTOSCAN, CAP_0x801d, CAP_CAMERAENABLED,
CAP_0x801e,
CAP_CAMERAORDER, CAP_CAMERASIDE,
CAP_CUSTOMDSDATA,
CAP_CLEARPAGE, CAP_FEEDPAGE,
CAP_DEVICEONLINE, CAP_DUPLEX,
CAP_DUPLEXENABLED,
CAP_ENABLEDSUIONLY, CAP_ENDORSER,
CAP_FEEDERALIGNMENT,
CAP_FEEDERENABLED, CAP_FEEDERLOADED,
CAP_INDICATORS,
CAP_JOBCONTROL, CAP_PAPERDETECTABLE,
CAP_PRINTER,
CAP_PRINTERENABLED, CAP_PRINTERINDEX,
CAP_PRINTERMODE,
CAP_PRINTERSTRING, CAP_SUPPORTEDCAPS,
CAP_UICONTROLLABLE,
CAP_XFERCOUNT, ICAP_AUTOBRIGHT,
ICAP_AUTOSIZE,
ICAP_AUTOMATICBORDERDETECTION,
ICAP_BITDEPTH,
ICAP_BITDEPTHREDUCTION, ICAP_BITORDER,
ICAP_BRIGHTNESS,
ICAP_COMPRESSION, ICAP_CONTRAST,
ICAP_EXTIMAGEINFO,
ICAP_FILTER, ICAP_FRAMES,
ICAP_HALFTONES,
ICAP_IMAGEFILEFORMAT, ICAP_JPEGQUALITY,
ICAP_MAXFRAMES,
ICAP_MINIMUMHEIGHT, ICAP_MINIMUMWIDTH,
ICAP_ORIENTATION,
ICAP_PHYSICALWIDTH, ICAP_PHYSICALHEIGHT,
ICAP_PIXELFLAVOR,
ICAP_PIXELTYPE, ICAP_PLANARCHUNKY,
ICAP_ROTATION,
ICAP_SUPPORTEDSIZES,
ICAP_UNDEFINEDIMAGESIZE, ICAP_UNITS,
ICAP_XFERMECH,
ICAP_XRESOLUTION, ICAP_YRESOLUTION,
CAP_0x8034,
CAP_0x8062, CAP_0x8049, CAP_0x804a,
CAP_0x8069,
CAP_0x80a1, CAP_0x8003, CAP_0x8029,
CAP_0x805d,
CAP_0x8057, CAP_0x806b, CAP_0x8000,
CAP_0x800d,
CAP_0x80b8, CAP_0x8006, CAP_0x8007,
ICAP_THRESHOLD,
CAP_0x8036, CAP_0x8035, CAP_0x8001,
CAP_0x8076,
CAP_0x8037, CAP_0x8058, CAP_0x8059,
CAP_0x8065,
CAP_0x8042, CAP_0x8070, CAP_0x8079,
CAP_0x8077,
CAP_0x8078, CAP_0x8025, CAP_0x8008,
CAP_0x8032,
CAP_0x8011, CAP_0x8009, CAP_0x800b,
CAP_0x80b4,
CAP_0x800c, CAP_0x80b3, CAP_0x806c,
CAP_0x806f,
CAP_0x806e, CAP_0x80a4, CAP_0x80a3,
CAP_0x8043,
CAP_0x8018, CAP_0x8004, CAP_0x8016,
CAP_0x803f,
CAP_0x8040, CAP_0x807e, CAP_0x8080,
CAP_0x8081,
CAP_0x803b, CAP_0x8068, CAP_0x806a,
CAP_0x805f,
CAP_0x8060, CAP_0x8087, CAP_0x8086,
CAP_0x8053,
CAP_0x8088, CAP_0x8061, CAP_0x803d,
CAP_0x80eb,
ICAP_AUTOMATICDESKEW, CAP_0x802a, CAP_0x80a2,
CAP_0x8082,
CAP_SERIALNUMBER, CAP_0x8089, CAP_0x8084,
CAP_0x808a,
CAP_0x80b0, CAP_0x80b1, CAP_0x80ae,
CAP_0x80af,
CAP_0x800e, CAP_0x80f8, CAP_0x80f9,
CAP_0x8063,
CAP_0x80e8, CAP_0x80da ]
Great, now, looking at all CAP_0x8FFF (I've pruned the list of all but custom
caps that have BOOLEAN value types:
CAP_0x801d:
GET.............bool TRUE
CAP_0x80eb:
GET.............bool ENUM{ FALSE, TRUE } Current: FALSE,
Default: FALSE
CAP_0x8100:
GET.............bool FALSE
CAP_0x8101:
GET.............bool FALSE
Now, searching for these in your favorite search engine may in fact reveal
one of our own KB articles:
Q10372 - PRB:
AutoDiscardBlankPages Doesn't Work With Canon Scanners
... and it just so happens that it mentions that cap 0x8001 is used to enable/disable
auto blank page detection. So, unless you were looking for Blank Page Detection
(hint: look in the article, there's another cap you need to make it work for
Cannon Scanners that support it), you can just cross it off the list of
candidates for the DoubleFeedError reporting. (since hypothetically, that's what
we're looking for)
So, now you need another tool... This time, it's TWIRL Twain Protocol
Analyzer - TWISTER gave us a generic list of all features the scanner reported
supporting and what happened when it get/set them, but it didn't identify the
one(s) of interest entirely. So download Twirl.
TWIRL Twain Probe
Remember,
custom capabilities show up in Twirl as CAP_0x8002, CAP_0x801d, etc.
1. Open and enable the TWAIN driver (which brings up the driver's UI)
2.
In Twirl, enable the 'monitor' mode (a two-state pushbutton under the
Capabilities list)
3. In the scanner UI, change the setting of interest e.g.
from Document to Photo
4. Watch to see if Twirl detects a capability
changing.
If you are lucky, you'll see the value clearly toggling and you can then use
the approach mentioned here to set or get
the value as needed.
However, this doesn't always work. So you have to go through the custom
capabilities 'by hand' so to speak
1. Put the TWAIN driver into the Open
state.
2. Note the value of all the custom capabilities that seem like they
might control the feature you're after.
(In our DoubleFeedDetection example,
it's probably going to be Boolean or an enum that parses to Boolean, so not an
integer or string .)
3. Enable the driver and change Document to Photo or
vice versa.
4. Disable the driver or start a scan, forcing the driver to
'save' what is shown in it's UI
5. Back in Twirl go through and click on each
possible custom capability which triggers a 'MSG_GET' which shows the latest
value. Again, you are looking for one that has changed.
6. Assuming you find
it, you can use the [Set] and [Reset] buttons to see if you can control the
setting (SET it, then Enable the driver, see what the UI shows, Disable the
driver, SET a different value, Enable the driver, see if the UI value has
changed.)
Original Article:
Q10398 - HOWTO: Track Down a TWAIN Custom Capability