10-19-2007, 11:26 AM | #16 |
Wizard
Posts: 3,442
Karma: 300001
Join Date: Sep 2006
Location: Belgium
Device: PRS-500/505/700, Kindle, Cybook Gen3, Words Gear
|
I'll have a look at how eBook Library interfaces with 505 but a little later...
|
10-19-2007, 11:39 AM | #17 |
Junior Member
Posts: 1
Karma: 10
Join Date: Oct 2007
Device: 505
|
Apple Dev Connection has reference to some classes and methods that should help you out (I think, assuming you can import them successfully in your Python code). The two libraries I could find are at: http://developer.apple.com/reference...xUSB-date.html
|
Advert | |
|
10-19-2007, 12:33 PM | #18 | |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
10-19-2007, 12:40 PM | #19 | |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
|
|
10-19-2007, 12:43 PM | #20 | |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Quote:
EDIT: As far as I can tell this only allows for presence testing. I can't figure out how to find the drive letter its mapped to, Last edited by kovidgoyal; 10-19-2007 at 02:32 PM. |
|
Advert | |
|
10-19-2007, 06:58 PM | #21 |
Junior Member
Posts: 1
Karma: 28
Join Date: Oct 2007
Location: Los Angeles, CA
Device: PRS-505
|
WMI VBS script example
You should be able to use windows WMI api to get the info... here's and example VBS script I found on MSDN that enumerates the physical drives on the system and determines the drive letter. Simply save the the code to a text file and give the file a .vbs extension and you sould be able to run in in windows just by double clicking it. Hope this helps you.
Code:
ComputerName = "." Set wmiServices = GetObject ( _ "winmgmts:{impersonationLevel=Impersonate}!//" _ & ComputerName) ' Get physical disk drive Set wmiDiskDrives = wmiServices.ExecQuery ( _ "SELECT Caption, DeviceID, PNPDeviceID FROM Win32_DiskDrive") For Each wmiDiskDrive In wmiDiskDrives WScript.Echo "Disk drive Caption: " _ & wmiDiskDrive.Caption _ & VbNewLine & "PNPDeviceID: " _ & " (" & wmiDiskDrive.PNPDeviceID & ")" 'Use the disk drive device id to ' find associated partition query = "ASSOCIATORS OF {Win32_DiskDrive.DeviceID='" _ & wmiDiskDrive.DeviceID & "'} WHERE AssocClass = Win32_DiskDriveToDiskPartition" Set wmiDiskPartitions = wmiServices.ExecQuery(query) For Each wmiDiskPartition In wmiDiskPartitions 'Use partition device id to find logical disk Set wmiLogicalDisks = wmiServices.ExecQuery _ ("ASSOCIATORS OF {Win32_DiskPartition.DeviceID='" _ & wmiDiskPartition.DeviceID & "'} WHERE AssocClass = Win32_LogicalDiskToPartition") For Each wmiLogicalDisk In wmiLogicalDisks WScript.Echo "Drive letter associated" _ & " with disk drive = " _ & wmiDiskDrive.Caption _ & wmiDiskDrive.PNPDeviceID _ & VbNewLine & " Partition = " _ & wmiDiskPartition.DeviceID _ & VbNewLine & " is " _ & wmiLogicalDisk.DeviceID Next Next Next |
10-19-2007, 07:56 PM | #22 |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Thanks WMI should do the trick for windows.
|
10-20-2007, 12:40 PM | #23 |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
SVN now has working commandline implementations for both linux and windows. OSX is the only holdout.
|
10-20-2007, 01:47 PM | #24 |
Resident Curmudgeon
Posts: 74,758
Karma: 131375596
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
|
Nice work!
|
10-21-2007, 02:59 AM | #25 | |
Bit Wrangler
Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
|
Check this out...
Quote:
Look for NSWorkSpace on this page. This code is a python example of how one would do what i was talking about. I suppose in the case of the 505's internal memory, one would look for say,database/media|cache|sync on whatever path the notification gives the handler there ( Code:
path = aNotification.userInfo()['NSDevicePath'] Hope that help in some way -K |
|
10-21-2007, 12:23 PM | #26 |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Notification isn't enough what if the device was attached before the app is started. Also notification requires an apple event loop running whereas my app has a qt event loop. Doubt they'd be enough. Also detecting by path is inadequate, especially in the case of the storage card as that may not have any directory structure if it has been inserted for the first time.
|
10-24-2007, 05:20 PM | #27 |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Released 0.4.13 which supports the 505 in both windows and linux. Note that support is not well tested. You may lose history/bookmarks or have to reset your reader occassionally. If that happens, please open a bug report with the exact sequence of operations you performed while transferring to the reader.
|
10-25-2007, 08:05 AM | #28 | |
Bit Wrangler
Posts: 181
Karma: 415
Join Date: Oct 2007
Device: Sony PRS-505
|
I looked into all of this, actually...
Quote:
on launch, you check the mounted volumes, of course The PRS-505 actually comes up in the device registry a couple of different ways and the SD comes up listed separate from the internal memory as a different device. os x provides a shell tool call ioreg that lasts these; grepping the output for the 505 show them. it tells you the "BSD Device" is a quasi abstract way but its still a bit indirect without fooling around in iokit. It i were doing this, I'd simply have the user "tag" and SD they wanted to use with the app; this way they could manage the content even if the reader wasn't plugged in. But that's just me |
|
10-25-2007, 11:33 AM | #29 |
creator of calibre
Posts: 44,041
Karma: 22669822
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
|
Again I don't want to have to rely on the file structure of either the internal memory or the card. I think that's just asking the user to perform one step more than necessary. 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.
|
10-26-2007, 01:59 AM | #30 | |
Bit Wrangler
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:
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 " |
|
Tags |
libprs500, prs-505 |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
libprs500 | tommy still | Calibre | 2 | 02-09-2008 10:55 AM |
Using libprs500 | jerryleejr | Calibre | 2 | 01-28-2008 12:29 AM |
Using Libprs500 for 505 | JeffASonyReader | Calibre | 17 | 01-21-2008 09:34 AM |
Help!!! libprs500 | MountainMan | Calibre | 11 | 11-13-2007 11:25 PM |
libprs500 and 505 | carchase | Sony Reader | 6 | 10-28-2007 03:06 PM |