Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre

Notices

Reply
 
Thread Tools Search this Thread
Old 03-27-2010, 05:27 AM   #16
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: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
remove the encoding declaration (line that has coding in it) from the top of the py file.
kovidgoyal is offline   Reply With Quote
Old 03-27-2010, 06:11 AM   #17
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Well that was a rookie mistake. My bad.

Ok, so now it's adding it, but it doesn't seem to be subclassing any of the data. It adds it as the base USBMS driver. Here's the output:

Code:
tony@tony:~/Desktop$ calibre-customize -a myandroiddriver.zip
Plugin added: USBMS Base Device Interface (1, 0, 0)
tony@tony:~/Desktop$
Code:
tony@tony:~$ calibre-customize -l
Type           Name                Version        Disabled       Site Customization

Device InterfaceUSBMS Base Device Interface(1, 0, 0)      False          
	Communicate with an eBook reader.
	Configure Device
It's like it's stopping at the 'import USBMS' line, and not going any further.

The modified driver file is literally just the Android 'driver.py' from the source package, modified with my BCD (0x226 instead of 0x0100). Although I also changed the class from ANDROID to ANDROID2 because I thought maybe it was conflicting there, but it didn't help.
Attached Files
File Type: zip myandroiddriver.zip (1.0 KB, 216 views)
tonyx3 is offline   Reply With Quote
Advert
Old 03-27-2010, 06:42 AM   #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: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Small bug in the USBMS base class, will be fixed in the next release.
kovidgoyal is offline   Reply With Quote
Old 03-27-2010, 07:04 AM   #19
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Cool, thanks. I ended up switching to a development environment so I could just tweak the .py directly, and it's working great now.

Also, while looking around at the code I noticed this comment in 'interface.py'

Code:
# BCD can be either None to not distinguish between devices based on BCD, or
# it can be a list of the BCD numbers of all devices supported by this driver.
    BCD         = None


So I tried to just set it to 'None' in the android driver, and it didn't work at all. Am I misreading this comment, or is this even possible?


Thanks!
tonyx3 is offline   Reply With Quote
Old 03-27-2010, 09:34 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: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
It's possible in general, but IIRC not for the android driver, which has various special semantics.

Incidentally, I've added your BCD to trunk.
kovidgoyal is offline   Reply With Quote
Advert
Old 03-27-2010, 09:41 PM   #21
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Yeah, I noticed the new BCD there when I updated my copy of the source. Thanks.

Too bad about the Android driver, then. My python skills aren't up to tracing it back to see where the issue starts...
tonyx3 is offline   Reply With Quote
Old 03-28-2010, 12:33 AM   #22
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Ok, so i got it to detect based only on VENDOR_ID and PRODUCT_ID, without BCD, but I had to convert the driver from using the 'dictionary of dictionaries' approach, to using the fields separately, the way the HanlinV3 driver does, for example.

I just left the BCD out completely, so it reverts to the 'None' value, inherited from interface.py.

So I changed from the old version:

Code:
VENDOR_ID   = {
            0x0bb4 : { 0x0c02 : [0x100], 0x0c01 : [0x100]},
            0x22b8 : { 0x41d9 : [0x216]},
            0x18d1 : { 0x4e11 : [0x0100], 0x4e12: [0x0100,0x226]},
            0x04e8 : { 0x681d : [0x0222]},
            }

To this method:

Code:
VENDOR_ID   = [0x0bb4, 0x22b8, 0x18d1, 0x04e8]
PRODUCT_ID  = [0x0c02, 0x0c01, 0x41d9, 0x4e11, 0x4e12, 0x681d]
I'm not sure it's ideal though, because it doesn't correlate the product id's with their proper vendor id, it just matches each field with one of the options in the comma separated list. It would be better if it could use the old, dictionary approach, but without requiring BCD, but I haven't figured out how to do that yet.(The Hanlin driver, which uses this method, only has one possible vendor id, while the Android one has 4)

I suppose the likelyhood of two of the vendors using the same product id is pretty slim, though, isn't it, considering there's currently only four vendor id's in the list? It's theoretically possible, I suppose, but not likely.

In any case, it does detect my Nexus One, but I don't have any other Android devices to test it on. I guess it would match any of the others in the list, as long as they matched one of the vendor id's and one of the product id's.

What are your thoughts on this method?


Edit: I just noticed that this is very similar to the way the cybook driver is formatted, but the cybook still has the BCD field.
tonyx3 is offline   Reply With Quote
Old 03-28-2010, 12:38 AM   #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: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I implemented the dictionary lookup for the android driver because there are going to be lots and lots of android devices, so indivdual matching is a recipe for disaster. And I still think that matching on BCDs is neccessary. For example, the Nook is an android device but has various special requireements, for cover handling to enable cover flow browsing.
kovidgoyal is offline   Reply With Quote
Old 03-28-2010, 12:50 AM   #24
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Yeah, I can see that with Android having lots of devices, it's not optimal, which is why I kinda hedged around it above. But I guess I'm still not convinced that BCD is necessary for normal Android devices.

The nook is technically an Android device, yes, but it's a dedicated ebook reader, and its OS is pretty heavily modified, so as you mention, it does require special consideration. But the vast majority of Android devices don't. You already handle the nook with a custom driver, and not with the Android driver, so you've noticed that as well.

I just don't see that any device which will be handled by this Android driver is going to need any special considerations that might be dependent on BCD. It's a driver for generic Android devices, none of which are dedicated ebook devices with their own special anything, in relation to reading ebooks.

In other words, if it's a Motorola Droid (determined by vendor and product id), it's not gonna matter what custom Android build someone runs on it, it's still gonna interface along the parameters of this driver. Same goes for all other normal Android devices.
tonyx3 is offline   Reply With Quote
Old 03-28-2010, 01:25 AM   #25
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: 44,153
Karma: 22670164
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
I'm not convinced, but lets see how things progress in the Android world. There's no need to make a final decision here and now.
kovidgoyal is offline   Reply With Quote
Old 03-28-2010, 01:27 AM   #26
tonyx3
Connoisseur
tonyx3 began at the beginning.
 
Posts: 55
Karma: 10
Join Date: Jan 2010
Device: Nexus One
Indeed. Also, thanks for being so helpful and patient.
tonyx3 is offline   Reply With Quote
Reply

Tags
android, calibre


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Calibre doesn't detect my PRS-600 EugZol Calibre 3 12-29-2009 11:16 AM
Calibre does not detect HTC Hero bharbo Calibre 1 11-27-2009 12:01 AM
Calibre does not detect my prs-505 :( mrstu Calibre 31 10-28-2009 02:14 PM
calibre 0.6 cannot detect cybook on Linux Hanselda Calibre 10 08-04-2009 03:09 PM
Calibre doesn't detect reader boydcarts Calibre 2 03-21-2009 04:13 PM


All times are GMT -4. The time now is 06:25 AM.


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