summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--MAINTAINERS2
-rw-r--r--NEWS3
-rw-r--r--camlibs/canon/canon.c4
-rw-r--r--camlibs/canon/usb.c3
-rw-r--r--camlibs/digigr8/digi_postprocess.c3
-rw-r--r--camlibs/digigr8/digigr8.c3
-rw-r--r--camlibs/digita/commands.c3
-rw-r--r--camlibs/digita/digita.c3
-rw-r--r--camlibs/digita/serial.c3
-rw-r--r--camlibs/directory/directory.c4
-rw-r--r--camlibs/iclick/iclick.c3
-rw-r--r--camlibs/soundvision/agfa_cl18.c3
-rw-r--r--camlibs/soundvision/commands.c3
-rw-r--r--camlibs/soundvision/soundvision.c3
-rw-r--r--camlibs/soundvision/tiger_fastflicks.c3
-rw-r--r--camlibs/sq905/postprocess.c3
-rw-r--r--camlibs/sq905/sq905.c3
-rw-r--r--doc/Makefile.am2
-rw-r--r--doc/build_OS2.txt19
-rw-r--r--doc/libgphoto2.34
-rw-r--r--doc/libgphoto2_port.32
-rw-r--r--gphoto2/gphoto2.h9
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port-portability.h97
-rw-r--r--libgphoto2_port/gphoto2/gphoto2-port.h4
-rw-r--r--libgphoto2_port/serial/unix.c46
-rw-r--r--libgphoto2_port/usb/Makefile-files2
-rw-r--r--libgphoto2_port/usb/usb-os2.c271
27 files changed, 7 insertions, 501 deletions
diff --git a/MAINTAINERS b/MAINTAINERS
index 4ccde3c4b..8c06d0be1 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -18,8 +18,6 @@ libgphoto2:
PORTS
--------------------------------------------------------------------------------
-OS/2:
- Bart van Leeuwen <bart_van_leeuwen@netage.nl>
*BSD:
Arnaud Launay <asl@launay.org>
diff --git a/NEWS b/NEWS
index dc54050e9..71a4fefa3 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,8 @@
libgphoto2 2.5.27.1 development snapshot
+general:
+* OS/2 support removed (broken and unused since at least 2006)
+
ptp2:
* olympus: wait time was twice as long as required if no events arrived
* Sigma Fp: added basic beta support for capture, live view and config.
diff --git a/camlibs/canon/canon.c b/camlibs/canon/canon.c
index f6a441d58..b8ca56393 100644
--- a/camlibs/canon/canon.c
+++ b/camlibs/canon/canon.c
@@ -30,10 +30,6 @@
#include <time.h>
#endif
-#ifdef OS2
-#include <db.h>
-#endif
-
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port-log.h>
diff --git a/camlibs/canon/usb.c b/camlibs/canon/usb.c
index d61c45576..d43d32bb6 100644
--- a/camlibs/canon/usb.c
+++ b/camlibs/canon/usb.c
@@ -21,9 +21,6 @@
#include <sys/stat.h>
#include <unistd.h>
#endif /* CANON_EXPERIMENTAL_UPLOAD */
-#ifdef OS2
-#include <db.h>
-#endif
#ifdef ENABLE_NLS
# include <libintl.h>
diff --git a/camlibs/digigr8/digi_postprocess.c b/camlibs/digigr8/digi_postprocess.c
index 58403ca82..3f271515a 100644
--- a/camlibs/digigr8/digi_postprocess.c
+++ b/camlibs/digigr8/digi_postprocess.c
@@ -23,9 +23,6 @@
#include <fcntl.h>
#include <string.h>
#include <math.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
diff --git a/camlibs/digigr8/digigr8.c b/camlibs/digigr8/digigr8.c
index 07aee65d9..287d007ba 100644
--- a/camlibs/digigr8/digigr8.c
+++ b/camlibs/digigr8/digigr8.c
@@ -24,9 +24,6 @@
#include <fcntl.h>
#include <string.h>
#include <math.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
diff --git a/camlibs/digita/commands.c b/camlibs/digita/commands.c
index 22c8fb544..0f1c9da13 100644
--- a/camlibs/digita/commands.c
+++ b/camlibs/digita/commands.c
@@ -28,9 +28,6 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include "digita.h"
#include "gphoto2-endian.h"
diff --git a/camlibs/digita/digita.c b/camlibs/digita/digita.c
index 72ce3419f..a31119429 100644
--- a/camlibs/digita/digita.c
+++ b/camlibs/digita/digita.c
@@ -31,9 +31,6 @@
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
-#ifdef OS2
-#include <db.h>
-#endif
#define GP_MODULE "digita"
diff --git a/camlibs/digita/serial.c b/camlibs/digita/serial.c
index a23504d2d..ced601b91 100644
--- a/camlibs/digita/serial.c
+++ b/camlibs/digita/serial.c
@@ -29,9 +29,6 @@
#include <stdlib.h>
#include <errno.h>
#include <string.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include "gphoto2-endian.h"
#include "digita.h"
diff --git a/camlibs/directory/directory.c b/camlibs/directory/directory.c
index 55014a27d..af6f25b46 100644
--- a/camlibs/directory/directory.c
+++ b/camlibs/directory/directory.c
@@ -146,11 +146,7 @@ get_mime_type (const char *filename)
dot = strrchr(filename, '.');
if (dot) {
for (x = 0; mime_table[x].extension; x++) {
-#ifdef OS2
- if (!stricmp(mime_table[x].extension, dot+1))
-#else
if (!strcasecmp (mime_table[x].extension, dot+1))
-#endif
return (mime_table[x].mime_type);
}
}
diff --git a/camlibs/iclick/iclick.c b/camlibs/iclick/iclick.c
index c1ed4cfb6..e1af9c04e 100644
--- a/camlibs/iclick/iclick.c
+++ b/camlibs/iclick/iclick.c
@@ -28,9 +28,6 @@
#include <fcntl.h>
#include <string.h>
#include <math.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
diff --git a/camlibs/soundvision/agfa_cl18.c b/camlibs/soundvision/agfa_cl18.c
index d90adb6a4..181a27895 100644
--- a/camlibs/soundvision/agfa_cl18.c
+++ b/camlibs/soundvision/agfa_cl18.c
@@ -27,9 +27,6 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include "gphoto2-endian.h"
diff --git a/camlibs/soundvision/commands.c b/camlibs/soundvision/commands.c
index d249e2f87..b198d81b4 100644
--- a/camlibs/soundvision/commands.c
+++ b/camlibs/soundvision/commands.c
@@ -29,9 +29,6 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include "gphoto2-endian.h"
diff --git a/camlibs/soundvision/soundvision.c b/camlibs/soundvision/soundvision.c
index 0b3c19ab7..5fb7e71a8 100644
--- a/camlibs/soundvision/soundvision.c
+++ b/camlibs/soundvision/soundvision.c
@@ -34,9 +34,6 @@
#include <errno.h>
#include <fcntl.h>
#include <string.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
diff --git a/camlibs/soundvision/tiger_fastflicks.c b/camlibs/soundvision/tiger_fastflicks.c
index b06744df9..4833f7fd7 100644
--- a/camlibs/soundvision/tiger_fastflicks.c
+++ b/camlibs/soundvision/tiger_fastflicks.c
@@ -42,9 +42,6 @@
#include <fcntl.h>
#include <string.h>
#include <stdlib.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include "gphoto2-endian.h"
diff --git a/camlibs/sq905/postprocess.c b/camlibs/sq905/postprocess.c
index 177deca17..ae35ba474 100644
--- a/camlibs/sq905/postprocess.c
+++ b/camlibs/sq905/postprocess.c
@@ -23,9 +23,6 @@
#include <fcntl.h>
#include <string.h>
#include <math.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
diff --git a/camlibs/sq905/sq905.c b/camlibs/sq905/sq905.c
index 548871034..ddbc50b66 100644
--- a/camlibs/sq905/sq905.c
+++ b/camlibs/sq905/sq905.c
@@ -22,9 +22,6 @@
#include <fcntl.h>
#include <string.h>
#include <math.h>
-#ifdef OS2
-#include <db.h>
-#endif
#include <gphoto2/gphoto2.h>
#include <gphoto2/gphoto2-port.h>
diff --git a/doc/Makefile.am b/doc/Makefile.am
index 343d3da8d..c4d35711a 100644
--- a/doc/Makefile.am
+++ b/doc/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = api
-old_EXTRA_DIST = DAEMON build_OS2.txt \
+old_EXTRA_DIST = DAEMON \
camlib_devel.lyx \
camlib_devel-portmon.eps camlib_devel-repeater.eps \
camlib_devel.sgml camlib_devel.txt camlib_devel-y.eps \
diff --git a/doc/build_OS2.txt b/doc/build_OS2.txt
deleted file mode 100644
index e0bfc2521..000000000
--- a/doc/build_OS2.txt
+++ /dev/null
@@ -1,19 +0,0 @@
-30-7-2000
-bvl: initial release
-about this Document:
-
-This document is a summary of what is needed to build gphoto2 on OS/2
-
-make : nmake v3 available on hobbes,
- http://hobbes.nmsu.edu/pub/os2/dev/util/nmakew.zip
-
-compile : gcc version 2.8.1
- http://hobbes.nmsu.edu/cgi-bin/h-browse?sh=1&dir=/pub/os2/dev/emx/v0.9d
-
-libraries : pthreads
- unfortunately I don't know whih version I use here but the one from netlabs should be working
- ftp://ftp.netlabs.org/pub/pthreads/
-
-make sure the emx\lib directory is added to your lib environment 'SET LIB=x:\EMX\LIB'
-else the pthreads DLL's and LIB's should be in the EMX tree
-
diff --git a/doc/libgphoto2.3 b/doc/libgphoto2.3
index ffa08b9bd..583db0fda 100644
--- a/doc/libgphoto2.3
+++ b/doc/libgphoto2.3
@@ -42,12 +42,12 @@ command line and, if dealing with USB problems, setting the environment variable
\fBCAMLIBS\fR
If set, defines the directory where the
libgphoto2
-library looks for its camera drivers (camlibs). You only need to set this on OS/2 systems and broken/test installations.
+library looks for its camera drivers (camlibs). You only need to set this on Windows systems and broken/test installations.
.TP
\fBIOLIBS\fR
If set, defines the directory where the
libgphoto2_port
-library looks for its I/O drivers (iolibs). You only need to set this on OS/2 systems and broken/test installations.
+library looks for its I/O drivers (iolibs). You only need to set this on Windows systems and broken/test installations.
.TP
\fBLD_DEBUG\fR
Set this to
diff --git a/doc/libgphoto2_port.3 b/doc/libgphoto2_port.3
index 2e96a06a8..c8562a018 100644
--- a/doc/libgphoto2_port.3
+++ b/doc/libgphoto2_port.3
@@ -42,7 +42,7 @@ docs will be added here in the future.
\fBIOLIBS\fR
If set, defines the directory where the
libgphoto2_port
-library looks for its I/O drivers (iolibs). You only need to set this on OS/2 systems and broken/test installations.
+library looks for its I/O drivers (iolibs). You only need to set this on Windows systems and broken/test installations.
.TP
\fBLD_DEBUG\fR
Set this to
diff --git a/gphoto2/gphoto2.h b/gphoto2/gphoto2.h
index 9bb6ba970..b73bdbb84 100644
--- a/gphoto2/gphoto2.h
+++ b/gphoto2/gphoto2.h
@@ -28,15 +28,6 @@
extern "C" {
#endif
-#ifdef OS2
-# include <db.h>
-# include <sys/param.h>
-# define CAMLIBS getenv("CAMLIBS")
-# define RTLD_LAZY 0x001
-# define VERSION "2"
-# define usleep(t) _sleep2(((t)+500)/ 1000)
-#endif
-
#ifdef WIN32
#ifndef CAMLIBS
#define CAMLIBS "."
diff --git a/libgphoto2_port/gphoto2/gphoto2-port-portability.h b/libgphoto2_port/gphoto2/gphoto2-port-portability.h
index 1a8cdc17d..4f963b025 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port-portability.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port-portability.h
@@ -74,103 +74,6 @@ typedef struct {
* End WIN32 definitions
************************************************************************/
-#elif defined(__SOME_OS2_MAGIC_HERE__)
-
-/************************************************************************
- * Begin OS/2 definitions
- ************************************************************************/
-
-# define strcasecmp(foo,bar) stricmp(foo,bar)
-# define gp_system_dir_delim '\\'
-
-# ifndef GPIO_OS2_INCLUDED
-# define GPIO_OS2_INCLUDED
-# define IOLIBS getenv("IOLIBS")
-/*#define IOLIBS "./libgphoto2_port"*/
-# define RTLD_LAZY 0x001
-
-
-# ifndef HAVE_TERMIOS_H
-# define INCL_DOSDEVIOCTL /* DosDevIOCtl values */
-# define IOCTL_ASYNC 0x0001
-# define ASYNC_SETBAUDRATE 0x0041
-/* c_cflag bit meaning */
-# define CBAUD 0x0000100f
-# define B0 0x00000000 /* hang up */
-# define B50 0x00000001
-# define B75 0x00000002
-# define B110 0x00000003
-# define B134 0x00000004
-# define B150 0x00000005
-# define B200 0x00000006
-# define B300 0x00000007
-# define B600 0x00000008
-# define B1200 0x00000009
-# define B1800 0x0000000a
-# define B2400 0x0000000b
-# define B4800 0x0000000c
-# define B9600 0x0000000d
-# define B19200 0x0000000e
-# define B38400 0x0000000f
-# define EXTA B19200
-# define EXTB B38400
-# define CSIZE 0x00000030
-# define CS5 0x00000000
-# define CS6 0x00000010
-# define CS7 0x00000020
-# define CS8 0x00000030
-# define CSTOPB 0x00000040
-# define CREAD 0x00000080
-# define PARENB 0x00000100
-# define PARODD 0x00000200
-# define HUPCL 0x00000400
-# define CLOCAL 0x00000800
-# define CBAUDEX 0x00001000
-# define B57600 0x00001001
-# define B115200 0x00001002
-# define B230400 0x00001003
-# define B460800 0x00001004
-# define B76800 0x00001005
-# define B153600 0x00001006
-# define B307200 0x00001007
-# define B614400 0x00001008
-# define B921600 0x00001009
-# define B500000 0x0000100a
-# define B576000 0x0000100b
-# define B1000000 0x0000100c
-# define B1152000 0x0000100d
-# define B1500000 0x0000100e
-# define B2000000 0x0000100f
-
-# endif /* HAVE_TERMIOS_H */
-
-# define CIBAUD 0x100f0000 /* input baud rate (not used) */
-# define CMSPAR 0x40000000 /* mark or space (stick) parity */
-/* #define CRTSCTS 0x80000000 */ /* flow control */
-
-/* modem lines */
-# define TIOCM_LE 0x001
-# define TIOCM_DTR 0x002
-# define TIOCM_RTS 0x004
-# define TIOCM_ST 0x008
-# define TIOCM_SR 0x010
-# define TIOCM_CTS 0x020
-# define TIOCM_CAR 0x040
-# define TIOCM_RNG 0x080
-# define TIOCM_DSR 0x100
-# define TIOCM_CD TIOCM_CAR
-# define TIOCM_RI TIOCM_RNG
-
-# define TIOCMBIC 0x06C
-# define TIOCMBIS 0x06B
-# define TIOCMGET 0x06E
-
-# endif /* GPIO_OS2_INCLUDED */
-
-/************************************************************************
- * End OS/2 definitions
- ************************************************************************/
-
#else
/************************************************************************
diff --git a/libgphoto2_port/gphoto2/gphoto2-port.h b/libgphoto2_port/gphoto2/gphoto2-port.h
index 3fe6b2fee..7e5c67d99 100644
--- a/libgphoto2_port/gphoto2/gphoto2-port.h
+++ b/libgphoto2_port/gphoto2/gphoto2-port.h
@@ -28,10 +28,6 @@
/* For portability */
#include <gphoto2/gphoto2-port-portability.h>
-#ifdef OS2
-#include <gphoto2/gphoto2-port-portability-os2.h>
-#include <os2.h>
-#endif
#ifdef __cplusplus
extern "C" {
diff --git a/libgphoto2_port/serial/unix.c b/libgphoto2_port/serial/unix.c
index 9b8165df6..8207acfcc 100644
--- a/libgphoto2_port/serial/unix.c
+++ b/libgphoto2_port/serial/unix.c
@@ -174,12 +174,6 @@
#define GP_PORT_SERIAL_RANGE_HIGH 4
#endif
-#ifdef OS2
-#define GP_PORT_SERIAL_PREFIX "COM%i"
-#define GP_PORT_SERIAL_RANGE_LOW 1
-#define GP_PORT_SERIAL_RANGE_HIGH 4
-#endif
-
/* IRIX */
#if defined(__sgi)
#define GP_PORT_SERIAL_PREFIX "/dev/ttyd%i"
@@ -304,9 +298,6 @@ gp_port_library_list (GPPortInfoList *list)
char path[1024], prefix[1024];
int x;
struct stat s;
-#ifdef OS2
- int r, fh, option;
-#endif
/* Copy in the serial port prefix */
strcpy (prefix, GP_PORT_SERIAL_PREFIX);
@@ -322,15 +313,6 @@ gp_port_library_list (GPPortInfoList *list)
sprintf (path, prefix, x);
- /* OS/2 seems to need an additional check */
-#ifdef OS2
- r = DosOpen (path, &fh, &option, 0, 0, 1,
- OPEN_FLAGS_FAIL_ON_ERROR |
- OPEN_SHARE_DENYREADWRITE, 0);
- DosClose(fh);
- if (r)
- continue;
-#endif
/* Very first of all, if the device node is not there,
* there is no need to try locking. */
if ((stat (path, &s) == -1) && ((errno == ENOENT) || (errno == ENODEV)))
@@ -396,9 +378,6 @@ static int
gp_port_serial_open (GPPort *dev)
{
int result, max_tries = 5, i;
-#ifdef OS2
- int fd;
-#endif
char *port;
GPPortInfo info;
@@ -429,10 +408,6 @@ gp_port_serial_open (GPPort *dev)
#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__) || defined(__MidnightBSD__)
dev->pl->fd = open (port, O_RDWR | O_NOCTTY | O_NONBLOCK);
-#elif OS2
- fd = open (port, O_RDWR | O_BINARY);
- dev->pl->fd = open (port, O_RDWR | O_BINARY);
- close(fd);
#else
if (dev->pl->fd == -1)
dev->pl->fd = open (port, O_RDWR | O_NOCTTY | O_SYNC | O_NONBLOCK);
@@ -525,13 +500,11 @@ gp_port_serial_write (GPPort *dev, const char *bytes, int size)
}
/* wait till all bytes are really sent */
-#ifndef OS2
#ifdef HAVE_TERMIOS_H
tcdrain (dev->pl->fd);
#else
ioctl (dev->pl->fd, TCDRAIN, 0);
#endif
-#endif
return GP_OK;
}
@@ -796,16 +769,11 @@ static int
gp_port_serial_check_speed (GPPort *dev)
{
speed_t speed;
-#ifdef OS2
- ULONG rc;
- ULONG ulParmLen = 2; /* Maximum size of the parameter packet */
-#else
#ifdef HAVE_TERMIOS_H
struct termios tio;
#else
struct sgttyb ttyb;
#endif
-#endif
/*
* We need an open device in order to set the speed. If there is no
@@ -821,19 +789,6 @@ gp_port_serial_check_speed (GPPort *dev)
GP_LOG_D ("Setting baudrate to %d...", dev->settings.serial.speed);
speed = gp_port_serial_baudconv (dev->settings.serial.speed);
-#ifdef OS2
- rc = DosDevIOCtl (dev->pl->fd, /* Device handle */
- 0x0001, /* Serial-device control */
- 0x0043, /* Sets bit rate */
- (PULONG) &(dev->settings.serial.speed),
- sizeof(baudrate), /* Max. size of parameter list */
- &ulParmLen, /* Size of parameter packet */
- NULL, /* No data packet */
- 0, /* Maximum size of data packet */
- NULL); /* Size of data packet */
- if(rc != 0)
- printf("DosDevIOCtl baudrate error:%d\n",rc);
-#else /* !OS2 */
#ifdef HAVE_TERMIOS_H
if (tcgetattr(dev->pl->fd, &tio) < 0) {
gp_port_set_error (dev, _("Could not set the baudrate to %d"),
@@ -914,7 +869,6 @@ gp_port_serial_check_speed (GPPort *dev)
return GP_ERROR_IO_SERIAL_SPEED;
}
#endif
-#endif
dev->pl->baudrate = dev->settings.serial.speed;
return GP_OK;
diff --git a/libgphoto2_port/usb/Makefile-files b/libgphoto2_port/usb/Makefile-files
index 9cfde9e98..c33929e44 100644
--- a/libgphoto2_port/usb/Makefile-files
+++ b/libgphoto2_port/usb/Makefile-files
@@ -1,7 +1,5 @@
# -*- Makefile -*-
-EXTRA_DIST += usb/usb-os2.c
-
EXTRA_LTLIBRARIES += usb.la
usb_la_LDFLAGS = $(iolib_ldflags)
diff --git a/libgphoto2_port/usb/usb-os2.c b/libgphoto2_port/usb/usb-os2.c
deleted file mode 100644
index 33a111934..000000000
--- a/libgphoto2_port/usb/usb-os2.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
-/* gphoto2-port-usb.c - USB transport functions
-
- Copyright 1999-2000 Johannes Erdfelt <johannes@erdfelt.com>
-
- The GPIO Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- The GPIO Library 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
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public
- License along with the GPIO Library; see the file COPYING.LIB. If not,
- write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include <stdlib.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <sys/time.h>
-#include <sys/param.h>
-#include <dirent.h>
-#include <string.h>
-
-/*#include <usb.h>*/
-#include <gphoto2/gphoto2-port.h>
-
-
-int gp_port_usb_list(gp_port_info *list, int *count);
-int gp_port_usb_init(gp_port *dev);
-int gp_port_usb_exit(gp_port *dev);
-int gp_port_usb_open(gp_port *dev);
-int gp_port_usb_close(gp_port *dev);
-int gp_port_usb_reset(gp_port *dev);
-int gp_port_usb_write(gp_port * dev, char *bytes, int size);
-int gp_port_usb_read(gp_port * dev, char *bytes, int size);
-int gp_port_usb_update(gp_port * dev);
-
-int gp_port_usb_clear_halt_lib(gp_port * dev, int ep);
-int gp_port_usb_msg_read_lib(gp_port * dev, int value, char *bytes, int size);
-int gp_port_usb_msg_write_lib(gp_port * dev, int value, char *bytes, int size);
-int gp_port_usb_find_device_lib(gp_port *dev, int idvendor, int idproduct);
-
-/* Dynamic library functions
- --------------------------------------------------------------------- */
-
-gp_port_type gp_port_library_type () {
-
- return (GP_PORT_USB);
-}
-
-gp_port_operations *gp_port_library_operations () {
-
- gp_port_operations *ops;
-
- ops = calloc(1, sizeof(gp_port_operations));
- if (!ops)
- return NULL;
-
- ops->init = gp_port_usb_init;
- ops->exit = gp_port_usb_exit;
- ops->open = gp_port_usb_open;
- ops->close = gp_port_usb_close;
- ops->read = gp_port_usb_read;
- ops->write = gp_port_usb_write;
- ops->update = gp_port_usb_update;
- ops->clear_halt = gp_port_usb_clear_halt_lib;
- ops->msg_write = gp_port_usb_msg_write_lib;
- ops->msg_read = gp_port_usb_msg_read_lib;
- ops->find_device = gp_port_usb_find_device_lib;
-
- return (ops);
-}
-
-int gp_port_library_list(gp_port_info *list, int *count)
-{
-
- list[*count].type = GP_PORT_USB;
- strcpy(list[*count].name, "Universal Serial Bus");
- strcpy(list[*count].path, "usb:");
- /* list[*count].argument_needed = 0; */
- *count += 1;
-
- return GP_OK;
-}
-
-int gp_port_usb_init(gp_port *dev)
-{
-/* usb_init();
- usb_find_busses();
- usb_find_devices();*/
- return (GP_OK);
-}
-
-int gp_port_usb_exit(gp_port *dev)
-{
- return (GP_OK);
-}
-
-int gp_port_usb_open(gp_port *dev)
-{
- int ret;
- void *udev;
-
- if (dev->debug_level)
- printf ("gp_port_usb_open() called\n");
-
- /* Open the device using the previous usb_handle returned by find_device */
- udev = dev->device_handle;
- /*dev->device_handle = usb_open(udev);*/
- if (!dev->device_handle)
- return GP_ERROR_IO_OPEN;
-
- /*ret = usb_set_configuration(dev->device_handle, dev->settings.usb.config);*/
- if (ret < 0) {
- fprintf(stderr, "gp_port_usb_open: could not set config %d: %s\n",
- dev->settings.usb.config, strerror(errno));
- return GP_ERROR_IO_OPEN;
- }
-
- /*ret = usb_claim_interface(dev->device_handle, dev->settings.usb.interface);*/
- if (ret < 0) {
- fprintf(stderr, "gp_port_usb_open: could not claim intf %d: %s\n",
- dev->settings.usb.interface, strerror(errno));
- return GP_ERROR_IO_OPEN;
- }
-
- /*ret = usb_set_altinterface(dev->device_handle, dev->settings.usb.altsetting);*/
- if (ret < 0) {
- fprintf(stderr, "gp_port_usb_open: could not set intf %d/%d: %s\n",
- dev->settings.usb.interface,
- dev->settings.usb.altsetting, strerror(errno));
- return GP_ERROR_IO_OPEN;
- }
-
- return GP_OK;
-}
-
-int gp_port_usb_close(gp_port *dev)
-{
- if (dev->debug_level)
- printf ("gp_port_usb_close() called\n");
-
- /*if (usb_close(dev->device_handle) < 0)
- fprintf(stderr, "gp_port_usb_close: %s\n",
- strerror(errno)); */
-
- dev->device_handle = NULL;
-
- return GP_OK;
-}
-
-int gp_port_usb_reset(gp_port *dev)
-{
- /*gp_port_usb_close(dev);
- return gp_port_usb_open(dev);*/
-}
-
-int gp_port_usb_clear_halt_lib(gp_port * dev, int ep)
-{
- int ret=0;
-
- switch (ep) {
- case GP_PORT_USB_ENDPOINT_IN :
- /*ret=usb_clear_halt(dev->device_handle, dev->settings.usb.inep);*/
- break;
- case GP_PORT_USB_ENDPOINT_OUT :
- /*ret=usb_clear_halt(dev->device_handle, dev->settings.usb.outep);*/
- case GP_PORT_USB_ENDPOINT_INT :
- /*ret=usb_clear_halt(dev->device_handle, dev->settings.usb.intep);*/
- break;
- default:
- fprintf(stderr,"gp_port_usb_clear_halt: bad EndPoint argument\n");
- return GP_ERROR_IO_USB_CLEAR_HALT;
- }
- return (ret ? GP_ERROR_IO_USB_CLEAR_HALT : GP_OK);
-}
-
-int gp_port_usb_write(gp_port * dev, char *bytes, int size)
-{
- int ret;
-/*
- if (dev->debug_level) {
- int i;
-
- printf("gp_port_usb_write(): ");
- for (i = 0; i < size; i++)
- printf("%02x ",(unsigned char)bytes[i]);
- printf("\n");
- }
-*/
- /*ret = usb_bulk_write(dev->device_handle, dev->settings.usb.outep,
- bytes, size, dev->timeout);*/
- if (ret < 0)
- return (GP_ERROR_IO_WRITE);
- return (ret);
-}
-
-int gp_port_usb_read(gp_port * dev, char *bytes, int size)
-{
- int ret;
-
- /*ret = usb_bulk_read(dev->device_handle, dev->settings.usb.inep,
- bytes, size, dev->timeout);*/
- if (ret < 0)
- return GP_ERROR_IO_READ;
-
-/*
- if (dev->debug_level) {
- int i;
-
- printf("gp_port_usb_read(timeout=%d): ", dev->timeout);
- for (i = 0; i < ret; i++)
- printf("%02x ",(unsigned char)(bytes[i]));
- printf("\n");
- }
-*/
-
- return ret;
-}
-
-int gp_port_usb_msg_write_lib(gp_port * dev, int value, char *bytes, int size)
-{
- /*return usb_control_msg(dev->device_handle,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE,
- size > 1 ? 0x04 : 0x0c, value, 0, bytes, size, dev->timeout);*/
-}
-
-int gp_port_usb_msg_read_lib(gp_port * dev, int value, char *bytes, int size)
-{
- /*return usb_control_msg(dev->device_handle,
- USB_TYPE_VENDOR | USB_RECIP_DEVICE | 0x80,
- size > 1 ? 0x04 : 0x0c, value, 0, bytes, size, dev->timeout);*/
-}
-
-/*
- * This function applys changes to the device
- * (At this time it does nothing)
- */
-int gp_port_usb_update(gp_port * dev)
-{
- memcpy(&dev->settings, &dev->settings_pending, sizeof(dev->settings));
-
- return GP_OK;
-}
-
-int gp_port_usb_find_device_lib(gp_port * d, int idvendor, int idproduct)
-{
- /*struct usb_bus *bus;
- struct usb_device *dev;
- for (bus = usb_busses; bus; bus = bus->next) {
- for (dev = bus->devices; dev; dev = dev->next) {
- if ((dev->descriptor.idVendor == idvendor) &&
- (dev->descriptor.idProduct == idproduct)) {
- if (d)
- d->device_handle = dev;
- return GP_OK;
- }
- }
- } */
-
- return GP_ERROR_IO_USB_FIND;
-}