test-scsi 756 B

123456789101112131415161718192021222324
  1. #!/bin/sh
  2. #LGPL 2007 www.puppylinux.com
  3. #replaces test-scsi in Antonio Gallo's libhardware package.
  4. #written by Dougal. Small mods by BarryK 19 June 2007.
  5. for ADEV in `ls -1 /sys/block | grep -E 'sd[a-z]|sr[0-9]|scd[0-9]' | tr '\n' ' '`
  6. do
  7. [ "$ADEV" ] || continue
  8. #echo "$ADEV"
  9. case $ADEV in
  10. sd*) # all appear as Direct-Access
  11. MEDIA="Direct-Access" ;;
  12. sr*|scd*) # scsi cdroms #(note that original apps use 'CD-ROM' to
  13. #+ distinguish from ide cdroms, but it just seems to cause trouble)
  14. MEDIA="cdrom" ;;
  15. *) # maybe I let something bad in -- skip it
  16. continue
  17. ;;
  18. esac
  19. VENDOR="`cat /sys/block/$ADEV/device/vendor`"
  20. MODEL="`cat /sys/block/$ADEV/device/model`"
  21. echo "/dev/$ADEV - $MEDIA - $VENDOR$MODEL"
  22. done