Discussion:
[Thunar-dev] "Ejecting" USB flash drives
Harald Judt
2011-02-22 16:42:49 UTC
Permalink
Hi,

Since thunar switched to udev, the "unmount" action has been replaced
with an "eject" action which unfortunately removes the drive from the
list in the left-pane menu.

I do not want that; I want the USB flash drive in my list as long as it
is physically attached to the computer. "Eject" is wrong here anyway,
you can't eject it like you can a CD or DVD. How can I revert this
annoying behaviour?

@thunar-dev: If this is only possible via patching the sources, I'm very
willing to do it this way.

Regards,

Harald
--
`Experience is the best teacher.'
Tino Keitel
2011-02-22 19:22:20 UTC
Permalink
Post by Harald Judt
Hi,
Since thunar switched to udev, the "unmount" action has been
replaced with an "eject" action which unfortunately removes the
drive from the list in the left-pane menu.
I do not want that; I want the USB flash drive in my list as long as
it is physically attached to the computer. "Eject" is wrong here
anyway, you can't eject it like you can a CD or DVD. How can I
revert this annoying behaviour?
@thunar-dev: If this is only possible via patching the sources, I'm
very willing to do it this way.
I HAL times, thunar gathered the eject capability from HAL and used it
if the HAL entry had it set. So to enable/disable the eject entry you
had to change/add according entries in a HAL fdi file. I don't know
how it currently works, but maybe a similar interface exists that just
needs to be adjusted to your needs.

Regards,
Tino
Tino Keitel
2011-02-23 06:52:59 UTC
Permalink
Post by Tino Keitel
Post by Harald Judt
Hi,
Since thunar switched to udev, the "unmount" action has been
replaced with an "eject" action which unfortunately removes the
drive from the list in the left-pane menu.
I do not want that; I want the USB flash drive in my list as long as
it is physically attached to the computer. "Eject" is wrong here
anyway, you can't eject it like you can a CD or DVD. How can I
revert this annoying behaviour?
@thunar-dev: If this is only possible via patching the sources, I'm
very willing to do it this way.
I HAL times, thunar gathered the eject capability from HAL and used it
if the HAL entry had it set. So to enable/disable the eject entry you
had to change/add according entries in a HAL fdi file. I don't know
how it currently works, but maybe a similar interface exists that just
needs to be adjusted to your needs.
I found eject related settings in
/usr/share/polkit-1/actions/org.freedesktop.udisks.policy:

<action id="org.freedesktop.udisks.drive-eject">
[...]
<defaults>
<allow_any>no</allow_any>
<allow_inactive>no</allow_inactive>
<allow_active>yes</allow_active>
</defaults>
</action>

Regards,
Tino
Yves-Alexis Perez
2011-02-23 07:04:26 UTC
Permalink
Post by Harald Judt
I do not want that; I want the USB flash drive in my list as long as it
is physically attached to the computer. "Eject" is wrong here anyway,
you can't eject it like you can a CD or DVD. How can I revert this
annoying behaviour?
Note that eject does make sense for some usb devices. First, that means
it unmounts all the partitions at once and it stops the power. Secondly,
in some cases (?smart? devices like media player, phones etc.) it's
required to eject and not just unmount.

Regards,
--
Yves-Alexis
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://mail.xfce.org/pipermail/thunar-dev/attachments/20110223/ab45e5a8/attachment.pgp>
Harald Judt
2011-02-23 15:23:40 UTC
Permalink
Post by Yves-Alexis Perez
Post by Harald Judt
I do not want that; I want the USB flash drive in my list as long as it
is physically attached to the computer. "Eject" is wrong here anyway,
you can't eject it like you can a CD or DVD. How can I revert this
annoying behaviour?
Note that eject does make sense for some usb devices. First, that means
it unmounts all the partitions at once and it stops the power. Secondly,
in some cases (?smart? devices like media player, phones etc.) it's
required to eject and not just unmount.
Ok, you're right, so for _some_ usb devices it does make sense. I used
udisks --show-info to investigate some hardware:

Behold:
USB flash drive
ejectable: 0
Sansa fuze media player:
ejectable: 0
DVD drive:
ejectable: 1

So udisks reports it is not ejectable, yet I can eject it because it is
removable.

-----
http://hal.freedesktop.org/docs/udisks/udisks.7.html
ID_DRIVE_EJECTABLE:
Whether the media in the drive is physically ejectable. Only set this to
1 (or 0) if the drive truly uses (or doesn't) ejectable media. In
particular, it is not necessary to set this for e.g. iPod or Kindle
devices where it is necessary to send a command via eject(1) since the
desktop user session will offer this option for removable devices
regardless of whether they are ejectable. If this property is not set, a
heuristic will be used to determine if the media is ejectable (drives
using optical, Zip or Jaz media are considered ejectable).
-----

Great, let the others deal with it. I guess "smart" devices etc. don't
set "ejectable" to the right value (that would be 1), do they? Will they
leave it undefined? I wonder whether thunar could use this property in a
better way to decide between ejectable or simply unmount-able. Are there
reasons not to do so?

Anyway, I've patched thunar to reactivate the unmount action for both
the tree view and the shortcut view. As most of the code is already in
place, this was not very difficult, I just had to do a little copy &
paste here and there. It adds another entry to the context menu, but
does not remove the eject entry. While it's just a hack, duplicates some
code, contains unnecessary checks or misses some and therefore is
certainly improvable, I'll still attach it to the mail for those who are
interested.

Regards,
Harald
--
`Experience is the best teacher.'
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: thunar-1.3.0-add-unmount-menu-entry.patch
URL: <http://mail.xfce.org/pipermail/thunar-dev/attachments/20110223/22af405c/attachment.ksh>
Jannis Pohlmann
2011-02-23 16:45:24 UTC
Permalink
Hey,

On Wed, 23 Feb 2011 16:23:40 +0100
Post by Harald Judt
Anyway, I've patched thunar to reactivate the unmount action for both
the tree view and the shortcut view. As most of the code is already
in place, this was not very difficult, I just had to do a little copy
& paste here and there. It adds another entry to the context menu,
but does not remove the eject entry. While it's just a hack,
duplicates some code, contains unnecessary checks or misses some and
therefore is certainly improvable, I'll still attach it to the mail
for those who are interested.
the reason for removing the the unmount option was to make things
easier for people. Nobody should have to understand what unmounting is
and how it differs from ejecting.

You attach (mount) your drive and you detach (eject) it and that's it.
Keeping a device around after unmounting it just to be able to mount it
again later makes no sense IMHO. Please show me a valid use case where
this is important and I might rethink my perspective. I can only think
of "oops, I forgot to copy this file to the USB stick, now I need to
mount it again" so far.

Please note that we don't always eject. If the device doesn't support
ejecting then we just umount (we still call it eject in the GUI to
avoid confusion regarding unmount vs. eject). So if GIO told us that
e.g. USB sticks cannot be ejected, then we would only unmount it. (And
yes, we could also try to power it down if no partitions on the device
are being used.)

I am against bringing back umount + eject and I favor eject only. If
GIO provides us with wrong information however there's little we can do.

- Jannis
Yves-Alexis Perez
2011-02-23 16:55:29 UTC
Permalink
Post by Jannis Pohlmann
Please show me a valid use case where
this is important and I might rethink my perspective. I can only think
of "oops, I forgot to copy this file to the USB stick, now I need to
mount it again" so far.
When you have multiple partitions or drives on the device. And no, these
are not only for geeks, think smartphones with internal memory + sdcard
or card readers with multiple slots.

If ?eject? remove all of them at once, it's a bit painful.

Regards,
--
Yves-Alexis
Jannis Pohlmann
2011-02-23 16:57:23 UTC
Permalink
On Wed, 23 Feb 2011 17:55:29 +0100
Post by Yves-Alexis Perez
Post by Jannis Pohlmann
Please show me a valid use case where
this is important and I might rethink my perspective. I can only
think of "oops, I forgot to copy this file to the USB stick, now I
need to mount it again" so far.
When you have multiple partitions or drives on the device. And no,
these are not only for geeks, think smartphones with internal memory
+ sdcard or card readers with multiple slots.
If ?eject? remove all of them at once, it's a bit painful.
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.

- Jannis
Yves-Alexis Perez
2011-02-23 17:05:55 UTC
Permalink
Post by Jannis Pohlmann
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.
Because I don't want to keep stuff mounted when I don't need it.
--
Yves-Alexis
Jannis Pohlmann
2011-02-23 17:11:45 UTC
Permalink
On Wed, 23 Feb 2011 18:05:55 +0100
Post by Yves-Alexis Perez
Post by Jannis Pohlmann
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.
Because I don't want to keep stuff mounted when I don't need it.
So you're umounting simply because you *can*? So by removing that
option we actually save you a lot of time because you no longer have a
way to pursue your weird habbit of unmounting things all the time.
Isn't that a good thing? :P

I don't know how a device still mounted could be considered bad (or
distracting) other than for reasons of power management (but there eject
helps).

- Jannis
Harald Judt
2011-02-23 18:52:39 UTC
Permalink
Post by Jannis Pohlmann
On Wed, 23 Feb 2011 18:05:55 +0100
Post by Yves-Alexis Perez
Post by Jannis Pohlmann
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.
Because I don't want to keep stuff mounted when I don't need it.
So you're umounting simply because you *can*? So by removing that
option we actually save you a lot of time because you no longer have a
way to pursue your weird habbit of unmounting things all the time.
Isn't that a good thing? :P
I don't know how a device still mounted could be considered bad (or
distracting) other than for reasons of power management (but there eject
helps).
First, I like the idea that there is only one option for
unmount/detaching/ejecting/whatever-you-call-it a device. I agree that
it is simplier to understand. However, 'ejecting' for me also has a
connotation of concerning hardware and physical manipulation which in
this case seems a bit inappropriate. Never mind, the semantics are not
that important here.

I can imagine one reason why still showing the device after ejecting it
might be useful: You won't guess how many people forget their USB flash
drives (no, that gladly did not happen to me). If they still see it
attached, they might be more alert not to forget.
Post by Jannis Pohlmann
Post by Yves-Alexis Perez
Because I don't want to keep stuff mounted when I don't need it.
It is the same with me. Additionally, I can be sure that everything has
been written to disk when I unmount it, so the filesystem won't get
corrupt in case of troubles. Just a matter of habit. And I like to see
what is still (physically) attached to the computer.

These issues put aside, what would make everyone happy would be gio
reporting the 'ejectable' capability correctly so that thunar doesn't
try to eject the device if "ejectable" is false. Assuming that this is
indeed the problem like you stated in a previous mail. I will
investigate further why this doesn't work correctly and would of course
greatly appreciate your help.

Finally, I like the new eject icon. It is clear and saves you a click
and the delay of reading a menu entry.

Regards,
Harald
--
`Experience is the best teacher.'
Bobby Bingham
2011-02-24 01:36:51 UTC
Permalink
On Wed, 23 Feb 2011 17:57:23 +0100
Post by Jannis Pohlmann
On Wed, 23 Feb 2011 17:55:29 +0100
Post by Yves-Alexis Perez
Post by Jannis Pohlmann
Please show me a valid use case where
this is important and I might rethink my perspective. I can only
think of "oops, I forgot to copy this file to the USB stick, now I
need to mount it again" so far.
When you have multiple partitions or drives on the device. And no,
these are not only for geeks, think smartphones with internal memory
+ sdcard or card readers with multiple slots.
If ?eject? remove all of them at once, it's a bit painful.
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.
I haven't been following this thread carefully, and I may be
misunderstanding how this works, but how about the case of a card
reader with multiple slots? What if I want to unmount the SD card so I
can use a different SD card, but I still want to use the CF card I have
inserted in another slot?

If "eject" unmounts all the cards on the device, then you can't do this?
--
Bobby Bingham
??????????????????????
Harald Judt
2011-02-24 10:44:13 UTC
Permalink
Post by Bobby Bingham
I haven't been following this thread carefully, and I may be
misunderstanding how this works, but how about the case of a card
reader with multiple slots? What if I want to unmount the SD card so I
can use a different SD card, but I still want to use the CF card I have
inserted in another slot?
If "eject" unmounts all the cards on the device, then you can't do this?
I guess gio won't allow this:
http://git.gnome.org/browse/gvfs/commit/?id=6e70902ee77cb0bd6063bcf4d215b13a13bf5ee4

Besides, a lot of people would have complained by now.

Regards,
Harald
--
`Experience is the best teacher.'
Harald Judt
2011-02-24 17:00:56 UTC
Permalink
Post by Jannis Pohlmann
On Wed, 23 Feb 2011 17:55:29 +0100
Post by Yves-Alexis Perez
Post by Jannis Pohlmann
Please show me a valid use case where
this is important and I might rethink my perspective. I can only
think of "oops, I forgot to copy this file to the USB stick, now I
need to mount it again" so far.
When you have multiple partitions or drives on the device. And no,
these are not only for geeks, think smartphones with internal memory
+ sdcard or card readers with multiple slots.
If ?eject? remove all of them at once, it's a bit painful.
But why do you need to unmount at all then? Just eject once you now
longer intend to have the device connected to your machine.
- Jannis
I've seen you've posted to the gvfs list about this some time ago, but
there is no response to your questions in the archive.
http://mail.gnome.org/archives/gvfs-list/2010-October/msg00000.html

I've then checked the git repository and found this:
http://git.gnome.org/browse/gvfs/commit/?id=b8f430b51f4071a7c7ba6601caf20f817fda531d

This is still present in HEAD, albeit slightly modified:
drive->can_eject = ((gdu_device_drive_get_is_media_ejectable
(device) || gdu_device_is_removable (device)) &&
gdu_device_is_media_available (device) && !
_is_pc_floppy_drive (device)) ||
gdu_device_drive_get_requires_eject (device);

So gio decides that all removable drives except floppy drives are ejectable.

...and the corresponding bug report:
https://bugzilla.gnome.org/show_bug.cgi?id=576587

So how about the following proposal:

* Add a configuration entry for thunarrc like 'ShowUnmountMenuEntry'
so that users who want the unmount feature can enable it?
Most of the code needed is already there, and not much would
have to be added. Additionally, this seems to be functionality
unlikely to change very often so the maintenance efforts would
be minimal. No harm done, and the user has the choice to choose
what he or she likes best.

* The eject button is always there for quick and easy access.
No need to look up an entry in the context menu.

Harald

--
`Experience is the best teacher.'

Loading...