Log message improvements.

merge-requests/317/merge
Thierry HUCHARD 2020-01-11 08:56:46 +01:00
rodzic aedebecef7
commit d8f983bbd9
12 zmienionych plików z 338 dodań i 17 usunięć

Wyświetl plik

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="UTF-8"?>
<scan:ScannerCapabilities xmlns:scan="http://schemas.hp.com/imaging/escl/2011/05/03" xmlns:pwg="http://www.pwg.org/schemas/2010/12/sm">
<pwg:Version>2.63</pwg:Version>
<pwg:MakeAndModel>EPSON ET-3750 Series</pwg:MakeAndModel>
<pwg:SerialNumber>583445553030353862</pwg:SerialNumber>
<scan:UUID>cfe92100-67c4-11d4-a45f-f8d0273406ee</scan:UUID>
<scan:AdminURI>http://192.168.0.73:80/PRESENTATION/BONJOUR</scan:AdminURI>
<scan:IconURI>https://192.168.0.73:443/PRESENTATION/AIRPRINT/PRINTER_128.PNG</scan:IconURI>
<scan:Platen>
<scan:PlatenInputCaps>
<scan:MinWidth>96</scan:MinWidth>
<scan:MaxWidth>2550</scan:MaxWidth>
<scan:MinHeight>96</scan:MinHeight>
<scan:MaxHeight>3510</scan:MaxHeight>
<scan:MaxScanRegions>1</scan:MaxScanRegions>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>BlackAndWhite1</scan:ColorMode>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode>RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:DocumentFormats>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
<scan:DocumentFormatExt>image/jpeg</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>300</scan:XResolution>
<scan:YResolution>300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>1200</scan:XResolution>
<scan:YResolution>1200</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
<scan:ColorSpaces>
<scan:ColorSpace scan:default="true">sRGB</scan:ColorSpace>
</scan:ColorSpaces>
<scan:CcdChannels>
<scan:CcdChannel scan:default="true">NTSC</scan:CcdChannel>
</scan:CcdChannels>
<scan:BinaryRenderings>
<scan:BinaryRendering>Threshold</scan:BinaryRendering>
<scan:BinaryRendering scan:default="true">Halftone</scan:BinaryRendering>
</scan:BinaryRenderings>
<scan:ContentTypes>
<pwg:ContentType>Photo</pwg:ContentType>
<pwg:ContentType>Text</pwg:ContentType>
<pwg:ContentType>TextAndPhoto</pwg:ContentType>
</scan:ContentTypes>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Photo</scan:Intent>
<scan:Intent>Preview</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>1200</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>1200</scan:MaxOpticalYResolution>
<scan:RiskyLeftMargin>17</scan:RiskyLeftMargin>
<scan:RiskyRightMargin>17</scan:RiskyRightMargin>
<scan:RiskyTopMargin>17</scan:RiskyTopMargin>
<scan:RiskyBottomMargin>17</scan:RiskyBottomMargin>
</scan:PlatenInputCaps>
</scan:Platen>
<scan:Adf>
<scan:AdfSimplexInputCaps>
<scan:MinWidth>96</scan:MinWidth>
<scan:MaxWidth>2550</scan:MaxWidth>
<scan:MinHeight>96</scan:MinHeight>
<scan:MaxHeight>4200</scan:MaxHeight>
<scan:MaxScanRegions>1</scan:MaxScanRegions>
<scan:SettingProfiles>
<scan:SettingProfile>
<scan:ColorModes>
<scan:ColorMode>BlackAndWhite1</scan:ColorMode>
<scan:ColorMode>Grayscale8</scan:ColorMode>
<scan:ColorMode>RGB24</scan:ColorMode>
</scan:ColorModes>
<scan:DocumentFormats>
<pwg:DocumentFormat>application/pdf</pwg:DocumentFormat>
<pwg:DocumentFormat>image/jpeg</pwg:DocumentFormat>
<scan:DocumentFormatExt>application/pdf</scan:DocumentFormatExt>
<scan:DocumentFormatExt>image/jpeg</scan:DocumentFormatExt>
</scan:DocumentFormats>
<scan:SupportedResolutions>
<scan:DiscreteResolutions>
<scan:DiscreteResolution>
<scan:XResolution>100</scan:XResolution>
<scan:YResolution>100</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>200</scan:XResolution>
<scan:YResolution>200</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>300</scan:XResolution>
<scan:YResolution>300</scan:YResolution>
</scan:DiscreteResolution>
<scan:DiscreteResolution>
<scan:XResolution>600</scan:XResolution>
<scan:YResolution>600</scan:YResolution>
</scan:DiscreteResolution>
</scan:DiscreteResolutions>
</scan:SupportedResolutions>
<scan:ColorSpaces>
<scan:ColorSpace scan:default="true">sRGB</scan:ColorSpace>
</scan:ColorSpaces>
<scan:CcdChannels>
<scan:CcdChannel scan:default="true">NTSC</scan:CcdChannel>
</scan:CcdChannels>
<scan:BinaryRenderings>
<scan:BinaryRendering>Threshold</scan:BinaryRendering>
<scan:BinaryRendering scan:default="true">Halftone</scan:BinaryRendering>
</scan:BinaryRenderings>
<scan:ContentTypes>
<pwg:ContentType>Photo</pwg:ContentType>
<pwg:ContentType>Text</pwg:ContentType>
<pwg:ContentType>TextAndPhoto</pwg:ContentType>
</scan:ContentTypes>
</scan:SettingProfile>
</scan:SettingProfiles>
<scan:SupportedIntents>
<scan:Intent>Document</scan:Intent>
<scan:Intent>TextAndGraphic</scan:Intent>
<scan:Intent>Photo</scan:Intent>
<scan:Intent>Preview</scan:Intent>
</scan:SupportedIntents>
<scan:MaxOpticalXResolution>600</scan:MaxOpticalXResolution>
<scan:MaxOpticalYResolution>600</scan:MaxOpticalYResolution>
<scan:RiskyLeftMargin>17</scan:RiskyLeftMargin>
<scan:RiskyRightMargin>17</scan:RiskyRightMargin>
<scan:RiskyTopMargin>35</scan:RiskyTopMargin>
<scan:RiskyBottomMargin>35</scan:RiskyBottomMargin>
</scan:AdfSimplexInputCaps>
<scan:FeederCapacity>50</scan:FeederCapacity>
<scan:Justification>
<pwg:XImagePosition>Right</pwg:XImagePosition>
<pwg:YImagePosition>Top</pwg:YImagePosition>
</scan:Justification>
<scan:AdfOptions>
<scan:AdfOption>DetectPaperLoaded</scan:AdfOption>
</scan:AdfOptions>
</scan:Adf>
<scan:BrightnessSupport>
<scan:Min>-100</scan:Min>
<scan:Max>100</scan:Max>
<scan:Normal>0</scan:Normal>
<scan:Step>1</scan:Step>
</scan:BrightnessSupport>
<scan:CompressionFactorSupport>
<scan:Min>1</scan:Min>
<scan:Max>3</scan:Max>
<scan:Normal>2</scan:Normal>
<scan:Step>1</scan:Step>
</scan:CompressionFactorSupport>
<scan:ContrastSupport>
<scan:Min>-100</scan:Min>
<scan:Max>100</scan:Max>
<scan:Normal>0</scan:Normal>
<scan:Step>1</scan:Step>
</scan:ContrastSupport>
<scan:SharpenSupport>
<scan:Min>0</scan:Min>
<scan:Max>3</scan:Max>
<scan:Normal>2</scan:Normal>
<scan:Step>1</scan:Step>
</scan:SharpenSupport>
<scan:ThresholdSupport>
<scan:Min>0</scan:Min>
<scan:Max>255</scan:Max>
<scan:Normal>186</scan:Normal>
<scan:Step>1</scan:Step>
</scan:ThresholdSupport>
</scan:ScannerCapabilities>

Wyświetl plik

@ -35,7 +35,6 @@
#include "../include/sane/sanei.h"
#include "../include/sane/sanei_backend.h"
#include "../include/sane/sanei_config.h"
#include "../include/sane/sanei_debug.h"
#define min(A,B) (((A)<(B)) ? (A) : (B))
#define max(A,B) (((A)>(B)) ? (A) : (B))
@ -150,6 +149,7 @@ convertFromESCLDev(ESCL_Device *cdev)
snprintf(tmp, sizeof(tmp), "http://%s:%d", cdev->ip_address, cdev->port_nb);
else
snprintf(tmp, sizeof(tmp), "https://%s:%d", cdev->ip_address, cdev->port_nb);
DBG( 1, "Escl add device : %s\n", tmp);
sdev->name = strdup(tmp);
sdev->model = strdup(cdev->model_name);
sdev->vendor = strdup("ESCL");

Wyświetl plik

@ -48,6 +48,19 @@
#define BACKEND_NAME escl
#endif
#define DEBUG_NOT_STATIC
#include "../include/sane/sanei_debug.h"
#ifndef DBG_LEVEL
#define DBG_LEVEL PASTE(sanei_debug_, BACKEND_NAME)
#endif
#ifndef NDEBUG
# define DBGDUMP(level, buf, size) \
do { if (DBG_LEVEL >= (level)) sanei_escl_dbgdump(buf, size); } while (0)
#else
# define DBGDUMP(level, buf, size)
#endif
#define ESCL_CONFIG_FILE "escl.conf"
typedef struct {

Wyświetl plik

@ -21,6 +21,8 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
@ -346,15 +348,17 @@ escl_capabilities(SANE_String_Const name, SANE_Status *status)
curl_handle = curl_easy_init();
strcpy(tmp, name);
strcat(tmp, scanner_capabilities);
DBG( 1, "Get Capabilities : %s\n", tmp);
curl_easy_setopt(curl_handle, CURLOPT_URL, tmp);
if (strncmp(name, "https", 5) == 0) {
DBG( 1, "Ignoring safety certificates, use https\n");
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L);
}
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_c);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var);
if (curl_easy_perform(curl_handle) != CURLE_OK) {
fprintf(stderr, "THERE IS NO SCANNER\n");
DBG( 1, "The scanner didn't respond.\n");
*status = SANE_STATUS_INVAL;
}
data = xmlReadMemory(var->memory, var->size, "file.xml", NULL, 0);

Wyświetl plik

@ -21,6 +21,9 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include <assert.h>
@ -142,21 +145,21 @@ escl_devices(SANE_Status *status)
*status = SANE_STATUS_GOOD;
if (!(simple_poll = avahi_simple_poll_new())) {
fprintf(stderr, "Failed to create simple poll object.\n");
DBG( 1, "Failed to create simple poll object.\n");
*status = SANE_STATUS_INVAL;
goto fail;
}
client = avahi_client_new(avahi_simple_poll_get(simple_poll), 0,
client_callback, NULL, &error);
if (!client) {
fprintf(stderr, "Failed to create client: %s\n", avahi_strerror(error));
DBG( 1, "Failed to create client: %s\n", avahi_strerror(error));
*status = SANE_STATUS_INVAL;
goto fail;
}
if (!(sb = avahi_service_browser_new(client, AVAHI_IF_UNSPEC,
AVAHI_PROTO_UNSPEC, "_uscan._tcp",
NULL, 0, browse_callback, client))) {
fprintf(stderr, "Failed to create service browser: %s\n",
DBG( 1, "Failed to create service browser: %s\n",
avahi_strerror(avahi_client_errno(client)));
*status = SANE_STATUS_INVAL;
goto fail;
@ -165,7 +168,7 @@ escl_devices(SANE_Status *status)
AVAHI_PROTO_UNSPEC,
"_uscans._tcp", NULL, 0,
browse_callback, client))) {
fprintf(stderr, "Failed to create service browser: %s\n",
DBG( 1, "Failed to create service browser: %s\n",
avahi_strerror(avahi_client_errno(client)));
*status = SANE_STATUS_INVAL;
goto fail;

Wyświetl plik

@ -1,3 +1,29 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2019 Touboul Nathane
Copyright (C) 2019 Thierry HUCHARD <thierry@ordissimo.com>
This file is part of the SANE package.
SANE is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
SANE is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with sane; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include "../include/sane/sanei.h"
@ -148,6 +174,7 @@ get_JPEG_data(capabilities_t *scanner, int *w, int *h, int *bps)
jpeg_destroy_decompress(&cinfo);
if (surface != NULL)
free(surface);
DBG( 1, "Escl Jpeg : Error reading jpeg\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;
@ -164,6 +191,7 @@ get_JPEG_data(capabilities_t *scanner, int *w, int *h, int *bps)
if (surface == NULL) {
jpeg_destroy_decompress(&cinfo);
fseek(scanner->tmp, start, SEEK_SET);
DBG( 1, "Escl Jpeg : Memory allocation problem\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;

Wyświetl plik

@ -21,6 +21,9 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include <stdio.h>
@ -108,7 +111,7 @@ download_callback(void *str, size_t size, size_t nmemb, void *userp)
char *content = realloc(download->memory, download->size + realsize + 1);
if (content == NULL) {
fprintf(stderr, "not enough memory (realloc returned NULL)\n");
DBG( 1, "Not enough memory (realloc returned NULL)\n");
return (0);
}
download->memory = content;
@ -145,16 +148,19 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
*status = SANE_STATUS_GOOD;
if (name == NULL || scanner == NULL) {
*status = SANE_STATUS_NO_MEM;
DBG( 1, "Create NewJob : the name or the scan are invalid.\n");
return (NULL);
}
upload = (struct uploading *)calloc(1, sizeof(struct uploading));
if (upload == NULL) {
*status = SANE_STATUS_NO_MEM;
DBG( 1, "Create NewJob : memory allocation failure\n");
return (NULL);
}
download = (struct downloading *)calloc(1, sizeof(struct downloading));
if (download == NULL) {
free(upload);
DBG( 1, "Create NewJob : memory allocation failure\n");
*status = SANE_STATUS_NO_MEM;
return (NULL);
}
@ -172,11 +178,12 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
}
else
format_ext = f_ext;
DBG( 1, "Create NewJob : %s\n", scanner->default_format);
if (curl_handle != NULL) {
snprintf(cap_data, sizeof(cap_data), settings, scanner->height, scanner->width, 0, 0, scanner->default_format,
format_ext,
scanner->default_color, scanner->default_resolution, scanner->default_resolution);
// fprintf(stderr, "CAP_DATA = %s\n", cap_data);
DBG( 1, "Create NewJob : %s\n", cap_data);
upload->read_data = strdup(cap_data);
upload->size = strlen(cap_data);
download->memory = malloc(1);
@ -194,7 +201,7 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
curl_easy_setopt(curl_handle, CURLOPT_HEADERFUNCTION, download_callback);
curl_easy_setopt(curl_handle, CURLOPT_HEADERDATA, (void *)download);
if (curl_easy_perform(curl_handle) != CURLE_OK) {
fprintf(stderr, "THERE IS NO SCANNER\n");
DBG( 1, "Create NewJob : the scanner responded incorrectly.\n");
*status = SANE_STATUS_INVAL;
}
else {
@ -209,16 +216,18 @@ escl_newjob (capabilities_t *scanner, SANE_String_Const name, SANE_Status *statu
*location = '\0';
result = strdup(temporary);
}
DBG( 1, "Create NewJob : %s\n", result);
}
free(download->memory);
}
else {
fprintf(stderr, "THERE IS NO LOCATION\n");
DBG( 1, "Create NewJob : The creation of the failed job\n");
*status = SANE_STATUS_INVAL;
}
}
else {
*status = SANE_STATUS_NO_MEM;
DBG( 1, "Create NewJob : The creation of the failed job\n");
return (NULL);
}
}

Wyświetl plik

@ -1,3 +1,29 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2019 Touboul Nathane
Copyright (C) 2019 Thierry HUCHARD <thierry@ordissimo.com>
This file is part of the SANE package.
SANE is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
SANE is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with sane; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include "../include/sane/sanei.h"
@ -37,7 +63,7 @@ get_PNG_data(capabilities_t *scanner, int *w, int *h, int *components)
// check for valid magic number
if (!png_check_sig (magic, sizeof (magic)))
{
fprintf(stderr,"PNG error: is not a valid PNG image!\n");
DBG( 1, "Escl Png : PNG error is not a valid PNG image!\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;
@ -49,6 +75,8 @@ get_PNG_data(capabilities_t *scanner, int *w, int *h, int *components)
(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!png_ptr)
{
DBG( 1, "Escl Png : PNG error create a png read struct\n");
if (scanner->tmp)
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;
@ -59,6 +87,7 @@ get_PNG_data(capabilities_t *scanner, int *w, int *h, int *components)
png_infop info_ptr = png_create_info_struct (png_ptr);
if (!info_ptr)
{
DBG( 1, "Escl Png : PNG error create a png info struct\n");
png_destroy_read_struct (&png_ptr, NULL, NULL);
if (scanner->tmp) {
fclose(scanner->tmp);
@ -78,6 +107,7 @@ get_PNG_data(capabilities_t *scanner, int *w, int *h, int *components)
fclose(scanner->tmp);
scanner->tmp = NULL;
}
DBG( 1, "Escl Png : PNG read error.\n");
return (SANE_STATUS_INVAL);
}
// setup libpng for using standard C fread() function

Wyświetl plik

@ -21,6 +21,9 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include <stdlib.h>
@ -53,7 +56,9 @@ CURL_CALL:
strcat(scan_cmd, result);
strcat(scan_cmd, scanner_start);
curl_easy_setopt(curl_handle, CURLOPT_URL, scan_cmd);
DBG( 1, "Reset Job : %s.\n", scan_cmd);
if (strncmp(name, "https", 5) == 0) {
DBG( 1, "Ignoring safety certificates, use https\n");
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L);
}

Wyświetl plik

@ -21,6 +21,9 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include <stdio.h>
@ -72,7 +75,9 @@ escl_scan(capabilities_t __sane_unused__ *scanner, SANE_String_Const name, char
strcat(scan_cmd, result);
strcat(scan_cmd, scanner_start);
curl_easy_setopt(curl_handle, CURLOPT_URL, scan_cmd);
if (strncmp(name, "https", 5) == 0) {
DBG( 1, "Scan : %s.\n", scan_cmd);
if (strncmp(name, "https", 5) == 0) {
DBG( 1, "Ignoring safety certificates, use https\n");
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L);
}

Wyświetl plik

@ -21,6 +21,9 @@
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include <stdio.h>
@ -50,7 +53,7 @@ memory_callback_s(void *contents, size_t size, size_t nmemb, void *userp)
char *str = realloc(mem->memory, mem->size + realsize + 1);
if (str == NULL) {
fprintf(stderr, "not enough memory (realloc returned NULL)\n");
DBG(1, "not enough memory (realloc returned NULL)\n");
return (0);
}
mem->memory = str;
@ -136,14 +139,16 @@ escl_status(SANE_String_Const name)
strcpy(tmp, name);
strcat(tmp, scanner_status);
curl_easy_setopt(curl_handle, CURLOPT_URL, tmp);
DBG( 1, "Get Status : %s.\n", tmp);
if (strncmp(name, "https", 5) == 0) {
DBG( 1, "Ignoring safety certificates, use https\n");
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0L);
}
curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, memory_callback_s);
curl_easy_setopt(curl_handle, CURLOPT_WRITEDATA, (void *)var);
if (curl_easy_perform(curl_handle) != CURLE_OK) {
fprintf(stderr, "THERE IS NO SCANNER\n");
DBG( 1, "The scanner didn't respond.\n");
status = SANE_STATUS_INVAL;
goto clean_data;
}

Wyświetl plik

@ -1,3 +1,29 @@
/* sane - Scanner Access Now Easy.
Copyright (C) 2019 Touboul Nathane
Copyright (C) 2019 Thierry HUCHARD <thierry@ordissimo.com>
This file is part of the SANE package.
SANE is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free
Software Foundation; either version 3 of the License, or (at your
option) any later version.
SANE is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with sane; see the file COPYING. If not, write to the Free
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
This file implements a SANE backend for eSCL scanners. */
#define DEBUG_DECLARE_ONLY
#include "../include/sane/config.h"
#include "escl.h"
#include "../include/sane/sanei.h"
@ -36,7 +62,7 @@ get_TIFF_data(capabilities_t *scanner, int *w, int *h, int *components)
lseek(fileno(scanner->tmp), 0, SEEK_SET);
tif = TIFFFdOpen(fileno(scanner->tmp), "temp", "r");
if (!tif) {
fprintf(stderr, "Can not open, or not a TIFF file.\n");
DBG( 1, "Escl Tiff : Can not open, or not a TIFF file.\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;
@ -50,7 +76,7 @@ get_TIFF_data(capabilities_t *scanner, int *w, int *h, int *components)
raster = (unsigned char*) malloc(npixels * sizeof (uint32));
if (raster != NULL)
{
fprintf(stderr, "Memory allocation problem.\n");
DBG( 1, "Escl Tiff : Memory allocation problem.\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;
@ -60,7 +86,7 @@ get_TIFF_data(capabilities_t *scanner, int *w, int *h, int *components)
if (!TIFFReadRGBAImage(tif, width, height, (uint32 *)raster, 0))
{
fprintf(stderr, "Problem reading image data.\n");
DBG( 1, "Escl Tiff : Problem reading image data.\n");
if (scanner->tmp) {
fclose(scanner->tmp);
scanner->tmp = NULL;