Something went wrong. Try again.
A Zig library for driving Elgato Stream Deck devices over USB HID.
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041// SPDX-FileCopyrightText: © 2026 Jeffrey C. Ollie <jeff@ocjtech.us>// SPDX-License-Identifier: MIT
//! Print the udev rules for every device this library knows.//!//! The rules come out of the device table rather than out of somebody's//! memory, so a model added to `StreamDeck.Type` appears here without//! anyone having to remember. `nix/module.nix` carries what this prints//! and a test checks that it still does.//!//! With no arguments the rules use `uaccess`, which hands the device to//! whoever is logged in at the seat. `--group NAME` writes the older//! shape instead, for a machine with no seat.
const std = @import("std");const streamdeck = @import("streamdeck");
pub fn main(init: std.process.Init) !void { var owner: streamdeck.udev.Owner = .uaccess;
var args = init.minimal.args.iterate(); _ = args.next(); while (args.next()) |arg| { if (std.mem.eql(u8, arg, "--group")) { owner = .{ .group = args.next() orelse return error.MissingGroupName }; } else if (std.mem.startsWith(u8, arg, "--group=")) { owner = .{ .group = arg["--group=".len..] }; } }
var buf: [4096]u8 = undefined; const locked = std.debug.lockStderr(&buf); defer std.debug.unlockStderr();
try streamdeck.udev.writeRules(&locked.file_writer.interface, owner);}
test { std.testing.refAllDecls(@This());}