#!/bin/sh
#LGPL 2007 www.puppylinux.com
#replaces test-scsi in Antonio Gallo's libhardware package.
#written by Dougal. Small mods by BarryK 19 June 2007.

for ADEV in `ls -1 /sys/block | grep -E 'sd[a-z]|sr[0-9]|scd[0-9]' | tr '\n' ' '`
do
  [ "$ADEV" ] || continue
  #echo "$ADEV"
  case $ADEV in
   sd*) # all appear as Direct-Access
     MEDIA="Direct-Access" ;;
   sr*|scd*) #  scsi cdroms #(note that original apps use 'CD-ROM' to
        #+ distinguish from ide cdroms, but it just seems to cause trouble)
     MEDIA="cdrom" ;;
   *) # maybe I let something bad in -- skip it
     continue
     ;;
  esac
  VENDOR="`cat /sys/block/$ADEV/device/vendor`"
  MODEL="`cat /sys/block/$ADEV/device/model`"
  echo "/dev/$ADEV - $MEDIA - $VENDOR$MODEL"
done
