Finding the name of a USB volume

Peter Brigham MD pmbrig at gmail.com
Wed Jan 6 15:29:03 EST 2010


FWIW, I was unable to find a way of getting the name of the currently- 
connected USB printer without asking the user when it is first  
encountered and storing the associated printername (as listed in the  
printer dialog under printers with available drivers). With printers  
there seems to be no way of fetching the user-chosen name of the  
device from any shell call for USB info, at least as far as I have  
been able to discover. But I am hardly knowledgeable about shell  
calls....

-- Peter

Peter M. Brigham
pmbrig at gmail.com
http://home.comcast.net/~pmbrig


On Jan 6, 2010, at 10:36 AM, Richard Gaskin wrote:

> I'm making a custom installer in which I want to provide the option  
> of a normal desktop install to the hard drive and a zero-footprint  
> install to a removable USB drive (no registry entries, prefs stored  
> in the app folder, etc.).
>
> To help make this simple for the user I'd like to present a list of  
> available USB drives if they choose that option, so they can pick  
> the target for the install.
>
> Phil Davis was kind enough to share some pointers in his libUsbDrive  
> library (see <http://pdslabs.net/usb/index.html>), which has me  
> exploring the use of shell calls on OS X to system_profiler, e.g.:
>
>   get shell("system_profiler -xml SPUSBDataType")
>
> While the info returned there contains a lot of very useful stuff,  
> the one thing I'm not able to find is the name of the volume as it  
> appears to the user on the desktop.
>
> Well, sometimes, that is.
>
> It seems that if I've named the drive in the Finder, the Volumes  
> section of the data returned from that shell call is filled in, and  
> includes the apparent name of the volume.
>
> But drives which haven't been given a name on a Mac system appear on  
> the desktop as "Untitled", and although the data from the  
> system_profiler shows it as a removable drive there is no Volumes  
> section included and hence no way to know the name of the drive as  
> it appears to the user.
>
> When there is is a Volumes section the _name key there shows the  
> name as it appears in the Finder, but drives that have not  
> explicitly been given a name appear as "Untitled" or "Untitled 1",  
> etc., in the Finder and the corresponding _name key from  
> system_profiler is something different (for example my card reader  
> device has a _name value of "Generic USB2.0 card " in  
> system_profiler, but on the desktop it appears as "Untitled 1").
>
> Do any of you know a way I can use shell or AppleScript to obtain  
> the apparent name of a removable drive when system_profiler fails to  
> return it?
>
> Extra bonus points:  what shell calls would I use to get this info  
> on Linux?  I think I have the Windows side of things down, but I'll  
> need to work out the Linux side soon.
>
> TIA -
>
> --
> Richard Gaskin
> Fourth World
> Rev training and consulting: http://www.fourthworld.com
> Webzine for Rev developers: http://www.revjournal.com
> revJournal blog: http://revjournal.com/blog.irv
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list