# Can't read PTP camera

## stdPikachu

I've had this problem for a while now, but the gf is now getting annoyed...! What makes the problem even more perplexing is the fact that another computer with a near-identical config works perfectly.

The camera in question is a Canon Powershot A530 which only works in PTP mode (i.e no USB mass storage mode) with apps like gphoto2/digikam. When I try it on my main workstation, tybalt, every app fails to connect to and even detect the camera, even when run as root. On my mythtv box everything works as expected.

Both systems have the latest udev, libgphoto2 and digikam installed, all compiled against current libs. Plugging the camera in generates entries in dmesg;

```
Nov 27 21:24:40 tybalt usb 2-1: new high speed USB device using ehci_hcd and address 12

Nov 27 21:24:40 tybalt usb 2-1: configuration #1 chosen from 1 choice

Nov 27 21:25:28 tybalt usb 2-1: USB disconnect, address 12
```

plus a KDE prompt on what I'd like to do with the hardware. Permissions aren't a problem - all device nodes are created with 664 permissions belonging to the usb group as per:

```
SUBSYSTEM=="usb_device", PROGRAM="/bin/sh -c 'K=%k; K=$${K#usbdev}; printf bus/usb/%%03i/%%03i $${K%%%%.*} $${K#*.}'", NAME="%c", MODE="0664", GROUP="usb"
```

Yet even when I try with bare gphoto2 as root, nothing is returned:

```
tybalt ~ # gphoto2 --auto-detect

Model                          Port

----------------------------------------------------------
```

Prospero, naturally, works fine even as a regular user:

```
mythtv@prospero ~ $ gphoto2 --auto-detect

Model                          Port

----------------------------------------------------------

Canon PowerShot A530 (PTP mode) usb:

Canon PowerShot A530 (PTP mode) usb:001,005
```

In fact, tybalt returns a result so quickly that it's almost as if it's not even bothering to detect anything.

Does anyone have any idea what the problem is here? I've tried every possible option with tinkering with udev, hotplug and all the rest of them that I can think of, all to no avail. The most annoying thing of all is that, up until a few weeks ago, tybalt worked perfectly too, and all other USB devices (keyboard, mouse, bluetooth) work perfectly. Neither machine has any weird CFLAGS or anything like that. I've tried different versions of libusb, running gphoto2 through strace and couldn't find anything suspicious, but I'm no expert...

A hojillion thanks in advance to anyone who can give me the faintest idea of what's going on...!

----------

## stdPikachu

No takers?

In that case, does anyone have any pointers for debugging libgphoto/gphoto/digikam? I don't mind looking for bugs, as long as I have a reasonably good idea of what it is I'm meant to be looking for. Even if anyone has a good guide on getting a decent strace out of gphoto it'd come in very handy!

----------

## wolfger

I have a similar problem, but it's more annoying because the camera used to work and has stopped. Plugging in gives 

```
usb 1-6: new high speed USB device using ehci_hcd and address 10

usb 1-6: configuration #1 chosen from 1 choice

```

, and Digikam recognizes it as "Sony DSC-F707V (PTP mode)" (although it's really a DSC-S600), but when I try to get my picture, it pops up "failed to connect to camera". Again, this camera used to work with Digikam, but no longer does, so I'm tearing my hair out...

----------

## wolfger

Ah, nevermind. A bit further down the search page, I found the thread from the last time I had this problem...

https://forums.gentoo.org/viewtopic-t-513833-highlight-digikam.html

----------

## stdPikachu

Aye, mine also used to work, but then suddenly stopped... my usb_devices udev rules is the same as yours it seems, and gphoto2 won't even connect as root...

----------

## wolfger

Well, fixing my udev rules (again) fixed the problem for me (again).  So you're saying something else is broke for you? Are you sure your usb cable is good (does it work on other computers)? Is your usb port good (does it work with other devices)?

----------

## stdPikachu

Positive the hardware is good - as outlined, when running on prospero everything camera-related works fine (well, apart from KDE/Konqueror access), but on tybalt I get absolutely no response whatsoever. It's weird...!

----------

## tom_bxl

Hi,

I had similar problems with my camera in PTP mode and with my scanner, both work OK on my laptop but both give errors on my desktop. I keep both PCs in sync using the same kernel and software versions as well as configuration.

I suspect it is related to libusb (see my previous  post). 

Lucky me, I can work it around by using my camera in mass storage mode on the desktop and it works perfectly, as other USB devices that do not use libusb but kernel modules (pda, webcam, usb drive, scanner without libusb). So I guess the hardware is OK.

No clue what's wrong   :Sad:   so far, will keep my posts updated if I find anything.

You can use USB_DEBUG as follow to get more output when using gphoto2

```

zorglub brol # USB_DEBUG=255 gphoto2 -P

```

Thomas

----------

## tom_bxl

Do you have the usb 2 module ehci_hcd loaded? Maybe give a try removing the module. This has "solved" all my usb problems. Both camera in PTP and scanner work just fine. The strange thing is that these errors occured even if these devices were pluged-in a usb 1 port ???!!!???

----------

## stdPikachu

Not tried that yet, will give it a whirl when I get back home.

Which USB controller is it you're using? Not that I have a great deal of USB devices, but I can see it being a PITA having to change modules all the time I want to get non-cruddy transfer speeds out of it... if this turns out to be the culprit, does that mean it's a bug in the kernel's USB stack...?

----------

## tom_bxl

I have a VIA controller. I don't consider this as a solution, but I 'm trying to find out what could be the cause. The strande thing is that I only get this with the ehci module loaded with programs using libusb. When accessing the devices without libusb, everything runs smoothly. Libusb returns I/O errors with ehci loaded.

----------

