From 04a61a10f4eaeff602755b612cbb59837a05ae5b Mon Sep 17 00:00:00 2001 From: Lutz Mueller Date: Fri, 26 Oct 2001 20:11:19 +0000 Subject: [PATCH] =?UTF-8?q?2001-10-26=20=20Lutz=20M=EF=BF=BDller=20?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * include: Move everything from here to ... * libgphoto2_port: ... here. git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@2770 67ed7778-7388-44ab-90cf-0a291f65f57c --- libgphoto2_port/ChangeLog | 5 ++ libgphoto2_port/Makefile.am | 2 +- libgphoto2_port/configure.in | 3 +- libgphoto2_port/include/.cvsignore | 8 -- libgphoto2_port/include/Makefile.am | 8 -- libgphoto2_port/include/gphoto2-port-serial.h | 87 ------------------- libgphoto2_port/include/gphoto2-port-usb.h | 15 ---- libgphoto2_port/libgphoto2_port/.cvsignore | 4 + libgphoto2_port/libgphoto2_port/Makefile.am | 7 +- .../gphoto2-port-portability-os2.h} | 0 ...rtability.c => gphoto2-port-portability.c} | 0 .../gphoto2-port-portability.h} | 0 .../gphoto2-port.h | 43 ++++++--- libgphoto2_port/serial/unix.c | 63 +++++++++++++- libgphoto2_port/usb/libusb.c | 3 +- 15 files changed, 108 insertions(+), 140 deletions(-) delete mode 100644 libgphoto2_port/include/.cvsignore delete mode 100644 libgphoto2_port/include/Makefile.am delete mode 100644 libgphoto2_port/include/gphoto2-port-serial.h delete mode 100644 libgphoto2_port/include/gphoto2-port-usb.h rename libgphoto2_port/{include/gphoto2_port-portability-os2.h => libgphoto2_port/gphoto2-port-portability-os2.h} (100%) rename libgphoto2_port/libgphoto2_port/{portability.c => gphoto2-port-portability.c} (100%) rename libgphoto2_port/{include/gphoto2-portability.h => libgphoto2_port/gphoto2-port-portability.h} (100%) rename libgphoto2_port/{include => libgphoto2_port}/gphoto2-port.h (82%) diff --git a/libgphoto2_port/ChangeLog b/libgphoto2_port/ChangeLog index 0ff94ffc6..c88230c47 100644 --- a/libgphoto2_port/ChangeLog +++ b/libgphoto2_port/ChangeLog @@ -1,3 +1,8 @@ +2001-10-26 Lutz Müller + + * include: Move everything from here to ... + * libgphoto2_port: ... here. + 2001-10-26 Lutz Müller * configure.in: Give users the possibility _not_ to compile in USB diff --git a/libgphoto2_port/Makefile.am b/libgphoto2_port/Makefile.am index faa25b3aa..51b94caf1 100644 --- a/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/Makefile.am @@ -7,7 +7,7 @@ VERSION_FLAGS = -DLIBGPPORT_VERSION=\"@LIBGPPORT_VERSION@\" -DHAVE_TERMIOS_H ## Executable files bin_SCRIPTS = gphoto2-port-config -SUBDIRS = po intl libgphoto2_port include test @IOLIB_SUBDIRS@ doc m4 +SUBDIRS = po intl libgphoto2_port test @IOLIB_SUBDIRS@ doc m4 ## GNOME configuration script confexecdir=$(libdir) diff --git a/libgphoto2_port/configure.in b/libgphoto2_port/configure.in index d07d07c8f..59a5ac8ce 100644 --- a/libgphoto2_port/configure.in +++ b/libgphoto2_port/configure.in @@ -1,7 +1,7 @@ dnl Process this file with autoconf to produce a configure script. AC_INIT(libgphoto2_port/gphoto2-port.c) -AM_CONFIG_HEADER(include/config.h) +AM_CONFIG_HEADER(libgphoto2_port/config.h) LIBGPPORT_MAJOR_VERSION=0 LIBGPPORT_MINOR_VERSION=0 @@ -211,7 +211,6 @@ Makefile libgphoto2_port/Makefile serial/Makefile usb/Makefile -include/Makefile gphoto2-port-config intl/Makefile po/Makefile.in diff --git a/libgphoto2_port/include/.cvsignore b/libgphoto2_port/include/.cvsignore deleted file mode 100644 index 93be734a6..000000000 --- a/libgphoto2_port/include/.cvsignore +++ /dev/null @@ -1,8 +0,0 @@ -*~ .*~ -Makefile -Makefile.in -config.h -config.h.in -stamp-h -stamp-h1 -stamp-h.in diff --git a/libgphoto2_port/include/Makefile.am b/libgphoto2_port/include/Makefile.am deleted file mode 100644 index bce6d997c..000000000 --- a/libgphoto2_port/include/Makefile.am +++ /dev/null @@ -1,8 +0,0 @@ -EXTRA_DIST = gphoto2_port-portability-os2.h - -gphoto2_port_incdir = $(includedir)/gphoto2 -gphoto2_port_inc_HEADERS =\ - gphoto2-port.h \ - gphoto2-portability.h \ - gphoto2-port-serial.h \ - gphoto2-port-usb.h diff --git a/libgphoto2_port/include/gphoto2-port-serial.h b/libgphoto2_port/include/gphoto2-port-serial.h deleted file mode 100644 index 657341025..000000000 --- a/libgphoto2_port/include/gphoto2-port-serial.h +++ /dev/null @@ -1,87 +0,0 @@ -#ifndef _GP_PORT_SERIAL_H_ -#define _GP_PORT_SERIAL_H_ - -/* Serial port prefix for enumeration */ -/* %i for numbers, %c for letters */ -/* also define the low and high values of the range to check for devices */ - - -/* Linux */ -#ifdef __linux -/* devfs is accounted for in the implementation */ -#define GP_PORT_SERIAL_PREFIX "/dev/ttyS%i" -#define GP_PORT_SERIAL_RANGE_LOW 0 -#define GP_PORT_SERIAL_RANGE_HIGH 32 -#endif - -/* BSD */ -#if defined(__FreeBSD__) || defined(__NetBSD__) -#define GP_PORT_SERIAL_PREFIX "/dev/tty0%i" -#define GP_PORT_SERIAL_RANGE_LOW 0 -#define GP_PORT_SERIAL_RANGE_HIGH 32 -#endif - -/* Darwin */ -#if defined(__APPLE__) -/* Does this many any sense on a Mac??? */ -#define GP_PORT_SERIAL_PREFIX "/dev/tty.modem" -#define GP_PORT_SERIAL_RANGE_LOW 0 -#define GP_PORT_SERIAL_RANGE_HIGH 0 -#endif - -/* Solaris */ -#ifdef sun -#define GP_PORT_SERIAL_PREFIX "/dev/tty%c" -#define GP_PORT_SERIAL_RANGE_LOW 'a' -#define GP_PORT_SERIAL_RANGE_HIGH 'z' -#endif - -/* BeOS */ -#ifdef beos -/* ????????????? */ -#define GP_PORT_SERIAL_PREFIX NULL -#define GP_PORT_SERIAL_RANGE_LOW 0 -#define GP_PORT_SERIAL_RANGE_HIGH 0 -#endif - -/* Windows */ -#ifdef WIN32 -#define GP_PORT_SERIAL_PREFIX "COM%i:" -#define GP_PORT_SERIAL_RANGE_LOW 1 -#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 - -/* Others? */ - -/* Default */ -#ifndef GP_PORT_SERIAL_PREFIX -#define GP_PORT_SERIAL_PREFIX "/dev/cua%i" -#define GP_PORT_SERIAL_RANGE_LOW 0 -#define GP_PORT_SERIAL_RANGE_HIGH 0 -#endif - -/* Serial port specific settings */ -typedef struct { - char port[128]; - int speed; - int bits; - int parity; - int stopbits; -} gp_port_serial_settings; - -extern struct gp_port_operations gp_port_serial_operations; - -#define PIN_RTS 0 -#define PIN_DTR 1 -#define PIN_CTS 2 -#define PIN_DSR 3 -#define PIN_CD 4 -#define PIN_RING 5 - -#endif /* _GP_PORT_SERIAL_H_ */ diff --git a/libgphoto2_port/include/gphoto2-port-usb.h b/libgphoto2_port/include/gphoto2-port-usb.h deleted file mode 100644 index 08912bf53..000000000 --- a/libgphoto2_port/include/gphoto2-port-usb.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef _GP_PORT_USB_H_ -#define _GP_PORT_USB_H_ - -/* USB port specific settings */ -typedef struct { - int inep; - int outep; - int config; - int interface; - int altsetting; -} gp_port_usb_settings; - -extern struct gp_port_operations gp_port_usb_operations; - -#endif /* _GP_PORT_USB_H_ */ diff --git a/libgphoto2_port/libgphoto2_port/.cvsignore b/libgphoto2_port/libgphoto2_port/.cvsignore index 78f298a59..11a0f620f 100644 --- a/libgphoto2_port/libgphoto2_port/.cvsignore +++ b/libgphoto2_port/libgphoto2_port/.cvsignore @@ -4,3 +4,7 @@ Makefile .libs *.lo libgphoto2_port.la +config.h.in +config.h +stamp.h.in +stamp.h diff --git a/libgphoto2_port/libgphoto2_port/Makefile.am b/libgphoto2_port/libgphoto2_port/Makefile.am index 04fd7aef8..ceda573ca 100644 --- a/libgphoto2_port/libgphoto2_port/Makefile.am +++ b/libgphoto2_port/libgphoto2_port/Makefile.am @@ -14,11 +14,14 @@ libgphoto2_port_la_SOURCES = \ gphoto2-port-log.c \ gphoto2-port-library.h \ gphoto2-port.c \ - gphoto2-port-result.c \ - portability.c + gphoto2-port-portability.c \ + gphoto2-port-result.c libgphoto2_portincludedir = $(includedir)/gphoto2 libgphoto2_portinclude_HEADERS = \ gphoto2-port-info-list.h \ gphoto2-port-log.h \ + gphoto2-port-portability.h \ gphoto2-port-result.h + +EXTRA_DIST = gphoto2-port-portability-os2.h diff --git a/libgphoto2_port/include/gphoto2_port-portability-os2.h b/libgphoto2_port/libgphoto2_port/gphoto2-port-portability-os2.h similarity index 100% rename from libgphoto2_port/include/gphoto2_port-portability-os2.h rename to libgphoto2_port/libgphoto2_port/gphoto2-port-portability-os2.h diff --git a/libgphoto2_port/libgphoto2_port/portability.c b/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.c similarity index 100% rename from libgphoto2_port/libgphoto2_port/portability.c rename to libgphoto2_port/libgphoto2_port/gphoto2-port-portability.c diff --git a/libgphoto2_port/include/gphoto2-portability.h b/libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h similarity index 100% rename from libgphoto2_port/include/gphoto2-portability.h rename to libgphoto2_port/libgphoto2_port/gphoto2-port-portability.h diff --git a/libgphoto2_port/include/gphoto2-port.h b/libgphoto2_port/libgphoto2_port/gphoto2-port.h similarity index 82% rename from libgphoto2_port/include/gphoto2-port.h rename to libgphoto2_port/libgphoto2_port/gphoto2-port.h index b2251d34a..65b3bdba3 100644 --- a/libgphoto2_port/include/gphoto2-port.h +++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.h @@ -23,18 +23,13 @@ #include +/* For portability */ +#include #ifdef OS2 -#include +#include #include #endif -/* Include the portability layer */ -#include "gphoto2-portability.h" - -/* Include the various headers for other devices */ -#include "gphoto2-port-serial.h" -#include "gphoto2-port-usb.h" - #ifndef TRUE #define TRUE (0==0) #endif @@ -45,11 +40,26 @@ #define GP_PORT_MAX_BUF_LEN 4096 /* max length of receive buffer */ -/* Put the settings together in a union */ -typedef union { - gp_port_serial_settings serial; - gp_port_usb_settings usb; -} GPPortSettings; +typedef struct _GPPortSettingsSerial GPPortSettingsSerial; +struct _GPPortSettingsSerial { + char port[128]; + int speed; + int bits, parity, stopbits; +}; + +typedef struct _GPPortSettingsUSB GPPortSettingsUSB; +struct _GPPortSettingsUSB { + int inep, outep; + int config; + int interface; + int altsetting; +}; + +typedef union _GPPortSettings GPPortSettings; +union _GPPortSettings { + GPPortSettingsSerial serial; + GPPortSettingsUSB usb; +}; enum { GP_PORT_USB_ENDPOINT_IN, @@ -96,6 +106,13 @@ int gp_port_settings_get (GPPort *dev, GPPortSettings *settings); int gp_port_write (GPPort *dev, char *bytes, int size); int gp_port_read (GPPort *dev, char *bytes, int size); +#define PIN_RTS 0 +#define PIN_DTR 1 +#define PIN_CTS 2 +#define PIN_DSR 3 +#define PIN_CD 4 +#define PIN_RING 5 + int gp_port_pin_get (GPPort *dev, int pin, int *level); int gp_port_pin_set (GPPort *dev, int pin, int level); diff --git a/libgphoto2_port/serial/unix.c b/libgphoto2_port/serial/unix.c index 6ea051c74..3fdcba856 100644 --- a/libgphoto2_port/serial/unix.c +++ b/libgphoto2_port/serial/unix.c @@ -28,6 +28,7 @@ */ #include +#include #include #include @@ -61,11 +62,9 @@ # include #endif -#include #include #include #include -#include #ifdef HAVE_TERMIOS_H static struct termios term_old; @@ -94,6 +93,66 @@ static struct sgttyb term_old; #define CHECK(result) {int r=(result); if (r<0) return (r);} +/* Linux */ +#ifdef __linux +/* devfs is accounted for in the implementation */ +#define GP_PORT_SERIAL_PREFIX "/dev/ttyS%i" +#define GP_PORT_SERIAL_RANGE_LOW 0 +#define GP_PORT_SERIAL_RANGE_HIGH 32 +#endif + +/* BSD */ +#if defined(__FreeBSD__) || defined(__NetBSD__) +#define GP_PORT_SERIAL_PREFIX "/dev/tty0%i" +#define GP_PORT_SERIAL_RANGE_LOW 0 +#define GP_PORT_SERIAL_RANGE_HIGH 32 +#endif + +/* Darwin */ +#if defined(__APPLE__) +/* Does this many any sense on a Mac??? */ +#define GP_PORT_SERIAL_PREFIX "/dev/tty.modem" +#define GP_PORT_SERIAL_RANGE_LOW 0 +#define GP_PORT_SERIAL_RANGE_HIGH 0 +#endif + +/* Solaris */ +#ifdef sun +#define GP_PORT_SERIAL_PREFIX "/dev/tty%c" +#define GP_PORT_SERIAL_RANGE_LOW 'a' +#define GP_PORT_SERIAL_RANGE_HIGH 'z' +#endif + +/* BeOS */ +#ifdef beos +/* ????????????? */ +#define GP_PORT_SERIAL_PREFIX NULL +#define GP_PORT_SERIAL_RANGE_LOW 0 +#define GP_PORT_SERIAL_RANGE_HIGH 0 +#endif + +/* Windows */ +#ifdef WIN32 +#define GP_PORT_SERIAL_PREFIX "COM%i:" +#define GP_PORT_SERIAL_RANGE_LOW 1 +#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 + +/* Others? */ + +/* Default */ +#ifndef GP_PORT_SERIAL_PREFIX +#define GP_PORT_SERIAL_PREFIX "/dev/cua%i" +#define GP_PORT_SERIAL_RANGE_LOW 0 +#define GP_PORT_SERIAL_RANGE_HIGH 0 +#endif + struct _GPPortPrivateLibrary { int fd; /* Device handle */ }; diff --git a/libgphoto2_port/usb/libusb.c b/libgphoto2_port/usb/libusb.c index 7aadeb0de..442500269 100644 --- a/libgphoto2_port/usb/libusb.c +++ b/libgphoto2_port/usb/libusb.c @@ -20,7 +20,7 @@ * Boston, MA 02111-1307, USA. */ #include -#include "gphoto2-port-usb.h" +#include #include #include @@ -37,7 +37,6 @@ #include #include #include -#include #ifdef ENABLE_NLS # include