#led #sysfs #command-line #alienware

app alienware_cli

Command Line app to control the lights on an Alienware Alpha R1/R2

17 releases (stable)

1.0.12 Feb 25, 2024
1.0.10 Oct 3, 2023
1.0.9 Feb 11, 2023
1.0.2 Apr 14, 2022
0.1.4 Feb 25, 2022

#40 in Hardware support

Apache-2.0

36KB
690 lines

alienware-cli

Crates.io Crates.io Build Status dependency status snapcraft.io

The alienware-cli application controls the LEDs and the HDMI in and out ports on an Alienware Alpha desktop machine. The API is based on the alienware_wmi_control.sh script that used to come with the SteamOS distribution of Linux for Alienware machines.

You might also want to check out a python project to control the same lights AlienFX.

Install

First method: if cargo is available to your root user with a correct toolchain:

sudo cargo install alienware_cli --root /usr/local

Second method: install for yourself using cargo and then copy to a location that is in all users path:

cargo install alienware-cli
sudo cp ~/.cargo/bin/alienware-cli /usr/local/bin

Third method: grab the latest version from the releases page:

curl -OL https://github.com/a1ecbr0wn/alienware-wmi/releases/download/latest/alienware-cli && chmod 775 alienware-cli

Use

To see a description of the command line parameters use the -h parameter:

$ alienware-cli -h
Command Line app to control the lights on an Alienware Alpha R1/R2

Usage: alienware-cli [OPTIONS]

Options:
  -c, --connector      State of the HDMI ports
  -l, --led-state      State of the LEDs
  -H, --head <HEAD>    Set the LED state of the head button
  -L, --left <LEFT>    Set the LED state of the left LEDs
  -R, --right <RIGHT>  Set the LED state of the right LEDs
  -j, --json           Output in JSON format for machine readability (combined with -c or -l)
  -V, --version        Print version information
  -h, --help           Print help

The -c and -l parameters show information about the hdmi connections and LEDs respectively, this two parameters can be used together or separately and can also be used with the -j parameter which formats the response in json format for machine readability:

$ alienware-cli -lc
HDMI passthrough state: present
    Input HDMI is unconnected
    Output HDMI is connected to gpu

LED state: present
    head:
        red: 15
        green: 0
        blue: 15
    left:
        red: 0
        green: 15
        blue: 15
$ alienware-cli -jlc
{"hdmi":{"hdmi":{"exists":true,"input":"unconnected","output":"gpu"}},"leds":{"exists":true,"left":{"red":0,"green":15,"blue":15},"head":{"red":15,"green":0,"blue":15}}}

The colour of the LEDs can be set for different LED clusters with the -H, -L, and -R parameters for the head, left and right clusters respectively. The LED colours can be set either with the name of the colour or the RGB value where the value of each colour has a 0-15 scale. Since these commands are changing the values of files in sysfs, the command should be run with root permissions:

Both of the following examples sets the head button to cyan:

sudo alienware-cli -H cyan
sudo alienware-cli -H "0 15 15"

Disclaimer and License

If you use this software, you use it AT YOUR OWN RISK.

This software is licenced under the Apache-2.0 licence.

Dependencies

~3.5–5MB
~92K SLoC