2001-10-26 Lutz M�ller <urc8@rz.uni-karlsruhe.de>
* 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
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2001-10-26 Lutz Müller <urc8@rz.uni-karlsruhe.de>
|
||||
|
||||
* include: Move everything from here to ...
|
||||
* libgphoto2_port: ... here.
|
||||
|
||||
2001-10-26 Lutz Müller <urc8@rz.uni-karlsruhe.de>
|
||||
|
||||
* configure.in: Give users the possibility _not_ to compile in USB
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
*~ .*~
|
||||
Makefile
|
||||
Makefile.in
|
||||
config.h
|
||||
config.h.in
|
||||
stamp-h
|
||||
stamp-h1
|
||||
stamp-h.in
|
||||
@@ -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
|
||||
@@ -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_ */
|
||||
@@ -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_ */
|
||||
@@ -4,3 +4,7 @@ Makefile
|
||||
.libs
|
||||
*.lo
|
||||
libgphoto2_port.la
|
||||
config.h.in
|
||||
config.h
|
||||
stamp.h.in
|
||||
stamp.h
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -23,18 +23,13 @@
|
||||
|
||||
#include <gphoto2-port-info-list.h>
|
||||
|
||||
/* For portability */
|
||||
#include <gphoto2-port-portability.h>
|
||||
#ifdef OS2
|
||||
#include <gphoto2_port-portability-os2.h>
|
||||
#include <gphoto2-port-portability-os2.h>
|
||||
#include <os2.h>
|
||||
#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);
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <gphoto2-port-library.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -61,11 +62,9 @@
|
||||
# include <lockdev.h>
|
||||
#endif
|
||||
|
||||
#include <gphoto2-port-serial.h>
|
||||
#include <gphoto2-port-result.h>
|
||||
#include <gphoto2-port-log.h>
|
||||
#include <gphoto2-port.h>
|
||||
#include <gphoto2-port-library.h>
|
||||
|
||||
#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 */
|
||||
};
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
* Boston, MA 02111-1307, USA.
|
||||
*/
|
||||
#include <config.h>
|
||||
#include "gphoto2-port-usb.h"
|
||||
#include <gphoto2-port-library.h>
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -37,7 +37,6 @@
|
||||
#include <gphoto2-port.h>
|
||||
#include <gphoto2-port-result.h>
|
||||
#include <gphoto2-port-log.h>
|
||||
#include <gphoto2-port-library.h>
|
||||
|
||||
#ifdef ENABLE_NLS
|
||||
# include <libintl.h>
|
||||
|
||||
Reference in New Issue
Block a user