summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog18
-rw-r--r--frontends/command-line/interface.c9
-rw-r--r--libgphoto2/gphoto2-abilities-list.c32
-rw-r--r--libgphoto2_port/libgphoto2_port/gphoto2-port.c3
-rw-r--r--libgphoto2_port/usb/libusb.c13
-rw-r--r--packaging/rpm/package.spec.in72
-rwxr-xr-xpackaging/usbcam.console13
7 files changed, 115 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 0f73d2ac5..1f4d6441d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,17 @@
+2001-10-28 Hans Ulrich Niedermann <gp@n-dimensional.de>
+
+ * frontends/command-line/interface.c: moved status msgs to stderr
+ * libgphoto2/gphoto2-abilities-list.c: don't scan USB for ID 0,
+ better (?) error handling and reporting
+ * libgphoto2_port/libgphoto2_port/gphoto2-port.c: removed report
+ about param that is only passed on
+ * libgphoto2_port/usb/libusb.c: improved error reporting
+ * packaging/usbcam.console: improved chown/chmod handling
+ (race condition removed)
+ * packaging/rpm/package.spec.in: begun support for automatic file lists
+
2001-10-27 Marcus Meissner <marcus@jet.franken.de>
+
* camlibs/jd11: New Jenoptik JD11 driver for gphoto2.
* configure.in: added jd11 subdirs
* MAINTAINERS: added myself
@@ -16,11 +29,12 @@
* Makefile.am: moved spec file to packaging/rpm/
* Makefile.am: added CDPATH warning, rpm target and cvs-tags target
- * gphoto.spec.in: moved spec file to packaging/rpm/
+ * gphoto.spec.in: moved spec file to packaging/rpm/package.spec.in
* configure.in: added packaging/rpm/Makefile.am
* configure.in: moved spec file to packaging/rpm/
- * packaging/Makefile.am: added rpm/
+ * packaging/Makefile.am: added rpm/, removed README.rpm
* packaging/rpm/: new directory with Makefile.am and .cvsignore
+ * packaging/Makefile.am: use @PACKAGE@-@VERSION@.spec for the SRPM file
* packaging/README.rpm: removed obsolete how-to-build-a-RPM docs
* packaging/rpm/README.rpm: added new this-is-how-our-RPM-works-internally docs
* libgphoto2_port/po/POTFILES.in: gphoto2-port.c, not gp_port.c
diff --git a/frontends/command-line/interface.c b/frontends/command-line/interface.c
index 6e6316232..a5994c1bb 100644
--- a/frontends/command-line/interface.c
+++ b/frontends/command-line/interface.c
@@ -15,15 +15,14 @@ status_func (Camera *camera, const char *status, void *data)
return;
if (*status) {
- printf ("Status: %s\r", status);
+ fprintf (stderr, "Status: %s\n", status);
fflush(stdout);
} else {
-
/*
- * This is not very clever - if you know any better,
- * step forward.
+ * This is still not very clever -
+ * if you know any better, step forward.
*/
- printf (" \r");
+ fprintf (stderr, "Status: OK (i.e. \"\")\n");
}
}
diff --git a/libgphoto2/gphoto2-abilities-list.c b/libgphoto2/gphoto2-abilities-list.c
index f65269f93..602427dcd 100644
--- a/libgphoto2/gphoto2-abilities-list.c
+++ b/libgphoto2/gphoto2-abilities-list.c
@@ -275,21 +275,41 @@ gp_abilities_list_detect (CameraAbilitiesList *list,
case GP_PORT_USB:
/* Detect USB cameras */
- gp_log (GP_LOG_DEBUG, "gphoto2-abilities-list",
+ gp_log (GP_LOG_VERBOSE, __FILE__,
"Auto-detecting USB cameras...");
for (x = 0; x < count; x++) {
+ int res;
v = list->abilities[x].usb_vendor;
p = list->abilities[x].usb_product;
- if ((gp_port_usb_find_device (port, v, p)
- == GP_OK)) {
- gp_log (GP_LOG_DEBUG,
- "gphoto2-abilities-list",
- "Found '%s' (%i,%i)",
+ if ( (0 == v) || (0 == p) )
+ continue; /* illegal anyway */
+ res = gp_port_usb_find_device (port, v, p);
+ if (res == GP_OK) {
+ gp_log (GP_LOG_DEBUG, __FILE__,
+ "Found '%s' (0x%x,0x%x)",
list->abilities[x].model,
v, p);
gp_list_append (l,
list->abilities[x].model,
info.path);
+ } else if (res == GP_ERROR_IO_USB_FIND) {
+ /* "cam not found" is a common
+ * case when scanning the bus,
+ * so we just ignore this
+ * quietly
+ */
+ gp_port_set_error(port,NULL);
+ } else if (res < 0) {
+ /* another error occured.
+ * perhaps we should better
+ * report this to the calling
+ * method?
+ */
+ gp_log (GP_LOG_DEBUG, __FILE__,
+ "gp_port_usb_find_device(vendor=0x%x, "
+ "product=0x%x) returned %i, clearing error message on port",
+ v,p,res);
+ gp_port_set_error(port,NULL);
}
}
break;
diff --git a/libgphoto2_port/libgphoto2_port/gphoto2-port.c b/libgphoto2_port/libgphoto2_port/gphoto2-port.c
index d551787aa..5306f1014 100644
--- a/libgphoto2_port/libgphoto2_port/gphoto2-port.c
+++ b/libgphoto2_port/libgphoto2_port/gphoto2-port.c
@@ -566,9 +566,6 @@ gp_port_flush (GPPort *port, int direction)
int
gp_port_usb_find_device (GPPort *port, int idvendor, int idproduct)
{
- gp_log (GP_LOG_DEBUG, "gphoto2-port", "Looking for "
- "(vendor 0x%x, product 0x%x)...", idvendor, idproduct);
-
CHECK_NULL (port);
CHECK_INIT (port);
diff --git a/libgphoto2_port/usb/libusb.c b/libgphoto2_port/usb/libusb.c
index 442500269..df5c2fc45 100644
--- a/libgphoto2_port/usb/libusb.c
+++ b/libgphoto2_port/usb/libusb.c
@@ -178,8 +178,8 @@ gp_port_usb_clear_halt_lib(GPPort *port, int ep)
ret=usb_clear_halt(port->pl->dh, port->settings.usb.outep);
break;
default:
- gp_log (GP_LOG_DEBUG, "gphoto2-port-usb",
- "gp_port_usb_clear_halt: bad EndPoint argument");
+ gp_port_set_error (port, "gp_port_usb_clear_halt: "
+ "bad EndPoint argument");
return GP_ERROR_BAD_PARAMETERS;
}
return (ret ? GP_ERROR_IO_USB_CLEAR_HALT : GP_OK);
@@ -326,6 +326,9 @@ gp_port_usb_find_device_lib(GPPort *port, int idvendor, int idproduct)
* Better to check here.
*/
if ((idvendor == 0) || (idproduct == 0)) {
+ gp_port_set_error (port, "NOT looking for illegal USB device "
+ "(vendor 0x%x, product 0x%x)...",
+ idvendor, idproduct);
return GP_ERROR_BAD_PARAMETERS;
}
@@ -334,11 +337,17 @@ gp_port_usb_find_device_lib(GPPort *port, int idvendor, int idproduct)
if ((dev->descriptor.idVendor == idvendor) &&
(dev->descriptor.idProduct == idproduct)) {
port->pl->d = dev;
+ gp_port_set_error (port, "Looking for USB device "
+ "(vendor 0x%x, product 0x%x)... found.",
+ idvendor, idproduct);
return GP_OK;
}
}
}
+ gp_port_set_error (port, "Looking for USB device "
+ "(vendor 0x%x, product 0x%x)... not found.",
+ idvendor, idproduct);
return GP_ERROR_IO_USB_FIND;
}
diff --git a/packaging/rpm/package.spec.in b/packaging/rpm/package.spec.in
index d7db58910..e2939c62d 100644
--- a/packaging/rpm/package.spec.in
+++ b/packaging/rpm/package.spec.in
@@ -1,13 +1,19 @@
########################################################################
+#
# $Id$
#
# RPM spec file for gphoto2
+#
+# TODO list concerning packaging
+# - review and coordinate RPM packaging for gphoto2, libusb, gtkam
+#
########################################################################
+####################################
Summary: Software for accessing digital cameras
Name: @PACKAGE@
Version: @VERSION@
-Release: 1
+Release: 2
License: LGPL
Group: Applications/Multimedia
BuildRoot: %{_tmppath}/%{name}-%{version}-root
@@ -20,14 +26,7 @@ BuildRequires: libusb-devel
BuildRequires: gtk-doc
BuildRequires: findutils perl
-########################################################################
-# TODO about packaging
-########################################################################
-#
-# * review and coordinate RPM packaging for gphoto2, libusb, gtkam
-#
-########################################################################
-
+####################################
%description
The gPhoto2 project is a universal, free application and library
framework that lets you download images from several different
@@ -42,12 +41,14 @@ ii) the command-line utility gphoto2
Other (GUI) frontends are available seperately.
+####################################
%package devel
Summary: Headers and links to compile against the libgphoto2 library.
Requires: %{name} = %{version}
Provides: libgphoto2-devel
Group: Development/Libraries
+####################################
%description devel
The gPhoto2 project is a universal, free application and library
framework that lets you download images from several different
@@ -58,10 +59,16 @@ the old "gphoto" package.
This package contains the files needed to compile applications that
use libgphoto2.
+########################################################################
+# Building and installing the beast into %{buildroot}
+########################################################################
+
+####################################
%prep
-rm -rf $RPM_BUILD_DIR/%{name}-%{version}
+rm -rf "${RPM_BUILD_DIR}/%{name}-%{version}"
%setup -q -n %{name}-%{version}
+####################################
%build
CFLAGS="${CFLAGS:-%optflags}" ; export CFLAGS ;
CXXFLAGS="${CXXFLAGS:-%optflags}" ; export CXXFLAGS ;
@@ -84,8 +91,9 @@ FFLAGS="${FFLAGS:-%optflags}" ; export FFLAGS ;
--with-html-dir=%{_docdir}/%{name}-%{version}/html
make
+####################################
%install
-rm -rf $RPM_BUILD_ROOT
+rm -rf "${RPM_BUILD_ROOT}"
make DESTDIR=%{buildroot} \
prefix=%{_prefix} \
@@ -104,24 +112,33 @@ make DESTDIR=%{buildroot} \
infodir=%{_infodir} \
install
+# we should move that into the proper Makefile.am eventually
install -d -m755 %{buildroot}/etc/hotplug/usb/
install -m755 packaging/usbcam.console %{buildroot}/etc/hotplug/usb/usbcam
-find %{buildroot} -type f | sed 's!^%{buildroot}!!' | sort > %{name}-%{version}.files
+# build file list
+# find %{buildroot} -type f | sed 's!^%{buildroot}!!' | sort > %{name}-%{version}.files
+# figure out list of documentation stuff
+# htmldir=$(grep '/html/' < "%{name}-%{version}.files" | sed 's/html\/.*/html/' | sort -u)
+# echo "%docdir ${htmldir}" > %{name}-%{version}.docfiles
+
+####################################
%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf "${RPM_BUILD_ROOT}"
+########################################################################
+# file list and installation for main package
+########################################################################
-##### gphoto2
+####################################
%files
+# -f %{name}-%{version}.docfiles
%defattr(-,root,root)
%{_bindir}/gphoto2
%{_datadir}/gphoto2/konica/*
%doc doc/gphoto2.txt doc/gphoto2-cli.txt
-%doc AUTHORS README COPYING NEWS
-%docdir doc/api/html
-%docdir libgphoto2_port/doc/html
+%doc AUTHORS README COPYING
%{_libdir}/libgphoto2.*
%{_libdir}/gphoto2/*
%{_libdir}/libgphoto2_port.*
@@ -131,23 +148,23 @@ rm -rf $RPM_BUILD_ROOT
%{_libdir}/pkgconfig/libgphoto-2.0.pc
/etc/hotplug/usb/usbcam
-#
-# FIXME: When updating from one RPM to a newer one,
-# the cams get (correctly) removed from usb.usermap but not
-# added again.
-#
-
+####################################
%post
+
# add supported cameras to /etc/hotplug/usb.usermap
grep -v '^usbcam' /etc/hotplug/usb.usermap > /etc/hotplug/usb.usermap.tmp
gphoto2 --print-usb-usermap >> /etc/hotplug/usb.usermap.tmp
mv /etc/hotplug/usb.usermap.tmp /etc/hotplug/usb.usermap
+
# register libraries
/sbin/ldconfig
+####################################
%postun
+
# unregister libraries
/sbin/ldconfig
+
# remove supported cameras from /etc/hotplug/usb.usermap
# this has to be done in postun as we have to test
# whether there is still a usbcam script or not, i.e.
@@ -160,6 +177,11 @@ else
mv /etc/hotplug/usb.usermap.tmp /etc/hotplug/usb.usermap
fi
+########################################################################
+# file list and installation for -devel subpackage
+########################################################################
+
+####################################
%files devel
%defattr(-,root,root)
%docdir %{_docdir}/%{name}-%{version}/html
@@ -168,7 +190,9 @@ fi
%{_includedir}/gphoto2/*
-##### Change log
+########################################################################
+# ChangeLog
+########################################################################
%changelog
* Sat Oct 27 2001 Hans Ulrich Niedermann <gp@n-dimensional.de>
- fixed update behaviour for hotplug list (do not erase it when updating)
diff --git a/packaging/usbcam.console b/packaging/usbcam.console
index 1b51fb703..7d941479e 100755
--- a/packaging/usbcam.console
+++ b/packaging/usbcam.console
@@ -21,7 +21,14 @@
if [ "${ACTION}" = "add" ] && [ -f "${DEVICE}" ]
then
- user="$(ls -l /dev/console | awk '/\/dev\/console$/ { print $3; }')"
- chown "${user}" "${DEVICE}"
- chmod 0600 "${DEVICE}"
+ # old code, using traditional parameters
+ # user="$(ls -l /dev/console | awk '/\/dev\/console$/ { print $3; }')"
+ # chown "${user}" "${DEVICE}"
+ # chmod 0600 "${DEVICE}"
+
+ # new code, using GNU style parameters
+ CONSOLE="/dev/console"
+ chown 0000 "${DEVICE}" # precaution against possible race conditions
+ chown --reference "${CONSOLE}" "${DEVICE}"
+ chmod --reference "${CONSOLE}" "${DEVICE}"
fi