| To: | realbasic-nug at lists dot realsoftware dot com |
|---|---|
| Subject: | Re: Finding Ejectable Volumes. (Dennis Birch) |
| From: | Craig Hoyt <craig at aztech4mac dot com> |
| Date: | Tue, 30 May 2006 09:56:54 -0700 |
| Delivered-to: | listarchive at realsoftware dot com |
| Delivered-to: | realbasic-nug at lists dot realsoftware dot com |
| References: | <20060529230752 dot 09A6E12B2331 at lists dot realsoftware dot com> |
I started this thread and I've been tinkering around with solutions
for weeks now. Let me start off by saying that I originally tried to
tackle this on my own, I search archives and all the RB sites for an
answer. I originally stumbled across Charles' 'DevInfo.rb' example. I
wrongly implemented the routines and found them too slow and
unresponsive to use. After finding no other answer to my problem I
asked the List. Charles responded with a suggestion to use the old
PrameterBlock method. While these routines are still alive in the OS
they are doomed to be dumped any minute. Charles is the man when it
comes to these kind of answers so I decided to take a look at re-
implementing his DevInfo code.
If used properly this is a very acceptable solution and all (almost all) info is correct. At startup of my App I read all available drives and store in my own list including volume name, ID, and all info reported by the shell script. Then I just check to see if the VolumeCount has changed. If VolumeCount is less I remove the missing volume from the list and if it's greater I add the item to the list. This way a volume only needs to be checked once. There are some downsides to using this method: it is slow and enough to put the business end of a pistol in your mouth when it comes across a DC/DVD and the drive is sleeping. Unfortunately OSX users are familiar with this sort of issue as unexpected stalls and the spinning rainbow pizza of death pops up for a while many times and for unexpected reasons. At least I know why it stalls while spinning up the CD/DVD drive and gathering the info but it is painfully slow at best. Other volumes take about a second each(which is very slow compared to the old PB method). The more volumes the longer it takes. As a benchmark I have a G4 with a 2.0 GHz single proc and 2Gb Ram, 4 internal hard drives and a CD/DVD drive. For testing I also connected a USB Flash drive, a USB external HD, and a Firewire external HD. If the CD/DVD is awake it takes about 20 seconds to scan all 8 volumes. If the CD/ DVD drive is sleeping it can take well over a minute:-( Using this method, all the data returned is correct except one little issue. I have a laptop drive in an external USB enclosure and it falsely reports that the volume is bootable. This is possibly due to the drive was in a powerbook and a flag might be set on the drive at formatting which is falsely reporting this condition. Not sure about why I get the false info on that but all Firewire drive info is accurate. I hope this helps and realize this was a long winded post and I apologize. I would also like to thank all who offered solutions to my quest, especially Charles who seems to have many of the answers I seek. I hope this can be my way to guide others as I have been guided. Craig ================================================== Message: 5 Subject: Re: Finding Ejectable Volumes. From: "Dennis Birch" <dennisbirch at gmail dot com> Date: Mon, 29 May 2006 12:52:14 -0700 I implemented the suggested declares solution in a module and it works great for CD-ROMs and USB devices I've mounted. However my external FireWire drive (which can be safely unmounted in the Finder) does not show as being ejectable. Anybody happen to know why that might be the case? On 5/23/06, Charles Yeomans <charles at declaresub dot com> wrote:This information is not hard to retrieve for MacOS. You call PBHGetVolParmsSync. You test the extended attributes field of the GetVolParmsInfoBuffer struct passed. The volume is ejectable when bit 0 is set. The Volumes section of chapter 4 of my declares book has an example that calls PBHGetVolParmsSync.================================================== Message: 7 Subject: Re: Finding Ejectable Volumes. From: "Dennis Birch" <dennisbirch at gmail dot com> Date: Mon, 29 May 2006 13:58:15 -0700 I should add that the IsEjectable function also works correctly with volumes mounted from disk images, and with network volumes. On 5/29/06, Dennis Birch <dennisbirch at gmail dot com> wrote:I implemented the suggested declares solution in a module and it worksgreat for CD-ROMs and USB devices I've mounted. However my external FireWire drive (which can be safely unmounted in the Finder) does not show as being ejectable. Anybody happen to know why that might be the case? On 5/23/06, Charles Yeomans <charles at declaresub dot com> wrote:This information is not hard to retrieve for MacOS. You call PBHGetVolParmsSync. You test the extended attributes field of the GetVolParmsInfoBuffer struct passed. The volume is ejectable when bit 0 is set. The Volumes section of chapter 4 of my declares book has an example that calls PBHGetVolParmsSync. _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives of this list here: <http://support.realsoftware.com/listarchives/lists.html> |
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| ||
| Previous by Date: | Re: XmlDocument.ToString leak workarounds?, John Balestrieri |
|---|---|
| Next by Date: | Re: type-casting enumerations, Mars Saxman |
| Previous by Thread: | XmlDocument.ToString leak workarounds?, DeanG |
| Next by Thread: | Re: Finding Ejectable Volumes. (Dennis Birch), Norman Palardy |
| Indexes: | [Date] [Thread] [Top] [All Lists] |