Add error handling for parse-edid call.

If parse-edid can not parse the given edid, use "Unknown" for vendor
and model name.
This commit is contained in:
Alexander Grothe 2018-05-08 10:28:25 +02:00
parent 6724ddcc23
commit 70945dc97b
4 changed files with 490 additions and 474 deletions

File diff suppressed because it is too large Load Diff

View File

@ -5035,12 +5035,17 @@ def parse_xrandr_verbose(iterator):
def parse_edid_data(edid):
vendor = "Unknown"
model = "Unknown"
data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True)
for line in data.splitlines():
if "VendorName" in line:
vendor = line.strip().split('"')[1]
if "ModelName" in line:
model = line.strip().split('"')[1]
try:
data = subprocess.check_output("parse-edid < {}".format(edid),
shell=True, universal_newlines=True)
except subprocess.CalledProcessError:
pass
else:
for line in data.splitlines():
if "VendorName" in line:
vendor = line.strip().split('"')[1]
if "ModelName" in line:
model = line.strip().split('"')[1]
return vendor, model
def collect_nvidia_data():

View File

@ -174,12 +174,17 @@ def parse_xrandr_verbose(iterator):
def parse_edid_data(edid):
vendor = "Unknown"
model = "Unknown"
data = subprocess.check_output("parse-edid < {}".format(edid), shell=True, universal_newlines=True)
for line in data.splitlines():
if "VendorName" in line:
vendor = line.strip().split('"')[1]
if "ModelName" in line:
model = line.strip().split('"')[1]
try:
data = subprocess.check_output("parse-edid < {}".format(edid),
shell=True, universal_newlines=True)
except subprocess.CalledProcessError:
pass
else:
for line in data.splitlines():
if "VendorName" in line:
vendor = line.strip().split('"')[1]
if "ModelName" in line:
model = line.strip().split('"')[1]
return vendor, model
def collect_nvidia_data():

View File

@ -0,0 +1 @@
lircd0_socket: /var/run/lirc/lircd0