monitors: don't hardcode lines for ddc check
Since new ddcutil update it's not possible to hardcode
This commit is contained in:
parent
d4bc255cdb
commit
46ff77c1d6
1 changed files with 3 additions and 3 deletions
|
|
@ -56,9 +56,9 @@ export class Monitor extends GObject.Object {
|
||||||
this.isDdc = out.split("\n\n").some(display => {
|
this.isDdc = out.split("\n\n").some(display => {
|
||||||
if (!/^Display \d+/.test(display)) return false;
|
if (!/^Display \d+/.test(display)) return false;
|
||||||
const lines = display.split("\n");
|
const lines = display.split("\n");
|
||||||
if (lines[3].split(":")[3] !== monitor.serial) return false;
|
if (lines.find(l => l.startsWith("Monitor:"))?.split(":")[3] !== monitor.serial) return false;
|
||||||
this.busNum = lines[1].split("/dev/i2c-")[1];
|
this.busNum = lines.find(l => l.startsWith("I2C bus:"))?.split("/dev/i2c-")[1];
|
||||||
return true;
|
return this.busNum !== undefined;
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(() => (this.isDdc = false))
|
.catch(() => (this.isDdc = false))
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue