View Single Post
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