diff --git a/hwcompatible/cert_info.py b/hwcompatible/cert_info.py index f486777354b75c725ac203d29e6f687ced690246..410ef09b8497ce90513146b9cf849ca2b2ece594 100644 --- a/hwcompatible/cert_info.py +++ b/hwcompatible/cert_info.py @@ -77,6 +77,13 @@ class CertInfo: oec_json["date"] = curday filename = self.command.run_cmd( "modinfo %s | grep filename | awk '{print $2}'" % device.driver, log_print=False) + if len(filename[0].strip("\n")) == 0: + kernel_modules = device.get_modules() + for module in kernel_modules: + filename = self.command.run_cmd( + "modinfo %s | grep filename | awk '{print $2}'" % module, log_print=False) + if len(filename[0].strip("\n")) == 0: + continue shanum = self.command.run_cmd( "sha256sum %s | awk '{print $1}'" % filename[0].strip("\n"), log_print=False) oec_json["sha256"] = shanum[0].strip("\n") diff --git a/hwcompatible/device.py b/hwcompatible/device.py index 6597af2b007d48501e84e83274f7954dc864a407..49961b0ea93445954aa14e33a1d6cd7055ca59f4 100755 --- a/hwcompatible/device.py +++ b/hwcompatible/device.py @@ -85,6 +85,7 @@ class Device: self.path = properties["DEVPATH"] else: self.properties = dict() + self.modules = list() def get_property(self, prop): """ @@ -407,6 +408,23 @@ class Device: def set_driver(self, driver): self.driver = driver + def get_modules(self): + """ + get the kernel modules name of the board + :return: + """ + modules = list() + self.get_pci() + if not self.pci: + return modules + cmd_result = self.command.run_cmd( + "lspci -xs %s -v" % self.pci, log_print=False) + for info in cmd_result[0].split('\n'): + if re.search("Kernel modules", info) and len(info.split(":")[1].strip()) > 0: + self.modules = info.split(":")[1].strip().split(", ") + return self.modules + return modules + def get_pci(self): """ get the pci of card.