Accepting request 171331 from KDE:Distro:Factory

- Added patch digikam-patch78541.diff from upstream to fix 
  detection of certain cameras (bnc#814622, bko#311393)

OBS-URL: https://build.opensuse.org/request/show/171331
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/digikam?expand=0&rev=109
This commit is contained in:
Stephan Kulow 2013-04-18 08:14:05 +00:00 committed by Git OBS Bridge
parent f3e9aa016e
commit 37fd167863
3 changed files with 167 additions and 0 deletions

158
digikam-patch78541.diff Normal file
View File

@ -0,0 +1,158 @@
commit 1f0dbbd3b3a6246e8c66b038a3f1e06af2f5ee11
Author: Gilles Caulier <caulier.gilles@gmail.com>
Date: Mon Apr 1 14:59:20 2013 +0200
Apply patch #78541 from Marcus Meissner about to find devices by usb vendor and product id, also if libgphoto2
just finds them by interface class.
BUGS: 311393
FIXED-IN: 3.2.0
diff --git a/utilities/importui/backend/gpcamera.cpp b/utilities/importui/backend/gpcamera.cpp
index 708d424..a41dff1 100644
--- a/core/utilities/importui/backend/gpcamera.cpp
+++ b/core/utilities/importui/backend/gpcamera.cpp
@@ -1295,8 +1295,7 @@ bool GPCamera::uploadItem(const QString& folder, const QString& itemName, const
#ifdef HAVE_GPHOTO2
int errorCode;
CameraFile* cfile = 0;
-
- errorCode = gp_file_new(&cfile);
+ errorCode = gp_file_new(&cfile);
if (errorCode != GP_OK)
{
@@ -1599,11 +1598,10 @@ void GPCamera::getSupportedCameras(int& count, QStringList& clist)
clist.clear();
count = 0;
- CameraAbilitiesList* abilList = 0;
CameraAbilities abil;
+ CameraAbilitiesList* abilList = 0;
GPContext* context = 0;
-
- context = gp_context_new();
+ context = gp_context_new();
gp_abilities_list_new(&abilList);
gp_abilities_list_load(abilList, context);
@@ -1661,7 +1659,7 @@ void GPCamera::getSupportedPorts(QStringList& plist)
{
gp_port_info_list_get_info(list, i, &info);
#ifdef HAVE_GPHOTO25
- char *xpath;
+ char* xpath = 0;
gp_port_info_get_name (info, &xpath);
plist.append(xpath);
#else
@@ -1685,8 +1683,7 @@ void GPCamera::getCameraSupportedPorts(const QString& model, QStringList& plist)
CameraAbilities abilities;
CameraAbilitiesList* abilList = 0;
GPContext* context = 0;
-
- context = gp_context_new();
+ context = gp_context_new();
gp_abilities_list_new(&abilList);
gp_abilities_list_load(abilList, context);
@@ -1719,8 +1716,8 @@ int GPCamera::autoDetect(QString& model, QString& port)
GPPortInfoList* infoList = 0;
const char* camModel_ = 0, *camPort_ = 0;
GPContext* context = 0;
+ context = gp_context_new();
- context = gp_context_new();
gp_list_new(&camList);
gp_abilities_list_new(&abilList);
@@ -1789,8 +1786,9 @@ bool GPCamera::findConnectedUsbCamera(int vendorId, int productId, QString& mode
CameraList* camList = 0;
bool success = false;
// get name and port of detected camera
- const char* model_str = 0, *port_str = 0;
- context = gp_context_new();
+ const char* model_str = 0;
+ const char* port_str = 0;
+ context = gp_context_new();
// get list of all ports
gp_port_info_list_new(&list);
@@ -1804,30 +1802,71 @@ bool GPCamera::findConnectedUsbCamera(int vendorId, int productId, QString& mode
gp_list_new (&camList);
gp_abilities_list_detect(abilList, list, camList, context);
gp_context_unref(context);
- gp_port_info_list_free(list);
int count = gp_list_count(camList);
- int cnt = 0;
+ int cnt = 0;
for (int i = 0 ; i < count ; i++)
{
const char* xmodel = 0;
gp_list_get_name(camList, i, &xmodel);
- int model = gp_abilities_list_lookup_model (abilList, xmodel);
+ int model = gp_abilities_list_lookup_model (abilList, xmodel);
CameraAbilities ab;
- gp_abilities_list_get_abilities (abilList, model, &ab);
+ gp_abilities_list_get_abilities(abilList, model, &ab);
+
+ if (ab.port != GP_PORT_USB)
+ continue;
+
+ /* KDE provides us USB Vendor and Product, but we might just
+ * have covered this via a class match. Check class matched
+ * cameras also for matchingo USB vendor/product id
+ */
+ if (ab.usb_vendor == 0)
+ {
+ int ret;
+ GPPortInfo info;
+ const char* xport = 0;
+ GPPort* gpport = 0;
+
+ /* get the port path so we only look at this bus position */
+ gp_list_get_value(camList, i, &xport);
+ ret = gp_port_info_list_lookup_path (list, xport);
- if (ab.port != GP_PORT_USB) continue;
- if (ab.usb_vendor != vendorId) continue;
- if (ab.usb_product != productId)continue;
+ if (ret < GP_OK) /* should not happen */
+ continue;
- /* keep it, and continue iterating, in case we find anohter one */
+ /* get the lowlevel port info for the path */
+ gp_port_info_list_get_info(list, ret, &info);
+
+ /* open lowlevel driver interface briefly to search */
+ gp_port_new(&gpport);
+ gp_port_set_info(gpport, info);
+
+ /* And now call into the lowlevel usb driver to see if the bus position
+ * has that specific vendor/product id */
+ if (gp_port_usb_find_device(gpport, vendorId, productId) == GP_OK)
+ {
+ ab.usb_vendor = vendorId;
+ ab.usb_product = productId;
+ }
+
+ gp_port_free (gpport);
+ }
+
+ if (ab.usb_vendor != vendorId)
+ continue;
+
+ if (ab.usb_product != productId)
+ continue;
+
+ /* keep it, and continue iterating, in case we find another one */
gp_list_get_name (camList, i, &model_str);
gp_list_get_value(camList, i, &port_str);
cnt++;
}
+ gp_port_info_list_free(list);
gp_abilities_list_free(abilList);
if (cnt > 0)

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Mon Apr 15 14:14:46 UTC 2013 - tittiatcoke@gmail.com
- Added patch digikam-patch78541.diff from upstream to fix
detection of certain cameras (bnc#814622, bko#311393)
-------------------------------------------------------------------
Wed Mar 13 09:51:53 UTC 2013 - nico.kruber@gmail.com

View File

@ -36,6 +36,8 @@ Patch3: remove-gplv2-only.patch
Patch5: digikam_no_build_vkontakte.diff
# PATCH-FIX-UPSTREAM digikam-3.0.0.no-kdcraw.version-check.patch -- version check for libkdcraw currently broken
Patch6: digikam-3.0.0.no-kdcraw.version-check.patch
# PATCH-FIX-UPSTREAM digikam-patch78541.diff -- mmeisner@suse.com find devices by usb vendor and product id
Patch7: digikam-patch78541.diff
BuildRequires: ImageMagick
BuildRequires: bison
BuildRequires: boost-devel
@ -247,6 +249,7 @@ popd
%patch3
%patch5
%patch6 -p1
%patch7 -p1
# Remove build time references so build-compare can do its work
FAKE_BUILDDATE=$(LC_ALL=C date -u -r %{_sourcedir}/%{name}.changes '+%%b %%e %%Y')