Bug 117248

Summary: Opening default app when camera inserted return KIOExec error
Product: [Applications] digikam Reporter: Carl <sleepkreep>
Component: Import-Gphoto2Assignee: Digikam Developers <digikam-bugs-null>
Severity: normal CC: abrams, caulier.gilles, ismail
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In: 0.9.0
Attachments: Patch fixing the issue.

Description Carl 2005-11-29 01:04:01 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources
Compiler:          gcc 3.3.5 
OS:                Linux

When I insert a camera through USB, the media manager loads the default app.  In this case it is the command `digikam --detect-camera` .  However when attempting to load digikam, I get this error =

"The file or folder / does not exist"

I have been getting similiar behavior since 3.4 .  I don't know how to recieve any console output, but running the command from the command line works fine.
Comment 1 Thiago Macieira 2005-11-29 01:51:02 UTC
Check your ~/.xsession-errors file
Comment 2 Carl 2005-11-29 16:54:34 UTC
kio (KDirWatch): KDirWatch-1 emitting dirty /proc/net/arp
kio (KTrader): KServiceTypeProfile::offers serviceType=media/gphoto2camera genericServiceType=Application
kio (KTrader): KServiceTypeProfile::offers serviceType=media/gphoto2camera genericServiceType=KParts/ReadOnlyPart
kio (KTrader): query for media/gphoto2camera : returning 1 offers
kio (KDirWatch): KDirWatch-1 emitting dirty /proc/net/arp
kio (KIOJob): stat media:/camera
kio (UIServer): UIServer::newJob observerAppId=kdesktop. Giving id=20
kio (UIServer): UIServer::stating 20 media:/camera
kdeinit: Got EXEC_NEW 'kio_media' from launcher.
kio (KLauncher): kio_media (pid 22274) up and running.
DCOP: register 'kio_media-22274' -> number of clients is now 30
DCOP: unregister 'kio_media-22274'
DCOP: register 'anonymous-22274' -> number of clients is now 30
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-carl/ksycoca
media kioslave: MediaProtocol::stat: media:/camera
media kioslave: MediaImpl::statMedium: camera
media kioslave: MediaList::findByName(camera)
media kioslave: MediaProtocol::createMedium
media kioslave: url = media:/camera, mime = media/gphoto2camera
kio (KIOJob): stat camera:/
kdeinit: Got EXEC_NEW 'kio_kamera' from launcher.
kio (KLauncher): kio_kamera (pid 22275) up and running.
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-carl/ksycoca
kio (UIServer): UIServer::jobFinished id=20
kio (KLauncher): KLauncher: Got start_service_by_desktop_path('.hidden/digikam-2.desktop', ...)

kdeinit: Got EXT_EXEC 'kioexec' from launcher.
Could not load library! Trying exec....
kio (KLauncher): kioexec (pid 22278) up and running.
kio (KDirWatch): KDirWatch-1 emitting dirty /proc/net/arp
DCOP: register 'kioexec-22278' -> number of clients is now 31
kioexec: command=digikam --detect-camera
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-carl/ksycoca
kioexec: Copying media:/camera to file:///var/tmp/kdecache-carl/krun/22278.0.camera
kio (KIOJob): kio_uiserver registered
kio (UIServer): UIServer::newJob observerAppId=kioexec-22278. Giving id=21
kioexec: Constructor returned...
kio_file: put(): /var/tmp/kdecache-carl/krun/22278.0.camera, mode=-1
kio (kioslave): SlaveBase::canResume offset=0
kdeinit: Got EXEC_NEW 'kio_media' from launcher.
kio (KLauncher): kio_media (pid 22285) up and running.
DCOP: register 'kio_media-22285' -> number of clients is now 32
DCOP: unregister 'kio_media-22285'
DCOP: register 'anonymous-22285' -> number of clients is now 32
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-carl/ksycoca
kio_media: ForwardingSlaveBase::get: media:/camera
media kioslave: MediaList::findByName(camera)
kdeinit: Got EXEC_NEW 'kio_kamera' from launcher.
kio (KLauncher): kio_kamera (pid 22286) up and running.
kio (KSycoca): Trying to open ksycoca from /var/tmp/kdecache-carl/ksycoca
kio (KIOJob): error 11 /
kio (KIOJob): error 11 /
kio (Scheduler): Scheduler: killing slave 19792
kio (Slave): killing slave pid=19792 (file://)
kio (KIOConnection): ERROR: Header read failed, errno=104
kio (KIOJob): Job::kill this=0x819e2d0 KIO::TransferJob m_progressId=0 quietly=true
kio (KIOConnection): ERROR: Header has invalid size (-1)
kio (kioslave): SlaveBase::waitForAnswer has read error.
kio (UIServer): UIServer::jobFinished id=21
kdeinit: PID 19792 terminated.
Comment 3 Tom Albers 2006-02-04 21:06:08 UTC
This is a  permission problem. try running digiKam as root to see if that works...
Comment 4 Tom Albers 2006-02-04 21:07:59 UTC
btw, where do you see that error and do you have a mass storage camera?
Comment 5 Nadav Kavalerchik 2006-03-11 17:30:26 UTC
i get the same error (and i run as root)

if i Cancel the "storage media" dialog and issue "digikam --detect-camera" command at the konsole, Digikam opens with camera dialog and all works just fine.
Comment 6 Carl 2006-03-11 18:18:28 UTC
To answer your question Tom, I have a 1GB card in my camera.  I'm not sure if that qualifies as a mass storage camera.   I got that error from my .xsession-errors file.
Comment 7 Rinse De Vries 2006-05-06 01:37:59 UTC
I get the same error.
Problem is ( i guess) that kio_media expects a command containing an placeholder for an URL, like %u, but the digikam-command 'digikam --detect-camera' does not need/accept one.

I noticed the same problem with dvd's and mplayer.
mplayer likes to access dvd's with the command 'mplayer dvd:/', but that one can't be used because kio_media puts another url right behind it, thus confusing mplayer.

Kaffeine works around this by accepting a URL in its command:
kaffeine -d %u DVD

digikam --download-from %u also works, but only with usb mass storage devices, not with camera's that need gphoto.

Comment 8 Alexander Rink 2006-06-08 22:12:40 UTC
Same problem here using a Canon Powershot A70 on kde 3.5.3 while trying to start digikam. When I plugin the camera a window shows up "A new medium has been detected. What do you want to do?". Because starting digikam was not listed there I added it to the actions. But when I choose this action, a message box pops up containing "Error - KIOExec. The file or folder / does not exist." and digikam isn't started at all. The Powershot A70 is no mass storage camera but needs the PTP. The comment from Rinse sounds very plausible to me.
Comment 9 caulier.gilles 2006-06-09 18:41:56 UTC
Current 0.9.0-svn (trunk) implementation have been fixed by Marcel this week. Please checkout the code and try again.

Note : stable branch (0.8.2) is not patched.

Gilles Caulier
Comment 10 Andrzej Sobczyk 2006-06-16 17:35:58 UTC
I had the same problem with gentoo, kde 3.5.2, and digikam, and Canon PowerShot G6 which works in PTP mode.
I fixed this by simple way, I changed the command line to ``digikam --detect-camera -caption "%u"`` and eveything works fine.

Andrzej Sobczyk
Comment 11 Carl 2006-06-16 17:46:09 UTC
Hey, that worked.  Thanks!
Comment 12 Thorbjørn Martsum 2006-06-29 20:14:21 UTC
Yeah - I was about to suggest something similar to what Andrzej Sobczyk 
(but got interrupted and just came back now)

In other cases "|" (pipe) can be a good command to have ... 
(e.g. playing cd audio with xmms - which was my problem)

xmms -p | grep -i %u
Comment 13 Marcel Wiesweg 2006-07-12 13:08:35 UTC
Current SVN installs a helper script which happily accepts an %u parameter
("/usr/kde/3.5/share/apps/digikam/utils/digikam-camera storage %u" is the command line in the digikam-mount-and-download.desktop file).

I don't know where you specify a default app that the media manager should start, but there is a "Digikam mount and download" entry in the media dialog, which represents one of the .desktop files mentioned above.

If the desktop files are not installed (0.9 series only I think) it's probably a KDE or distribution issue.
Comment 14 Nadav Kavalerchik 2006-09-17 09:11:45 UTC
digikam --detect-camera -caption "%u"
worked for me ! thanks :-)
Comment 15 Ismail Donmez 2006-12-12 09:25:20 UTC
I am reopening the bug, problem occurs because digikam-gphoto2-camera.desktop has no %u in Exec line hence KDE tries to download with kioexec, solution is to add %u there and ignore extra argument for detect case in digikam-camera. I will attach a patch to fix the issue.
Comment 16 Ismail Donmez 2006-12-12 09:26:06 UTC
Created attachment 18894 [details]
Patch fixing the issue.
Comment 17 Ismail Donmez 2006-12-12 09:26:33 UTC
Confirming with 0.9.0 rc2.
Comment 18 caulier.gilles 2006-12-13 07:51:00 UTC
SVN commit 613015 by cgilles:

digikam from trunk : patch from ismail donmez (cartman) to fix hotplug digiKam script : digikam-gphoto2-camera.desktop has no %u in Exec line hence KDE tries to download with kioexec, solution is to add %u there and ignore extra argument for detect case in digikam-camera.

BUG: 117248
CCMAIL: ismail@kde.org

 M  +12 -3     digikam-camera  
 M  +1 -1      digikam-gphoto2-camera.desktop.in  

--- trunk/extragear/graphics/digikam/utilities/hotplug/digikam-camera #613014:613015
@@ -10,6 +10,7 @@
+    args="$@"
 	echo "${0##*/}: wrong action.  Usage"
@@ -23,9 +24,17 @@
 	case "$app" in
 		echo "recycling running $app: $dcopcall $@"
-		exec dcop "$app" camera  "$dcopcall" "$@"
+        if test -z "$args"; then
+		    exec dcop "$app" camera  "$dcopcall"
+        else
+            exec dcop "$app" camera  "$dcopcall" "$args"
+        fi
-echo "starting digikam with $cmdoption $@"
-exec digikam  "$cmdoption" "$@"
+echo "starting digikam with $cmdoption $args"
+if test -z "$args"; then
+    exec digikam  "$cmdoption"
+    exec digikam  "$cmdoption" "$args"
--- trunk/extragear/graphics/digikam/utilities/hotplug/digikam-gphoto2-camera.desktop.in #613014:613015
@@ -1,5 +1,5 @@
 [Desktop Action digiKam Detect and Download]
-Exec=@digikamhelper_dir@/digikam-camera detect
+Exec=@digikamhelper_dir@/digikam-camera detect %u
 Name=digiKam Detect and Download
Comment 19 Tommi Tervo 2007-02-07 13:14:50 UTC
*** Bug 141288 has been marked as a duplicate of this bug. ***