diff --git a/ChangeLog b/ChangeLog index 2be8e62ca..96abc03cb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2003-04-10 Henning Meier-Geinitz + + * backend/test.c backend/test.h doc/descriptions/test.desc: Added + support for OS/2 (from Franz Bakan ). 2003-04-05 Nathan Rutman diff --git a/backend/test.c b/backend/test.c index 3e8b481ab..61de5bfe6 100644 --- a/backend/test.c +++ b/backend/test.c @@ -1,5 +1,5 @@ /* sane - Scanner Access Now Easy. - Copyright (C) 2002 Henning Meier-Geinitz + Copyright (C) 2002, 2003 Henning Meier-Geinitz This file is part of the SANE package. This program is free software; you can redistribute it and/or @@ -41,7 +41,7 @@ This backend is for testing frontends. */ -#define BUILD 20 +#define BUILD 21 #include "../include/sane/config.h" @@ -60,6 +60,9 @@ #include "../include/sane/sanei.h" #include "../include/sane/saneopts.h" #include "../include/sane/sanei_config.h" +#ifdef HAVE_OS2_H +#include "../include/sane/sanei_thread.h" +#endif #define BACKEND_NAME test #include "../include/sane/sanei_backend.h" @@ -1202,6 +1205,21 @@ read_option (SANE_String line, SANE_String option_string, return SANE_STATUS_GOOD; } +#ifdef HAVE_OS2_H +/* + * reader thread for OS/2: need a wrapper, because threads can have + * only one parameter. +*/ +static void +os2_reader_process (void *data) +{ + struct Test_Device *test_device = (struct Test_Device *) data; + + DBG (1, "reader_process thread started\n"); + reader_process (test_device, test_device->reader_fds); +} +#endif + static SANE_Status reader_process (Test_Device * test_device, SANE_Int fd) { @@ -2437,7 +2455,13 @@ sane_start (SANE_Handle handle) return SANE_STATUS_IO_ERROR; } +#ifndef HAVE_OS2_H test_device->reader_pid = fork (); +#else + /* create reader routine as new process or thread */ + test_device->reader_fds = pipe_descriptor[1]; + test_device->reader_pid = sanei_thread_begin (os2_reader_process, (void *) test_device); +#endif if (test_device->reader_pid == 0) /* child */ { SANE_Status status; @@ -2462,7 +2486,9 @@ sane_start (SANE_Handle handle) return SANE_STATUS_NO_MEM; } /* parent */ +#ifndef HAVE_OS2_H close (pipe_descriptor[1]); +#endif test_device->pipe = pipe_descriptor[0]; return SANE_STATUS_GOOD; diff --git a/backend/test.h b/backend/test.h index 318882298..61a98538e 100644 --- a/backend/test.h +++ b/backend/test.h @@ -89,6 +89,9 @@ typedef struct Test_Device SANE_Parameters params; SANE_String name; SANE_Int reader_pid; +#ifdef HAVE_OS2_H + SANE_Int reader_fds; /* OS/2: pipe write handler for reader */ +#endif SANE_Int pipe; FILE *pipe_handle; SANE_Word pass; diff --git a/doc/descriptions/test.desc b/doc/descriptions/test.desc index 517a9918f..d45233496 100644 --- a/doc/descriptions/test.desc +++ b/doc/descriptions/test.desc @@ -10,7 +10,7 @@ ; :backend "test" ; name of backend -:version "1.0-20" ; version of backend +:version "1.0-21" ; version of backend :status :stable ; :alpha, :beta, :stable, :new :manpage "sane-test" ; name of manpage (if it exists) :url "http://www.meier-geinitz.de/sane/test-backend/" ; backend's web page