feat: get Device from Card.

This commit is contained in:
Jackson Netherwood-Imig
2026-03-06 15:17:51 -08:00
parent 411ec740e9
commit 35b92f2324
4 changed files with 61 additions and 20 deletions
+6 -4
View File
@@ -5,13 +5,15 @@ pub fn main(init: std.process.Init) !void {
const io = init.io;
const gpa = init.gpa;
const device = drm.Device.getFromDevId(io, gpa, drm.makeDev(226, 0), .{}) catch
try drm.Device.getFromDevId(io, gpa, drm.makeDev(226, 1), .{});
// const device = drm.Device.getFromDevId(io, gpa, drm.makeDev(226, 0), .{}) catch
// try drm.Device.getFromDevId(io, gpa, drm.makeDev(226, 1), .{});
// const card = try device.openNode(io);
const card = try drm.Card.openAuto(io, .primary);
const device = try card.getDevice(io, gpa, .{});
std.log.info("Device node path: {s}.", .{device.nodePath()});
// const card = try drm.Card.openAuto(io);
const card = try device.openNode(io);
defer card.close(io);
const res = try card.getModesettingResources(gpa);
defer res.deinit(gpa);