Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 10-19-2007, 11:26 AM   #16
igorsk
Wizard
igorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfoldedigorsk reads XML... blindfolded
 
Posts: 3,443
Karma: 52235
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...
igorsk is offline   Reply With Quote
Old 10-19-2007, 11:39 AM   #17
Matter
Junior Member
Matter began at the beginning.
 
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
Matter is offline   Reply With Quote
Old 10-19-2007, 12:33 PM   #18
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by mrkai View Post
...for mac os x is in fact free, ships with every mac, and is included with every commercially sold copy of mac os x; it is also available in its entirety as a free download from apple.

anyway, os x has a mechanism that is the inverse of polling (very inefficient) where you simple tell the os to tell you when a removable is mounted, what it was, and then your code decides what to do with it.

I'm not a python guy, but i know that pyobjc bridges the cocoa apis direct to python...and that this bridge actually will be shipping by default on the system with 10.5. right now, you bundle it if you wish to use it.
I'm glad to hear that it does have this. Do you have a link to some documentation about this system. I can always write a python extension to use cocoa, or ship pyobjc with libprs500.
kovidgoyal is offline   Reply With Quote
Old 10-19-2007, 12:40 PM   #19
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by shondark View Post
Hi! I've been reading this forums for a lot of time and now that I'm almost in possesion of my PRS-505 y want to try to participate a little more..

I don't know but maybe this could help you Kovid.

http://www.ureader.com/message/1018345.aspx

If not, if you could explain what do you want this function to do we could try to help you.


And sorry for my english... :P
That looks interesting, but I would like something a little more authoritative than a forum message to base my code off. What I need is some way to go from a USB vendor ID and device ID to the drive letter where the usb device is mapped. Preferably using some well defined OS API that is stable across XP and Vista.
kovidgoyal is offline   Reply With Quote
Old 10-19-2007, 12:43 PM   #20
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Quote:
Originally Posted by sputnik_1 View Post
I think what you're looking for is this key in the registry :

HKEY_Local_Machine\SYSTEM\Current Control Set\Enum\USB\Vid_054c&Pid_031e

As far as I know, those Pid's are unique per device -- so you should only see those if you have a PRS-505 that's been attached. Doing a search for this key may be the easiest way, I'll dig and see if there's another easier identifier.
That sounds like it should work, I'll test it on XP and vista and see if it does.

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.
kovidgoyal is offline   Reply With Quote
Old 10-19-2007, 06:58 PM   #21
smcclain
Junior Member
smcclain began at the beginning.
 
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
smcclain is offline   Reply With Quote
Old 10-19-2007, 07:56 PM   #22
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Thanks WMI should do the trick for windows.
kovidgoyal is offline   Reply With Quote
Old 10-20-2007, 12:40 PM   #23
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
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.
kovidgoyal is offline   Reply With Quote
Old 10-20-2007, 01:47 PM   #24
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 37,025
Karma: 18129756
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Sony Reader PRS-650, iPad, nook STR
Nice work!
JSWolf is offline   Reply With Quote
Old 10-21-2007, 02:59 AM   #25
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
Check this out...

Quote:
Originally Posted by kovidgoyal View Post
I'm glad to hear that it does have this. Do you have a link to some documentation about this system. I can always write a python extension to use cocoa, or ship pyobjc with libprs500.
http://www.oreillynet.com/pub/a/mac/...yobjc_one.html

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']
in that example) and run with it...process the metadata in cache/media.xml...get a raw file listing, etc/whatever.


Hope that help in some way

-K
mrkai is offline   Reply With Quote
Old 10-21-2007, 12:23 PM   #26
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
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.
kovidgoyal is offline   Reply With Quote
Old 10-24-2007, 05:20 PM   #27
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
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.
kovidgoyal is offline   Reply With Quote
Old 10-25-2007, 08:05 AM   #28
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 looked into all of this, actually...

Quote:
Originally Posted by kovidgoyal View Post
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.
...and as an experienced OS X programmer, these are all trivial case, really.

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
mrkai is offline   Reply With Quote
Old 10-25-2007, 11:33 AM   #29
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 25,913
Karma: 5035037
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.
kovidgoyal is offline   Reply With Quote
Old 10-26-2007, 01:59 AM   #30
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.
...the polling that you are doing is *horrible* on OS X. looking at drives onlyhen 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 "
mrkai is offline   Reply With Quote
Reply

Tags
libprs500, prs-505

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

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


All times are GMT -4. The time now is 07:49 PM.


MobileRead.com is a privately owned, operated and funded community.