Sponsored Content
Top Forums Shell Programming and Scripting BASH Script to Detect and List USB Flash Drives Post 302297921 by godzillarama on Monday 16th of March 2009 06:58:34 AM
Old 03-16-2009
Thanks, Corona, for those replies; however, I believe that the LSHW utility will do nicely for gathering the information I'm wanting to list for the users. Here is a sample output from my machine. Two flash drives are connected (one of them older and painfully small -- 64MB -- the other 1GB).

This is the result of the "lshw -short" command.

Code:
H/W path                Device     Class       Description
==========================================================
                                   system      PROD00000000
/0                                 bus         Motherboard
/0/0                               processor   Intel(R) Pentium(R) 4 CPU 2.00GHz
/0/0/0                             memory      8KiB L1 cache
/0/0/1                             memory      512KiB L2 cache
/0/1                               memory      2021MiB System memory
/0/100                             bridge      651 Host
/0/100/1                           bridge      Virtual PCI-to-PCI bridge (AGP)
/0/100/1/0                         display     NV44A [GeForce 6200]
/0/100/2                           bridge      SiS962 [MuTIOL Media IO]
/0/100/2.1                         bus         SiS961/2 SMBus Controller
/0/100/2.5                         storage     5513 [IDE]
/0/100/2.5/0            ide0       bus         IDE Channel 0
/0/100/2.5/0/0          /dev/hda   disk        160GB SAMSUNG SP1604N
/0/100/2.5/0/0/1        /dev/hda1  volume      127GiB Windows NTFS volume
/0/100/2.5/0/0/2        /dev/hda2  volume      21GiB Windows NTFS volume
/0/100/2.5/0/1          /dev/hdb   disk        81GB Maxtor 6L080L0
/0/100/2.5/0/1/1        /dev/hdb1  volume      76GiB EXT3 volume
/0/100/2.5/1            ide1       bus         IDE Channel 1
/0/100/2.5/1/0          /dev/hdc   disk        SONY DVD RW DW-Q30A
/0/100/2.5/1/0/0        /dev/hdc   disk
/0/100/2.5/1/1          /dev/hdd   disk        LITE-ON LTR-52327S
/0/100/2.7                         multimedia  AC'97 Sound Controller
/0/100/3                           bus         USB 1.1 Controller
/0/100/3/1              usb4       bus         OHCI Host Controller
/0/100/3.1                         bus         USB 1.1 Controller
/0/100/3.1/1            usb5       bus         OHCI Host Controller
/0/100/3.3                         bus         USB 2.0 Controller
/0/100/3.3/1            usb1       bus         EHCI Host Controller
/0/100/a                           bus         USB
/0/100/a/1              usb6       bus         OHCI Host Controller
/0/100/a.1                         bus         USB
/0/100/a.1/1            usb7       bus         OHCI Host Controller
/0/100/a.1/1/1                     input       Microsoft IntelliMouse
/0/100/a.2                         bus         USB 2.0
/0/100/a.2/1            usb2       bus         EHCI Host Controller
/0/100/a.2/1/3          scsi2      storage     Flash Disk
/0/100/a.2/1/3/0.0.0    /dev/sda   disk        1029MB SCSI Disk
/0/100/a.2/1/3/0.0.0/1  /dev/sda1  volume      981MiB Windows FAT volume
/0/100/b                           bus         VT82xxxxx UHCI USB 1.1 Controller
/0/100/b/1              usb8       bus         UHCI Host Controller
/0/100/b/1/1            scsi3      storage     Mass Storage Device
/0/100/b/1/1/0.0.0      /dev/sdb   disk        65MB SCSI Disk
/0/100/b/1/1/0.0.0/1    /dev/sdb1  volume      62MiB Windows FAT volume
/0/100/b.1                         bus         VT82xxxxx UHCI USB 1.1 Controller
/0/100/b.1/1            usb9       bus         UHCI Host Controller
/0/100/b.2                         bus         USB 2.0
/0/100/b.2/1            usb3       bus         EHCI Host Controller
/0/100/d                eth0       network     RTL-8139/8139C/8139C+

Only takes a couple of seconds. True, lshw tends to view flash drives as SCSI devices, but I don't see that as a dealbreaker.
 

9 More Discussions You Might Find Interesting

1. Filesystems, Disks and Memory

Mounting USB Drives in Solaris 9 x86

I'm trying to moun my external USB Mass Storage Drive (80GB) in my Solaris 9 box, I am new to Solaris, and kind of new to linux / unix variants. The external HD contains windows files, but I will be using it as a central storage area for my windows/ linux clients. Thanks -- N:confused:C (1 Reply)
Discussion started by: N0C717
1 Replies

2. What is on Your Mind?

USB Thumb Drives

I'm hunting around for thumb drives that aren't working. Something you may have kicking around in a drawer that you don't need any more. One you've upgraded and just don't need. I'm willing to pay a couple bucks for you to drop it into an envelope with a few stamps and send it along. I'm... (0 Replies)
Discussion started by: BOFH
0 Replies

3. Shell Programming and Scripting

how floppy disks, CDs and flash drives (pen drives) are accessed in UNIX

hi how floppy disks, CDs and flash drives (pen drives) are accessed in UNIX? thanks (0 Replies)
Discussion started by: nokia1100
0 Replies

4. Filesystems, Disks and Memory

USB Flash Drives

Can Solaris/any GNU/Linux distros/ any flavor of FreeBSD be booted, right from aUSB flash drive? Mine's the one pictured here. SanDisk | Products | USB Flash Drives | SanDisk CruzerŽ Titanium Plus USB Flash Drive Also, on a completely unrelated note (just so I don't have to fill up forum... (4 Replies)
Discussion started by: led3234
4 Replies

5. Solaris

Does Solaris Volume Manager support USB flash drives?

I would like to mirror or stripe across multiple USB flash drives on a Sun Blade 100 workstation running Solaris 10. Thanks! (6 Replies)
Discussion started by: yoda9999
6 Replies

6. Shell Programming and Scripting

script to detect a file from inserted usb and puts into a Variable

There is a same named log file that I have on my 2 different android phones. When I plug it into my computer, it appears in the media folder, For example the first android phone: /media/F6BA-0AF5/folder/A.log I want to put that into a variable to be manipulated.... (3 Replies)
Discussion started by: tobenguyen
3 Replies

7. What is on Your Mind?

Idea: selling Puppy Linux flash drives

What do you think of the idea of selling flash drives already prepared to boot Puppy Linux on PCs? (I still need to see if I can boot on Macs using online instructions I've found.) I know it's not too hard to prep your own flash drive, even if you have to buy one first, but just think about why... (8 Replies)
Discussion started by: MrMormon
8 Replies

8. Shell Programming and Scripting

Bash script to detect nonpingable hosts

I have a script to detect if a host is pingable or not. The problem is that I would like it to put the nonpingable hosts in one file and the pingable hosts in another. I have come up with this so far: for ip in `cat /tmp/testlist2`; do ping -c 3 $ip >/dev/null && echo "$ip is up" || echo "$ip... (5 Replies)
Discussion started by: newbie2010
5 Replies

9. Solaris

Anyway to do ufsdump os backup to usb drives

hi folks happy new year to all, I haven't been coming round for a long time. I've been googling about this can't seem to find any good examples, I need to know if it's possible to do a ufsdump os backup into a usb flash drive. Then what about in event of os recovery when we boot to single... (2 Replies)
Discussion started by: sparcguy
2 Replies
EHCI(4) 						   BSD Kernel Interfaces Manual 						   EHCI(4)

NAME
ehci -- USB Enhanced Host Controller driver SYNOPSIS
ehci* at cardbus? function ? ehci* at pci? dev ? function ? usb* at ehci? DESCRIPTION
The ehci driver provides support for the USB Enhanced Host Controller Interface, which is used by USB 2.0 controllers. EHCI controllers are peculiar in that they can only handle the USB 2.0 protocol. This means that they normally have one or more companion controllers (i.e., ohci(4) or uhci(4)) handling USB 1.x devices. Consequently each USB connector is electrically connected to two USB con- trollers. The handling of this is totally automatic, but can be noticed since USB 1.x and USB 2.0 devices plugged in to the same connector appear to connect to different USB busses. SEE ALSO
cardbus(4), ohci(4), pci(4), uhci(4), usb(4) HISTORY
The ehci driver appeared in NetBSD 1.6. BUGS
The support for hubs that are connected with high speed upstream and low or full speed downstream (i.e., for transaction translators) is lim- ited. BSD
Aug 10, 2008 BSD
All times are GMT -4. The time now is 12:39 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy