def getDeviceInfo(busId): configFile = os.path.join(zorgConfigDir, zorgConfig) if not os.path.exists(configFile): return doc = piksemel.parse(configFile) cardTag = None for tag in doc.tags("Card"): if tag.getAttribute("busId") == busId: cardTag = tag break if not cardTag: return device = VideoDevice(busId=busId) device.saved_vendor_id = cardTag.getTagData("VendorId") device.saved_product_id = cardTag.getTagData("ProductId") probeResultTag = cardTag.getTag("ProbeResult") probeResult = {} for tag in probeResultTag.tags("Value"): key = tag.getAttribute("key") child = tag.firstChild() if child: value = child.data() else: value = "" probeResult[key] = value activeConfigTag = cardTag.getTag("ActiveConfig") driverTag = activeConfigTag.getTag("Driver") device.driver = driverTag.firstChild().data() device.package = driverTag.getAttribute("package") device.depth = activeConfigTag.getTagData("Depth") activeOutputs = [] modes = {} def addMonitor(output, tag): mon = Monitor() mon.vendor = tag.getTagData("Vendor") or "" mon.model = tag.getTagData("Model") or "Unknown Monitor" mon.hsync = tag.getTagData("HorizSync") or mon.hsync mon.vref = tag.getTagData("VertRefresh") or mon.vref device.monitors[output] = mon outputTag = activeConfigTag.getTag("Output") name = outputTag.firstChild().data() activeOutputs.append(name) mode = outputTag.getAttribute("mode") if mode: modes[name] = mode monitorTag = activeConfigTag.getTag("Monitor") if monitorTag: addMonitor(name, monitorTag) outputTag = activeConfigTag.getTag("SecondOutput") if outputTag: name = outputTag.firstChild().data() activeOutputs.append(name) mode = outputTag.getAttribute("mode") if mode: modes[name] = mode monitorTag = activeConfigTag.getTag("SecondMonitor") if monitorTag: addMonitor(name, monitorTag) device.desktop_setup = activeConfigTag.getTagData("DesktopSetup") device.probe_result = probeResult device.active_outputs = activeOutputs device.modes = modes return device