From 9d408bce58e13c3bd263e2f70b3a16b2832a55b6 Mon Sep 17 00:00:00 2001 From: cono Date: Thu, 5 May 2016 16:35:30 +0300 Subject: [PATCH] Add Eurocom Sky MX5 support. Improve dmidecode parsing, as dmidecode prints warning for me and system-board validation fails. Delete SMBus.close as I don't see this method in SMBus class. --- init-headphone | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) mode change 100644 => 100755 init-headphone diff --git a/init-headphone b/init-headphone old mode 100644 new mode 100755 index 9af63f1..8f4c44c --- a/init-headphone +++ b/init-headphone @@ -4,8 +4,9 @@ from __future__ import print_function import subprocess import os import sys +import re -SUPPORTED_SYSTEM_PRODUCT_NAMES = ["W230SS"] +SUPPORTED_SYSTEM_PRODUCT_NAMES = ["W230SS", "SKY MX5"] SUPPORTED_I2C_BUS_NAMES = ["SMBus I801 adapter at f040"] I2C_CLASS_PATH = "/sys/class/i2c-dev" CMDLINE_PATH = "/proc/cmdline" @@ -28,8 +29,7 @@ DATA = [ def get_system_product_name(): try: - return subprocess.check_output(["dmidecode", "-s", "system-product-name"] - ).strip() + return "\n".join([line for line in subprocess.check_output(["dmidecode", "-s", "system-product-name"]).splitlines() if not line.startswith('#')]).strip() except OSError: print("Error: dmidecode is not installed", file=sys.stderr) return False @@ -141,7 +141,6 @@ def init_headphone(): return False for device_cmd, device_data in DATA: i2c_bus.write_byte_data(DEVICE_ADDRESS, device_cmd, device_data) - i2c_bus.close() return True if __name__ == "__main__":