Update readme, slash configs

This commit is contained in:
Luke D. Jones
2025-01-12 17:36:10 +13:00
parent 2123f369ad
commit 128bc3fce1
113 changed files with 1545 additions and 1305 deletions

View File

@@ -23,7 +23,7 @@ fn main() -> Result<(), Box<dyn Error>> {
Path::new(&args[1]),
None,
args[2].parse::<f32>().unwrap(),
AnimeType::GA401,
AnimeType::GA401
)?;
let anime_type = get_anime_type();

View File

@@ -21,14 +21,11 @@ fn main() {
let brightness = args[2].parse::<f32>().unwrap();
let anime_type = get_anime_type();
let mut seq = Sequences::new(anime_type);
seq.insert(
0,
&ActionLoader::AsusAnimation {
file: path.into(),
time: rog_anime::AnimTime::Infinite,
brightness,
},
)
seq.insert(0, &ActionLoader::AsusAnimation {
file: path.into(),
time: rog_anime::AnimTime::Infinite,
brightness
})
.unwrap();
loop {

View File

@@ -27,10 +27,10 @@ fn main() -> Result<(), Box<dyn Error>> {
args[3].parse::<f32>().unwrap(),
Vec2::new(
args[4].parse::<f32>().unwrap(),
args[5].parse::<f32>().unwrap(),
args[5].parse::<f32>().unwrap()
),
args[6].parse::<f32>().unwrap(),
anime_type,
anime_type
)?;
proxy.write(<AnimeDataBuffer>::try_from(&matrix)?).unwrap();

View File

@@ -30,10 +30,10 @@ fn main() -> Result<(), Box<dyn Error>> {
args[3].parse::<f32>().unwrap(),
Vec2::new(
args[4].parse::<f32>().unwrap(),
args[5].parse::<f32>().unwrap(),
args[5].parse::<f32>().unwrap()
),
args[6].parse::<f32>().unwrap(),
anime_type,
anime_type
)?;
loop {

View File

@@ -36,10 +36,10 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
Colour {
r: 200,
g: 110,
b: 0,
b: 0
},
100,
10,
10
));
seq.push(zone);

View File

@@ -40,7 +40,7 @@ pub struct AnimeCommand {
#[options(no_short, meta = "", help = "Off with his head!!!")]
pub off_with_his_head: Option<bool>,
#[options(command)]
pub command: Option<AnimeActions>,
pub command: Option<AnimeActions>
}
#[derive(Options)]
@@ -54,7 +54,7 @@ pub enum AnimeActions {
#[options(help = "display an animated diagonal/pixel-perfect GIF")]
PixelGif(AnimeGifDiagonal),
#[options(help = "change which builtin animations are shown")]
SetBuiltins(Builtins),
SetBuiltins(Builtins)
}
#[derive(Options)]
@@ -82,7 +82,7 @@ pub struct Builtins {
)]
pub shutdown: AnimShutdown,
#[options(meta = "", help = "set/apply the animations <true/false>")]
pub set: Option<bool>,
pub set: Option<bool>
}
#[derive(Options)]
@@ -100,7 +100,7 @@ pub struct AnimeImage {
#[options(meta = "", default = "0.0", help = "the angle in radians")]
pub angle: f32,
#[options(meta = "", default = "1.0", help = "brightness 0.0-1.0")]
pub bright: f32,
pub bright: f32
}
#[derive(Options)]
@@ -110,7 +110,7 @@ pub struct AnimeImageDiagonal {
#[options(meta = "", help = "full path to the png to display")]
pub path: String,
#[options(meta = "", default = "1.0", help = "brightness 0.0-1.0")]
pub bright: f32,
pub bright: f32
}
#[derive(Options)]
@@ -134,7 +134,7 @@ pub struct AnimeGif {
default = "1",
help = "how many loops to play - 0 is infinite"
)]
pub loops: u32,
pub loops: u32
}
#[derive(Options)]
@@ -150,5 +150,5 @@ pub struct AnimeGifDiagonal {
default = "1",
help = "how many loops to play - 0 is infinite"
)]
pub loops: u32,
pub loops: u32
}

View File

@@ -17,7 +17,7 @@ pub struct LedPowerCommand1 {
#[options(meta = "", help = "Control boot animations <true/false>")]
pub boot: Option<bool>,
#[options(meta = "", help = "Control suspend animations <true/false>")]
pub sleep: Option<bool>,
pub sleep: Option<bool>
}
#[derive(Options, Debug)]
@@ -25,7 +25,7 @@ pub struct LedPowerCommand2 {
#[options(help = "print help message")]
pub help: bool,
#[options(command)]
pub command: Option<SetAuraZoneEnabled>,
pub command: Option<SetAuraZoneEnabled>
}
#[derive(Options, Debug)]
@@ -42,7 +42,7 @@ pub enum SetAuraZoneEnabled {
#[options(help = "")]
RearGlow(AuraPowerStates),
#[options(help = "")]
Ally(AuraPowerStates),
Ally(AuraPowerStates)
}
#[derive(Debug, Clone, Options)]
@@ -56,12 +56,12 @@ pub struct AuraPowerStates {
#[options(help = "defaults to false if option unused")]
pub sleep: bool,
#[options(help = "defaults to false if option unused")]
pub shutdown: bool,
pub shutdown: bool
}
#[derive(Options)]
pub struct LedBrightness {
level: Option<u8>,
level: Option<u8>
}
impl LedBrightness {
pub fn new(level: Option<u8>) -> Self {
@@ -96,7 +96,7 @@ impl ToString for LedBrightness {
Some(0x00) => "low",
Some(0x01) => "med",
Some(0x02) => "high",
_ => "unknown",
_ => "unknown"
};
s.to_owned()
}
@@ -113,7 +113,7 @@ pub struct SingleSpeed {
meta = "",
help = "set the zone for this effect e.g, 0, 1, one, logo, lightbar-left"
)]
pub zone: AuraZone,
pub zone: AuraZone
}
#[derive(Debug, Clone, Options, Default)]
@@ -129,7 +129,7 @@ pub struct SingleSpeedDirection {
meta = "",
help = "set the zone for this effect e.g, 0, 1, one, logo, lightbar-left"
)]
pub zone: AuraZone,
pub zone: AuraZone
}
#[derive(Debug, Clone, Default, Options)]
@@ -143,7 +143,7 @@ pub struct SingleColour {
meta = "",
help = "set the zone for this effect e.g, 0, 1, one, logo, lightbar-left"
)]
pub zone: AuraZone,
pub zone: AuraZone
}
#[derive(Debug, Clone, Default, Options)]
@@ -159,7 +159,7 @@ pub struct SingleColourSpeed {
meta = "",
help = "set the zone for this effect e.g, 0, 1, one, logo, lightbar-left"
)]
pub zone: AuraZone,
pub zone: AuraZone
}
#[derive(Debug, Clone, Options, Default)]
@@ -177,7 +177,7 @@ pub struct TwoColourSpeed {
meta = "",
help = "set the zone for this effect e.g, 0, 1, one, logo, lightbar-left"
)]
pub zone: AuraZone,
pub zone: AuraZone
}
#[derive(Debug, Clone, Default, Options)]
@@ -191,7 +191,7 @@ pub struct MultiZone {
#[options(short = "c", meta = "", help = "set the RGB value e.g, ff00ff")]
pub colour3: Colour,
#[options(short = "d", meta = "", help = "set the RGB value e.g, ff00ff")]
pub colour4: Colour,
pub colour4: Colour
}
#[derive(Debug, Clone, Default, Options)]
@@ -207,7 +207,7 @@ pub struct MultiColourSpeed {
#[options(short = "d", meta = "", help = "set the RGB value e.g, ff00ff")]
pub colour4: Colour,
#[options(no_long, meta = "", help = "set the speed: low, med, high")]
pub speed: Speed,
pub speed: Speed
}
/// Byte value for setting the built-in mode.
@@ -239,7 +239,7 @@ pub enum SetAuraBuiltin {
#[options(help = "set a vertical line zooming from left")]
Comet(SingleColour), // 11
#[options(help = "set a wide vertical line zooming from left")]
Flash(SingleColour), // 12
Flash(SingleColour) // 12
}
impl Default for SetAuraBuiltin {

View File

@@ -26,7 +26,7 @@ pub struct CliStart {
#[options(help = "Toggle one-shot battery charge to 100%")]
pub one_shot_chg: bool,
#[options(command)]
pub command: Option<CliCommand>,
pub command: Option<CliCommand>
}
#[derive(Options)]
@@ -55,7 +55,7 @@ pub enum CliCommand {
help = "Change platform settings. This is a new interface exposed by the asus-armoury \
driver, some of the settings will be the same as the older platform interface"
)]
Armoury(ArmouryCommand),
Armoury(ArmouryCommand)
}
#[derive(Debug, Clone, Options)]
@@ -73,7 +73,7 @@ pub struct ProfileCommand {
pub profile_get: bool,
#[options(meta = "", help = "set the active profile")]
pub profile_set: Option<ThrottlePolicy>,
pub profile_set: Option<ThrottlePolicy>
}
#[derive(Options)]
@@ -85,13 +85,13 @@ pub struct LedModeCommand {
#[options(help = "switch to previous aura mode")]
pub prev_mode: bool,
#[options(command)]
pub command: Option<SetAuraBuiltin>,
pub command: Option<SetAuraBuiltin>
}
#[derive(Options)]
pub struct GraphicsCommand {
#[options(help = "print help message")]
pub help: bool,
pub help: bool
}
#[derive(Options, Debug)]
@@ -124,7 +124,7 @@ pub struct PlatformCommand {
)]
pub panel_overdrive_set: Option<bool>,
#[options(no_long, short = "o", help = "get panel overdrive")]
pub panel_overdrive_get: bool,
pub panel_overdrive_get: bool
}
#[derive(Options, Debug)]
@@ -132,5 +132,5 @@ pub struct ArmouryCommand {
#[options(help = "print help message")]
pub help: bool,
#[options(free)]
pub free: Vec<String>,
pub free: Vec<String>
}

View File

@@ -45,5 +45,5 @@ pub struct FanCurveCommand {
help = "data format = 30c:1%,49c:2%,59c:3%,69c:4%,79c:31%,89c:49%,99c:56%,109c:58%. \
`--mod-profile` required. If '%' is omitted the fan range is 0-255"
)]
pub data: Option<CurveData>,
pub data: Option<CurveData>
}

View File

@@ -89,7 +89,7 @@ fn main() {
fn print_error_help(
err: &dyn std::error::Error,
supported_interfaces: &[String],
supported_properties: &[Properties],
supported_properties: &[Properties]
) {
check_service("asusd");
println!("\nError: {}\n", err);
@@ -130,7 +130,7 @@ fn check_service(name: &str) -> bool {
fn find_iface<T>(iface_name: &str) -> Result<Vec<T>, Box<dyn std::error::Error>>
where
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>,
T: ProxyImpl<'static> + From<zbus::Proxy<'static>>
{
let conn = zbus::blocking::Connection::system().unwrap();
let f = zbus::blocking::fdo::ObjectManagerProxy::new(&conn, "xyz.ljones.Asusd", "/").unwrap();
@@ -157,7 +157,7 @@ where
T::builder(&conn)
.path(path.clone())?
.destination("xyz.ljones.Asusd")?
.build()?,
.build()?
);
}
return Ok(ctrl);
@@ -170,7 +170,7 @@ fn do_parsed(
parsed: &CliStart,
supported_interfaces: &[String],
supported_properties: &[Properties],
conn: Connection,
conn: Connection
) -> Result<(), Box<dyn std::error::Error>> {
match &parsed.command {
Some(CliCommand::Aura(mode)) => handle_led_mode(mode)?,
@@ -281,7 +281,7 @@ fn do_parsed(
let level = aura.brightness()?;
println!("Current keyboard led brightness: {level:?}");
}
Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?,
Some(level) => aura.set_brightness(rog_aura::LedBrightness::from(level))?
}
}
} else {
@@ -425,7 +425,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
image.angle,
Vec2::new(image.x_pos, image.y_pos),
image.bright,
anime_type,
anime_type
)?;
proxy.write(<AnimeDataBuffer>::try_from(&matrix)?)?;
@@ -444,7 +444,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
Path::new(&image.path),
None,
image.bright,
anime_type,
anime_type
)?;
proxy.write(matrix.into_data_buffer(anime_type)?)?;
@@ -466,7 +466,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
Vec2::new(gif.x_pos, gif.y_pos),
AnimTime::Count(1),
gif.bright,
anime_type,
anime_type
)?;
let mut loops = gif.loops as i32;
@@ -497,7 +497,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
Path::new(&gif.path),
AnimTime::Count(1),
gif.bright,
anime_type,
anime_type
)?;
let mut loops = gif.loops as i32;
@@ -530,7 +530,7 @@ fn handle_anime(cmd: &AnimeCommand) -> Result<(), Box<dyn std::error::Error>> {
boot: builtins.boot,
awake: builtins.awake,
sleep: builtins.sleep,
shutdown: builtins.shutdown,
shutdown: builtins.shutdown
})?;
}
}
@@ -551,7 +551,12 @@ fn verify_brightness(brightness: f32) {
fn handle_slash(cmd: &SlashCommand) -> Result<(), Box<dyn std::error::Error>> {
if (cmd.brightness.is_none()
&& cmd.interval.is_none()
&& cmd.slash_mode.is_none()
&& cmd.show_on_boot.is_none()
&& cmd.show_on_shutdown.is_none()
&& cmd.show_on_sleep.is_none()
&& cmd.show_on_battery.is_none()
&& cmd.show_battery_warning.is_none()
&& cmd.mode.is_none()
&& !cmd.list
&& !cmd.enable
&& !cmd.disable)
@@ -577,8 +582,24 @@ fn handle_slash(cmd: &SlashCommand) -> Result<(), Box<dyn std::error::Error>> {
if let Some(interval) = cmd.interval {
proxy.set_interval(interval)?;
}
if let Some(slash_mode) = cmd.slash_mode {
proxy.set_slash_mode(slash_mode)?;
if let Some(slash_mode) = cmd.mode {
proxy.set_mode(slash_mode)?;
}
if let Some(show) = cmd.show_on_boot {
proxy.set_show_on_boot(show)?;
}
if let Some(show) = cmd.show_on_shutdown {
proxy.set_show_on_shutdown(show)?;
}
if let Some(show) = cmd.show_on_sleep {
proxy.set_show_on_sleep(show)?;
}
if let Some(show) = cmd.show_on_battery {
proxy.set_show_on_battery(show)?;
}
if let Some(show) = cmd.show_battery_warning {
proxy.set_show_battery_warning(show)?;
}
}
if cmd.list {
@@ -772,7 +793,7 @@ fn handle_led_power1(power: &LedPowerCommand1) -> Result<(), Box<dyn std::error:
fn handle_led_power_1_do_1866(
aura: &AuraProxyBlocking,
power: &LedPowerCommand1,
power: &LedPowerCommand1
) -> Result<(), Box<dyn std::error::Error>> {
let mut states = Vec::new();
if power.keyboard {
@@ -781,7 +802,7 @@ fn handle_led_power_1_do_1866(
boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(),
shutdown: false,
shutdown: false
});
}
if power.lightbar {
@@ -790,7 +811,7 @@ fn handle_led_power_1_do_1866(
boot: power.boot.unwrap_or_default(),
awake: power.awake.unwrap_or_default(),
sleep: power.sleep.unwrap_or_default(),
shutdown: false,
shutdown: false
});
}
@@ -852,7 +873,7 @@ fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box<dyn std::error:
aura_cli::SetAuraZoneEnabled::Lightbar(l) => set(PowerZones::Lightbar, l),
aura_cli::SetAuraZoneEnabled::Lid(l) => set(PowerZones::Lid, l),
aura_cli::SetAuraZoneEnabled::RearGlow(r) => set(PowerZones::RearGlow, r),
aura_cli::SetAuraZoneEnabled::Ally(r) => set(PowerZones::Ally, r),
aura_cli::SetAuraZoneEnabled::Ally(r) => set(PowerZones::Ally, r)
}
}
@@ -866,7 +887,7 @@ fn handle_led_power2(power: &LedPowerCommand2) -> Result<(), Box<dyn std::error:
fn handle_throttle_profile(
conn: &Connection,
supported: &[Properties],
cmd: &ProfileCommand,
cmd: &ProfileCommand
) -> Result<(), Box<dyn std::error::Error>> {
if !supported.contains(&Properties::ThrottlePolicy) {
println!("Profiles not supported by either this kernel or by the laptop.");
@@ -910,7 +931,7 @@ fn handle_throttle_profile(
fn handle_fan_curve(
conn: &Connection,
cmd: &FanCurveCommand,
cmd: &FanCurveCommand
) -> Result<(), Box<dyn std::error::Error>> {
let Ok(fan_proxy) = FanCurvesProxyBlocking::new(conn).map_err(|e| {
println!("Fan-curves not supported by either this kernel or by the laptop: {e:?}");
@@ -989,7 +1010,7 @@ fn handle_fan_curve(
fn handle_platform_properties(
conn: &Connection,
supported: &[Properties],
cmd: &PlatformCommand,
cmd: &PlatformCommand
) -> Result<(), Box<dyn std::error::Error>> {
{
if (cmd.gpu_mux_mode_set.is_none()

View File

@@ -31,5 +31,5 @@ pub struct ScsiCommand {
pub colours: Vec<Colour>,
#[options(help = "list available animations")]
pub list: bool,
pub list: bool
}

View File

@@ -9,12 +9,27 @@ pub struct SlashCommand {
pub enable: bool,
#[options(help = "Ddisable the Slash Ledbar")]
pub disable: bool,
#[options(meta = "", help = "Set brightness value <0-255>")]
#[options(short = "l", meta = "", help = "Set brightness value <0-255>")]
pub brightness: Option<u8>,
#[options(meta = "", help = "Set interval value <0-5>")]
pub interval: Option<u8>,
#[options(meta = "", help = "Set SlashMode (so 'list' for all options)")]
pub slash_mode: Option<SlashMode>,
pub mode: Option<SlashMode>,
#[options(help = "list available animations")]
pub list: bool,
#[options(short = "B", meta = "", help = "Show the animation on boot")]
pub show_on_boot: Option<bool>,
#[options(short = "S", meta = "", help = "Show the animation on shutdown")]
pub show_on_shutdown: Option<bool>,
#[options(short = "s", meta = "", help = "Show the animation on sleep")]
pub show_on_sleep: Option<bool>,
#[options(short = "b", meta = "", help = "Show the animation on battery")]
pub show_on_battery: Option<bool>,
#[options(
short = "w",
meta = "",
help = "Show the low-battery warning animation"
)]
pub show_battery_warning: Option<bool>
}