views:

151

answers:

1

I'm trying to modify the Android device driver for calibre (an e-book management program) so that it identifies devices by only vendor id and product id, and excludes BCD.

The driver is a fairly simply python plugin, and is currently set up to use all three numbers, but apparently, when Android devices use custom Android builds (ie CyanogenMod for the Nexus One), it changes the BCD so calibre stops recognizing it.

The current code looks like this, with a simple list of vendor id's, that then have allowed product id's and BCD's with them:

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

The line I'm specifically trying to change is:

0x18d1 : { 0x4e11 : [0x0100], 0x4e12: [0x0100]},

Which is, the line for identifying a Nexus One. My N1, running CyanogenMod 5.0.5, has the BCD 0x226, and rather than just adding it to the list, I'd prefer to eliminate the BCD from the recognition process, so that any device with vendor id 0x18d1 and product id 0x4e11 or 0x4e12 would be recognized. The custom Android rom doesn't change enough for the specifics to matter.

The syntax seems to require the BCD in brackets.

How can I edit this so that it matches anything in that field?

A: 

That is a data structure, it doesn't "match" anything per se. The change would have to happen in the code that uses that data structure to do the matching. Nothing you could do on the data structure itself would mean "match all" unless there's some kind of flag the matching code recognizes.

nosklo
Ah, right. Thanks. It looks like there may be just such a flag. I'll go play with it.
Tony