318 |
318 |
319 def GetModuleInfos(self, module_infos): |
319 def GetModuleInfos(self, module_infos): |
320 vendor = ExtractHexDecValue(module_infos["vendor"]) |
320 vendor = ExtractHexDecValue(module_infos["vendor"]) |
321 vendor_infos = self.Library.get(vendor) |
321 vendor_infos = self.Library.get(vendor) |
322 if vendor_infos is not None: |
322 if vendor_infos is not None: |
323 for group_name, group_infos in vendor_infos["groups"].iteritems(): |
323 for _group_name, group_infos in vendor_infos["groups"].iteritems(): |
324 for device_type, device_infos in group_infos["devices"]: |
324 for device_type, device_infos in group_infos["devices"]: |
325 product_code = ExtractHexDecValue(device_infos.getType().getProductCode()) |
325 product_code = ExtractHexDecValue(device_infos.getType().getProductCode()) |
326 revision_number = ExtractHexDecValue(device_infos.getType().getRevisionNo()) |
326 revision_number = ExtractHexDecValue(device_infos.getType().getRevisionNo()) |
327 if product_code == ExtractHexDecValue(module_infos["product_code"]) and \ |
327 if product_code == ExtractHexDecValue(module_infos["product_code"]) and \ |
328 revision_number == ExtractHexDecValue(module_infos["revision_number"]): |
328 revision_number == ExtractHexDecValue(module_infos["revision_number"]): |
352 for row in reader: |
352 for row in reader: |
353 if has_header: |
353 if has_header: |
354 has_header = False |
354 has_header = False |
355 else: |
355 else: |
356 params_values = {} |
356 params_values = {} |
357 for (param, param_infos), value in zip( |
357 for (param, _param_infos), value in zip( |
358 self.MODULES_EXTRA_PARAMS, row[3:]): |
358 self.MODULES_EXTRA_PARAMS, row[3:]): |
359 if value != "": |
359 if value != "": |
360 params_values[param] = int(value) |
360 params_values[param] = int(value) |
361 self.ModulesExtraParams[ |
361 self.ModulesExtraParams[ |
362 tuple(map(int, row[:3]))] = params_values |
362 tuple(map(int, row[:3]))] = params_values |
363 csvfile.close() |
363 csvfile.close() |
364 |
364 |
365 def SaveModulesExtraParams(self): |
365 def SaveModulesExtraParams(self): |
366 csvfile = open(self.GetModulesExtraParamsFilePath(), "wb") |
366 csvfile = open(self.GetModulesExtraParamsFilePath(), "wb") |
367 extra_params = [param for param, params_infos in self.MODULES_EXTRA_PARAMS] |
367 extra_params = [param for param, _params_infos in self.MODULES_EXTRA_PARAMS] |
368 writer = csv.writer(csvfile, delimiter=';') |
368 writer = csv.writer(csvfile, delimiter=';') |
369 writer.writerow(['Vendor', 'product_code', 'revision_number'] + extra_params) |
369 writer.writerow(['Vendor', 'product_code', 'revision_number'] + extra_params) |
370 for (vendor, product_code, revision_number), module_extra_params in self.ModulesExtraParams.iteritems(): |
370 for (vendor, product_code, revision_number), module_extra_params in self.ModulesExtraParams.iteritems(): |
371 writer.writerow([vendor, product_code, revision_number] + |
371 writer.writerow([vendor, product_code, revision_number] + |
372 [module_extra_params.get(param, '') |
372 [module_extra_params.get(param, '') |