]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
add option descriptor file
authorBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jan 2024 07:39:34 +0000 (08:39 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Sun, 28 Jan 2024 07:39:34 +0000 (08:39 +0100)
CMakeLists.txt
src/kds_s2000w_net.c
src/kds_s2000w_option_descriptors.c [new file with mode: 0644]
src/kds_s2000w_option_descriptors.h [new file with mode: 0644]

index 40bcd5284a56747ec690456d5ef9944a653a6bb0..57077871c44c41481b1fe6170630e5b4a8d1d6fa 100644 (file)
@@ -9,6 +9,7 @@ find_package(JSON-C REQUIRED)
 add_library("sane-kds_s2000w_net"
        SHARED
        "src/kds_s2000w_net.c"
+       "src/kds_s2000w_option_descriptors.c"
        "src/kds_s2000w_handler.c"
        "src/kds_s2000w_client.c")
 set_target_properties("sane-kds_s2000w_net" PROPERTIES VERSION 1)
index 8c6e055a505ab42096a6347ef43df8b0e0efb97e..b36007929d8ed565fe7e5e9296559608e8516ac1 100644 (file)
@@ -3,6 +3,7 @@
 #include <string.h>
 #include <sane/sane.h>
 #include <sane/saneopts.h>
+#include "kds_s2000w_option_descriptors.h"
 #include "kds_s2000w_handler.h"
 
 #define MAX_OPTION_COUNT 24
@@ -171,13 +172,7 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
 {
        switch (option) {
                case 0:
-                       option_descriptors[option].name = SANE_NAME_NUM_OPTIONS;
-                       option_descriptors[option].title = SANE_TITLE_NUM_OPTIONS;
-                       option_descriptors[option].desc = SANE_DESC_NUM_OPTIONS;
-                       option_descriptors[option].unit = SANE_UNIT_NONE;
-                       option_descriptors[option].cap = SANE_CAP_SOFT_DETECT;
-                       option_descriptors[option].constraint_type = SANE_CONSTRAINT_NONE;
-                       option_descriptors[option].constraint.string_list = NULL;
+                       kds_s2000w_option_descriptor_num_options(&option_descriptors[option]);
                        break;
                case 1:
                        option_descriptors[option].name = SANE_NAME_STANDARD;
@@ -443,7 +438,6 @@ const SANE_Option_Descriptor* _sane_kds_s2000w_net_get_option_descriptor(
 
 
        switch (option) {
-               case 0:
                case 2:
                case 8:
                case 12:
diff --git a/src/kds_s2000w_option_descriptors.c b/src/kds_s2000w_option_descriptors.c
new file mode 100644 (file)
index 0000000..fa42589
--- /dev/null
@@ -0,0 +1,16 @@
+#include <stddef.h>
+#include <sane/saneopts.h>
+#include "kds_s2000w_option_descriptors.h"
+
+void kds_s2000w_option_descriptor_num_options(SANE_Option_Descriptor* descriptor)
+{
+               descriptor->name = SANE_NAME_NUM_OPTIONS;
+               descriptor->title = SANE_TITLE_NUM_OPTIONS;
+               descriptor->desc = SANE_DESC_NUM_OPTIONS;
+               descriptor->unit = SANE_UNIT_NONE;
+               descriptor->cap = SANE_CAP_SOFT_DETECT;
+               descriptor->constraint_type = SANE_CONSTRAINT_NONE;
+               descriptor->constraint.string_list = NULL;
+               descriptor->type = SANE_TYPE_INT;
+               descriptor->size = sizeof(SANE_Int);
+}
\ No newline at end of file
diff --git a/src/kds_s2000w_option_descriptors.h b/src/kds_s2000w_option_descriptors.h
new file mode 100644 (file)
index 0000000..aefa49f
--- /dev/null
@@ -0,0 +1,5 @@
+#ifndef KDS_S2000W_OPTION_DESCRIPTORS_H
+#include <sane/sane.h>
+
+void kds_s2000w_option_descriptor_num_options(SANE_Option_Descriptor* descriptor);
+#endif
\ No newline at end of file