- Add patch from

http://sourceforge.net/tracker/?func=detail&aid=2801117&group_id=8874&a
    tid=308874 and generate generic udev rules for device identification
    (ID_GPHOTO2* properties)
This commit is contained in:
Jindrich Novy 2009-08-10 12:35:17 +00:00
parent 6d4203ba58
commit 9338bed76d
2 changed files with 122 additions and 1 deletions

View File

@ -1,7 +1,7 @@
Summary: Library for accessing digital cameras
Name: libgphoto2
Version: 2.4.6
Release: 2%{?dist}
Release: 3%{?dist}
# GPLV2+ for the main lib (due to exif.c) and most plugins, some plugins GPLv2
License: GPLv2+ and GPLv2
Group: Development/Libraries
@ -11,6 +11,7 @@ Patch1: gphoto2-pkgcfg.patch
Patch2: gphoto2-storage.patch
Patch3: gphoto2-ixany.patch
Patch4: gphoto2-maxentries.patch
Patch5: libgphoto2.udev-136.patch
Url: http://www.gphoto.org/
Requires: lockdev
BuildRequires: libusb-devel >= 0.1.5
@ -54,6 +55,7 @@ use libgphoto2.
%patch2 -p1 -b .storage
%patch3 -p1 -b .ixany
%patch4 -p1 -b .maxentries
%patch5 -p1 -b .udev136
for i in AUTHORS COPYING libgphoto2_port/AUTHORS libgphoto2_port/COPYING.LIB `find -name 'README.*'`; do
mv ${i} ${i}.old
@ -107,6 +109,14 @@ export CAMLIBS=$RPM_BUILD_ROOT%{_libdir}/%{name}/%{version}
export LD_LIBRARY_PATH=$RPM_BUILD_ROOT%{_libdir}
$RPM_BUILD_ROOT%{_libdir}/%{name}/print-camera-list hal-fdi | \
grep -v "<!-- This file was generated" > $RPM_BUILD_ROOT/%{_datadir}/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
# Output udev rules for device identification; this is used by GVfs gphoto2
# backend and others.
#
# Btw, since it's /lib/udev, never e.g. /lib64/udev, we hardcode the path
#
mkdir -p $RPM_BUILD_ROOT/lib/udev/rules.d
$RPM_BUILD_ROOT%{_libdir}/%{name}/print-camera-list udev-rules version 136 > $RPM_BUILD_ROOT/lib/udev/rules.d/40-libgphoto2.rules
popd
rm -rf %{buildroot}%{_libdir}/libgphoto2/*/*a
@ -132,6 +142,7 @@ rm -rf "${RPM_BUILD_ROOT}"
%{_libdir}/libgphoto2/*/*.so
%{_libdir}/*.so.*
%{_datadir}/hal/fdi/information/20thirdparty/10-camera-libgphoto2.fdi
/lib/udev/rules.d/40-libgphoto2.rules
%{_libdir}/udev/check-ptp-camera
%{_libdir}/udev/check-mtp-device
@ -151,6 +162,10 @@ rm -rf "${RPM_BUILD_ROOT}"
%{_mandir}/man3/*
%changelog
* Sun Aug 09 2009 David Zeuthen <davidz@redhat.com> 2.4.6-3
- Add patch from http://sourceforge.net/tracker/?func=detail&aid=2801117&group_id=8874&atid=308874
and generate generic udev rules for device identification (ID_GPHOTO2* properties)
* Fri Jul 24 2009 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.4.6-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild

106
libgphoto2.udev-136.patch Normal file
View File

@ -0,0 +1,106 @@
--- libgphoto2-2.4.6/packaging/generic/print-camera-list.c 2009-03-23 08:56:56.000000000 +0100
+++ /home/martin/ubuntu/tmp/libgphoto2-2.4.6/packaging/generic/print-camera-list.c 2009-06-04 18:12:33.000000000 +0200
@@ -366,12 +366,14 @@
typedef enum {
UDEV_PRE_0_98 = 0,
- UDEV_0_98 = 1
+ UDEV_0_98 = 1,
+ UDEV_136 = 2
} udev_version_t;
static const StringFlagItem udev_version_t_map[] = {
{ "pre-0.98", UDEV_PRE_0_98 },
{ "0.98", UDEV_0_98 },
+ { "136", UDEV_136 },
{ NULL, 0 }
};
@@ -399,13 +401,20 @@
"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
/* UDEV_0_98 */
"SUBSYSTEM!=\"usb|usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
+ "ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n",
+ /* UDEV_136 */
+ "SUBSYSTEM!=\"usb\", GOTO=\"libgphoto2_rules_end\"\n"
+ "ENV{DEVTYPE}!=\"usb_device\", GOTO=\"libgphoto2_rules_end\"\n"
"ACTION!=\"add\", GOTO=\"libgphoto2_rules_end\"\n\n"
+ "ENV{ID_USB_INTERFACES}==\"\", IMPORT{program}=\"usb_id --export %%p\"\n\n"
};
static const char * const usbcam_strings[] = {
/* UDEV_PRE_0_98 */
- "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\", ",
+ "SYSFS{idVendor}==\"%04x\", SYSFS{idProduct}==\"%04x\"",
/* UDEV_0_98 */
- "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ",
+ "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\"",
+ /* UDEV_136 */
+ "ATTRS{idVendor}==\"%04x\", ATTRS{idProduct}==\"%04x\", ENV{ID_GPHOTO2}=\"1\", ENV{GPHOTO2_DRIVER}=\"proprietary\""
};
udev_persistent_data_t *pdata;
pdata = calloc(1, sizeof(udev_persistent_data_t));
@@ -444,7 +453,8 @@
&& pdata->mode == NULL
&& pdata->group == NULL
&& pdata->owner == NULL
- && pdata->script == NULL) {
+ && pdata->script == NULL
+ && pdata->version <= UDEV_0_98) {
FATAL("Either <script> or <mode,group,owner> parameters must be given.");
}
if ((pdata->script != NULL) && (pdata->mode != NULL
@@ -547,7 +557,11 @@
if (flags & GP_USB_HOTPLUG_MATCH_INT_CLASS) {
if ((flags & (GP_USB_HOTPLUG_MATCH_INT_CLASS|GP_USB_HOTPLUG_MATCH_INT_SUBCLASS|GP_USB_HOTPLUG_MATCH_INT_PROTOCOL)) == (GP_USB_HOTPLUG_MATCH_INT_CLASS|GP_USB_HOTPLUG_MATCH_INT_SUBCLASS|GP_USB_HOTPLUG_MATCH_INT_PROTOCOL)) {
- printf("PROGRAM=\"check-ptp-camera %02d/%02d/%02d\", ", class, subclass, proto);
+ if (pdata->version == UDEV_136) {
+ printf("ENV{ID_USB_INTERFACES}==\"*:%02d%02d%02d:*\", ENV{ID_GPHOTO2}=\"1\", ENV{GPHOTO2_DRIVER}=\"PTP\"", class, subclass, proto);
+ } else {
+ printf("PROGRAM=\"check-ptp-camera %02d/%02d/%02d\"", class, subclass, proto);
+ }
has_valid_rule = 1;
} else {
if (class == 666) {
@@ -568,6 +582,9 @@
}
}
if (has_valid_rule != 0) {
+ if (pdata->script != NULL || pdata->mode != NULL || pdata->owner != NULL || pdata->group != NULL)
+ printf(", ");
+
if (pdata->script != NULL) {
printf("RUN+=\"%s\"\n", pdata->script);
} else if (pdata->mode != NULL || pdata->owner != NULL || pdata->group != NULL) {
@@ -589,7 +606,8 @@
printf("\n");
} else {
printf("\n");
- FATAL("udev_camera_func(): illegal branch");
+ if (pdata->version < UDEV_136)
+ FATAL("udev_camera_func(): illegal branch");
}
}
return 0;
@@ -1118,12 +1136,16 @@
fdi_device_end_func
},
{"udev-rules",
- "udev rules file either for pre-0.98 or 0.98 and later",
- "Put it into /etc/udev/rules.d/90-libgphoto2.rules, set file mode, owner, group\n"
+ "udev rules file",
+ "For modes \"pre-0.98\" and \"0.98\" (and later), put it into\n"
+ " /etc/udev/rules.d/90-libgphoto2.rules, set file mode, owner, group\n"
" or add script to run. This rule files also uses the\n"
" check-ptp-camera script included in libgphoto2 source. Either put it to\n"
" /lib/udev/check-ptp-camera or adjust the path in the generated rules file.\n"
- " If you give a script parameter, the mode, owner, group parameters will be ignored.",
+ " If you give a script parameter, the mode, owner, group parameters will be ignored.\n"
+ " For mode \"136\" put it into /lib/udev/rules.d/40-libgphoto2.rules;\n"
+ " you can still use mode/owner/group, but the preferred mode of operation\n"
+ " is to use udev-extras for dynamic access permissions.\n",
"[script <PATH_TO_SCRIPT>|version <version>|mode <mode>|owner <owner>|group <group>]*",
udev_begin_func,
udev_camera_func,