summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric S. Raymond <esr@thyrsus.com>2009-01-20 02:23:52 +0000
committerEric S. Raymond <esr@thyrsus.com>2009-01-20 02:23:52 +0000
commitc288fb6cc7e3e3c34461bcfe8b735745a91b32a8 (patch)
treed8c3cc09eb913ca71bed1a57cf0a401177284f0a
parent1d1151cae49fe6ebd0b1e66ea3ecf41227859394 (diff)
downloadgpsd-c288fb6cc7e3e3c34461bcfe8b735745a91b32a8.tar.gz
Add some sanity checks in the wrapper class, and tweak the DB so it passes.
-rw-r--r--gpscap.ini16
-rw-r--r--gpscap.py20
2 files changed, 30 insertions, 6 deletions
diff --git a/gpscap.ini b/gpscap.ini
index 1c58f94b..f70364b2 100644
--- a/gpscap.ini
+++ b/gpscap.ini
@@ -332,7 +332,7 @@ notes = <td> Reported by Tobias Minich &lt;belgabor&#x40;gmx.de&gt; <ul>
[EarthMate USB]
type = device
-vendor = DeLorme
+vendor = Delorme
packaging = GPS mouse
reference = http://www.delorme.com/earthmate/default.asp
uses = SiRF-2
@@ -346,7 +346,7 @@ notes = This was the replacement for the old Zodiac version that spoke
[EarthMate]
type = device
-vendor = DeLorme
+vendor = Delorme
packaging = GPS mouse
uses = Zodiac
interfaces = RS232C
@@ -354,7 +354,7 @@ notes = These models have been discontinued.
[TripMate]
type = device
-vendor = DeLorme
+vendor = Delorme
packaging = GPS mouse
reference = http://vancouver-webpages.com/peter/tripmate.faq
uses = Zodiac
@@ -630,6 +630,8 @@ notes = This receiver, or at least the firmware it ships with does not
[TripNav TN-200]
type = device
+vendor = GlobalSat
+packaging = GPS mouse
reference = http://www.usglobalsat.com/item.asp?itemid=45&catid=13
uses = SiRF-2
interfaces = USB
@@ -766,6 +768,8 @@ notes = Bluetooth operation requires -b option. Powered fro a care
[M-241]
type = device
+vendor = Holux
+packaging = GPS mouse
reference = http://www.holux.com/JCore/en/products/products_content.jsp?pno=341
engine = MTK
interfaces = Bluetooth, USB
@@ -801,7 +805,7 @@ notes = The product page points at a retail site carrying these
[EC-10X]
type = device
-vwndor = Magellan
+vendor = Magellan
packaging = handset
reference = http://www.herman-nelson.com/itemInfo.cfm?itemID=205
engine = Old Rockwell (Jupiter?)
@@ -1003,6 +1007,8 @@ notes = Reported by Robert Pouliot &lt;krynos&#x40;saturnus.com&gt;<br/>
[iGPS-500]
type = device
+vendor = Pharos
+packaging = GPS mouse
reference = http://www.pharosgps.com/products/proddetail.asp?prod=006_PB010_1.00&cat=141
uses = SiRF-3
subtype = GSC3f
@@ -1174,7 +1180,7 @@ tested = 2.26
nmea = 2.1
notes = Reported by Rob Janssen.
-[Trimble]
+[Trimble Lassen IQ]
type = device
vendor = Trimble
packaging = OEM module
diff --git a/gpscap.py b/gpscap.py
index 689fbdf6..7cb44812 100644
--- a/gpscap.py
+++ b/gpscap.py
@@ -30,6 +30,24 @@ class GPSDictionary(ConfigParser.RawConfigParser):
self.remove_option(section, "uses")
if not keepgoing:
break
-
+ # Sanity check: All items must have a type field.
+ for section in self.sections():
+ if not self.has_option(section, "type"):
+ raise ConfigParser.Error("%s has no type" % section)
+ elif self.get(section, "type") not in ("engine", "vendor", "device"):
+ raise ConfigParser.Error("%s has invalid type" % section)
+ # Sanity check: All devices must point at a vendor object.
+ # Side effect: build the list of vendors.
+ self.vendors = []
+ for section in self.sections():
+ if self.get(section, "type") == "vendor":
+ self.vendors.append(section)
+ self.vendors.sort()
+ for section in self.sections():
+ if self.get(section, "type") == "device":
+ if not self.has_option(section, "vendor"):
+ raise ConfigParser.Error("%s has no vendor" % section)
+ if self.get(section, "vendor") not in self.vendors:
+ raise ConfigParser.Error("%s has invalid vendor" % section)
if __name__ == "__main__":
d = GPSDictionary()