View Single Post
Old 10-26-2007, 03:34 PM   #32
mrkai
Bit Wrangler
mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.mrkai has a complete set of Star Wars action figures.
 
Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
I think you are trying to solve the wrong(ish) problem here...

Quote:
Originally Posted by kovidgoyal View Post
...ioreg sounds like it might work, though having to run a commandline program just to find out what devices are attached to the system seems like a lot of unnecessary overhead. Maybe I'll just have to bite the bullet and look at IOKit.
...as the polling that you are doing is *horrible* on OS X. looking at drives only when the state changes is a *far* superior solution (on any os, really)..if if you are doing this via iokit or some other means to determine if the PRS 505 is connected.

Since with the 505 there is no need for direct manipulation of the data via a protocol (thank you Sony for Mass Storage support!) it would be a far better *user experience* to not constantly scan for what you are looking for and let the os tell you its a good time to work.

While this might not be the more...geeky "MIT" way of solving the "is the the Reader's mass storage volume?" it is most definitely a better experience for the *user* on OS X in that "Bell Labs" sort of way

To put it another way: OS X is a *nix...python is a scripting language. You *could* say, use iokit and some code like this...figure out how to wrap it, etc...

or, simply do this when the system tells you its got a new removable mounted:

Code:
mount|grep `ioreg -n "Sony PRS-505/UC Media" |grep "BSD Name"|cut -d'"' -f4`|cut -d' ' -f3
If the 505 is one of those volumes, you'd have the path of the reader's internal store.

Or not Its your software
mrkai is offline   Reply With Quote