After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 591009 - Don't use gphoto when AFC is present on iPhones
Don't use gphoto when AFC is present on iPhones
Status: RESOLVED FIXED
Product: gvfs
Classification: Core
Component: gphoto backend
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gvfs-maint
gvfs-maint
: 597803 (view as bug list)
Depends on: 591005
Blocks:
 
 
Reported: 2009-08-06 22:38 UTC by Bastien Nocera
Modified: 2010-03-24 14:04 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Mark AFC devices as such in the usbmuxd udev rules (1.50 KB, patch)
2010-03-22 15:21 UTC, Bastien Nocera
none Details | Review
Ignore gphoto2 mounts on AFC capable devices (1.27 KB, patch)
2010-03-22 15:22 UTC, Bastien Nocera
none Details | Review
Ignore gphoto2 mounts on AFC capable devices (1.31 KB, patch)
2010-03-22 15:35 UTC, Bastien Nocera
committed Details | Review

Description Bastien Nocera 2009-08-06 22:38:51 UTC
When AFC is present, don't use gphoto, as we can already get the same data through other means (a DCIM directory will appear under the mount).
Comment 1 David Zeuthen (not reading bugmail) 2009-08-09 23:18:39 UTC
Sounds good to me... about implementing it... seems like we need to teach the gphoto2 volume monitor about detecting devices capable of being driven by the AFC driver code - is this complicated (e.g. sending commands to the device) or is it just a VPD check? Should probably also make the AFC and GPhoto2 monitors share code for this...
Comment 2 Bastien Nocera 2009-10-08 13:29:36 UTC
*** Bug 597803 has been marked as a duplicate of this bug. ***
Comment 3 Martin Szulecki 2009-10-20 09:20:39 UTC
@David: It is a matter of the gphoto2 rules flagging the device as a "camera" afaik.
Comment 4 David Zeuthen (not reading bugmail) 2009-11-09 14:19:37 UTC
(In reply to comment #3)
> @David: It is a matter of the gphoto2 rules flagging the device as a "camera"
> afaik.

Yeah, and that's still correct since the camera still can be driven by a PTP driver. The thing here is that we have two different drivers (gphoto2 and afc) that can be used - we need logic to only use one of them (afc in this case).
Comment 5 Martin Pitt 2010-03-11 11:40:42 UTC
Is there an easy (in terms of udev rules) way to check which devices are handled by the afc backend? A particular usb interface/protocol and the like?

Then we could add this check to the gvfs gphoto backend to ignore devices which have ID_GPHOTO2, but also match this interface/protocol, and enclose this check in #ifdef HAVE_AFC.

I don't see another elegant and race free variant here, unless there's a way to predict/force the probing order of gvfs backends?
Comment 6 Martin Pitt 2010-03-11 11:57:02 UTC
(In reply to comment #5)
> Is there an easy (in terms of udev rules) way to check which devices are
> handled by the afc backend? A particular usb interface/protocol and the like?

Ah, it seems there might be. libimobiledevice ships a hal fdi with

    <match key="info.subsystem" string="usb">
      <match key="usb.vendor_id" int="0x05ac">
        <match key="usb.product_id" compare_ge="0x1290">
          <match key="usb.product_id" compare_le="0x1294">
            <match key="usb.interface.number" int="0x1">
              <append key="info.capabilities" type="strlist">afc</append>

but this seems very limited. Do all the Apple-type devices really look that much alike?
Comment 7 Bastien Nocera 2010-03-11 13:36:35 UTC
(In reply to comment #5)
> Is there an easy (in terms of udev rules) way to check which devices are
> handled by the afc backend? A particular usb interface/protocol and the like?

A patch to usbmuxd's udev rule would be enough to add a tag.

> Then we could add this check to the gvfs gphoto backend to ignore devices which
> have ID_GPHOTO2, but also match this interface/protocol, and enclose this check
> in #ifdef HAVE_AFC.
> 
> I don't see another elegant and race free variant here, unless there's a way to
> predict/force the probing order of gvfs backends?

I think that just ignoring all gphoto mounts from AFC-capable devices is good enough.
Comment 8 Martin Pitt 2010-03-11 15:09:35 UTC
(In reply to comment #7)

> I think that just ignoring all gphoto mounts from AFC-capable devices is good
> enough.

Ah, this way around? I assumed that the afc backend would be preferred, since it's more specialized for Apple hardware.
Comment 9 Bastien Nocera 2010-03-11 15:23:16 UTC
(In reply to comment #8)
> (In reply to comment #7)
> 
> > I think that just ignoring all gphoto mounts from AFC-capable devices is good
> > enough.
> 
> Ah, this way around? I assumed that the afc backend would be preferred, since
> it's more specialized for Apple hardware.

I think you might have confused what I said.

You'd put the code in the gphoto volume monitor to ignore all devices that are tagged as being AFC capable. This would need to depend on the AFC backend being compiled.
Comment 10 Martin Szulecki 2010-03-11 16:20:38 UTC
I think Bastien got it right, either one can check for the 0x05ac:0x1290-0x1299 USB id range but due to the fact that this range is already maintained by usbmuxd's udev rules it makes more sense to just add a flag in the udev rules.

Please mind that this only should apply to the GVFS backend, since the PTP interface is still exposed access using libgphoto should still work.
Comment 11 Bastien Nocera 2010-03-22 15:21:21 UTC
Created attachment 156755 [details] [review]
Mark AFC devices as such in the usbmuxd udev rules

Would allow user-space to know that the device is AFC capable.

Helps with GNOME Bugzilla:
Comment 12 Bastien Nocera 2010-03-22 15:22:31 UTC
Created attachment 156756 [details] [review]
Ignore gphoto2 mounts on AFC capable devices

Requires a small usbmuxd udev rules change, to mark devices
with the USBMUXD_AFC_DEVICE property.
Comment 13 Bastien Nocera 2010-03-22 15:23:22 UTC
Patches for usbmuxd's udev rules, as well as the gphoto2 backend changes attached.

Works nicely for me, I now get 2 pop-ups instead of 4 :)
Comment 14 Bastien Nocera 2010-03-22 15:35:09 UTC
Created attachment 156758 [details] [review]
Ignore gphoto2 mounts on AFC capable devices

Requires a small usbmuxd udev rules change, to mark devices
with the USBMUXD_AFC_DEVICE property.
Comment 15 Bastien Nocera 2010-03-22 15:35:43 UTC
Comment on attachment 156755 [details] [review]
Mark AFC devices as such in the usbmuxd udev rules

Obsoleted by upstream patch
Comment 16 Bastien Nocera 2010-03-24 14:04:25 UTC
Attachment 156758 [details] pushed as b6202b8 - Ignore gphoto2 mounts on AFC capable devices