KDE blocks digital camera detection as usb-scsi disk

Bug #155788 reported by przemkus
16
Affects Status Importance Assigned to Milestone
kdebase (Ubuntu)
Invalid
Undecided
Unassigned
kdegraphics (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Binary package hint: kdebase-kio-plugins

Kubuntu 7.10 "Gutsy Gibbon", both i386 and amd64 with all available updates (2007-10-22)

Package: kdebase-kio-plugins
Source: kdebase
Version: 4:3.5.8-0ubuntu2

Linux kernel is: 2.6.22-14-generic

Issue tested on two computers (a desktop i386 and a laptop amd64) and with three different digital cameras (Olympus C-370Z, Canon S2 IS, Canon A85).
As I see, this error affects KDE only. When KDE is down, in text console everything works fine.

Problem description:
The problem is that when I plug into usb a digital camera, it is not recognized as an usb-scsi disk (no devs created). Only a annoying KDE daemon called kio_kamera can access my digital camera (in Konqueror the path is camera://usb_camera_name_etc) - a camera icon appears named "USB Mass Storage Interface". No directory in /media is created / mounted.
I know that automounting of usb-disks is disabled by default in Gutsy, I have to do it by clicking "mount" or "open in a new window", but the problem is that no devs are created (eg. sda sda1), so even manual mount is impossible.

dmesg after plugging my camera in KDE:
[ 159.433779] usb 1-2: new full speed USB device using uhci_hcd and address 2
[ 159.601690] usb 1-2: configuration #1 chosen from 1 choice
[ 159.697320] usbcore: registered new interface driver libusual
[ 159.835867] Initializing USB Mass Storage driver...
[ 159.836359] scsi0 : SCSI emulation for USB Mass Storage devices
[ 159.924446] usb-storage: device found at 2
[ 159.924454] usb-storage: waiting for device to settle before scanning
[ 159.924912] usbcore: registered new interface driver usb-storage
[ 159.925077] USB Mass Storage support registered.

as you see, it hangs on "usb-storage: waiting for device to settle before scanning", then the kio_kamera fancy stuff initializes

In Feisty, everything works fine. Both icons appear, the kio_kamera one named "USB Mass Storage Interface" and a mounted usb-disk named with the label of fat partition existing on flash card in my camera.

dmesg in Feisty after plugging camera:
[ 241.575917] usb 1-2: new full speed USB device using uhci_hcd and address 2
[ 241.743964] usb 1-2: configuration #1 chosen from 1 choice
[ 242.014847] usbcore: registered new interface driver libusual
[ 242.078164] Initializing USB Mass Storage driver...
[ 242.078309] scsi0 : SCSI emulation for USB Mass Storage devices
[ 242.078384] usbcore: registered new interface driver usb-storage
[ 242.078388] USB Mass Storage support registered.
[ 242.078873] usb-storage: device found at 2
[ 242.078876] usb-storage: waiting for device to settle before scanning
[ 247.097481] usb-storage: device scan complete
[ 247.103481] scsi 0:0:0:0: Direct-Access OLYMPUS X450/D535Z/C370Z 1.00 PQ: 0 ANSI: 0 CCS
[ 247.279401] SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
[ 247.284406] sda: Write Protect is off
[ 247.284411] sda: Mode Sense: 00 06 00 00
[ 247.284414] sda: assuming drive cache: write through
[ 247.296394] SCSI device sda: 256000 512-byte hdwr sectors (131 MB)
[ 247.301395] sda: Write Protect is off
[ 247.301399] sda: Mode Sense: 00 06 00 00
[ 247.301401] sda: assuming drive cache: write through
[ 247.301846] sda: sda1
[ 247.308934] sd 0:0:0:0: Attached scsi removable disk sda
[ 247.353233] sd 0:0:0:0: Attached scsi generic sg0 type 0

I've found two solutions, which I place below, for fixing symptoms, but I still don't know the cause of this problem affecting Gutsy.

Solution 1:
  sudo rmmod usb_storage
  sudo modprobe usb_storage
Then plug in the camera again, and it just works exactly like in Feisty. ....till next re-login into KDE.
(you probably have to at least once plug the camera, before reloading kernel module and plugging the camera again)

after applying solution 1, dmesg says:
[ 2279.418184] usb 1-2: new full speed USB device using uhci_hcd and address 7
[ 2279.586248] usb 1-2: configuration #1 chosen from 1 choice
[ 2279.589395] scsi8 : SCSI emulation for USB Mass Storage devices
[ 2279.589600] usb-storage: device found at 7
[ 2279.589602] usb-storage: waiting for device to settle before scanning
[ 2284.586846] usb-storage: device scan complete
[ 2284.592842] scsi 8:0:0:0: Direct-Access OLYMPUS X450/D535Z/C370Z 1.00 PQ: 0 ANSI: 0 CCS
[ 2284.598016] sd 8:0:0:0: [sda] 1023104 512-byte hardware sectors (524 MB)
[ 2284.602802] sd 8:0:0:0: [sda] Write Protect is off
[ 2284.602806] sd 8:0:0:0: [sda] Mode Sense: 00 06 00 00
[ 2284.602810] sd 8:0:0:0: [sda] Assuming drive cache: write through
[ 2284.614805] sd 8:0:0:0: [sda] 1023104 512-byte hardware sectors (524 MB)
[ 2284.619798] sd 8:0:0:0: [sda] Write Protect is off
[ 2284.619802] sd 8:0:0:0: [sda] Mode Sense: 00 06 00 00
[ 2284.619805] sd 8:0:0:0: [sda] Assuming drive cache: write through
[ 2284.619810] sda: sda1
[ 2284.625899] sd 8:0:0:0: [sda] Attached SCSI removable disk
[ 2284.625956] sd 8:0:0:0: Attached scsi generic sg0 type 0

as you see, sda1 is detected

Solution 2:
enter KDE System Guard (process table) and kill "kdeinit" and all "kio_kamera" instances (there are probably two of them, don't know why I noticed only one instance of kio_kamera in Feisty)
After applying solution 2 usb-storage doesn't hang on "usb-storage: waiting for device to settle before scanning" and you can mount the camera manually (/dev/sda1)

Is it a KDE problem (kdebase-kio-plugins) or kernel module (usb_storage) causes it ?

Revision history for this message
Serhiy Kachaniuk (serzholino) wrote :

I can confirm this on 2 gutsy systems. One with 2.6.22 kernel and one with 2.6.20. Workaround #2 works for me too.

Changed in kdebase:
status: New → Confirmed
Revision history for this message
JLK (jlk) wrote :

I have exactly the same problem with kernel 2.6.22-14-generic and a Panasonic DMC-FZ7 camera.
Workaround #1 doesn't work for me, and I didn't try workaround #2 because I don't want to kill kdeinit ;-)

Revision history for this message
przemkus (przemkus) wrote :

I really don't know why workaround #1 works, I have to repeat those steps several times (reload kernel module usb_storage, connect camera, disconnect, reload module, and so on). It finally works for me... but I honestly hate to fight like this with my computer.

You may also try log off KDE, and then in text console connect cable and mount your camera manually:
eg.
sudo mount -t vfat /dev/sda1 /mnt
and transfer files with mc

Greetings :)

Revision history for this message
JLK (jlk) wrote :

Well I think this bug is related to this one: https://bugs.launchpad.net/ubuntu/+source/udev/+bug/173429

A workaround that worked for me was to rename (or remove) /etc/udev/rules.d/45-libgphoto2.rules

Hope this helps !

Revision history for this message
przemkus (przemkus) wrote :

Thanks a lot! :) It works :)

Revision history for this message
obesity52 (obesity52) wrote :

I appear to have the same problem. On Kubuntu 7.10, my
Olympus FE-170 and some other Olympus camera would not
mount in KDE, but would mount when only logged into the console.

Removing 45-libgphoto2.rules didn't work for me (kubuntu 7.10).
kio_kamera didn't seem to have anything to do with it this time. (?)

What did fix it though was making all of these changes (I don't
think all of these steps were actually required):

/etc/udev/rules.d/lib-gphoto2.rules
        removed file (doesn't seem to actually do anything, though)

/usr/share/services/kfile_media.desktop
        removed 'gphoto2camera' entry (seems to have no effect)

/usr/share/services/kipiplugin-kamera.desktop
        removed entire file (well... renamed actually)

/usr/share/services/camera.protocol
        replaced 'camera.protocol' file with 'system.protocol', but
        changed the line:
                protocol=system
        to:
                protocol=camera

Revision history for this message
Gurubie (gurubie) wrote :

None of this works for me. What I have to add is I continually plug and unplug the camera (Panasinic FZ18), eventually I can get files off the cameras internal memory. It doesn't last long though. It goes away and there seems to be no exact number of times to try. Maybe about 4 but sometimes many more. What in the world is wrong with KDE? This looks to me to be a small setting (guessing) or duplication or something but darned if I know what. Please help. At least with a working work-around. Let's get this in the upgrades too. It looks bad. very bad.

Revision history for this message
Gurubie (gurubie) wrote :

OK this is maddening but I will report what I found.

Now, after many tries, what was working, KDE says, I do not have the right permissions. What's really interesting is, when it's not usually saying (by dmesg) "waiting for the device to settle", it says "Trying to read beyond the limits of the device" or exact wording that is extremely similar.

These happens with the internal memory or on my 1GB SD memory card in the cam(that works fine in a good reader). I used the cameras built in format on it's internal memory but it made no difference. I doubt the camera memory came in a differing state than it's internal format command leaves it. I have only formated my 1GB SD by the cameras built in format command. So, (like the internal) I don't think my external card is the issue.

Notes: In camera formating may be the safest method of formating memory cards. Flash memory may have that skipped/blank area before the actual partition and that skip is for Flash alignment! Don't write over it! AKA, don't repartition when you format. Sometimes a particular format program also automatically changes the partition; before the actual format. IT WILL DESTABILIZE YOUR DRIVE! this may ve why so many are reported as duds. BUT, I read there MAY also be an issue with end of partition errors that the camera miss-detects, too. You would only see this as you run out of space and a file (perhaps a big movie) over writes the end, and you lose it. My internal memory does fine when it it filled up. Ironically, this "attempt to access beyond end of device" is the message I am getting above but not with the camera, with Kubuntu. So, it could definitely be related.

Also, besides Windows tendency to format Flash for FAT32 when it may be best as FAT(VFAT16) for <=4GB Flash, I also read Windows may format the partition similar to a floppy, rather than a hard drive. sda, instead of sda1 for example. This may be rejected by your differing devices (and firmware or drivers) and thus be incompatible across them.

So that's Two things about the underlying partition of Flash; that you may not have considered. FYI

All that said, it looks to be KDE and this worked before Gusty.

Other than a USB reader for the SD or PTP mode with the camera (not fully functioning with internal memory but maybe we can transfer movie clips to a SD first, then use a USB adapter instead of the cam cable), what is the KDE work around that works?

Revision history for this message
przemkus (przemkus) wrote :

I noticed that this problem still exists in Kubuntu 8.04 Hardy. But there's no more /etc/udev/rules.d/45-libgphoto2.rules file to erase to make it work.
What can I say? Shame....

Great greetings for everyone :)
Przemek

Revision history for this message
Marc Fournier (mfournier) wrote :

I confirm this bug is still present in kubuntu hardy, and I confirm it is caused in some cases by this bug: https://bugs.launchpad.net/libgphoto/+bug/173429 (however PMan's problem seems to be unrelated).

The problem is nevertheless something that should be fixed in KDE, IMO.

When using gnome or something else, cameras which provide mass-storage as well as PTP interfaces, appear on the desktop in the 2 forms (which is confusing and isn't a good thing).

KDE seems a bit smarter and will try to present only one device to the user, preferring PTP when available.

However when PTP is broken for any reason, KDE/kio_kamera should fallback to mass-storage mode. Currently it does nothing (no error message poping up, nothing appearing on the desktop). The only thing we have is the following message in syslog after a long timeout:
usb 5-2.1: usbfs: USBDEVFS_CONTROL failed cmd kio_kamera rqt 33 rq 102 len 0 ret -110

The workaround I suggest for kubuntu 8.04 is simply to uninstall the "kamera" package. It has no dependencies and will remove/unregister support for the "camera:/" URLs. No file to remove/edit, no command-line to type. This package seems to be the link between (buggy) libgphoto2 and KDE/HAL/udev. The downside is that cameras which only support PTP probably won't work anymore.

This way we revert to the "gnome" way of doing things: 2 items appear on the desktop:
 - a defective "USB Mass storage interface" (camera://blabla)
 - a valid "nG Removable Media" (/dev/sdXn)

Thanks for your consideration !
Marc

Revision history for this message
John (kde-e-wuuza) wrote :

Yeah, I was a little disappointed this wasn't fixed in Hardy coming from Gutsy. I can confirm my previous udev workaround stopped working, but removing the "kamera" package did fix it. I have a Panasonic DMC-TZ1.

Revision history for this message
ivan (ivan.tg) wrote :

Marc Fournier's fix helped me too. After removeing the "kamera" package my Panasonic FZ-18 was recognized once again. (Kubuntu 8.04)

Revision history for this message
GrahamGRA (graham-use-linux) wrote :

I had a similar issue. Except I was bogged down with this from dmesg

graham@salbutamol:~$ dmesg | tail
[ 7675.049783] usb 5-1: usbfs: USBDEVFS_CONTROL failed cmd kio_kamera rqt 33 rq 102 len 0 ret -110
[ 7683.052569] usb 5-1: usbfs: USBDEVFS_CONTROL failed cmd kio_kamera rqt 33 rq 102 len 0 ret -110
[ 7684.757591] usb 5-1: usbfs: USBDEVFS_CONTROL failed cmd kio_kamera rqt 33 rq 102 len 0 ret -71
[ 7684.853960] usb 5-1: USB disconnect, address 5
[ 7699.992864] usb 5-1: new full speed USB device using uhci_hcd and address 6
[ 7700.091921] usb 5-1: configuration #1 chosen from 1 choice
[ 7700.099310] scsi7 : SCSI emulation for USB Mass Storage devices
[ 7700.098973] usb-storage: device found at 6
[ 7700.098979] usb-storage: waiting for device to settle before scanning
[ 7710.372885] usb 5-1: usbfs: USBDEVFS_CONTROL failed cmd kio_kamera rqt 33 rq 102 len 0 ret -110

It would hang on 'waiting for device to settle before scanning' and then print the error about kio_kamera. That said... for me I don't think the kio_kamera command exists.

$ kio_[TAB]
kio_http_cache_cleaner kio_system_documenthelper
kio_media_mounthelper kio_uiserver
kio_media_realfolder kio_umountwrapper

Anyway... from what I can tell it was trying to mount my camera (Nikon Coolpix 5600) with PTP because PTP worked with my camera. I removed this from '/usr/share/hal/fdi/preprobe/10osvendor/20-libgphoto2.fdi'

   <match key="usb.vendor_id" int="1200">
    <match key="usb.product_id" int="302">
     <merge key="info.category" type="string">camera</merge>
     <append key="info.capabilities" type="strlist">camera</append>
     <merge key="camera.access_method" type="string">ptp</merge>
     <merge key="camera.libgphoto2.name" type="string">Nikon Coolpix 5600 (PTP mode)</merge>
     <merge key="camera.libgphoto2.support" type="bool">true</merge>
    </match>
   </match>

And it mounted correctly as a mass media device. I think it may be possible to have it mount correctly by changing camera.access_method to mass media but I don't know what to put in place of ptp.

Revision history for this message
przemkus (przemkus) wrote :

Removing 'kamera' package solves the problem for me also :D thanks!

Revision history for this message
zexpe (rosscollins-uk) wrote :

I have the same problem in Hardy with my Panasonic DMC-TZ1 camera. I did not have this problem in Feisty.

Removing "kamera" works, but is a bit messy as KDE still attempts to initiate access via the "camera:/" protocol and fails, prior to then loading the USB storage device.

Surely this should be a fairly high priority thing to fix for future releases? It's the sort of problem that would put off new users from using Ubuntu/Kubuntu.

Revision history for this message
Francisco T. (leviatan1) wrote :

Kubuntu intrepid alpha 6 detects correctly my olympus fe 110 and it mounts a usb disk.

In gusty and hardy I had the same problem.

Linux portatil 2.6.27-3-generic #1 SMP Wed Sep 10 16:02:00 UTC 2008 i686 GNU/Linux

Revision history for this message
Jonathan Thomas (echidnaman) wrote :

Reported fixed in Intrepid.

Changed in kdebase:
status: Confirmed → Invalid
Changed in kdegraphics:
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.