-rw-r--r-- | libopie2/opienet/omanufacturerdb.cpp | 25 | ||||
-rwxr-xr-x | libopie2/tools/stripmanuf.py | 27 |
2 files changed, 30 insertions, 22 deletions
diff --git a/libopie2/opienet/omanufacturerdb.cpp b/libopie2/opienet/omanufacturerdb.cpp index bcce11f..006ae72 100644 --- a/libopie2/opienet/omanufacturerdb.cpp +++ b/libopie2/opienet/omanufacturerdb.cpp | |||
@@ -81,35 +81,16 @@ OManufacturerDB::OManufacturerDB() | |||
81 | QString extManu; | 81 | QString extManu; |
82 | while (!s.atEnd()) | 82 | while (!s.atEnd()) |
83 | { | 83 | { |
84 | s >> addr; | 84 | s >> addr; |
85 | if ( !addr ) // read nothing!? | ||
86 | { | ||
87 | continue; | ||
88 | } | ||
89 | else | ||
90 | if ( addr[0] == '#' ) | ||
91 | { | ||
92 | continue; | ||
93 | } | ||
94 | s.skipWhiteSpace(); | ||
95 | s >> manu; | 85 | s >> manu; |
96 | s.skipWhiteSpace(); | ||
97 | s >> extManu; | 86 | s >> extManu; |
98 | if ( extManu[0] == '#' ) // we have an extended manufacturer | 87 | |
99 | { | ||
100 | s.skipWhiteSpace(); | ||
101 | extManu = s.readLine(); | ||
102 | odebug << "OManufacturerDB: read " << extManu << " as extended manufacturer string" << oendl; | ||
103 | manufacturersExt.insert( addr, extManu ); | ||
104 | } | ||
105 | else | ||
106 | s.readLine(); | ||
107 | odebug << "OManufacturerDB: read tuple " << addr << ", " << manu << oendl; | ||
108 | manufacturers.insert( addr, manu ); | 88 | manufacturers.insert( addr, manu ); |
89 | manufacturersExt.insert( addr, extManu ); | ||
90 | odebug << "OmanufacturerDB: parse '" << addr << "' as '" << manu << "' (" << extManu << ")" << oendl; | ||
109 | } | 91 | } |
110 | } | 92 | } |
111 | |||
112 | } | 93 | } |
113 | 94 | ||
114 | 95 | ||
115 | OManufacturerDB::~OManufacturerDB() | 96 | OManufacturerDB::~OManufacturerDB() |
diff --git a/libopie2/tools/stripmanuf.py b/libopie2/tools/stripmanuf.py new file mode 100755 index 0000000..28de0f9 --- a/dev/null +++ b/libopie2/tools/stripmanuf.py | |||
@@ -0,0 +1,27 @@ | |||
1 | #!/usr/bin/env python | ||
2 | |||
3 | # | ||
4 | # converts a manufacturer file in ethereal format (taken from their CVS) | ||
5 | # into something smaller and faster parseable | ||
6 | # | ||
7 | |||
8 | import sys | ||
9 | import os | ||
10 | |||
11 | i = file( sys.argv[1], "r" ) | ||
12 | o = file( sys.argv[2], "w" ) | ||
13 | |||
14 | for line in i: | ||
15 | #print line.strip() | ||
16 | entries = line.strip().split() | ||
17 | #print "number of entries =", len( entries ) | ||
18 | #print entries | ||
19 | if len( entries ) < 2: | ||
20 | continue | ||
21 | elif len( entries ) == 2: | ||
22 | print "2-line detected." | ||
23 | print >>o, entries[0], entries[1], entries[1] | ||
24 | elif len( entries ) > 2: | ||
25 | print >>o, entries[0], entries[1], "_".join( entries[3:] ) | ||
26 | else: | ||
27 | assert( false ) \ No newline at end of file | ||