summaryrefslogtreecommitdiff
path: root/include/sane/sanei_usb.h
diff options
context:
space:
mode:
authorJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
committerJörg Frings-Fürst <debian@jff-webhosting.net>2020-02-02 17:13:42 +0100
commit3dade5db2a37543f19f0967901d8d80a52a1e459 (patch)
tree808b2499b54563b3290f34d70d159b1024310873 /include/sane/sanei_usb.h
parent5bb4cf12855ec0151de15d6c5a2354ff08766957 (diff)
parentffa8801644a7d53cc1c785e3450f794c07a14eb0 (diff)
Update upstream source from tag 'upstream/1.0.29'
Update to upstream version '1.0.29' with Debian dir 2d358af604988ebe4348e38096245d66036fe5ed
Diffstat (limited to 'include/sane/sanei_usb.h')
-rw-r--r--include/sane/sanei_usb.h51
1 files changed, 51 insertions, 0 deletions
diff --git a/include/sane/sanei_usb.h b/include/sane/sanei_usb.h
index ce389ca..1c1699d 100644
--- a/include/sane/sanei_usb.h
+++ b/include/sane/sanei_usb.h
@@ -180,6 +180,57 @@ struct sanei_usb_dev_descriptor
SANE_Byte max_packet_size;
};
+/** Initialize sanei_usb for replay testing.
+
+ Initializes sanei_usb for testing by mocking whole USB stack. This function
+ must be called before sanei_usb_init().
+
+ The sanei_usb subsystem also implements a "development mode". It modifies
+ the XML data file with the actual commands of the test run and attemps to
+ proceed testing until a mismatching input command is found for which
+ input data is required.
+
+ A <known_commands_end/> node in the data XML file will cause sanei_usb not
+ to continue to the subsequent command in the XML file and instead it will
+ prepend all output commands before that node before an output command is
+ encountered.
+
+ @param path Path to the XML data file.
+ @param development_mode Enables development mode.
+ */
+extern SANE_Status sanei_usb_testing_enable_replay(SANE_String_Const path,
+ int development_mode);
+
+/** Initialize sanei_usb for recording.
+ *
+ * Initializes sanei_usb for recording communication with the scanner. This
+ * function must be called before sanei_usb_init().
+ *
+ * @param path Path to the XML data file.
+ * @param be_name The name of the backend to enable recording for.
+ */
+extern SANE_Status sanei_usb_testing_enable_record(SANE_String_Const path,
+ SANE_String_Const be_name);
+
+/** Returns backend name for testing.
+ *
+ * Returns backend name for the file registered in sanei_usb_testing_enable.
+ * The caller is responsible for freeing it.
+ */
+extern SANE_String sanei_usb_testing_get_backend();
+
+/** Returns SANE_TRUE if replay testing mode is enabled, i.e. whether we are working with fake
+ * scan data.
+ */
+extern SANE_Bool sanei_usb_is_replay_mode_enabled();
+
+/** Records a debug message in the captured USB data if testing mode is enabled. If testing mode
+ * is not enabled, this function does nothing.
+ *
+ * @param msg Message to record
+ */
+extern void sanei_usb_testing_record_message(SANE_String_Const message);
+
/** Initialize sanei_usb.
*
* Call this before any other sanei_usb function.