From b29cbe8d7363409fb30041efe6fbcd4b72b3aa0e Mon Sep 17 00:00:00 2001 From: Donn Morrison Date: Tue, 20 Feb 2001 08:43:25 +0000 Subject: [PATCH] donn added kodak dc3200 driver git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@1589 67ed7778-7388-44ab-90cf-0a291f65f57c --- camlibs/kodak/dc3200/Makefile | 374 ++++++++++++ camlibs/kodak/dc3200/Makefile.am | 12 + camlibs/kodak/dc3200/Makefile.in | 374 ++++++++++++ camlibs/kodak/dc3200/dc3200.c | 404 +++++++++++++ camlibs/kodak/dc3200/dc3200.h | 42 ++ camlibs/kodak/dc3200/library.c | 977 +++++++++++++++++++++++++++++++ camlibs/kodak/dc3200/library.h | 77 +++ 7 files changed, 2260 insertions(+) create mode 100644 camlibs/kodak/dc3200/Makefile create mode 100644 camlibs/kodak/dc3200/Makefile.am create mode 100644 camlibs/kodak/dc3200/Makefile.in create mode 100644 camlibs/kodak/dc3200/dc3200.c create mode 100644 camlibs/kodak/dc3200/dc3200.h create mode 100644 camlibs/kodak/dc3200/library.c create mode 100644 camlibs/kodak/dc3200/library.h diff --git a/camlibs/kodak/dc3200/Makefile b/camlibs/kodak/dc3200/Makefile new file mode 100644 index 000000000..e7bef385a --- /dev/null +++ b/camlibs/kodak/dc3200/Makefile @@ -0,0 +1,374 @@ +# Generated automatically from Makefile.in by configure. +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = /bin/sh + +srcdir = . +top_srcdir = ../../.. +prefix = /usr/local +exec_prefix = ${prefix} + +bindir = ${exec_prefix}/bin +sbindir = ${exec_prefix}/sbin +libexecdir = ${exec_prefix}/libexec +datadir = ${prefix}/share +sysconfdir = ${prefix}/etc +sharedstatedir = ${prefix}/com +localstatedir = ${prefix}/var +libdir = ${exec_prefix}/lib +infodir = ${prefix}/info +mandir = ${prefix}/man +includedir = ${prefix}/include +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/gphoto +pkglibdir = $(libdir)/gphoto +pkgincludedir = $(includedir)/gphoto + +top_builddir = ../../.. + +ACLOCAL = aclocal +AUTOCONF = autoconf +AUTOMAKE = automake +AUTOHEADER = autoheader + +INSTALL = /usr/bin/install -c +INSTALL_PROGRAM = ${INSTALL} $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = ${INSTALL} -m 644 +INSTALL_SCRIPT = ${INSTALL_PROGRAM} +transform = s,x,x, + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = i686-pc-linux +host_triplet = i686-pc-linux-gnu +AS = @AS@ +CATALOGS = +CATOBJEXT = .gmo +CC = gcc +CFLAGS = -g -O2 -g -Wall -I/usr/local/include/gphoto2 -I/usr/local/include -DGP_PORT_SUPPORTED_SERIAL +CPP = gcc -E +DATADIRNAME = share +DLLTOOL = @DLLTOOL@ +GENCAT = +GMOFILES = de.gmo +GMSGFMT = /usr/local/bin/msgfmt +GT_NO = +GT_YES = #YES# +INCLUDE_LOCALE_H = #include +INSTOBJEXT = .mo +INTLDEPS = +INTLLIBS = +INTLOBJS = +LIBGPHOTO2_INCLUDEDIR = -I${includedir} +LIBGPHOTO2_LIBDIR = -L${libdir} +LIBGPHOTO2_LIBS = -lgphoto2 +LIBGPHOTO2_PORT_DIR = +LIBGPHOTO2_VERSION = 2.0pre1 +LIBGPPORT_CONFIG = /usr/local/bin/gphoto2-port-config +LIBS = -ldl -L/usr/local/lib -lgphoto2_port +LIBTOOL = $(SHELL) $(top_builddir)/libtool +LN_S = ln -s +MAINT = # +MAKEINFO = makeinfo +MKINSTALLDIRS = ./mkinstalldirs +MSGFMT = /usr/local/bin/msgfmt +OBJDUMP = @OBJDUMP@ +PACKAGE = gphoto +POFILES = de.po +POSUB = po +RANLIB = ranlib +SUBDIRS_CAMLIBS = barbie canon directory sierra konica panasonic digita kodak minolta stv0680 +USE_INCLUDED_LIBINTL = no +USE_NLS = yes +VERSION = 2.0pre1 +l = + +camlibdir = $(prefix)/lib/gphoto2 +camlib_LTLIBRARIES = libgphoto2_kodak_dc3200.la + +INCLUDES = -I$(top_srcdir)/include + +libgphoto2_kodak_dc3200_la_SOURCES = dc3200.c dc3200.h library.c library.h + +libgphoto2_kodak_dc3200_la_LDFLAGS = -avoid-version -L$(shell pwd)/$(top_builddir)/libgphoto2/.libs + + +libgphoto2_kodak_dc3200_la_LIBADD = -lgphoto2 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(camlib_LTLIBRARIES) + + +DEFS = -DHAVE_CONFIG_H -I. -I$(srcdir) -I../../.. +CPPFLAGS = +LDFLAGS = -g -Wall +libgphoto2_kodak_dc3200_la_DEPENDENCIES = +libgphoto2_kodak_dc3200_la_OBJECTS = dc3200.lo library.lo +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/dc3200.P .deps/library.P +SOURCES = $(libgphoto2_kodak_dc3200_la_SOURCES) +OBJECTS = $(libgphoto2_kodak_dc3200_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .s +$(srcdir)/Makefile.in: # Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu camlibs/kodak/dc3200/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-camlibLTLIBRARIES: + +clean-camlibLTLIBRARIES: + -test -z "$(camlib_LTLIBRARIES)" || rm -f $(camlib_LTLIBRARIES) + +distclean-camlibLTLIBRARIES: + +maintainer-clean-camlibLTLIBRARIES: + +install-camlibLTLIBRARIES: $(camlib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(camlibdir) + @list='$(camlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(camlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(camlibdir)/$$p; \ + else :; fi; \ + done + +uninstall-camlibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(camlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(camlibdir)/$$p; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libgphoto2_kodak_dc3200.la: $(libgphoto2_kodak_dc3200_la_OBJECTS) $(libgphoto2_kodak_dc3200_la_DEPENDENCIES) + $(LINK) -rpath $(camlibdir) $(libgphoto2_kodak_dc3200_la_LDFLAGS) $(libgphoto2_kodak_dc3200_la_OBJECTS) $(libgphoto2_kodak_dc3200_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = camlibs/kodak/dc3200 + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu camlibs/kodak/dc3200/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-camlibLTLIBRARIES +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-camlibLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(camlibdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-camlibLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-camlibLTLIBRARIES clean-compile clean-libtool \ + clean-tags clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-camlibLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-camlibLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-camlibLTLIBRARIES distclean-camlibLTLIBRARIES \ +clean-camlibLTLIBRARIES maintainer-clean-camlibLTLIBRARIES \ +uninstall-camlibLTLIBRARIES install-camlibLTLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/camlibs/kodak/dc3200/Makefile.am b/camlibs/kodak/dc3200/Makefile.am new file mode 100644 index 000000000..fc3f4aa27 --- /dev/null +++ b/camlibs/kodak/dc3200/Makefile.am @@ -0,0 +1,12 @@ +camlibdir = $(prefix)/lib/gphoto2 +camlib_LTLIBRARIES = libgphoto2_kodak_dc3200.la + +INCLUDES = -I$(top_srcdir)/include + +libgphoto2_kodak_dc3200_la_SOURCES = dc3200.c dc3200.h library.c library.h + +libgphoto2_kodak_dc3200_la_LDFLAGS =\ + -avoid-version\ + -L$(shell pwd)/$(top_builddir)/libgphoto2/.libs + +libgphoto2_kodak_dc3200_la_LIBADD = -lgphoto2 diff --git a/camlibs/kodak/dc3200/Makefile.in b/camlibs/kodak/dc3200/Makefile.in new file mode 100644 index 000000000..4dcc3db0b --- /dev/null +++ b/camlibs/kodak/dc3200/Makefile.in @@ -0,0 +1,374 @@ +# Makefile.in generated automatically by automake 1.4 from Makefile.am + +# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + + +SHELL = @SHELL@ + +srcdir = @srcdir@ +top_srcdir = @top_srcdir@ +VPATH = @srcdir@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ + +bindir = @bindir@ +sbindir = @sbindir@ +libexecdir = @libexecdir@ +datadir = @datadir@ +sysconfdir = @sysconfdir@ +sharedstatedir = @sharedstatedir@ +localstatedir = @localstatedir@ +libdir = @libdir@ +infodir = @infodir@ +mandir = @mandir@ +includedir = @includedir@ +oldincludedir = /usr/include + +DESTDIR = + +pkgdatadir = $(datadir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ + +top_builddir = ../../.. + +ACLOCAL = @ACLOCAL@ +AUTOCONF = @AUTOCONF@ +AUTOMAKE = @AUTOMAKE@ +AUTOHEADER = @AUTOHEADER@ + +INSTALL = @INSTALL@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(AM_INSTALL_PROGRAM_FLAGS) +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +transform = @program_transform_name@ + +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +host_alias = @host_alias@ +host_triplet = @host@ +AS = @AS@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +DATADIRNAME = @DATADIRNAME@ +DLLTOOL = @DLLTOOL@ +GENCAT = @GENCAT@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GT_NO = @GT_NO@ +GT_YES = @GT_YES@ +INCLUDE_LOCALE_H = @INCLUDE_LOCALE_H@ +INSTOBJEXT = @INSTOBJEXT@ +INTLDEPS = @INTLDEPS@ +INTLLIBS = @INTLLIBS@ +INTLOBJS = @INTLOBJS@ +LIBGPHOTO2_INCLUDEDIR = @LIBGPHOTO2_INCLUDEDIR@ +LIBGPHOTO2_LIBDIR = @LIBGPHOTO2_LIBDIR@ +LIBGPHOTO2_LIBS = @LIBGPHOTO2_LIBS@ +LIBGPHOTO2_PORT_DIR = @LIBGPHOTO2_PORT_DIR@ +LIBGPHOTO2_VERSION = @LIBGPHOTO2_VERSION@ +LIBGPPORT_CONFIG = @LIBGPPORT_CONFIG@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +OBJDUMP = @OBJDUMP@ +PACKAGE = @PACKAGE@ +POFILES = @POFILES@ +POSUB = @POSUB@ +RANLIB = @RANLIB@ +SUBDIRS_CAMLIBS = @SUBDIRS_CAMLIBS@ +USE_INCLUDED_LIBINTL = @USE_INCLUDED_LIBINTL@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +l = @l@ + +camlibdir = $(prefix)/lib/gphoto2 +camlib_LTLIBRARIES = libgphoto2_kodak_dc3200.la + +INCLUDES = -I$(top_srcdir)/include + +libgphoto2_kodak_dc3200_la_SOURCES = dc3200.c dc3200.h library.c library.h + +libgphoto2_kodak_dc3200_la_LDFLAGS = -avoid-version -L$(shell pwd)/$(top_builddir)/libgphoto2/.libs + + +libgphoto2_kodak_dc3200_la_LIBADD = -lgphoto2 +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = ../../../config.h +CONFIG_CLEAN_FILES = +LTLIBRARIES = $(camlib_LTLIBRARIES) + + +DEFS = @DEFS@ -I. -I$(srcdir) -I../../.. +CPPFLAGS = @CPPFLAGS@ +LDFLAGS = @LDFLAGS@ +libgphoto2_kodak_dc3200_la_DEPENDENCIES = +libgphoto2_kodak_dc3200_la_OBJECTS = dc3200.lo library.lo +COMPILE = $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@ +DIST_COMMON = Makefile.am Makefile.in + + +DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST) + +TAR = gtar +GZIP_ENV = --best +DEP_FILES = .deps/dc3200.P .deps/library.P +SOURCES = $(libgphoto2_kodak_dc3200_la_SOURCES) +OBJECTS = $(libgphoto2_kodak_dc3200_la_OBJECTS) + +all: all-redirect +.SUFFIXES: +.SUFFIXES: .S .c .lo .o .s +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.in $(ACLOCAL_M4) + cd $(top_srcdir) && $(AUTOMAKE) --gnu camlibs/kodak/dc3200/Makefile + +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status $(BUILT_SOURCES) + cd $(top_builddir) \ + && CONFIG_FILES=$(subdir)/$@ CONFIG_HEADERS= $(SHELL) ./config.status + + +mostlyclean-camlibLTLIBRARIES: + +clean-camlibLTLIBRARIES: + -test -z "$(camlib_LTLIBRARIES)" || rm -f $(camlib_LTLIBRARIES) + +distclean-camlibLTLIBRARIES: + +maintainer-clean-camlibLTLIBRARIES: + +install-camlibLTLIBRARIES: $(camlib_LTLIBRARIES) + @$(NORMAL_INSTALL) + $(mkinstalldirs) $(DESTDIR)$(camlibdir) + @list='$(camlib_LTLIBRARIES)'; for p in $$list; do \ + if test -f $$p; then \ + echo "$(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(camlibdir)/$$p"; \ + $(LIBTOOL) --mode=install $(INSTALL) $$p $(DESTDIR)$(camlibdir)/$$p; \ + else :; fi; \ + done + +uninstall-camlibLTLIBRARIES: + @$(NORMAL_UNINSTALL) + list='$(camlib_LTLIBRARIES)'; for p in $$list; do \ + $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(camlibdir)/$$p; \ + done + +.s.o: + $(COMPILE) -c $< + +.S.o: + $(COMPILE) -c $< + +mostlyclean-compile: + -rm -f *.o core *.core + +clean-compile: + +distclean-compile: + -rm -f *.tab.c + +maintainer-clean-compile: + +.s.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +.S.lo: + $(LIBTOOL) --mode=compile $(COMPILE) -c $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +distclean-libtool: + +maintainer-clean-libtool: + +libgphoto2_kodak_dc3200.la: $(libgphoto2_kodak_dc3200_la_OBJECTS) $(libgphoto2_kodak_dc3200_la_DEPENDENCIES) + $(LINK) -rpath $(camlibdir) $(libgphoto2_kodak_dc3200_la_LDFLAGS) $(libgphoto2_kodak_dc3200_la_OBJECTS) $(libgphoto2_kodak_dc3200_la_LIBADD) $(LIBS) + +tags: TAGS + +ID: $(HEADERS) $(SOURCES) $(LISP) + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + here=`pwd` && cd $(srcdir) \ + && mkid -f$$here/ID $$unique $(LISP) + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) $(LISP) + tags=; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS)'; \ + unique=`for i in $$list; do echo $$i; done | \ + awk ' { files[$$0] = 1; } \ + END { for (i in files) print i; }'`; \ + test -z "$(ETAGS_ARGS)$$unique$(LISP)$$tags" \ + || (cd $(srcdir) && etags $(ETAGS_ARGS) $$tags $$unique $(LISP) -o $$here/TAGS) + +mostlyclean-tags: + +clean-tags: + +distclean-tags: + -rm -f TAGS ID + +maintainer-clean-tags: + +distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)/$(subdir) + +subdir = camlibs/kodak/dc3200 + +distdir: $(DISTFILES) + here=`cd $(top_builddir) && pwd`; \ + top_distdir=`cd $(top_distdir) && pwd`; \ + distdir=`cd $(distdir) && pwd`; \ + cd $(top_srcdir) \ + && $(AUTOMAKE) --include-deps --build-dir=$$here --srcdir-name=$(top_srcdir) --output-dir=$$top_distdir --gnu camlibs/kodak/dc3200/Makefile + @for file in $(DISTFILES); do \ + d=$(srcdir); \ + if test -d $$d/$$file; then \ + cp -pr $$/$$file $(distdir)/$$file; \ + else \ + test -f $(distdir)/$$file \ + || ln $$d/$$file $(distdir)/$$file 2> /dev/null \ + || cp -p $$d/$$file $(distdir)/$$file || :; \ + fi; \ + done + +DEPS_MAGIC := $(shell mkdir .deps > /dev/null 2>&1 || :) + +-include $(DEP_FILES) + +mostlyclean-depend: + +clean-depend: + +distclean-depend: + -rm -rf .deps + +maintainer-clean-depend: + +%.o: %.c + @echo '$(COMPILE) -c $<'; \ + $(COMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-cp .deps/$(*F).pp .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm .deps/$(*F).pp + +%.lo: %.c + @echo '$(LTCOMPILE) -c $<'; \ + $(LTCOMPILE) -Wp,-MD,.deps/$(*F).pp -c $< + @-sed -e 's/^\([^:]*\)\.o[ ]*:/\1.lo \1.o :/' \ + < .deps/$(*F).pp > .deps/$(*F).P; \ + tr ' ' '\012' < .deps/$(*F).pp \ + | sed -e 's/^\\$$//' -e '/^$$/ d' -e '/:$$/ d' -e 's/$$/ :/' \ + >> .deps/$(*F).P; \ + rm -f .deps/$(*F).pp +info-am: +info: info-am +dvi-am: +dvi: dvi-am +check-am: all-am +check: check-am +installcheck-am: +installcheck: installcheck-am +install-exec-am: +install-exec: install-exec-am + +install-data-am: install-camlibLTLIBRARIES +install-data: install-data-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am +install: install-am +uninstall-am: uninstall-camlibLTLIBRARIES +uninstall: uninstall-am +all-am: Makefile $(LTLIBRARIES) +all-redirect: all-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) AM_INSTALL_PROGRAM_FLAGS=-s install +installdirs: + $(mkinstalldirs) $(DESTDIR)$(camlibdir) + + +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f config.cache config.log stamp-h stamp-h[0-9]* + +maintainer-clean-generic: +mostlyclean-am: mostlyclean-camlibLTLIBRARIES mostlyclean-compile \ + mostlyclean-libtool mostlyclean-tags mostlyclean-depend \ + mostlyclean-generic + +mostlyclean: mostlyclean-am + +clean-am: clean-camlibLTLIBRARIES clean-compile clean-libtool \ + clean-tags clean-depend clean-generic mostlyclean-am + +clean: clean-am + +distclean-am: distclean-camlibLTLIBRARIES distclean-compile \ + distclean-libtool distclean-tags distclean-depend \ + distclean-generic clean-am + -rm -f libtool + +distclean: distclean-am + +maintainer-clean-am: maintainer-clean-camlibLTLIBRARIES \ + maintainer-clean-compile maintainer-clean-libtool \ + maintainer-clean-tags maintainer-clean-depend \ + maintainer-clean-generic distclean-am + @echo "This command is intended for maintainers to use;" + @echo "it deletes files that may require special tools to rebuild." + +maintainer-clean: maintainer-clean-am + +.PHONY: mostlyclean-camlibLTLIBRARIES distclean-camlibLTLIBRARIES \ +clean-camlibLTLIBRARIES maintainer-clean-camlibLTLIBRARIES \ +uninstall-camlibLTLIBRARIES install-camlibLTLIBRARIES \ +mostlyclean-compile distclean-compile clean-compile \ +maintainer-clean-compile mostlyclean-libtool distclean-libtool \ +clean-libtool maintainer-clean-libtool tags mostlyclean-tags \ +distclean-tags clean-tags maintainer-clean-tags distdir \ +mostlyclean-depend distclean-depend clean-depend \ +maintainer-clean-depend info-am info dvi-am dvi check check-am \ +installcheck-am installcheck install-exec-am install-exec \ +install-data-am install-data install-am install uninstall-am uninstall \ +all-redirect all-am all installdirs mostlyclean-generic \ +distclean-generic clean-generic maintainer-clean-generic clean \ +mostlyclean distclean maintainer-clean + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/camlibs/kodak/dc3200/dc3200.c b/camlibs/kodak/dc3200/dc3200.c new file mode 100644 index 000000000..aec2ea4c5 --- /dev/null +++ b/camlibs/kodak/dc3200/dc3200.c @@ -0,0 +1,404 @@ +/**************************************************** + * kodak dc3200 digital camera driver library * + * for gphoto2 * + * * + * author: donn morrison - dmorriso@gulf.uvic.ca * + * date: dec 2000 - feb 2001 * + * license: gpl * + * version: 1.5 * + * * + ****************************************************/ + +#include "dc3200.h" +#include "library.h" + +int camera_id (CameraText *id) { + + strcpy(id->text, "kodak-dc3200"); + + return (GP_OK); +} + +int camera_abilities (CameraAbilitiesList *list) { + + CameraAbilities *a; + + a = gp_abilities_new(); + + strcpy(a->model, "Kodak DC3200"); + a->port = GP_PORT_SERIAL; + a->speed[0] = 9600; + a->speed[1] = 19200; + a->speed[2] = 38400; + a->speed[3] = 57600; + a->speed[4] = 115200; + a->speed[5] = 0; + a->capture = GP_CAPTURE_NONE; + a->config = 0; + a->file_delete = 0; + a->file_preview = 1; + a->file_put = 0; + + gp_abilities_list_append(list, a); + + return (GP_OK); +} + +int camera_init (Camera *camera) { + + DC3200Data *dd; + int ret; + + if (!camera) + return (GP_ERROR); + + dd = (DC3200Data*)malloc(sizeof(DC3200Data)); + if (!dd) + return (GP_ERROR); + + /* First, set up all the function pointers */ + camera->functions->id = camera_id; + camera->functions->abilities = camera_abilities; + camera->functions->init = camera_init; + camera->functions->exit = camera_exit; + camera->functions->folder_list = camera_folder_list; + camera->functions->file_list = camera_file_list; + camera->functions->file_get = camera_file_get; + camera->functions->file_get_preview = camera_file_get_preview; + camera->functions->file_put = camera_file_put; + camera->functions->file_delete = camera_file_delete; + camera->functions->capture = camera_capture; + camera->functions->summary = camera_summary; + camera->functions->manual = camera_manual; + camera->functions->about = camera_about; + camera->functions->result_as_string = camera_result_as_string; + + if ((ret = gp_port_new(&(dd->dev), GP_PORT_SERIAL)) < 0) { + free(dd); + return (ret); + } + + camera->camlib_data = dd; + + /* initialize the camera */ + if (init(camera) == GP_ERROR) { + gp_port_close(dd->dev); + gp_port_free(dd->dev); + free(dd); + return (GP_ERROR); + } + + /* Everything went OK. Save the data*/ + dd->fs = gp_filesystem_new(); + + return (dc3200_keep_alive(dd)); +} + +int init(Camera *camera) +{ + gp_port_settings settings; + DC3200Data *dd = camera->camlib_data; + + strcpy(settings.serial.port, camera->port->path); + settings.serial.speed = 9600; + settings.serial.bits = 8; + settings.serial.parity = 0; + settings.serial.stopbits = 1; + + /* set up the port */ + if (gp_port_settings_set(dd->dev, settings) == GP_ERROR) + return GP_ERROR; + + /* open the port */ + if (gp_port_open(dd->dev) == GP_ERROR) + return GP_ERROR; + + gp_port_timeout_set(dd->dev, TIMEOUT); + + if (dc3200_set_speed(dd, camera->port->speed) == GP_ERROR) + return GP_ERROR; + + settings.serial.speed = camera->port->speed; + + /* set the new speed */ + if (gp_port_settings_set(dd->dev, settings) == GP_ERROR) + return GP_ERROR; + + /* Wait for it to update */ + sleep(1); + + /* Try to talk after speed change */ + if (dc3200_keep_alive(dd) == GP_ERROR) + return GP_ERROR; + + /* setup the camera */ + if (dc3200_setup(dd) == GP_ERROR) + return GP_ERROR; + + return GP_OK; +} + +int camera_exit (Camera *camera) +{ + DC3200Data *dd = camera->camlib_data; + if (!dd) + return (GP_OK); + + gp_filesystem_free(dd->fs); + + if (dd->dev) { + if (gp_port_close(dd->dev) == GP_ERROR) + { /* camera did a bad, bad thing */ } + gp_port_free(dd->dev); + } + + return (GP_OK); +} + +int check_last_use(Camera *camera) +{ + time_t t; + DC3200Data *dd = camera->camlib_data; + + time(&t); + + if(t - dd->last > 9) { + /* we have to re-init the camera */ + printf("camera inactive for > 9 seconds, re-initing.\n"); + return init(camera); + } + + return GP_OK; +} + +int camera_folder_list (Camera *camera, CameraList *list, char *folder) +{ + DC3200Data *dd = camera->camlib_data; + u_char *data = NULL; + long data_len = 0; + u_char *ptr_data_buff; + char filename[13], *ptr; + int res, i; + + if(check_last_use(camera) == GP_ERROR) + return GP_ERROR; + + /* get file list data */ + res = dc3200_get_data(dd, &data, &data_len, CMD_LIST_FILES, folder, NULL); + + if(res == GP_ERROR) + return GP_ERROR; + + /* check the data length, each record is 20 bytes */ + if(data_len%20 != 0 || data_len < 1) { + /* there is a problem */ + return GP_ERROR; + } + + if(data == NULL) + return GP_ERROR; + + /* add directories to the list */ + ptr_data_buff = data; + i = 0; + + while(i < data_len) { + /* files have 0x00, dirs have 0x10 */ + if(ptr_data_buff[11] != 0x10) { + ptr_data_buff += 20; + i += 20; + continue; + } + + /* skip directories starting with . */ + if(ptr_data_buff[0] == '.') { + ptr_data_buff += 20; + i += 20; + continue; + } + + /* copy the filename */ + strncpy(filename, ptr_data_buff, sizeof(filename)); + + /* chop off the trailing spaces and null terminate */ + ptr = strchr(filename, 0x20); + if(ptr) ptr[0] = 0; + + /* in case of long directory */ + filename[12] = 0; + + /* append dir to the list */ + gp_list_append(list, filename, GP_LIST_FOLDER); + + ptr_data_buff += 20; + i += 20; + } + + free(data); + return (dc3200_keep_alive(dd)); +} + +int camera_file_list (Camera *camera, CameraList *list, char *folder) +{ + DC3200Data *dd = camera->camlib_data; + u_char *data = NULL; + long data_len = 0; + u_char *ptr_data_buff; + char filename[13]; + int res, i; + + if(check_last_use(camera) == GP_ERROR) + return GP_ERROR; + + /* get file list data */ + res = dc3200_get_data(dd, &data, &data_len, CMD_LIST_FILES, folder, NULL); + + if(res == GP_ERROR) + return GP_ERROR; + + /* check the data length */ + if(data_len%20 != 0 || data_len < 1) { + /* there is a problem */ + return GP_ERROR; + } + + if(data == NULL) + return GP_ERROR; + + /* add files to the list */ + ptr_data_buff = data; + i = 0; + + while(i < data_len) { + /* files have 0x00, dirs have 0x10 */ + if(ptr_data_buff[11] != 0x00) { + ptr_data_buff += 20; + i += 20; + continue; + } + + /* copy the first 8 bytes of filename */ + strncpy(filename, ptr_data_buff, 8); + filename[8] = 0; + /* add dot */ + strcat(filename, "."); + /* copy extension, last 3 bytes*/ + strncat(filename, ptr_data_buff+8, 3); + + if(!strstr(filename, "JPG") && !strstr(filename, "jpg")) { + ptr_data_buff += 20; + i += 20; + continue; + } + + /* append file to the list */ + gp_list_append(list, filename, GP_LIST_FOLDER); + + ptr_data_buff += 20; + i += 20; + } + + free(data); + return (dc3200_keep_alive(dd)); +} + +int camera_file_get (Camera *camera, CameraFile *file, char *folder, char *filename) +{ + DC3200Data *dd = camera->camlib_data; + u_char *data = NULL; + long data_len = 0; + int res; + + if(check_last_use(camera) == GP_ERROR) + return GP_ERROR; + + res = dc3200_get_data(dd, &data, &data_len, CMD_GET_FILE, folder, filename); + + if(res == GP_ERROR) + return GP_ERROR; + + if(data == NULL || data_len < 1) + return GP_ERROR; + + gp_file_append(file, data, data_len); + + free(data); + return (dc3200_keep_alive(dd)); +} + +int camera_file_get_preview (Camera *camera, CameraFile *file, char *folder, char *filename) +{ + DC3200Data *dd = camera->camlib_data; + u_char *data = NULL; + long data_len = 0; + int res; + + if(check_last_use(camera) == GP_ERROR) + return GP_ERROR; + + res = dc3200_get_data(dd, &data, &data_len, CMD_GET_PREVIEW, folder, filename); + + if(res == GP_ERROR) + return GP_ERROR; + + if(data == NULL || data_len < 1) + return GP_ERROR; + + gp_file_append(file, data, data_len); + + free(data); + return (dc3200_keep_alive(dd)); +} + +int camera_file_put (Camera *camera, CameraFile *file, char *folder) +{ + return (GP_ERROR); +} + +int camera_file_delete (Camera *camera, char *folder, char *filename) +{ + return (GP_ERROR); +} + +int camera_capture (Camera *camera, CameraFile *file, CameraCaptureInfo *info) +{ + return (GP_ERROR); +} + +int camera_summary (Camera *camera, CameraText *summary) +{ + strcpy(summary->text, "No summary information yet"); + return (GP_OK); +} + +int camera_manual (Camera *camera, CameraText *manual) +{ + strcpy(manual->text, +"Known problems:\n\ +\n\ +1. If the Kodak DC3200 does not receive a command at least \ +every 10 seconds, it will time out, and will have to be \ +re-initialized. If you notice the camera does not respond, \ +simply re-select the camera. This will cause it to re-\ +initialize.\n\n\ +2. If you cancel a picture transfer, the driver will be left \ +in an unknown state, and will most likely need to be re-\ +initialized."); + return (GP_OK); +} + +int camera_about (Camera *camera, CameraText *about) +{ + strcpy(about->text, +"Kodak DC3200 Driver\n\ +Donn Morrison \n\n\ +Questions and comments appreciated."); + return (GP_OK); +} + +char* camera_result_as_string (Camera *camera, int result) +{ + if (result >= 0) return ("This is not an error..."); + if (-result < 100) return gp_result_as_string (result); + return ("This is a dc3200 specific error."); +} diff --git a/camlibs/kodak/dc3200/dc3200.h b/camlibs/kodak/dc3200/dc3200.h new file mode 100644 index 000000000..49f2721a2 --- /dev/null +++ b/camlibs/kodak/dc3200/dc3200.h @@ -0,0 +1,42 @@ +/**************************************************** + * kodak dc3200 digital camera driver library * + * for gphoto2 * + * * + * author: donn morrison - dmorriso@gulf.uvic.ca * + * date: dec 2000 - feb 2001 * + * license: gpl * + * version: 1.5 * + * * + ****************************************************/ + +#ifndef DC3200_H_INCLUDED + +#include +#include +#include +#include +#include +#include +#include + +#define CMD_LIST_FILES 0 +#define CMD_GET_PREVIEW 1 +#define CMD_GET_FILE 2 + +#define TIMEOUT 750 + +typedef struct { + gp_port *dev; + gp_port_settings settings; + CameraFilesystem *fs; + int pkt_seqnum; /* sequence number */ + int cmd_seqnum; /* command seqnum */ + int debug; + time_t last; /* remember last recv time */ +} DC3200Data; + +int init(Camera *camera); +int check_last_use(Camera *camera); + +#define DC3200_H_INCLUDED +#endif diff --git a/camlibs/kodak/dc3200/library.c b/camlibs/kodak/dc3200/library.c new file mode 100644 index 000000000..88fb7cd13 --- /dev/null +++ b/camlibs/kodak/dc3200/library.c @@ -0,0 +1,977 @@ +/**************************************************** + * kodak dc3200 digital camera driver library * + * for gphoto2 * + * * + * author: donn morrison - dmorriso@gulf.uvic.ca * + * date: dec 2000 - feb 2001 * + * license: gpl * + * version: 1.5 * + * * + ****************************************************/ + +#ifndef LIBRARY_H_INCLUDED + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dc3200.h" +#include "library.h" + + +#define DEBUG + + +/* + * dc3200_set_speed + * + * handshakes a baud rate with the camera + * + */ +int dc3200_set_speed(DC3200Data *dd, int baudrate) +{ + int baudcode = C9600; + u_char resp[INI_PACKET_LEN], msg[INI_PACKET_LEN]; + int resp_len = INI_PACKET_LEN, msg_len = INI_PACKET_LEN; + +/**/ printf("dc3200_set_speed\n"); + + msg[0] = 0xAF; + msg[1] = 0x00; + + switch(baudrate) { + case 9600: + baudcode = C9600; + break; + case 19200: + baudcode = C19200; + break; + case 38400: + baudcode = C38400; + break; + case 57600: + baudcode = C57600; + break; + case 115200: + baudcode = C115200; + break; + default: + printf("unsupported baudrate: %d.\n", baudrate); + return GP_ERROR; + } + + msg[2] = baudcode; + + /* send our preferred baud rate */ + if(dc3200_send_command(dd, msg, msg_len, resp, &resp_len) == GP_ERROR) + return GP_ERROR; + /* the camera responds with our preferred baud rate or its + * maximum baud rate, whichever is lowest + */ + + /* compile a confirmation packet */ + msg[0] = 0x9F; + msg[1] = 0x00; + if(resp_len == 2) { + msg_len = 2; + } else { + /* calculate reply baud handshake */ + msg[2] = (resp[2] + 1) / 2; + msg_len = INI_PACKET_LEN; + } + + if(dc3200_send_command(dd, msg, msg_len, resp, &resp_len) == GP_ERROR) + return GP_ERROR; + + if(resp_len == 2) { + /* set the handshaked baudrate + * supports only 9600 + */ + return C9600; + } else if(resp[1] == 0x01) { + /* set the handshaked baudrate */ + return (resp[2]*2) - 1; + } else { + /* unknown baud */ + return GP_ERROR; + } + + return GP_ERROR; +} + +/* + * dc3200_setup + * + * sends two commands essential for survival + * + */ +int dc3200_setup(DC3200Data *dd) +{ + /* + * some strange commands that must be + * completed after initialization and + * before any camera access + * + * version info? ... + * + */ + + u_char cmd1[5] = {0x01, dc3200_calc_seqnum(dd), 0x01, 0x00, 0x0F}; + u_char cmd2[8] = {0x01, dc3200_calc_seqnum(dd), 0x80, 0x00, 0x01, 0x81, 0x00, 0x03}; + + u_char ack[ACK_PACKET_LEN], resp[DEF_PACKET_LEN]; + int ack_len = ACK_PACKET_LEN, resp_len = DEF_PACKET_LEN; + +/**/ printf("dc3200_setup\n"); + + if(dc3200_send_command(dd, cmd1, sizeof(cmd1), ack, &ack_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_check_ack(dd, ack, ack_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_recv_response(dd, resp, &resp_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_send_ack(dd, resp[1]) == GP_ERROR) + return GP_ERROR; + + if(dc3200_send_command(dd, cmd2, sizeof(cmd2), ack, &ack_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_check_ack(dd, ack, ack_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_recv_response(dd, resp, &resp_len) == GP_ERROR) + return GP_ERROR; + if(dc3200_send_ack(dd, resp[1]) == GP_ERROR) + return GP_ERROR; + + /* set the cmd sequence number */ + dd->cmd_seqnum = 1; + dd->debug = 0; + + return GP_OK; +} + + +/* + * dc3200_get_data + * + * retrieves data from the camera as either file + * data or file/folder list data + * + */ + + /* command to retrieve directory listing + u_char list_pkt[DEF_PACKET_LEN] = {0x01, dc3200_calc_seqnum(dd), 0x80, 0x00, 0x20, 0x03, 26 + strlen(filename), + 0xc1, 0x50, 0x00, 0x00, 0x00, 0x00, 19 + strlen(filename), + 0x04, 0x01, 0x00, 0x01, 0x00, 0x01, 0x60, 0x01, 0x00, 0x01, 0x00, 0x05, + 0x00, 0x00, 0x00, 2 + strlen(filename), 0x01}; + */ + /* command to get the picture + u_char get_pkt[DEF_PACKET_LEN] = {0x01, calc_seqnum(), 0x80, 0x00, 0x20, 0x03, 26 + strlen(filename), + 0xC1, 0x50, 0x00, 0x00, 0x00, 0x00, 19 + strlen(filename), + 0x04, 0x01, 0x00, 0x01, 0x01, 0x04, 0x60, 0x10, 0x00, 0x01, 0x00, 0x05, + 0x00, 0x00, 0x00, 2 + strlen(filename), 0x01}; + */ + +int dc3200_get_data(DC3200Data *dd, u_char **data, u_long *data_len, int command, char *folder, char *filename) +{ + u_char ack[ACK_PACKET_LEN], resp[DEF_PACKET_LEN]; + int ack_len = ACK_PACKET_LEN, resp_len = DEF_PACKET_LEN; + u_long num_left = 0; + u_long total = 0; + int data_start_pos = 0; + u_char *ptr_data = NULL; + + /* command bytes */ + u_char cb1=0x00,cb2=0x00,cb3=0x00; + + /* packet parts */ + u_char pkt_hdr[7]; + u_char pkt_typ[7]; + u_char pkt_cmd[12]; + u_char pkt_len[5]; + + u_char *packet; + int packet_len; + char *file = NULL; + char *ptr = NULL; + +/**/ printf("dc3200_get_data\n"); + + if(folder) { + if(filename) { + file = malloc(strlen(folder) + strlen(filename) + 2); + if(!file) + return GP_ERROR; + + /* concatenate the folder + filename */ + strncpy(file, folder, strlen(folder)); + file[strlen(folder)] = 0; + /* append the filename */ + if(folder[strlen(folder)-1] != '\\') + strcat(file, "\\"); + strncat(file, filename, strlen(filename)); + + } else { + file = malloc(strlen(folder) + 2); + if(!file) + return GP_ERROR; + + /* concatenate the folder + filename */ + strncpy(file, folder, strlen(folder)); + file[strlen(folder)] = 0; + } + } else { + return GP_ERROR; + } + + /* change all /'s to \'s */ + while((ptr = strchr(file, '/'))) { + ptr[0] = '\\'; + } + + switch (command) { + case CMD_GET_PREVIEW: + cb1 = 0x02; cb2 = 0x70; cb3 = 0x11; + break; + case CMD_GET_FILE: + cb1 = 0x01; cb2 = 0x60; cb3 = 0x10; + break; + case CMD_LIST_FILES: + cb1 = 0x01; cb2 = 0x60; cb3 = 0x01; + break; + } + + pkt_hdr[0] = 0x01; + pkt_hdr[1] = dc3200_calc_seqnum(dd); + pkt_hdr[2] = 0x80; pkt_hdr[3] = 0x00; pkt_hdr[4] = 0x20; pkt_hdr[5] = 0x03; + pkt_hdr[6] = 26 + strlen(file); + + pkt_typ[0] = 0xC1; + pkt_typ[1] = 0x50; + pkt_typ[2] = 0x00; pkt_typ[3] = 0x00; pkt_typ[4] = 0x00; pkt_typ[5] = 0x00; + pkt_typ[6] = 19 + strlen(file); + + pkt_cmd[0] = 0x04; pkt_cmd[1] = cb1; /* cmd */ + pkt_cmd[2] = 0x00; pkt_cmd[3] = 0x01; /* ??? */ + pkt_cmd[4] = 0x00; pkt_cmd[5] = 0x01;/*++dd->cmd_seqnum; SEQ */ + pkt_cmd[6] = cb2; pkt_cmd[7] = cb3; /* cmd */ + pkt_cmd[8] = 0x00; pkt_cmd[9] = 0x01; /* ??? */ + pkt_cmd[10] = 0x00; pkt_cmd[11] = 0x05; /* ??? */ + + pkt_len[0] = 0x00; pkt_len[1] = 0x00; pkt_len[2] = 0x00; + pkt_len[3] = strlen(file) + 2; + pkt_len[4] = 0x01; + + packet_len = sizeof(pkt_hdr) + sizeof(pkt_typ) + sizeof(pkt_cmd) + sizeof(pkt_len) + strlen(file) + 2; + packet = malloc(packet_len); + if(!packet) { + free(file); + return GP_ERROR; + } + + /* clear packet */ + memset(packet, 0, packet_len); + + /* copy pkt parts into packet */ + memcpy(packet, pkt_hdr, sizeof(pkt_hdr)); + memcpy(packet + sizeof(pkt_hdr), pkt_typ, sizeof(pkt_typ)); + memcpy(packet + sizeof(pkt_hdr) + sizeof(pkt_typ), pkt_cmd, sizeof(pkt_cmd)); + memcpy(packet + sizeof(pkt_hdr) + sizeof(pkt_typ) + sizeof(pkt_cmd), pkt_len, sizeof(pkt_len)); + memcpy(packet + sizeof(pkt_hdr) + sizeof(pkt_typ) + sizeof(pkt_cmd) + sizeof(pkt_len), file, strlen(file)); + + free(file); + + /* send the command to list files */ + if(dc3200_send_command(dd, packet, packet_len, ack, &ack_len) == GP_ERROR){ + free(packet); + return GP_ERROR; + } + + free(packet); + + do { + resp_len = DEF_PACKET_LEN; + if(dc3200_recv_response(dd, resp, &resp_len) == GP_ERROR) { + return GP_ERROR; + } + + if(dc3200_send_ack(dd, resp[1]) == GP_ERROR) { + return GP_ERROR; + } + + /* + * we decide what action to take based on + * the number of packets we are expecting + * + * resp[7] holds this info + * + */ + switch(resp[7]) { + case 0xC1: + /* + * SINGLE PACKET + */ + + /* get the total list length from the data header */ + *data_len = bytes_to_l(resp[26], resp[27], resp[28], resp[29]); + num_left = 0; + data_start_pos = 31; + *data_len -= 1; + + /* allocate a buffer to store all this data */ + *data = malloc(*data_len); + if(*data == NULL) { + return GP_ERROR; + } + + ptr_data = *data; + + /* copy this portion of the data */ + memcpy(ptr_data, resp + data_start_pos, resp_len - data_start_pos); + /* incr the buff ptr */ + ptr_data += resp_len - data_start_pos; + break; + + case 0x41: + /* + * MULTIPACKET, START + */ + + /* get the total list length from the data header */ + *data_len = bytes_to_l(resp[34], resp[35], resp[36], resp[37]); + num_left = bytes_to_l(resp[12], resp[13], resp[14], resp[15]); + total = num_left; + data_start_pos = 39; + *data_len -= 1; + + /* allocate a buffer to store all this data */ + *data = malloc(*data_len); + if(*data == NULL) { + return GP_ERROR; + } + + ptr_data = *data; + + /* copy this portion of the data */ + memcpy(ptr_data, resp + data_start_pos, resp_len - data_start_pos); + /* incr the data ptr */ + ptr_data += resp_len - data_start_pos; + + /* update gphoto2 frontend */ + gp_frontend_progress(NULL, NULL, 100.0*(((float)total-(float)num_left)/(float)total)); + break; + + case 0x01: + /* + * MULTIPACKET, MIDDLE + */ + /* calculate the number of packets remaining */ + num_left = bytes_to_l(resp[12], resp[13], resp[14], resp[15]); + data_start_pos = 16; + + if(*data == NULL) { + return GP_ERROR; + } + + /* copy this portion of the data */ + memcpy(ptr_data, resp + data_start_pos, resp_len - data_start_pos); + /* incr the buff ptr */ + ptr_data += resp_len - data_start_pos; + + /* update gphoto2 frontend */ + gp_frontend_progress(NULL, NULL, 100.0*(((float)total-(float)num_left)/(float)total)); + break; + + case 0x81: + /* + * MULTIPACKET, END + */ + /* calculate the number of packets remaining */ + num_left = bytes_to_l(resp[12], resp[13], resp[14], resp[15]); + data_start_pos = 16; + + if(*data == NULL) { + return GP_ERROR; + } + + /* copy this portion of the data */ + memcpy(ptr_data, resp + data_start_pos, resp_len - data_start_pos); + /* incr the buff ptr */ + ptr_data += resp_len - data_start_pos; + + /* update gphoto2 frontend */ + /*gp_frontend_progress(NULL, NULL, 100.0*(((float)total-(float)num_left)/(float)total));*/ + gp_frontend_progress(NULL, NULL, 100.0); + break; + + default: + return GP_ERROR; + } + +#ifdef DEBUG + printf("packets remaining = %d\n", (int)num_left); +#endif + } while(num_left > 1); + + return GP_OK; +} + +/* + * dc3200_send_command + * + * if cmd == NULL || cmd_len == 0, send_command waits for a response + * otherwise, it sends a command and waits for an acknowledgement + * + */ +int dc3200_send_command(DC3200Data *dd, u_char *cmd, int cmd_len, u_char *ack, int *ack_len) +{ + int sends, reads; + int buff_len = *ack_len; + int received = 0; + u_char *buff = NULL; + +/**/ printf("dc3200_send_command\n"); + + buff = malloc(sizeof(u_char) * *ack_len); + if(buff == NULL) { + return GP_ERROR; + } + + sends = SEND_RETRIES; + + while(sends > 0) { + reads = READ_RETRIES; + /* check that we are acutally sending a command + * and not just waiting for data + */ + if(cmd != NULL && cmd_len > 0) { + /* turn on debug if first send fails */ + if(sends < SEND_RETRIES) { + dd->debug = 1; + } + + /* clear the read buffer */ + dc3200_clear_read_buffer(dd); + + /* send the command */ + dc3200_send_packet(dd, cmd, cmd_len); + } + + /* wait for response */ + while(reads > 0) { + if(dc3200_recv_packet(dd, buff, &buff_len) != GP_ERROR) { + received = 1; + break; + } + reads--; + } + + if(received) { + /* turn off debug */ + dd->debug = 0; + if(buff_len > *ack_len) { + /* buffer size too small */ + free(buff); + return GP_ERROR; + } + + /* sukksess */ + *ack_len = buff_len; + memcpy(ack, buff, buff_len); + free(buff); + return GP_OK; + } else { + sends--; + } + } + + /* send failed */ + free(buff); + return GP_ERROR; +} + +/* + * dc3200_recv_response + * + * receives a response from a previous command + * + */ +int dc3200_recv_response(DC3200Data *dd, u_char *resp, int *resp_len) +{ +/**/ printf("dc3200_recv_response\n"); + + return dc3200_send_command(dd, NULL, 0, resp, resp_len); +} + +/* + * dc3200_send_ack + * + * sends an ack packet + * + */ +int dc3200_send_ack(DC3200Data *dd, int seqnum) +{ + u_char ack[ACK_PACKET_LEN]; + ack[0] = 0x01; + ack[1] = seqnum + 16; + +/**/ printf("dc3200_send_ack\n"); + + return dc3200_send_packet(dd, ack, sizeof(ack)); +} + +/* + * dc3200_check_ack + * + * checks an ack packet (well ok not really) + * + */ +int dc3200_check_ack(DC3200Data *dd, u_char *ack, int ack_len) +{ +/**/ printf("dc3200_check_ack\n"); + return GP_OK; +} + +/* + * dc3200_send_packet + * + * compiles a packet from data and sends it + * + */ +int dc3200_send_packet(DC3200Data *dd, u_char *data, int data_len) +{ + int res; + + int buff_len = data_len; + u_char *buff = NULL; + +/**/ printf("dc3200_send_packet\n"); + + buff = malloc(sizeof(u_char) * buff_len); + if(!buff) + return GP_ERROR; + + memcpy(buff, data, buff_len); + + /* compile this into a packet */ + res = dc3200_compile_packet(dd, &buff, &buff_len); + if(res == GP_ERROR) + return res; + +#ifdef DEBUG + dump_buffer(buff, buff_len, "s", 16); +#endif +#ifndef DEBUG + if(dd->debug == 1) + dump_buffer(buff, buff_len, "s", 16); +#endif + res = gp_port_write(dd->dev, buff, data_len + 3); + free(buff); + return res; +} + +/* + * dc3200_recv_packet + * + * waits for a packet to arrive, checks it, and returns it + * + */ +int dc3200_recv_packet(DC3200Data *dd, u_char *data, int *data_len) +{ + int complete = 0; + int num_read = 0, res = 0, fails = 0; + + /* allocate storage for size, checksum, and EOP */ + u_char *buff = NULL; + +/**/ printf("dc3200_recv_packet\n"); + + buff = malloc(sizeof(u_char) * (*data_len + 3)); + if(buff == NULL) { + return GP_ERROR; + } + + memset(buff, 0, *data_len + 3); + + /* + * - read data until we get an 0xFF + * - process packet + * + */ + + res = gp_port_read(dd->dev, &buff[num_read], 1); + + while(res > 0 && fails < READ_RETRIES) { + if(res == 0) { + /* read nothing */ + fails++; + } else { + /* reset # of fails */ + fails = 0; + num_read++; + if(buff[num_read-1] == 0xFF) { + complete = 1; + break; + } + if(num_read == *data_len + 3) { + /* we've reached the buffer limit */ + complete = 0; + break; + } + } + res = gp_port_read(dd->dev, &buff[num_read], 1); + } + + if(!complete) { + /* packet incomplete */ + return GP_ERROR; + } + +#ifdef DEBUG + dump_buffer(buff, num_read, "r", 16); +#endif +#ifndef DEBUG + if(dd->debug == 1) + dump_buffer(buff, num_read, "r", 16); +#endif + + if(dc3200_process_packet(dd, buff, &num_read) == GP_ERROR) { + printf("packet process error.\n"); + return GP_ERROR; + } + + /* save the last successful packet received time */ + time(&(dd->last)); + + memcpy(data, buff, *data_len); + + /* return with new packet size */ + *data_len = num_read; + + free(buff); + return GP_OK; +} + +/* + * dc3200_compile_packet + * + * changes 0xFF -> 0xFE 0x01 + * 0xFE -> 0xFE 0x00 + * adds packet length, checksum, and EOP (0xFF) + * + */ +int dc3200_compile_packet(DC3200Data *dd, u_char **data, int *data_len) +{ + int count, i, j; + u_char *new_data = NULL; + u_char *tmp_ptr = NULL; + +/**/ printf("dc3200_compile_packet\n"); + + /* realloc + 2 for len and checksum */ + *data_len += 2; + + tmp_ptr = (u_char*)realloc(*data, *data_len); + if(tmp_ptr == NULL) + return GP_ERROR; + + *data = tmp_ptr; + + /* add length, checksum */ + (*data)[*data_len - 2] = *data_len - 2; + (*data)[*data_len - 1] = dc3200_calc_checksum(dd, *data, *data_len - 1); + + /* this is a hack to fix the 0xFF/0xFE problem. + * we adjust a "don't care" byte so the checksum + * is not 0xFF or 0xFE + */ + if((*data)[*data_len - 1] >= 0xFE) { + if(*data_len > 19) { + (*data)[19] += 2; + (*data)[*data_len - 1] = dc3200_calc_checksum(dd, *data, *data_len - 1); + printf("adjusting checksum to %02x\n", (*data)[*data_len - 1]); + } + } + + /* count number of 0xfe's and 0xff's */ + count = 0; + for(i=0;i<*data_len; i++) { + if((*data)[i] == 0xFE || (*data)[i] == 0xFF) + count++; + } + + new_data = (u_char*)malloc(*data_len + count + 3); /* 3 for length, checksum, EOP */ + if(!new_data) + return GP_ERROR; + + j = 0; + for(i=0;i<*data_len; i++) { + if((*data)[i] == 0xFE || (*data)[i] == 0xFF) { + printf("(*data)[i] == %02x\n", (*data)[i]); + printf("(*data)[i] - 0xFE == %02x\n", (*data)[i] - 0xFE); + new_data[j++] = 0xFE; + new_data[j++] = (*data)[i] - 0xFE; + } else { + new_data[j++] = (*data)[i]; + } + } + + /* adjust the new packet count */ + *data_len += count + 1; + + new_data[*data_len - 1] = 0xFF; + + /* free the old packet data */ + free(*data); + + /* set the ptr */ + *data = new_data; + + return GP_OK; +} + +/* + * dc3200_process_packet + * + * changes 0xFE 0x01 -> 0xFF + * 0xFE 0x00 -> 0xFE + * checks & removes packet length, checksum, EOP (0xFF) + * + */ +int dc3200_process_packet(DC3200Data *dd, u_char *data, int *data_len) +{ + int count = 0, i; + int length, checksum; + u_char *buff; + +/**/ printf("dc3200_process_packet\n"); + + if(data == NULL || *data_len < 1) { + return GP_ERROR; + } + + /* allocate a new buffer */ + buff = (u_char*)malloc(sizeof(u_char) * *data_len); + if(!buff) + return GP_ERROR; + + /* change 0xFE 0x00 | 0x01 -> 0xFF | 0xFE */ + for(i=0; i<*data_len; i++) { + if(data[i] == 0xFE) { + if(i<*data_len-1) { /* so we don't run out of array bounds */ + if(data[i+1] == 0x00) { + buff[count] = 0xFE; + /* advance i so we don't pick up the trailing byte */ + i++; + /* incr count */ + count++; + } else if(data[i+1] == 0x01) { + buff[count] = 0xFF; + i++; + count++; + } + } else { + /* we've found an 0xFE but there is no trailing byte */ + free(buff); + return GP_ERROR; + } + } else { + buff[count] = data[i]; + count++; + } + } + + /* copy over the old buffer */ + memcpy(data, buff, count); + + length = data[count - 3]; + checksum = data[count - 2]; + + /* make sure its a valid packet */ + if(length != count - 3 || checksum != dc3200_calc_checksum(dd, data, count - 2)) { + printf("%02x=%02x %02x=%02x\n", length, count - 3, checksum, dc3200_calc_checksum(dd, data, count - 2)); + return GP_ERROR; + } + + /* adjust packet size, strip length, checksum, EOP */ + *data_len = count - 3; + + free(buff); + return GP_OK; +} + +/* + * dc3200_calc_checksum + * + * calculates the checksum for a byte array + * + */ +int dc3200_calc_checksum(DC3200Data *dd, unsigned char * buffer, int len) +{ + int sum = 0, i; + +/**/ printf("dc3200_calc_checksum\n"); + + for(i=0; ipkt_seqnum >= 0x1F || dd->pkt_seqnum < 0x10) { + dd->pkt_seqnum = 0x10; +#ifdef DEBUG + printf("seqnum = %02x\n", dd->pkt_seqnum); +#endif + return dd->pkt_seqnum; + } else { + dd->pkt_seqnum++; +#ifdef DEBUG + printf("seqnum = %02x\n", dd->pkt_seqnum); +#endif + return dd->pkt_seqnum; + } +} + +/* + * dc3200_keep_alive + * + * sends and receives a ping packet to keep the + * camera awake + * + */ +int dc3200_keep_alive(DC3200Data *dd) +{ + u_char ka[ACK_PACKET_LEN]; /* keepalive */ + u_char ak[ACK_PACKET_LEN]; /* keepalive ack */ + int ak_len = ACK_PACKET_LEN; + +/**/ printf("dc3200_keep_alive\n"); + + ka[0] = 0xCF; + ka[1] = 0x01; + +/**/ printf("ping..."); +/**/ fflush(0); + + /* send keep alive packet */ + if(dc3200_send_command(dd, ka, sizeof(ka), ak, &ak_len) == GP_ERROR) { +/**/ printf("err.\n"); + return GP_ERROR; + } + + /* check the ack (should be same packet) */ + if(memcmp(ak,ka,ak_len) == 0) { +/**/ printf("pong.\n"); + return GP_OK; + } + +/**/ printf("err.\n"); + return GP_ERROR; +} + +/* + * dc3200_clear_read_buffer + * + * clears data in the read buffer by reading it out + * + * there is definitely a better way to accomplish this... + * + */ +int dc3200_clear_read_buffer(DC3200Data *dd) +{ + u_char byte; + int count = 0; + +/**/ printf("dc3200_clear_read_buffer\n"); + + gp_port_timeout_set(dd->dev, 0); + + while(gp_port_read(dd->dev, &byte, 1) > 0) + count++; + + if(count > 0) + printf("cleared %d bytes from read buffer\n", count); + + gp_port_timeout_set(dd->dev, TIMEOUT); + + return GP_OK; +} + +/* + * dump_buffer + * + * displays a byte array nicely formatted in hex format + * + */ +int dump_buffer(unsigned char * buffer, int len, char * title, int bytesperline) +{ + char spacer[80]; + int i; + +/**/ printf("dump_buffer\n"); + + memset(spacer, 0, sizeof(spacer)); + memset(spacer, ' ', strlen(title)+2); + + printf("%s: ", title); + + for(i=0; i 0) { + printf("\n%s", spacer); + } + printf("%02x ", buffer[i]); + } + + printf("\n"); + + printf("%s: ", title); + + for(i=0; i 0) { + printf("\n%s", spacer); + } + if(buffer[i] >= 0x20 && buffer[i] < 0x7F) { + printf("%c", buffer[i]); + } else { + printf("."); + } + } + + printf("\n"); + + return GP_OK; +} + +u_long bytes_to_l(int a, int b, int c, int d) +{ + u_long res = a; + res = res << 24 | b << 16 | c << 8 | d; + return res; +} + +#define LIBRARY_H_INCLUDED +#endif diff --git a/camlibs/kodak/dc3200/library.h b/camlibs/kodak/dc3200/library.h new file mode 100644 index 000000000..fdecee11d --- /dev/null +++ b/camlibs/kodak/dc3200/library.h @@ -0,0 +1,77 @@ +/**************************************************** + * kodak dc3200 digital camera driver library * + * for gphoto2 * + * * + * author: donn morrison - dmorriso@gulf.uvic.ca * + * date: dec 2000 - feb 2001 * + * license: gpl * + * version: 1.5 * + * * + ****************************************************/ + +#ifndef LIBRARY_H_INCLUDED + +#include "dc3200.h" + +/* retries */ +#define READ_RETRIES 2 +#define ACK_RETRIES 2 +#define SEND_RETRIES 4 + +/* packet sizes */ +#define DEF_PACKET_LEN 256 +#define ACK_PACKET_LEN 2 +#define INI_PACKET_LEN 3 + +/* command types */ +#define SETBAUD1 0xAF +#define SETBAUD2 0x9F +#define PING 0xCF +#define COMMAND 0x01 + +/* dc3200 baud rate values + * + * baud baudcode(ask) baudcode2(confirm) + * 9600 0x00 -- + * 19200 0x01 0x01 + * 38400 0x03 0x02 + * 57600 0x07 0x04 + * 115200 0x0F 0x08 + * + * except for 9600, baudcode = (baudcode2 + 1) / 2 + * + */ +#define C9600 0x00 +#define C19200 0x01 +#define C38400 0x03 +#define C57600 0x07 +#define C115200 0x0F + +int dc3200_set_speed(DC3200Data *dd, int baudrate); +int dc3200_setup(DC3200Data *dd); + +int dc3200_get_data(DC3200Data *dd, u_char **data, u_long *data_len, int command, char *folder, char *filename); + +int dc3200_send_command(DC3200Data *dd, u_char *cmd, int cmd_len, u_char *ack, int *ack_len); +int dc3200_recv_response(DC3200Data *dd, u_char *resp, int *resp_len); + +int dc3200_send_packet(DC3200Data *dd, u_char *data, int data_len); +int dc3200_recv_packet(DC3200Data *dd, u_char *data, int *data_len); + +int dc3200_compile_packet(DC3200Data *dd, u_char **data, int *data_len); +int dc3200_process_packet(DC3200Data *dd, u_char *data, int *data_len); + +int dc3200_send_ack(DC3200Data *dd, int seqnum); +int dc3200_check_ack(DC3200Data *dd, u_char *ack, int ack_len); + +int dc3200_calc_checksum(DC3200Data *dd, u_char *data, int data_len); +int dc3200_calc_seqnum(DC3200Data *dd); + +int dc3200_keep_alive(DC3200Data *dd); +int dc3200_clear_read_buffer(DC3200Data *dd); + +int dump_buffer(unsigned char * buffer, int len, char *title, int bytesperline); +ulong bytes_to_l(int a, int b, int c, int d); + +#define LIBRARY_H_INCLUDED +#endif