sane_backends: bump version (#4934)

This commit is contained in:
kenmays
2020-05-11 10:03:02 -07:00
committed by GitHub
parent 46416147a3
commit 5e7c4ef16c
5 changed files with 225 additions and 817 deletions

View File

@@ -1,491 +0,0 @@
From 285f210af3fbe69247d0bdddad794c0a68ffef66 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 24 Apr 2015 23:24:30 +1000
Subject: Fix for gcc2
diff --git a/sanei/sanei_thread.c b/sanei/sanei_thread.c
index fd58af2..9ac397f 100644
--- a/sanei/sanei_thread.c
+++ b/sanei/sanei_thread.c
@@ -486,6 +486,7 @@ sanei_thread_sendsig( SANE_Pid pid, int sig )
SANE_Pid
sanei_thread_waitpid( SANE_Pid pid, int *status )
{
+ int rc;
#ifdef USE_PTHREAD
int *ls;
#else
@@ -499,7 +500,6 @@ sanei_thread_waitpid( SANE_Pid pid, int *status )
DBG(2, "sanei_thread_waitpid() - %ld\n",
sanei_thread_pid_to_long(pid));
#ifdef USE_PTHREAD
- int rc;
rc = pthread_join( (pthread_t)pid, (void*)&ls );
if( 0 == rc ) {
--
2.2.2
From f8cce1fbe95aa3cc42b42dcf41fabf9c5590effc Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 25 Apr 2015 14:00:41 +1000
Subject: Fix for gcc2
diff --git a/backend/epson2_net.h b/backend/epson2_net.h
index 6aef2b7..b00b48c 100644
--- a/backend/epson2_net.h
+++ b/backend/epson2_net.h
@@ -2,6 +2,11 @@
#define _EPSON2_NET_H_
#include <sys/types.h>
+
+#ifdef __HAIKU__
+#include <sys/select.h>
+#endif
+
#include "../include/sane/sane.h"
extern int sanei_epson_net_read(struct Epson_Scanner *s, unsigned char *buf, ssize_t buf_size,
diff --git a/backend/epsonds-cmd.c b/backend/epsonds-cmd.c
index 5fb1f9d..a766c9f 100644
--- a/backend/epsonds-cmd.c
+++ b/backend/epsonds-cmd.c
@@ -225,9 +225,11 @@ static SANE_Status esci2_cmd_simple(epsonds_scanner* s, char *cmd, SANE_Status (
SANE_Status esci2_fin(epsonds_scanner *s)
{
+ SANE_Status status;
+
DBG(5, "%s\n", __func__);
- SANE_Status status = esci2_cmd_simple(s, "FIN x0000000", NULL);
+ status = esci2_cmd_simple(s, "FIN x0000000", NULL);
s->locked = 0;
return status;
}
@@ -260,6 +262,7 @@ static int decode_value(char *buf, int len)
/* h000 */
static char *decode_binary(char *buf)
{
+ int hl;
char tmp[6];
memcpy(tmp, buf, 4);
@@ -268,7 +271,7 @@ static char *decode_binary(char *buf)
if (buf[0] != 'h')
return NULL;
- int hl = strtol(tmp + 1, NULL, 16);
+ hl = strtol(tmp + 1, NULL, 16);
if (hl) {
char *v = malloc(hl + 1);
@@ -283,12 +286,13 @@ static char *decode_binary(char *buf)
static char *decode_string(char *buf)
{
+ char *p;
char *s = decode_binary(buf);
if (s == NULL)
return NULL;
/* trim white space at the end */
- char *p = s + strlen(s);
+ p = s + strlen(s);
while (*--p == ' ')
*p = '\0';
@@ -310,13 +314,13 @@ static SANE_Status info_cb(void *userdata, char *token, int len)
{
epsonds_scanner *s = (epsonds_scanner *)userdata;
+ /* pointer to the token's value */
+ char *value = token + 3;
+
if (DBG_LEVEL >= 11) {
debug_token(DBG_LEVEL, __func__, token, len);
}
- /* pointer to the token's value */
- char *value = token + 3;
-
/* nrd / nrdBUSY */
if (strncmp("nrd", token, 3) == 0) {
@@ -537,11 +541,11 @@ static SANE_Status info_cb(void *userdata, char *token, int len)
SANE_Status esci2_info(epsonds_scanner *s)
{
- DBG(1, "= gathering device information\n");
-
SANE_Status status;
int i = 4;
+ DBG(1, "= gathering device information\n");
+
do {
status = esci2_cmd_simple(s, "INFOx0000000", &info_cb);
if (status == SANE_STATUS_DEVICE_BUSY) {
@@ -798,11 +802,11 @@ static SANE_Status img_cb(void *userdata, char *token, int len)
if (strncmp("err", token, 3) == 0) {
- s->scanning = 0;
-
char *option = token + 3; /* ADF, TPU, FB */
char *cause = token + 3 + 4; /* OPN, PJ, PE, ERR, LTF, LOCK, DFED, DTCL, AUT, PERM */
+ s->scanning = 0;
+
DBG(1, "%s: error on option %3.3s, cause %4.4s\n",
__func__, option, cause);
@@ -837,6 +841,11 @@ SANE_Status
esci2_img(struct epsonds_scanner *s, SANE_Int *length)
{
SANE_Status status = SANE_STATUS_GOOD;
+ SANE_Status parse_status;
+
+ ssize_t read;
+
+ unsigned int more = 0;
*length = 0;
@@ -857,13 +866,13 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length)
}
/* check if we need to read any image data */
- unsigned int more = 0;
+ more = 0;
if (!esci2_check_header("IMG ", (char *)s->buf, &more)) {
return SANE_STATUS_IO_ERROR;
}
/* this handles eof and errors */
- SANE_Status parse_status = esci2_parse_block((char *)s->buf + 12, 64 - 12, s, &img_cb);
+ parse_status = esci2_parse_block((char *)s->buf + 12, 64 - 12, s, &img_cb);
/* no more data? return using the status of the esci2_parse_block
* call, which might hold other error conditions.
@@ -873,7 +882,7 @@ esci2_img(struct epsonds_scanner *s, SANE_Int *length)
}
/* ALWAYS read image data */
- ssize_t read = eds_recv(s, s->buf, more, &status);
+ read = eds_recv(s, s->buf, more, &status);
if (status != SANE_STATUS_GOOD) {
return status;
}
diff --git a/backend/epsonds-jpeg.c b/backend/epsonds-jpeg.c
index d825d99..03dc6b3 100644
--- a/backend/epsonds-jpeg.c
+++ b/backend/epsonds-jpeg.c
@@ -13,6 +13,10 @@
#define DEBUG_DECLARE_ONLY
+#ifdef __HAIKU__
+#define _STDLIB_H_
+#endif
+
#include <math.h>
#include "epsonds.h"
@@ -47,6 +51,7 @@ jpeg_term_source(j_decompress_ptr UNUSEDARG cinfo)
METHODDEF(boolean)
jpeg_fill_input_buffer(j_decompress_ptr cinfo)
{
+ int size;
epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src;
/* read from the scanner or the ring buffer */
@@ -57,7 +62,7 @@ jpeg_fill_input_buffer(j_decompress_ptr cinfo)
}
/* read from scanner if no data? */
- int size = min(1024, avail);
+ size = min(1024, avail);
eds_ring_read(src->s->current, src->buffer, size);
@@ -129,12 +134,14 @@ eds_jpeg_read_header(epsonds_scanner *s)
if (jpeg_start_decompress(&s->jpeg_cinfo)) {
+ int size;
+
DBG(3, "%s: w: %d, h: %d, components: %d\n",
__func__,
s->jpeg_cinfo.output_width, s->jpeg_cinfo.output_height,
s->jpeg_cinfo.output_components);
- int size = s->jpeg_cinfo.output_width * s->jpeg_cinfo.output_components * 1;
+ size = s->jpeg_cinfo.output_width * s->jpeg_cinfo.output_components * 1;
src->linebuffer = (*s->jpeg_cinfo.mem->alloc_large)((j_common_ptr)&s->jpeg_cinfo,
JPOOL_PERMANENT, size);
@@ -166,13 +173,14 @@ void
eds_jpeg_read(SANE_Handle handle, SANE_Byte *data,
SANE_Int max_length, SANE_Int *length)
{
+ int l;
epsonds_scanner *s = handle;
- *length = 0;
-
struct jpeg_decompress_struct cinfo = s->jpeg_cinfo;
epsonds_src_mgr *src = (epsonds_src_mgr *)s->jpeg_cinfo.src;
+ *length = 0;
+
/* copy from line buffer if available */
if (src->linebuffer_size && src->linebuffer_index < src->linebuffer_size) {
@@ -196,7 +204,7 @@ eds_jpeg_read(SANE_Handle handle, SANE_Byte *data,
* only one line at time is supported
*/
- int l = jpeg_read_scanlines(&cinfo, s->jdst->buffer, 1);
+ l = jpeg_read_scanlines(&cinfo, s->jdst->buffer, 1);
if (l == 0) {
return;
}
diff --git a/backend/epsonds-ops.c b/backend/epsonds-ops.c
index 94f1071..e4a6291 100644
--- a/backend/epsonds-ops.c
+++ b/backend/epsonds-ops.c
@@ -48,9 +48,10 @@ eds_dev_init(epsonds_device *dev)
SANE_Status
eds_dev_post_init(struct epsonds_device *dev)
{
+ SANE_String_Const *source_list_add = source_list;
+
DBG(10, "%s\n", __func__);
- SANE_String_Const *source_list_add = source_list;
if (dev->has_fb)
*source_list_add++ = FBF_STR;
@@ -336,13 +337,14 @@ eds_copy_image_from_ring(epsonds_scanner *s, SANE_Byte *data, SANE_Int max_lengt
if (s->params.depth == 1) {
while (lines--) {
+ int i;
+ SANE_Byte *p;
eds_ring_read(s->current, s->line_buffer, s->params.bytes_per_line);
eds_ring_skip(s->current, s->dummy);
- int i;
- SANE_Byte *p = s->line_buffer;
+ p = s->line_buffer;
for (i = 0; i < s->params.bytes_per_line; i++) {
*data++ = ~*p++;
@@ -379,12 +381,13 @@ SANE_Status eds_ring_init(ring_buffer *ring, SANE_Int size)
SANE_Status eds_ring_write(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
{
+ SANE_Int tail = ring->end - ring->wp;
+
if (size > (ring->size - ring->fill)) {
DBG(1, "ring buffer full, requested: %d, available: %d\n", size, ring->size - ring->fill);
return SANE_STATUS_NO_MEM;
}
- SANE_Int tail = ring->end - ring->wp;
if (size < tail) {
memcpy(ring->wp, buf, size);
@@ -409,6 +412,8 @@ SANE_Status eds_ring_write(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
SANE_Int eds_ring_read(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
{
+ SANE_Int tail = ring->end - ring->rp;
+
DBG(18, "reading from ring, %d bytes available\n", (int)ring->fill);
/* limit read to available */
@@ -417,7 +422,6 @@ SANE_Int eds_ring_read(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
size = ring->fill;
}
- SANE_Int tail = ring->end - ring->rp;
if (size < tail) {
memcpy(buf, ring->rp, size);
@@ -444,11 +448,12 @@ SANE_Int eds_ring_read(ring_buffer *ring, SANE_Byte *buf, SANE_Int size)
SANE_Int eds_ring_skip(ring_buffer *ring, SANE_Int size)
{
+ SANE_Int tail = ring->end - ring->rp;
+
/* limit skip to available */
if (size > ring->fill)
size = ring->fill;
- SANE_Int tail = ring->end - ring->rp;
if (size < tail) {
ring->rp += size;
} else {
diff --git a/backend/epsonds.c b/backend/epsonds.c
index d16744f..5a5f5b1 100644
--- a/backend/epsonds.c
+++ b/backend/epsonds.c
@@ -192,14 +192,14 @@ open_scanner(epsonds_scanner *s)
static SANE_Status
validate_usb(struct epsonds_scanner *s)
{
- DBG(1, "%s\n", __func__);
-
SANE_Status status;
int vendor, product;
int i = 0, numIds;
SANE_Bool is_valid = SANE_FALSE;
+ DBG(1, "%s\n", __func__);
+
/* if the sanei_usb_get_vendor_product call is not supported,
* then we just ignore this and rely on the user to config
* the correct device.
@@ -386,10 +386,11 @@ static SANE_Status
attach(const char *name, int type)
{
SANE_Status status;
+ epsonds_scanner *s;
DBG(7, "%s: devname = %s, type = %d\n", __func__, name, type);
- epsonds_scanner *s = device_detect(name, type, &status);
+ s = device_detect(name, type, &status);
if (s == NULL)
return status;
@@ -1116,6 +1117,9 @@ sane_get_parameters(SANE_Handle handle, SANE_Parameters *params)
SANE_Status
sane_start(SANE_Handle handle)
{
+ /* set scanning parameters */
+ char cmd[100]; /* take care not to overflow */
+
epsonds_scanner *s = (epsonds_scanner *)handle;
char buf[64];
SANE_Status status = 0;
@@ -1178,10 +1182,6 @@ sane_start(SANE_Handle handle)
print_params(s->params);
- /* set scanning parameters */
-
- char cmd[100]; /* take care not to overflow */
-
/* document source */
if (strcmp(source_list[s->val[OPT_SOURCE].w], ADF_STR) == 0) {
@@ -1264,6 +1264,7 @@ SANE_Status
sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length,
SANE_Int *length)
{
+ SANE_Int available;
SANE_Int read = 0, tries = 3;
SANE_Status status = 0;
epsonds_scanner *s = (epsonds_scanner *)handle;
@@ -1279,7 +1280,7 @@ sane_read(SANE_Handle handle, SANE_Byte *data, SANE_Int max_length,
}
/* anything in the buffer? pass it to the frontend */
- SANE_Int available = eds_ring_avail(s->current);
+ available = eds_ring_avail(s->current);
if (available) {
DBG(18, "reading from ring buffer, %d left\n", available);
--
2.2.2
From 4b7f9a60223c5e8c99b54ff57b52303c14819106 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 25 Apr 2015 14:14:31 +1000
Subject: Disable HAVE_IFADDRS_H for Haiku
diff --git a/backend/pixma_bjnp.c b/backend/pixma_bjnp.c
index dece926..6668713 100644
--- a/backend/pixma_bjnp.c
+++ b/backend/pixma_bjnp.c
@@ -106,6 +106,11 @@
# define SSIZE_MAX LONG_MAX
#endif
+
+#ifdef __HAIKU__
+#undef HAVE_IFADDRS_H
+#endif
+
/* static data */
static bjnp_device_t device[BJNP_NO_DEVICES];
static int bjnp_no_devices = 0;
--
2.2.2
From 8ef1284bbc93e1d7657433b24e053c13ede7f284 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 25 Apr 2015 16:00:27 +1000
Subject: Hack: cut off sanei_usb_clear_halt for Haiku
diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c
index f210d4f..fc569ac 100644
--- a/sanei/sanei_usb.c
+++ b/sanei/sanei_usb.c
@@ -2184,7 +2184,7 @@ sanei_usb_clear_halt (SANE_Int dn)
DBG (1, "sanei_usb_clear_halt: dn >= device number || dn < 0\n");
return SANE_STATUS_INVAL;
}
-
+#ifndef __HAIKU__
#ifdef HAVE_LIBUSB
/* This call seems to be required by Linux xhci driver
@@ -2227,7 +2227,7 @@ sanei_usb_clear_halt (SANE_Int dn)
#else /* not HAVE_LIBUSB && not HAVE_LIBUSB_1_0 */
DBG (1, "sanei_usb_clear_halt: libusb support missing\n");
#endif /* HAVE_LIBUSB || HAVE_LIBUSB_1_0 */
-
+#endif
return SANE_STATUS_GOOD;
}
--
2.2.2
From 5ea3cd7f4eb408791ff1c6a22b0711d43d3f208c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 25 Apr 2015 16:39:38 +1000
Subject: Disable IPV6 for pixma backend
diff --git a/backend/pixma_bjnp.c b/backend/pixma_bjnp.c
index 6668713..c253ba4 100644
--- a/backend/pixma_bjnp.c
+++ b/backend/pixma_bjnp.c
@@ -109,6 +109,7 @@
#ifdef __HAIKU__
#undef HAVE_IFADDRS_H
+#undef ENABLE_IPV6
#endif
/* static data */
--
2.2.2

View File

@@ -1,189 +0,0 @@
From 10dfdaf9098330b1480b3b231ec92c2b49432269 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 13 Nov 2015 11:26:01 +0000
Subject: Fix build
diff --git a/backend/epsonds-jpeg.c b/backend/epsonds-jpeg.c
index 62e8bb5..a8bc98f 100644
--- a/backend/epsonds-jpeg.c
+++ b/backend/epsonds-jpeg.c
@@ -15,6 +15,10 @@
#include "sane/config.h"
+#ifdef __HAIKU__
+#define _STDLIB_H_
+#endif
+
#include <math.h>
#include "epsonds.h"
@@ -49,8 +53,8 @@ jpeg_term_source(j_decompress_ptr __sane_unused__ cinfo)
METHODDEF(boolean)
jpeg_fill_input_buffer(j_decompress_ptr cinfo)
{
- epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src;
int avail, size;
+ epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src;
/* read from the scanner or the ring buffer */
diff --git a/backend/pixma_bjnp.c b/backend/pixma_bjnp.c
index fc4c501..76e058e 100644
--- a/backend/pixma_bjnp.c
+++ b/backend/pixma_bjnp.c
@@ -106,6 +106,10 @@
# define SSIZE_MAX LONG_MAX
#endif
+#ifdef __HAIKU__
+#undef HAVE_IFADDRS_H
+#endif
+
/* static data */
static bjnp_device_t device[BJNP_NO_DEVICES];
static int bjnp_no_devices = 0;
diff --git a/sanei/sanei_thread.c b/sanei/sanei_thread.c
index fcf52c1..5a1d63e 100644
--- a/sanei/sanei_thread.c
+++ b/sanei/sanei_thread.c
@@ -484,6 +484,7 @@ SANE_Pid
sanei_thread_waitpid( SANE_Pid pid, int *status )
{
#ifdef USE_PTHREAD
+ int rc;
int *ls;
#else
int ls;
@@ -496,7 +497,6 @@ sanei_thread_waitpid( SANE_Pid pid, int *status )
DBG(2, "sanei_thread_waitpid() - %ld\n",
sanei_thread_pid_to_long(pid));
#ifdef USE_PTHREAD
- int rc;
rc = pthread_join( (pthread_t)pid, (void*)&ls );
if( 0 == rc ) {
diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c
index e4b23dc..e066904 100644
--- a/sanei/sanei_usb.c
+++ b/sanei/sanei_usb.c
@@ -2203,6 +2203,7 @@ sanei_usb_clear_halt (SANE_Int dn)
return SANE_STATUS_INVAL;
}
+#ifndef __HAIKU__
#ifdef HAVE_LIBUSB_LEGACY
int ret;
@@ -2253,6 +2254,7 @@ sanei_usb_clear_halt (SANE_Int dn)
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
DBG (1, "sanei_usb_clear_halt: libusb support missing\n");
#endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */
+#endif
return SANE_STATUS_GOOD;
}
--
2.12.2
From 2c883078ed6859a1ea0abb596a82ba298500ae6b Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 13 Nov 2015 11:38:32 +0000
Subject: Disable IPV6 for pixma_bjnp
diff --git a/backend/pixma_bjnp.c b/backend/pixma_bjnp.c
index 76e058e..898b6dd 100644
--- a/backend/pixma_bjnp.c
+++ b/backend/pixma_bjnp.c
@@ -108,6 +108,7 @@
#ifdef __HAIKU__
#undef HAVE_IFADDRS_H
+#undef ENABLE_IPV6
#endif
/* static data */
--
2.12.2
From fe16c0067c163a300cb46260c958b9a7a3a6cac4 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Mon, 16 Nov 2015 11:13:48 +0000
Subject: Disable libusb context for Haiku
diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c
index e066904..75330bd 100644
--- a/sanei/sanei_usb.c
+++ b/sanei/sanei_usb.c
@@ -489,7 +489,12 @@ sanei_usb_init (void)
if (!sanei_usb_ctx)
{
DBG (4, "%s: initializing libusb-1.0\n", __func__);
+#ifdef __HAIKU__
+ ret = libusb_init (NULL);
+ sanei_usb_ctx = -1;
+#else
ret = libusb_init (&sanei_usb_ctx);
+#endif
if (ret < 0)
{
DBG (1,
@@ -547,7 +552,11 @@ int i;
#ifdef HAVE_LIBUSB
if (sanei_usb_ctx)
{
+#ifdef __HAIKU__
+ libusb_exit (NULL);
+#else
libusb_exit (sanei_usb_ctx);
+#endif
/* reset libusb-1.0 context */
sanei_usb_ctx=NULL;
}
@@ -871,7 +880,11 @@ static void libusb_scan_devices(void)
DBG (4, "%s: Looking for libusb-1.0 devices\n", __func__);
+#ifdef __HAIKU__
+ ndev = libusb_get_device_list (NULL, &devlist);
+#else
ndev = libusb_get_device_list (sanei_usb_ctx, &devlist);
+#endif
if (ndev < 0)
{
DBG (1,
--
2.12.2
From fe9bfb40c23549ca27dbe9532f4f348179d0d7c6 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 4 Jun 2017 12:22:31 +0200
Subject: missing includes
diff --git a/backend/epsonds.c b/backend/epsonds.c
index 218e08c..d402f58 100644
--- a/backend/epsonds.c
+++ b/backend/epsonds.c
@@ -41,6 +41,12 @@
#include "sane/config.h"
#include <ctype.h>
+#ifdef HAVE_SYS_SELECT_H
+#include <sys/select.h>
+#endif
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
#include <unistd.h>
#include "sane/saneopts.h"
--
2.12.2

View File

@@ -0,0 +1,201 @@
From 95991ce262a4a45dc36dc8d3d3fb68d720d7eb42 Mon Sep 17 00:00:00 2001
From: Ken Mays <kmays2000@gmail.com>
Date: Sun, 10 May 2020 02:15:08 +0000
Subject: Use USE_PTHREAD on Haiku for SnapScan Backend
diff --git a/backend/snapscan-usb.c b/backend/snapscan-usb.c
index 116f9db..a9a2782 100644
--- a/backend/snapscan-usb.c
+++ b/backend/snapscan-usb.c
@@ -534,7 +534,7 @@ static void snapscani_usb_shm_exit(void)
}
#else
#include <sys/ipc.h>
-#include <sys/shm.h>
+
static SANE_Status snapscani_usb_shm_init(void)
{
unsigned int shm_size = sizeof(struct urb_counters_t);
--
2.26.0
From 121ae68cbaaa08ccccb198930b84758e82f1e52d Mon Sep 17 00:00:00 2001
From: Ken Mays <kmays2000@gmail.com>
Date: Thu, 5 Sep 2019 01:15:08 +0000
Subject: Fix strsep redefined
diff --git a/include/sane/config.h.in b/include/sane/config.h.in
index fd125c8..8e8eef7 100644
--- a/include/sane/config.h.in
+++ b/include/sane/config.h.in
@@ -693,11 +693,12 @@ char *strdup (const char * s);
char *strndup(const char * s, size_t n);
#endif
-/* Prototype for strsep */
+/* Prototype for strsep
#ifndef HAVE_STRSEP
#define strsep sanei_strsep
char *strsep(char **stringp, const char *delim);
#endif
+*/
/* Prototype for usleep */
#ifndef HAVE_USLEEP
--
2.26.0
From 305ba99c32a3a74d5bc343f69429c5b27a020e2d Mon Sep 17 00:00:00 2001
From: Ken Mays <kmays2000@gmail.com>
Date: Thu, 5 Sep 2019 01:15:08 +0000
Subject: Fix fcntl placement
diff --git a/testsuite/sanei/test_wire.c b/testsuite/sanei/test_wire.c
index 48f464a..143a044 100644
--- a/testsuite/sanei/test_wire.c
+++ b/testsuite/sanei/test_wire.c
@@ -4,7 +4,7 @@
#include <string.h>
#include <unistd.h>
-#include <sys/fcntl.h>
+#include <fcntl.h>
#include "../include/sane/sane.h"
#include "../include/sane/sanei.h"
--
2.26.0
From d504aa479ca37bedf802b30a98014c66e2117bba Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 13 Nov 2015 11:26:01 +0000
Subject: Fix build for Haiku
diff --git a/backend/epsonds-jpeg.c b/backend/epsonds-jpeg.c
index 244f442..12b4a90 100644
--- a/backend/epsonds-jpeg.c
+++ b/backend/epsonds-jpeg.c
@@ -15,6 +15,10 @@
#include "sane/config.h"
+#ifdef __HAIKU__
+#define _STDLIB_H_
+#endif
+
#include <math.h>
#include "epsonds.h"
@@ -49,8 +53,8 @@ jpeg_term_source(j_decompress_ptr __sane_unused__ cinfo)
METHODDEF(boolean)
jpeg_fill_input_buffer(j_decompress_ptr cinfo)
{
- epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src;
int avail, size;
+ epsonds_src_mgr *src = (epsonds_src_mgr *)cinfo->src;
/* read from the scanner or the ring buffer */
diff --git a/backend/pixma/pixma_bjnp.c b/backend/pixma/pixma_bjnp.c
index 34ba918..214ce97 100644
--- a/backend/pixma/pixma_bjnp.c
+++ b/backend/pixma/pixma_bjnp.c
@@ -110,6 +110,11 @@
# define SSIZE_MAX LONG_MAX
#endif
+#ifdef __HAIKU__
+#undef HAVE_IFADDRS_H
+#undef ENABLE_IPV6
+#endif
+
/* static data */
static bjnp_device_t device[BJNP_NO_DEVICES];
static int bjnp_no_devices = 0;
diff --git a/sanei/sanei_thread.c b/sanei/sanei_thread.c
index f701423..f48dd3c 100644
--- a/sanei/sanei_thread.c
+++ b/sanei/sanei_thread.c
@@ -486,6 +486,7 @@ SANE_Pid
sanei_thread_waitpid( SANE_Pid pid, int *status )
{
#ifdef USE_PTHREAD
+ int rc;
int *ls;
#else
int ls;
@@ -498,7 +499,6 @@ sanei_thread_waitpid( SANE_Pid pid, int *status )
DBG(2, "sanei_thread_waitpid() - %ld\n",
sanei_thread_pid_to_long(pid));
#ifdef USE_PTHREAD
- int rc;
rc = pthread_join( (pthread_t)pid, (void*)&ls );
if( 0 == rc ) {
diff --git a/sanei/sanei_usb.c b/sanei/sanei_usb.c
index db0f452..6ab40f4 100644
--- a/sanei/sanei_usb.c
+++ b/sanei/sanei_usb.c
@@ -1394,7 +1394,12 @@ sanei_usb_init (void)
if (!sanei_usb_ctx)
{
DBG (4, "%s: initializing libusb-1.0\n", __func__);
+#ifdef __HAIKU__
+ ret = libusb_init (NULL);
+ sanei_usb_ctx = -1;
+#else
ret = libusb_init (&sanei_usb_ctx);
+#endif
if (ret < 0)
{
DBG (1,
@@ -1464,7 +1469,11 @@ int i;
#ifdef HAVE_LIBUSB
if (sanei_usb_ctx)
{
+#ifdef __HAIKU__
+ libusb_exit (NULL);
+#else
libusb_exit (sanei_usb_ctx);
+#endif
/* reset libusb-1.0 context */
sanei_usb_ctx=NULL;
}
@@ -1788,7 +1797,11 @@ static void libusb_scan_devices(void)
DBG (4, "%s: Looking for libusb-1.0 devices\n", __func__);
+#ifdef __HAIKU__
+ ndev = libusb_get_device_list (NULL, &devlist);
+#else
ndev = libusb_get_device_list (sanei_usb_ctx, &devlist);
+#endif
if (ndev < 0)
{
DBG (1,
@@ -3034,6 +3047,7 @@ sanei_usb_clear_halt (SANE_Int dn)
if (testing_mode == sanei_usb_testing_mode_replay)
return SANE_STATUS_GOOD;
+#ifndef __HAIKU__
#ifdef HAVE_LIBUSB_LEGACY
int ret;
@@ -3084,6 +3098,7 @@ sanei_usb_clear_halt (SANE_Int dn)
#else /* not HAVE_LIBUSB_LEGACY && not HAVE_LIBUSB */
DBG (1, "sanei_usb_clear_halt: libusb support missing\n");
#endif /* HAVE_LIBUSB_LEGACY || HAVE_LIBUSB */
+#endif
return SANE_STATUS_GOOD;
}
--
2.26.0

View File

@@ -1,119 +0,0 @@
SUMMARY="Scanner Access Now Easy (SANE)"
DESCRIPTION="
SANE stands for \"Scanner Access Now Easy\" and is an application programming \
interface (API) that provides standardized access to any raster image scanner \
hardware (flatbed scanner, hand-held scanner, video- and still-cameras, frame-\
grabbers, etc.).
The SANE standard is free and its discussion and development \
are open to everybody. The current source code is written to support several \
operating systems, including GNU/Linux, OS/2, Win32 and various Unices and is \
available under the GNU General Public License (commercial applications and \
backends are welcome, too, however).
This package includes scanners backends, the command line frontend scanimage, \
the saned server and the sane-find-scanner utility, along with their \
documentation.
"
HOMEPAGE="http://www.sane-project.org"
COPYRIGHT="David Mosberger-Tang, Andy Beck"
LICENSE="GNU LGPL v2"
REVISION="4"
SOURCE_URI="git://git.debian.org/sane/sane-backends.git#f6896e0de481fad5c63bf7ffc271aca89b9cbb01"
PATCHES="sane_backends-1.0.24.patchset"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86_gcc2 x86"
GLOBAL_WRITABLE_FILES="
settings/sane.d directory keep-old
"
PROVIDES="
sane_backends$secondaryArchSuffix = $portVersion
cmd:gamma4scanimage$secondaryArchSuffix = $portVersion
cmd:sane_config$secondaryArchSuffix = $portVersion
cmd:sane_find_scanner$secondaryArchSuffix = $portVersion
cmd:saned$secondaryArchSuffix = $portVersion
cmd:scanimage$secondaryArchSuffix = $portVersion
lib:libsane$secondaryArchSuffix = $portVersion
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libtiff$secondaryArchSuffix
lib:libusb_1.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
"
PROVIDES_devel="
sane_backends${secondaryArchSuffix}_devel = $portVersion
devel:libsane$secondaryArchSuffix = portVersion compat >= 0
"
REQUIRES_devel="
sane_backends$secondaryArchSuffix == $portVersion base
"
BUILD_REQUIRES="
devel:libjpeg$secondaryArchSuffix
devel:libtiff$secondaryArchSuffix
devel:libusb_1.0$secondaryArchSuffix
devel:libz$secondaryArchSuffix
"
BUILD_PREREQUIRES="
haiku${secondaryArchSuffix}_devel
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:awk
cmd:find
cmd:gcc$secondaryArchSuffix
cmd:libtoolize
cmd:libtoolize
cmd:make
cmd:pkg_config$secondaryArchSuffix
"
BUILD()
{
libtoolize --force --copy --install
aclocal
autoconf
automake
runConfigure configure \
--prefix=$prefix \
--bindir=$binDir \
--sbindir=$binDir \
--libdir=$libDir \
--includedir=$includeDir \
--datadir=$dataDir \
--with-docdir=$docDir \
--enable-pthread \
--disable-latex \
--disable-translations \
--enable-libusb_1_0 \
--enable-rpath \
--enable-pnm-backend \
LIBS=-lnetwork
# LIBUSB_1_0_LIBS=-lusb-1.0
make
}
INSTALL()
{
make install
# prepare develop/lib
prepareInstalledDevelLibs libsane
fixPkgconfig
# hack for old BeOS apps (Sanity)
ln -s $libDir/libsane.so.1 $libDir/libsane.so
# devel package
packageEntries devel \
$developDir
}

View File

@@ -13,19 +13,18 @@ backends are welcome, too, however).
This package includes scanners backends, the command line frontend scanimage, \
the saned server and the sane-find-scanner utility, along with their \
documentation."
HOMEPAGE="http://www.sane-project.org"
COPYRIGHT="David Mosberger-Tang, Andy Beck"
LICENSE="GNU LGPL v2"
REVISION="6"
SOURCE_URI="https://gitlab.com/sane-project/backends/-/archive/$portVersion/backends-$portVersion.tar.gz"
CHECKSUM_SHA256="9f263bb8d7ea56644e71e294a50763525b6b8e3e27ee1d55bea52658a939f0c9"
SOURCE_DIR="backends-$portVersion"
PATCHES="
sane_backends-$portVersion.patchset
"
REVISION="1"
SOURCE_URI="https://gitlab.com/sane-project/backends/uploads/54f858b20a364fc35d820df935a86478/sane-backends-$portVersion.tar.gz"
CHECKSUM_SHA256="aa027b4e5f59849cd41b8c26d54584cf31fffd986049019be6ad4140e11ea8ed"
SOURCE_DIR="sane-backends-$portVersion"
PATCHES="sane_backends-$portVersion.patchset"
ARCHITECTURES="?x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="?x86_gcc2 x86"
SECONDARY_ARCHITECTURES="x86"
GLOBAL_WRITABLE_FILES="
settings/sane.d directory keep-old
@@ -36,14 +35,16 @@ PROVIDES="
cmd:gamma4scanimage$secondaryArchSuffix = $portVersion
cmd:sane_config$secondaryArchSuffix = $portVersion
cmd:sane_find_scanner$secondaryArchSuffix = $portVersion
cmd:saned$secondaryArchSuffix = $portVersion
cmd:saned$secondaryArchSuffix = $portVersion
cmd:scanimage$secondaryArchSuffix = $portVersion
cmd:umax_pp$secondaryArchSuffix
lib:libsane$secondaryArchSuffix = $portVersion compat >= 1
"
REQUIRES="
haiku$secondaryArchSuffix
lib:libcurl$secondaryArchSuffix
lib:libjpeg$secondaryArchSuffix
lib:libpng16$secondaryArchSuffix
lib:libtiff$secondaryArchSuffix
lib:libusb_1.0$secondaryArchSuffix
lib:libz$secondaryArchSuffix
@@ -58,7 +59,9 @@ REQUIRES_devel="
"
BUILD_REQUIRES="
devel:libcurl$secondaryArchSuffix
devel:libjpeg$secondaryArchSuffix
devel:libpng16$secondaryArchSuffix
devel:libtiff$secondaryArchSuffix
devel:libusb_1.0$secondaryArchSuffix
devel:libz$secondaryArchSuffix
@@ -68,6 +71,8 @@ BUILD_PREREQUIRES="
cmd:aclocal
cmd:autoconf
cmd:automake
cmd:autoreconf
cmd:autopoint
cmd:awk
cmd:find
cmd:gcc$secondaryArchSuffix
@@ -78,11 +83,6 @@ BUILD_PREREQUIRES="
BUILD()
{
libtoolize --force --copy --install
aclocal
autoconf
automake --add-missing
runConfigure configure \
--prefix=$prefix \
--bindir=$binDir \
@@ -90,11 +90,12 @@ BUILD()
--libdir=$libDir \
--includedir=$includeDir \
--datadir=$dataDir \
--with-docdir=$docDir \
--docdir=$docDir \
--with-libcurl \
--enable-pthread \
--disable-latex \
--disable-translations \
--enable-libusb_1_0 \
--without-api-spec \
--disable-locking \
--with-usb \
--enable-rpath \
--enable-pnm-backend \
LIBS=-lnetwork
@@ -119,3 +120,8 @@ INSTALL()
packageEntries devel \
$developDir
}
TEST()
{
make check $jobArgs
}