Demise of the Hardware Abstraction Layer (HAL)

Steve Cookson it at sca-uk.com
Wed Mar 14 15:57:20 UTC 2012


As I understand it, HAL is officially deprecated. It's only included in
distros now to support old code which hasn't yet been made udev aware. It
depends on what you mean by 'be able to use HAL', but I would suggest you
start removing any dependence you have on it ASAP.

Hi Mark,
 
Thanks for this.  I have a piece of HAL code which give me some details
about USBs which I parse to get mounting info.  I tried other source, but it
didn't all appear to be there.
 
This what I have now:
 
#!/bin/ksh93
#
# list attached USB storage devices
#
 
for udi in $(/usr/bin/hal-find-by-capability --capability storage)
do
    device=$(hal-get-property --udi $udi --key block.device)
    #device2=$(hal-get-property --udi $udi --key block.storage_device)
    vendor=$(hal-get-property --udi $udi --key storage.vendor)
    model=$(hal-get-property --udi $udi --key storage.model)
    product=$(hal-get-property --udi $udi --key info.product)
    #dev=$(hal-get-property --udi $device2 --key linux.sysfs_path)
    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)
        label=$(hal-get-property --udi $parent_udi --key volume.label)
        media_removable=$(hal-get-property --udi $udi --key
storage.removable)
        media_size=$(hal-get-property --udi $udi --key
storage.removable.media_size)
        size=$(( ceil(media_size/(1000*1000*1000)) ))
        printf "-------------------------------------------------\n"
        printf "Vendor: $vendor\n"
        printf "Model:  $model\n"
        printf "Device: $device\n"
        printf "Product:  $product\n"
        printf "Mount:  $mount\n"
        printf "Size "${size}" GB \n"
        printf "Removable: $media_removable\n"
        #printf "Dev: $dev\n"
    fi
done

But it is not clear to me how I might get the same attributes from udev.
 
Regards
 
Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/kubuntu-users/attachments/20120314/3f7ffdb3/attachment.html>


More information about the kubuntu-users mailing list