From 3710b46c3ccf6ba736adb19e705feea4fd08e74b Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 7 Jun 2012 12:07:22 +0530 Subject: [PATCH] Device detection: Fix a bug that could cause device detection to fail completely if devices with certain vendor/product ids are connected. Fixes #1009718 (Exception loading device plugins) --- src/calibre/devices/interface.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/interface.py b/src/calibre/devices/interface.py index d75e96f386..9510dcf3d1 100644 --- a/src/calibre/devices/interface.py +++ b/src/calibre/devices/interface.py @@ -178,7 +178,13 @@ class DevicePlugin(Plugin): if cvid == vid: if pid in products: if hasattr(self.VENDOR_ID, 'keys'): - cbcd = self.VENDOR_ID[vid][pid] + try: + cbcd = self.VENDOR_ID[vid][pid] + except KeyError: + # Vendor vid does not have product pid, pid + # exists for some other vendor in this + # device + continue else: cbcd = self.BCD if self.test_bcd(bcd, cbcd):