]> gitweb.hhaalo.de Git - sane-kds-s2000w-net.git/commitdiff
get and init device
authorBastian Dehn <hhaalo@arcor.de>
Fri, 19 Jan 2024 18:08:01 +0000 (19:08 +0100)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 19 Jan 2024 18:08:01 +0000 (19:08 +0100)
src/kds_s2000w_net.c

index b22c2157b547dca05383aad8afb4d86a53a321e9..cc636934371f4c54d7a06e84445a0abf48e94a3d 100644 (file)
@@ -2,6 +2,8 @@
 #include <stdlib.h>
 #include <sane/sane.h>
 
+SANE_Device* device = NULL;
+
 SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback authorize)
 {
        if (version_code == NULL) {
@@ -14,6 +16,12 @@ SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback
                return SANE_STATUS_INVAL;
        }
 
+       device = malloc(sizeof(SANE_Device));
+       device->name = "kds_s2000w_net";
+       device->vendor = 0;
+       device->model = "Kodak Alaris s2000w series";
+       device->type = "document scanner";
+
        *version_code = SANE_VERSION_CODE(1, 0, 0);
        printf("init: version_code %ui\n", version_code);
        printf("init: kds_s2000w_net init\n");
@@ -23,14 +31,25 @@ SANE_Status _sane_kds_s2000w_net_init(SANE_Int* version_code, SANE_Auth_Callback
 
 void _sane_kds_s2000w_net_exit(void)
 {
+       free(device);
        printf("kds_s2000w_net exit\n");
 }
 
 SANE_Status _sane_kds_s2000w_net_get_devices(SANE_Device*** device_list,
        SANE_Bool local_only)
 {
+       if (device_list == NULL) {
+               printf("device list pointer is null\n");
+       }
+
+       if (local_only) {
+               return SANE_STATUS_INVAL;
+       }
+
        printf("kds_s2000w_net get devices\n");
 
+       **device_list = device;
+
        return SANE_STATUS_GOOD;
 }