ANN: New USB Drive Library

Len Morgan len-morgan at crcom.net
Tue Jun 26 09:38:23 EDT 2007


While I'm sure there a dll call you could use, the only way I've found so far is to download a utility from MS (devcon.exe). This tool is basically a command line version of "Device Manager" so it can be used for much more than USB drives.  If you do a Google search, there a several people that have written C versions of this same basic code so I imagine it wouldn't be too hard to write an external for Rev.

As to using "the volumes" to get the drive letters, it does in fact return a list of drive letters but doesn't tell you anything about the drives (other than the letters) so I'm not sure how to match them up.

Lastly, in Linux, I think you can just run the "mount" command and it will return a list of mounted drives.  If automount is running, when you plugin a thumb drive it should be mounted and then show up in the list.

My final problem, and this may be unique to me, is that I want to leave a digital camera hooked up to a computer and be able to read the photos out of it.  The problem is that apparently digital cameras (I've tried several) detect the connection to the computer and turn themselves off until you unplug.  I guess what I need is a way to power down a USB port so the camera is fooled into thinking that it has been disconnected.  This may not be possible.

Len Morgan


Ken Ray wrote:

> > On Mon, 25 Jun 2007 14:54:41 -0700, Phil Davis wrote:
> > 
>   
>> >> If I understand correctly, you're talking about the difference 
>> >> between unmounting the drive and unplugging it. The ability to 
>> >> unmount a drive would be nice. When I learn how to unmount a device 
>> >> from the command line on Win & Mac, I'll add it to this library.
>> >>
>> >> (If anyone already knows, feel free to jump in!)
>>     
> > 
> > For OS X, first do this:
> > 
> >   diskutil list
> > 
> > And then extract the list of disks (/dev/disk0, /dev/disk1, etc.). 
> > Then, for each disk, do:
> > 
> >   diskutil info <disk>
> > 
> > and then parse for "Protocol: USB" and "Ejectable: Yes". Then you have 
> > a list of mounted USB drives. Then to unmount a drive, execute:
> > 
> >   disutil unmountdisk <disk>
> > 
> > I'm not sure how to do it on Windows...
> > 
> > Ken Ray



More information about the use-livecode mailing list