Fwd: Re: gio synchronized unmount ?




Hello

I still face some problem when unmounting a device.

The goal is to unmount MTP device (mounted by gvfs gphoto2 backend)
when Rhythmbox starts because both RB and GVFS use the same libmtp layer
but the device can be opened only once.

The logic is as follow :
// begin
if (opening the MTP device fails) {

   call unmount_with_operation(MTP_mount, G_MOUNT_UNMOUNT_NONE, NULL, NULL,
                                                  unmount_done_cb,
something)
}

unmount_done_cb (...)
{

 ok = g_mount_unmount_with_operation_finish (MTP_mount, ...)
if (ok) {
     open the MTP device  // AAA
}
// end

In AAA the open fails (quite always) because the MTP device is not
completely unmounted.

The I've tried to register to the signal mount-removed emitted by volume
monitor but the result is weird ; sometime the signal handler is called
before unmount_done_cb, sometimes it is the opposite and whatever the
order is, the MTP device is not always available ?!

The only solution I've found is to add some kind of delayed retries to
open the MTP device but I find this solution not very smart and I am
surprised that there is not a more deterministic mean to be sure that
the unmount operation is completely done.

Any help appreciated

François






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