30 Aug 2012 13:10
urgent help required
amit pansuria <pansuriya.amit <at> gmail.com>
2012-08-30 11:10:01 GMT
2012-08-30 11:10:01 GMT
I m using hal utilinity on my linux (RHEL 5.5) to find the number of USB
devices connected to system
my problem is that when I connect two usb pen drive it shows correctly
now at run time when I unplug one of pen drive and re- run my script it
still shows two pen drive
ideally it shoud show only one after unplug.
I have write following script
for udi in $(/usr/bin/hal-find-by-capability --capability storage)
do
device=$(hal-get-property --udi $udi --key block.device)
vendor=$(hal-get-property --udi $udi --key storage.vendor)
model=$(hal-get-property --udi $udi --key storage.model)
echo "udi=$udi ** device=$device ** vendor=$vendor ** model=$model"
if [[ $(hal-get-property --udi $udi --key storage.bus) = "usb" ]]
then
parent_udi=$(hal-find-by-property --key block.storage_device
--string $udi)
mount=$(hal-get-property --udi $parent_udi --key
volume.mount_point)
echo "mount = $mount"
label=$(hal-get-property --udi $parent_udi --key volume.label)
media_size=$(hal-get-property --udi $udi --key
storage.removable.media_size)
size=$(( ceil(media_size/(1024*1024*1024)) ))
line="$vendor $model $device $label "${size}GB""
(Continue reading)
RSS Feed