urgent help required

amit pansuria pansuriya.amit at gmail.com
Thu Aug 30 04:10:01 PDT 2012


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""
      fi
 done

your help will be highly appreciated.

Regards,
Amit





Click here to Reply or Forward
Small Business Websites<http://pagead2.googlesyndication.com/aclk?sa=L&ai=BdRFv7Ek_UOr2A_CG2wW-yIGACdiJ9ZsCkLDInzbAjbcBkOTABBABGAEgho-AAigHOABQ9euTuf______AWDJ5pOHzKPAF7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkXIApCPhRioAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBsi3-Bo&num=1&sig=AOD64_2zvhLCiI9IXiuRT1zj3MrLtecwuA&adurl=http://www.DexOne.com>
Ads – Why this ad?
Helping 400,000+ Local Businesses Get Found & Get Chosen Everyday.
www.DexOne.com<http://pagead2.googlesyndication.com/aclk?sa=L&ai=BdRFv7Ek_UOr2A_CG2wW-yIGACdiJ9ZsCkLDInzbAjbcBkOTABBABGAEgho-AAigHOABQ9euTuf______AWDJ5pOHzKPAF7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkXIApCPhRioAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBsi3-Bo&num=1&sig=AOD64_2zvhLCiI9IXiuRT1zj3MrLtecwuA&adurl=http://www.DexOne.com>
15% full
Using 1.6 GB of your 10 GB
©2012 Google - Terms & Privacy <http://mail.google.com/mail/help/terms.html>
Last account activity: 0 minutes ago
Details

david
david at fubar.dk
Show details
Ads – Why these ads?
Seagate FreeAgent
GoFlex<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BYmIH7Ek_UOr2A_CG2wW-yIGACfrusegC8r-p7zvAjbcB8PZlEAIYAiCGj4ACKAc4AFDDrsCw_v____8BYMnmk4fMo8AXoAHasIjoA7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkWAAgHIAprJlyaoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBuqn9Bc&num=2&sig=AOD64_39lsktNG09Ljgmu6NHEuAq0h8jow&adurl=http://ad.doubleclick.net/clk%3B224718982%3B48387004%3Bq%3Fhttp://www.newegg.com/Product/Product.aspx%3FItem%3DN82E16822148886%26cm_mmc%3DGoogleContentNetwork-_-ExternalHDD-_-0828-_-0903%26nm_mc%3DExtBanner>
1.5TB USB 2.0 Black External HD $79.99 shipped w/ code EMCNBHB46
www.newegg.com/ExternalHardDrive<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BYmIH7Ek_UOr2A_CG2wW-yIGACfrusegC8r-p7zvAjbcB8PZlEAIYAiCGj4ACKAc4AFDDrsCw_v____8BYMnmk4fMo8AXoAHasIjoA7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkWAAgHIAprJlyaoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBuqn9Bc&num=2&sig=AOD64_39lsktNG09Ljgmu6NHEuAq0h8jow&adurl=http://ad.doubleclick.net/clk%3B224718982%3B48387004%3Bq%3Fhttp://www.newegg.com/Product/Product.aspx%3FItem%3DN82E16822148886%26cm_mmc%3DGoogleContentNetwork-_-ExternalHDD-_-0828-_-0903%26nm_mc%3DExtBanner>
Custom USB Flash
Drives<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BhCKN7Ek_UOr2A_CG2wW-yIGACZfdtvwCt9aM8ULAjbcBwIWQARADGAMgho-AAigHOABQv-KzGWDJ5pOHzKPAF6ABgbWU5gOyAQ9tYWlsLmdvb2dsZS5jb226AQ5nbWFpbC1jdi1iZWxvd8gBAdoBO2h0dHA6Ly9tYWlsLmdvb2dsZS5jb20vTVRReE1UY3lNemMyTURJek16VTVOamczTlVWWVVFRk9SRVZFyALH9O4RqAMBwAMN6AO5AugD5gPoA8IE6AMg9QMACABE4AaXmdMY&num=3&sig=AOD64_1lIJR8CiR8V1s6e6lONmZF3VGEUw&adurl=http://www.vistaprint.com/usb-flash-drives.aspx%3Ftxi%3D15522%26xnid%3DTopNav_USB%2BFlash%2BDrives_Promotional%2BItems_All%2BProducts%26xnav%3DTopNav>
Add Your Name, Logo & Contact Info. No Setup Fees. Order Online Today!
www.Vistaprint.com<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BhCKN7Ek_UOr2A_CG2wW-yIGACZfdtvwCt9aM8ULAjbcBwIWQARADGAMgho-AAigHOABQv-KzGWDJ5pOHzKPAF6ABgbWU5gOyAQ9tYWlsLmdvb2dsZS5jb226AQ5nbWFpbC1jdi1iZWxvd8gBAdoBO2h0dHA6Ly9tYWlsLmdvb2dsZS5jb20vTVRReE1UY3lNemMyTURJek16VTVOamczTlVWWVVFRk9SRVZFyALH9O4RqAMBwAMN6AO5AugD5gPoA8IE6AMg9QMACABE4AaXmdMY&num=3&sig=AOD64_1lIJR8CiR8V1s6e6lONmZF3VGEUw&adurl=http://www.vistaprint.com/usb-flash-drives.aspx%3Ftxi%3D15522%26xnid%3DTopNav_USB%2BFlash%2BDrives_Promotional%2BItems_All%2BProducts%26xnav%3DTopNav>
RS-232 to USB datalogger<http://pagead2.googlesyndication.com/aclk?sa=L&ai=Ba91d7Ek_UOr2A_CG2wW-yIGACc-m5v8Dr8WztlzAjbcB0IdWEAQYBCCGj4ACKAc4AFCowtqo-f____8BYMnmk4fMo8AXsgEPbWFpbC5nb29nbGUuY29tugEOZ21haWwtY3YtYmVsb3fIAQHaATtodHRwOi8vbWFpbC5nb29nbGUuY29tL01UUXhNVGN5TXpjMk1ESXpNelU1TmpnM05VVllVRUZPUkVWRagDAcADDegDuQLoA-YD6APCBOgDIPUDAAgAROAG96WZIg&num=4&sig=AOD64_0_yUqmShJoDUjd5Cip91SJSGaWmg&adurl=http://www.brig-elec.com>
Compact. Simple. Mounts easily. In stock. $269
www.brig-elec.com<http://pagead2.googlesyndication.com/aclk?sa=L&ai=Ba91d7Ek_UOr2A_CG2wW-yIGACc-m5v8Dr8WztlzAjbcB0IdWEAQYBCCGj4ACKAc4AFCowtqo-f____8BYMnmk4fMo8AXsgEPbWFpbC5nb29nbGUuY29tugEOZ21haWwtY3YtYmVsb3fIAQHaATtodHRwOi8vbWFpbC5nb29nbGUuY29tL01UUXhNVGN5TXpjMk1ESXpNelU1TmpnM05VVllVRUZPUkVWRagDAcADDegDuQLoA-YD6APCBOgDIPUDAAgAROAG96WZIg&num=4&sig=AOD64_0_yUqmShJoDUjd5Cip91SJSGaWmg&adurl=http://www.brig-elec.com>
Custom Flash Drives<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BfgjP7Ek_UOr2A_CG2wW-yIGACbGxk7ECuZu9ijLAjbcBoOg7EAUYBSCGj4ACKAc4AFDOq77F-_____8BYMnmk4fMo8AXoAHv6aPmA7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkWAAgGoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBqme5Ro&num=5&sig=AOD64_2OXQaWl77-5yj-rhNNBoI2QbJ_Xg&adurl=http://www.greenthumbdrives.com/>
More Models, Options & Services Free Logo, Load, Ship - Min. 50 Pcs
greenthumbdrives.com/FlashDrives<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BfgjP7Ek_UOr2A_CG2wW-yIGACbGxk7ECuZu9ijLAjbcBoOg7EAUYBSCGj4ACKAc4AFDOq77F-_____8BYMnmk4fMo8AXoAHv6aPmA7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkWAAgGoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBqme5Ro&num=5&sig=AOD64_2OXQaWl77-5yj-rhNNBoI2QbJ_Xg&adurl=http://www.greenthumbdrives.com/>
G Drive Data Recovery<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BHVNk7Ek_UOr2A_CG2wW-yIGACci574YDyN6e9y3AjbcBgONcEAYYBiCGj4ACKAc4AFD3ns_tAWDJ5pOHzKPAF6AB8cW3_wOyAQ9tYWlsLmdvb2dsZS5jb226AQ5nbWFpbC1jdi1iZWxvd8gBAdoBO2h0dHA6Ly9tYWlsLmdvb2dsZS5jb20vTVRReE1UY3lNemMyTURJek16VTVOamczTlVWWVVFRk9SRVZFgAIBqAMBwAMN6AO5AugD5gPoA8IE6AMg9QMACABE4Aa3tQs&num=6&sig=AOD64_0AHkwA8vB_ZoIsSH6-qGrNPPxFGQ&adurl=http://drivecrash.com/datarecovery/g-technology/>
G DriveSpecialists Recover Data No Recovery No Fee 800-233-3648
drivecrash.com<http://pagead2.googlesyndication.com/aclk?sa=l&ai=BHVNk7Ek_UOr2A_CG2wW-yIGACci574YDyN6e9y3AjbcBgONcEAYYBiCGj4ACKAc4AFD3ns_tAWDJ5pOHzKPAF6AB8cW3_wOyAQ9tYWlsLmdvb2dsZS5jb226AQ5nbWFpbC1jdi1iZWxvd8gBAdoBO2h0dHA6Ly9tYWlsLmdvb2dsZS5jb20vTVRReE1UY3lNemMyTURJek16VTVOamczTlVWWVVFRk9SRVZFgAIBqAMBwAMN6AO5AugD5gPoA8IE6AMg9QMACABE4Aa3tQs&num=6&sig=AOD64_0AHkwA8vB_ZoIsSH6-qGrNPPxFGQ&adurl=http://drivecrash.com/datarecovery/g-technology/>
Verbatim LED Bulbs<http://pagead2.googlesyndication.com/aclk?sa=L&ai=Bnt_37Ek_UOr2A_CG2wW-yIGACdPs6ccC-_z9nzvAjbcBkOUiEAcYByCGj4ACKAc4AFDe7brYBGDJ5pOHzKPAF7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkXIAvPqrCSoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBouQ9SA&num=7&sig=AOD64_3wPCJ22bkdA8fNAP1PVwRWuEptfA&adurl=http://www.greenlightingwholesale.com/verbatim-m-11.html>
Verbatim LED 5 year warranty Best prices available! Fully dimmable.
www.greenlightingwholesale.com<http://pagead2.googlesyndication.com/aclk?sa=L&ai=Bnt_37Ek_UOr2A_CG2wW-yIGACdPs6ccC-_z9nzvAjbcBkOUiEAcYByCGj4ACKAc4AFDe7brYBGDJ5pOHzKPAF7IBD21haWwuZ29vZ2xlLmNvbboBDmdtYWlsLWN2LWJlbG93yAEB2gE7aHR0cDovL21haWwuZ29vZ2xlLmNvbS9NVFF4TVRjeU16YzJNREl6TXpVNU5qZzNOVVZZVUVGT1JFVkXIAvPqrCSoAwHAAw3oA7kC6APmA-gDwgToAyD1AwAIAETgBouQ9SA&num=7&sig=AOD64_3wPCJ22bkdA8fNAP1PVwRWuEptfA&adurl=http://www.greenlightingwholesale.com/verbatim-m-11.html>
More about...
USB Flash Drive
»<https://mail.google.com/mail/?ui=2&ik=1bff9c024e&view=ap&t=r&rlk=USB%20Flash%20Drive&rll=en&rok=USB%20Flash%20Drive%2CCheap%20USB%20Flash%20Drive%2CBest%20USB%20Flash%20Drive%2CBuy%20USB%20Flash%20Drive>
Cheap USB Flash Drive
»<https://mail.google.com/mail/?ui=2&ik=1bff9c024e&view=ap&t=r&rlk=Cheap%20USB%20Flash%20Drive&rll=en&rok=USB%20Flash%20Drive%2CCheap%20USB%20Flash%20Drive%2CBest%20USB%20Flash%20Drive%2CBuy%20USB%20Flash%20Drive>
Best USB Flash Drive
»<https://mail.google.com/mail/?ui=2&ik=1bff9c024e&view=ap&t=r&rlk=Best%20USB%20Flash%20Drive&rll=en&rok=USB%20Flash%20Drive%2CCheap%20USB%20Flash%20Drive%2CBest%20USB%20Flash%20Drive%2CBuy%20USB%20Flash%20Drive>
Buy USB Flash Drive
»<https://mail.google.com/mail/?ui=2&ik=1bff9c024e&view=ap&t=r&rlk=Buy%20USB%20Flash%20Drive&rll=en&rok=USB%20Flash%20Drive%2CCheap%20USB%20Flash%20Drive%2CBest%20USB%20Flash%20Drive%2CBuy%20USB%20Flash%20Drive>


More information about the hal mailing list