[Thunar-dev] "Ejecting" USB flash drives

Harald Judt h.judt at gmx.at
Wed Feb 23 16:23:40 CET 2011


Am 23.02.2011 08:04, schrieb Yves-Alexis Perez:
> On Tue, 2011-02-22 at 17:42 +0100, Harald Judt wrote:
>> 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>


More information about the Thunar-dev mailing list