Skip to content

Commit e601556

Browse files
feat: reading edid
1 parent 25f79f4 commit e601556

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

example.zig

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,27 @@ pub fn main() !void {
2323
const encoder = node.getEncoder(connector.encoderId) catch null;
2424

2525
if (connector.props()) |props| {
26-
for (props) |propId| {
26+
const propValues = connector.propValues().?;
27+
28+
for (props, 0..) |propId, i| {
29+
const propValueId = propValues[i];
30+
2731
var prop: libdrm.types.ModeGetProperty = .{
2832
.propId = propId,
2933
};
3034
try prop.getAllocated(node.fd, alloc);
3135
defer prop.deinit(alloc);
3236

33-
if (prop.blobs()) |blobs| {
34-
for (blobs) |blobId| {
35-
var blob: libdrm.types.ModeGetBlob = .{
36-
.blobId = blobId,
37-
};
38-
try blob.getAllocated(node.fd, alloc);
37+
if (prop.flags.blob == 1) {
38+
var blob: libdrm.types.ModeGetBlob = .{
39+
.blobId = @intCast(propValueId),
40+
};
41+
if (blob.getAllocated(node.fd, alloc)) {
3942
defer blob.deinit(alloc);
4043

4144
std.debug.print("{}\n", .{blob});
45+
} else |err| {
46+
std.debug.print("{s}\n", .{@errorName(err)});
4247
}
4348
}
4449

0 commit comments

Comments
 (0)