[PATCH] USB mass storage unbind

Couriousous couriousous at mandriva.org
Fri Jul 27 01:16:19 PDT 2007


Le vendredi 27 juillet 2007, Artem Kachitchkine a écrit :
> > Here is a little patch which implement the same behavior as MS Windows
> > when you "Safely remove" an usb mass-storage: switch-off the device.
> >
> > The way to do it on linux is to unbind the device from the usb driver (at
> > least here it works), so I've hacked a patch on hal-storage-eject to
> > unbind it when it's "ejected".
>
> I think "eject" is a subset of "safe removal", but not the other way
> around, which is what you seem to be proposing. Not being able to do
> anything with the device after eject (remount, reformat, etc)  breaks user
> expectations. IMO "safe removal" is a separate operation that, if
> implemented, would require a distinctly separate HAL method and UI element.

I agree with you, but currently hal frontend (at least KDE) mix unmount 
and "Safe removal". KDE show "Enlever en toute sécurité" (which is the french 
translation of "Safe removal") for the umount operation. This is why I've 
implemented the eject as an unbind. For the vast majority of the users, 
unmounting mean "I don't want to use it anymore" so, unbind the device is 
somewhat justified. At least on the most used OS, the "Safe remove" is an 
unbind and there is no user visible umount operation. 

The umount is IMHO an internal operation which should not be exposed to the 
user. I don't see the point, for the average user, to have a plugged usb 
storage device but not mounting it. And BTW, the advanced user can still 
reuse his device even after being unbinded by writing the device ID 
in /sys/bus/usb/drivers/usb/bind, and the device is only unbinded at the 
eject step. You can still unmount it but not eject it.

But this patch is clearly not the definitive implementation and I don't know a 
lot about the "hal way" of solving such problems. 



More information about the hal mailing list