mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-29 11:38:52 +02:00
SANE: add recipe and patch for version 1.0.24
This commit is contained in:
@@ -1,239 +0,0 @@
|
|||||||
diff -urN sane-backends-1.0.21/backend/dll.c sane-backends-1.0.21-haiku/backend/dll.c
|
|
||||||
--- sane-backends-1.0.21/backend/dll.c 2010-04-05 13:18:03.063700992 +0000
|
|
||||||
+++ sane-backends-1.0.21-haiku/backend/dll.c 2010-06-24 03:47:33.416022528 +0000
|
|
||||||
@@ -50,7 +50,7 @@
|
|
||||||
# include "lalloca.h" /* MUST come first for AIX! */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
#include <kernel/OS.h>
|
|
||||||
#include <storage/FindDirectory.h>
|
|
||||||
#include <kernel/image.h>
|
|
||||||
@@ -210,7 +210,7 @@
|
|
||||||
} \
|
|
||||||
}
|
|
||||||
|
|
||||||
-#ifndef __BEOS__
|
|
||||||
+#if !defined __BEOS__ && !defined __HAIKU__
|
|
||||||
#include "dll-preload.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -238,7 +238,7 @@
|
|
||||||
static SANE_Auth_Callback auth_callback;
|
|
||||||
static struct backend *first_backend;
|
|
||||||
|
|
||||||
-#ifndef __BEOS__
|
|
||||||
+#if !defined __BEOS__ && !defined __HAIKU__
|
|
||||||
static const char *op_name[] = {
|
|
||||||
"init", "exit", "get_devices", "open", "close", "get_option_descriptor",
|
|
||||||
"control_option", "get_parameters", "start", "read", "cancel",
|
|
||||||
@@ -250,7 +250,7 @@
|
|
||||||
"sane_control_option", "sane_get_parameters", "sane_start", "sane_read", "sane_cancel",
|
|
||||||
"sane_set_io_mode", "sane_get_select_fd"
|
|
||||||
};
|
|
||||||
-#endif /* __BEOS__ */
|
|
||||||
+#endif /* __BEOS__ || __HAIKU__ */
|
|
||||||
|
|
||||||
static void *
|
|
||||||
op_unsupported (void)
|
|
||||||
@@ -320,7 +320,7 @@
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
#include <FindDirectory.h>
|
|
||||||
|
|
||||||
static SANE_Status
|
|
||||||
@@ -593,7 +593,7 @@
|
|
||||||
return SANE_STATUS_UNSUPPORTED;
|
|
||||||
#endif /* HAVE_DLL */
|
|
||||||
}
|
|
||||||
-#endif /* __BEOS__ */
|
|
||||||
+#endif /* __BEOS__ || __HAIKU__ */
|
|
||||||
|
|
||||||
static SANE_Status
|
|
||||||
init (struct backend *be)
|
|
||||||
@@ -634,7 +634,7 @@
|
|
||||||
static void
|
|
||||||
add_alias (const char *line_param)
|
|
||||||
{
|
|
||||||
-#ifndef __BEOS__
|
|
||||||
+#if !defined __BEOS__ && !defined __HAIKU__
|
|
||||||
const char *command;
|
|
||||||
enum
|
|
||||||
{ CMD_ALIAS, CMD_HIDE }
|
|
||||||
@@ -827,7 +827,7 @@
|
|
||||||
SANE_Status
|
|
||||||
sane_init (SANE_Int * version_code, SANE_Auth_Callback authorize)
|
|
||||||
{
|
|
||||||
-#ifndef __BEOS__
|
|
||||||
+#if !defined __BEOS__ && !defined __HAIKU__
|
|
||||||
char config_line[PATH_MAX];
|
|
||||||
size_t len;
|
|
||||||
FILE *fp;
|
|
||||||
@@ -847,7 +847,7 @@
|
|
||||||
DBG (1, "sane_init: SANE dll backend version %s from %s\n", DLL_VERSION,
|
|
||||||
PACKAGE_STRING);
|
|
||||||
|
|
||||||
-#ifndef __BEOS__
|
|
||||||
+#if !defined __BEOS__ && !defined __HAIKU__
|
|
||||||
/* chain preloaded backends together: */
|
|
||||||
for (i = 0; i < NELEMS (preloaded_backends); ++i)
|
|
||||||
{
|
|
||||||
@@ -909,7 +909,7 @@
|
|
||||||
}
|
|
||||||
closedir(dir);
|
|
||||||
}
|
|
||||||
-#endif /* __BEOS__ */
|
|
||||||
+#endif /* __BEOS__ || __HAIKU__ */
|
|
||||||
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
}
|
|
||||||
@@ -933,7 +933,7 @@
|
|
||||||
be->name);
|
|
||||||
(*(op_exit_t)be->op[OP_EXIT]) ();
|
|
||||||
}
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
/* use BeOS kernel functions to unload add-ons */
|
|
||||||
if(be->handle) unload_add_on((image_id)be->handle);
|
|
||||||
#else
|
|
||||||
@@ -957,7 +957,7 @@
|
|
||||||
#endif /* HAVE_DLOPEN */
|
|
||||||
|
|
||||||
#endif /* HAVE_DLL */
|
|
||||||
-#endif /* __BEOS__ */
|
|
||||||
+#endif /* __BEOS__ || __HAIKU__ */
|
|
||||||
}
|
|
||||||
if (!be->permanent)
|
|
||||||
{
|
|
||||||
diff -urN sane-backends-1.0.21/configure.in sane-backends-1.0.21-haiku/configure.in
|
|
||||||
--- sane-backends-1.0.21/configure.in 2010-04-26 00:55:27.008912896 +0000
|
|
||||||
+++ sane-backends-1.0.21-haiku/configure.in 2010-06-24 02:11:07.556269568 +0000
|
|
||||||
@@ -227,6 +227,7 @@
|
|
||||||
AC_CHECK_FUNC(gethostbyaddr,, [AC_CHECK_LIB(bind, gethostbyaddr, BIND_LIB="-lbind")])
|
|
||||||
AC_CHECK_FUNC(gethostbyaddr,, [AC_CHECK_LIB(nsl, gethostbyaddr, NSL_LIB="-lnsl")])
|
|
||||||
AC_CHECK_FUNC(socket, [SOCKET_LIBS=], [AC_CHECK_LIB(socket, socket, SOCKET_LIB="-lsocket")])
|
|
||||||
+AC_CHECK_FUNC(socket, [SOCKET_LIBS=], [AC_CHECK_LIB(network, socket, SOCKET_LIB="-lnetwork")])
|
|
||||||
AC_CHECK_FUNC(inet_aton,, [AC_CHECK_LIB(resolv, inet_aton, RESOLV_LIB="-lresolv")])
|
|
||||||
|
|
||||||
dnl Group related network libraries together so they can always be linked
|
|
||||||
@@ -293,7 +294,7 @@
|
|
||||||
HAVE_USB=no
|
|
||||||
if test "$enable_libusb" != "no"; then
|
|
||||||
case ${host_os} in
|
|
||||||
- beos*)
|
|
||||||
+ beos*|haiku*)
|
|
||||||
AC_CHECK_HEADERS(be/drivers/USB_scanner.h, HAVE_USB=yes, AC_MSG_ERROR([USB_scanner.h is required on BeOS]))
|
|
||||||
;;
|
|
||||||
os2*)
|
|
||||||
@@ -467,7 +468,7 @@
|
|
||||||
|
|
||||||
dnl Windows (cygwin/mingw), BeOS, and OS/2 need this.
|
|
||||||
case $host_os in
|
|
||||||
- cygwin* | mingw* | beos* | os2*)
|
|
||||||
+ cygwin* | mingw* | beos* | haiku* | os2*)
|
|
||||||
LDFLAGS="$LDFLAGS -no-undefined"
|
|
||||||
esac
|
|
||||||
|
|
||||||
@@ -619,6 +620,9 @@
|
|
||||||
beos*)
|
|
||||||
libdir='${exec_prefix}/add-ons'
|
|
||||||
;;
|
|
||||||
+ haiku*)
|
|
||||||
+ libdir=`finddir B_COMMON_DIRECTORY/add-ons`
|
|
||||||
+ ;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
AC_ARG_ENABLE(parport-directio,
|
|
||||||
diff -urN sane-backends-1.0.21/sanei/sanei_config.c sane-backends-1.0.21-haiku/sanei/sanei_config.c
|
|
||||||
--- sane-backends-1.0.21/sanei/sanei_config.c 2010-04-05 13:18:05.038273024 +0000
|
|
||||||
+++ sane-backends-1.0.21-haiku/sanei/sanei_config.c 2010-06-24 03:45:11.972816384 +0000
|
|
||||||
@@ -72,7 +72,7 @@
|
|
||||||
|
|
||||||
#define DEFAULT_DIRS "." DIR_SEP STRINGIFY(PATH_SANE_CONFIG_DIR)
|
|
||||||
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
#include <FindDirectory.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@
|
|
||||||
DBG_INIT();
|
|
||||||
|
|
||||||
dir_list = getenv ("SANE_CONFIG_DIR");
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
/* ~/config/settings/SANE takes precedence over /etc/sane.d/ */
|
|
||||||
if (!dir_list)
|
|
||||||
{
|
|
||||||
diff -urN sane-backends-1.0.21/sanei/sanei_pio.c sane-backends-1.0.21-haiku/sanei/sanei_pio.c
|
|
||||||
--- sane-backends-1.0.21/sanei/sanei_pio.c 2010-04-05 13:18:06.039321600 +0000
|
|
||||||
+++ sane-backends-1.0.21-haiku/sanei/sanei_pio.c 2010-06-24 03:45:37.013107200 +0000
|
|
||||||
@@ -534,7 +534,7 @@
|
|
||||||
|
|
||||||
#else /* !HAVE_IOPERM */
|
|
||||||
|
|
||||||
-#ifdef __BEOS__
|
|
||||||
+#if defined __BEOS__ || defined __HAIKU__
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
|
|
||||||
@@ -571,7 +571,7 @@
|
|
||||||
return(write(fd,buf,n));
|
|
||||||
}
|
|
||||||
|
|
||||||
-#else /* !__BEOS__ */
|
|
||||||
+#else /* !__BEOS__ || __HAIKU__ */
|
|
||||||
|
|
||||||
SANE_Status
|
|
||||||
sanei_pio_open (const char *dev, int *fdp)
|
|
||||||
@@ -598,6 +598,6 @@
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
-#endif /* __BEOS__ */
|
|
||||||
+#endif /* __BEOS__ || __HAIKU__ */
|
|
||||||
|
|
||||||
#endif /* !HAVE_IOPERM */
|
|
||||||
diff -urN sane-backends-1.0.21/sanei/sanei_usb.c sane-backends-1.0.21-haiku/sanei/sanei_usb.c
|
|
||||||
--- sane-backends-1.0.21/sanei/sanei_usb.c 2010-04-05 13:18:06.041156608 +0000
|
|
||||||
+++ sane-backends-1.0.21-haiku/sanei/sanei_usb.c 2010-06-24 03:46:05.417595392 +0000
|
|
||||||
@@ -195,7 +195,7 @@
|
|
||||||
void *data;
|
|
||||||
}
|
|
||||||
cmsg;
|
|
||||||
-#elif defined(__BEOS__)
|
|
||||||
+#elif defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
#include <drivers/USB_scanner.h>
|
|
||||||
#include <kernel/OS.h>
|
|
||||||
#endif /* __linux__ */
|
|
||||||
@@ -260,7 +260,7 @@
|
|
||||||
DBG (3, "sanei_usb_get_vendor_product: ioctl (product) "
|
|
||||||
"of device %s failed: %s\n", name, strerror (errno));
|
|
||||||
}
|
|
||||||
-#elif defined(__BEOS__)
|
|
||||||
+#elif defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
{
|
|
||||||
uint16 vendor, product;
|
|
||||||
if (ioctl (fd, B_SCANNER_IOCTL_VENDOR, &vendor) != B_OK)
|
|
||||||
@@ -440,7 +440,7 @@
|
|
||||||
"/dev/usb/", "scanner",
|
|
||||||
#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined (__OpenBSD__) || defined (__DragonFly__)
|
|
||||||
"/dev/", "uscanner",
|
|
||||||
-#elif defined(__BEOS__)
|
|
||||||
+#elif defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
"/dev/scanner/usb/", "",
|
|
||||||
#endif
|
|
||||||
0, 0
|
|
||||||
@@ -2344,7 +2344,7 @@
|
|
||||||
if ((rtype & 0x80) && debug_level > 10)
|
|
||||||
print_buffer (data, len);
|
|
||||||
return SANE_STATUS_GOOD;
|
|
||||||
-#elif defined(__BEOS__)
|
|
||||||
+#elif defined(__BEOS__) || defined(__HAIKU__)
|
|
||||||
struct usb_scanner_ioctl_ctrlmsg c;
|
|
||||||
|
|
||||||
c.req.request_type = rtype;
|
|
||||||
491
media-gfx/sane_backends/patches/sane_backends-1.0.24.patchset
Normal file
491
media-gfx/sane_backends/patches/sane_backends-1.0.24.patchset
Normal file
@@ -0,0 +1,491 @@
|
|||||||
|
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
|
||||||
|
|
||||||
121
media-gfx/sane_backends/sane_backends-1.0.24.recipe
Normal file
121
media-gfx/sane_backends/sane_backends-1.0.24.recipe
Normal file
@@ -0,0 +1,121 @@
|
|||||||
|
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 the command line frontend scanimage, the saned server \
|
||||||
|
and the sane-find-scanner utility, along with their documentation.
|
||||||
|
"
|
||||||
|
|
||||||
|
HOMEPAGE="http://www.sane-project.org"
|
||||||
|
LICENSE="GNU LGPL v2"
|
||||||
|
COPYRIGHT="David Mosberger-Tang, Andy Beck"
|
||||||
|
SRC_URI="git://git.debian.org/sane/sane-backends.git"
|
||||||
|
REVISION="1"
|
||||||
|
|
||||||
|
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:libz$secondaryArchSuffix
|
||||||
|
lib:libusb_1.0$secondaryArchSuffix
|
||||||
|
lib:libjpeg$secondaryArchSuffix
|
||||||
|
lib:libtiff$secondaryArchSuffix
|
||||||
|
"
|
||||||
|
|
||||||
|
BUILD_REQUIRES="
|
||||||
|
devel:libz$secondaryArchSuffix
|
||||||
|
devel:libusb_1.0$secondaryArchSuffix
|
||||||
|
devel:libjpeg$secondaryArchSuffix
|
||||||
|
devel:libtiff$secondaryArchSuffix
|
||||||
|
"
|
||||||
|
BUILD_PREREQUIRES="
|
||||||
|
haiku${secondaryArchSuffix}_devel
|
||||||
|
cmd:aclocal
|
||||||
|
cmd:autoconf
|
||||||
|
cmd:automake
|
||||||
|
cmd:libtoolize
|
||||||
|
cmd:awk
|
||||||
|
cmd:find
|
||||||
|
cmd:gcc$secondaryArchSuffix
|
||||||
|
cmd:libtoolize
|
||||||
|
cmd:make
|
||||||
|
cmd:pkg_config$secondaryArchSuffix
|
||||||
|
"
|
||||||
|
|
||||||
|
PATCHES="sane_backends-1.0.24.patchset"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
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
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
# ----- devel package -------------------------------------------------------
|
||||||
|
|
||||||
|
PROVIDES_devel="
|
||||||
|
sane_backends${secondaryArchSuffix}_devel = $portVersion
|
||||||
|
devel:libsane$secondaryArchSuffix = portVersion compat >= 0
|
||||||
|
"
|
||||||
|
REQUIRES_devel="
|
||||||
|
sane_backends$secondaryArchSuffix == $portVersion base
|
||||||
|
"
|
||||||
Reference in New Issue
Block a user