Re: Automounting GVFS systems when devices are added?



On Mon, 2008-10-13 at 14:47 -0700, Patrick Walton wrote:
> > Actually you really want a separate volume monitor [1], see the gphoto2
> > volume monitor (monitor/gphoto2 in the gvfs tree) for details on how to
> > write one; it should be straightforward [3].
> 
> This is what I was thinking of. It should still use HAL for device 
> detection for the time being though, right?

Yeah.

> So what I'm thinking about doing is adding a new value for volume.fstype 
> in HAL, "afc".

The volume wouldn't actually appear in HAL.

>  When my "gvfsmonitord-afc" or whatever sees a device that 
> supports afc, it'll mount the volume. If the phone is jailbroken, it 
> should mount both the jailed and jailbroken volumes (the convention is 
> for the jailbroken volume to be accessible at com.apple.afc2).

Can you open both at the same time? For AFC2, you could always have
"afc2://" as the URI scheme.

> Oh, and it doesn't support multiple iPhones or iPods at the moment, 
> because the underlying libiphone doesn't support them.

But it uses libusb, so it would be easy to add support for it (ie. it's
a bit of parsing somewhere in the public API, and a couple of lines of
code in iphone_get_device()).

>  However, I agree 
> that the URI should be in a form that allows us to support multiple 
> devices in the future. What would really be best is to use the serial 
> number of the device as an identifier (so, say, 
> afc://YM2105825234:com.apple.afc/), I think.

You can't get the serial number from HAL, you'd need to probe it,
probably using libiphone...

If you want to export the serial number, you can export it via an xattr
on the root folder of your mount.

>  This is an important 
> property to expose to applications anyway, because it is needed in the 
> obfuscated signature for the music database.

You just can't embed important information like that in the URI. I would
advise you to adopt something similar to libgphoto's way and use
"afc://[usb:bus_number,device_number]/" for the URI, even if you don't
actually use the information. It would be easy to fix after the fact.

Cheers



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]