getting UDI based on /dev/X filename
Roman Glebov
bleon at gmx.net
Wed Sep 28 12:00:22 PDT 2005
Martin Pitt wrote:
>Hi Roman!
>
>Roman Glebov [2005-09-28 13:36 +0200]:
>
>
>>is there a way to become udi of the device when i know its device file
>>name in /dev ?
>>
>>i know only manual way with lshal.
>>
>>
>
>First, why do you want to do this? I recently (well, yesterday) added
>a "mount by device" feature to the development and Ubuntu versions of
>pmount-hal, so that "pmount-hal /dev/sda1" will work now.
>
>As far as I know there is no command for finding out the UDI. The
>libhal-storage library provides that functionality:
>
> LibHalVolume* volume = libhal_volume_from_device_file( hal_ctx, "/dev/sda1" );
> char* udi = libhal_volume_get_udi (volume);
>
>so you can easily write your own program that does that. But it really
>depends on what you want to do, and in which context.
>
>Martin
>
>
>
for example i want to eject a drive if it is ejectable.
i am using gnome and pumount.
nautilus or something which umounts sends only mountpoint which should
get unmounted not the device itself.
So i need to find the corresponding udi to the mountpoint and then get
all other properties.
and then i can eject it if it is ejectable and do other nice things
dependant of deivce info.
Roman
More information about the hal
mailing list