mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-01-22 17:33:19 +01:00
Rename RGB to Per_KEY
This commit is contained in:
1
Makefile
1
Makefile
@@ -48,7 +48,6 @@ uninstall:
|
|||||||
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
rm -f "$(DESTDIR)/lib/udev/rules.d/99-$(BIN_D).rules"
|
||||||
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
rm -f "$(DESTDIR)$(sysconfdir)/dbus-1/system.d/$(BIN_D).conf"
|
||||||
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
rm -f "$(DESTDIR)/lib/systemd/system/$(BIN_D).service"
|
||||||
rm -rf "$(DESTDIR)$(sysconfdir)/asusd/"
|
|
||||||
|
|
||||||
update:
|
update:
|
||||||
cargo update
|
cargo update
|
||||||
|
|||||||
21
README.md
21
README.md
@@ -75,6 +75,27 @@ Models GA401, GA502, GU502 support LED brightness change only (no RGB).
|
|||||||
| G731 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
|
| G731 | X | X | X | X | X | X | X | X | X | X | X | X | X | X |
|
||||||
| G532 | X | X | X | X | X | X | X | X | X | X | X | X | | X |
|
| G532 | X | X | X | X | X | X | X | X | X | X | X | X | | X |
|
||||||
|
|
||||||
|
It is highly likely this doesn't cover all models.
|
||||||
|
|
||||||
|
For editing the `/etc/asusd/asusd-ledmodes.toml`, the LED Mode numbers are as follows:
|
||||||
|
|
||||||
|
```
|
||||||
|
0 STATIC
|
||||||
|
1 BREATHING
|
||||||
|
2 STROBE
|
||||||
|
3 RAINBOW
|
||||||
|
4 STAR
|
||||||
|
5 RAIN
|
||||||
|
6 HIGHLIGHT
|
||||||
|
7 LASER
|
||||||
|
8 RIPPLE
|
||||||
|
10 PULSE
|
||||||
|
11 COMET
|
||||||
|
12 FLASH
|
||||||
|
13 MULTISTATIC
|
||||||
|
255 PER_KEY
|
||||||
|
```
|
||||||
|
|
||||||
## Implemented
|
## Implemented
|
||||||
|
|
||||||
- [X] Daemon
|
- [X] Daemon
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ impl crate::Controller for CtrlKbdBacklight {
|
|||||||
while let Some(command) = recv.recv().await {
|
while let Some(command) = recv.recv().await {
|
||||||
let mut config = config.lock().await;
|
let mut config = config.lock().await;
|
||||||
match &command {
|
match &command {
|
||||||
AuraModes::RGB(_) => {
|
AuraModes::PerKey(_) => {
|
||||||
self.do_command(command, &mut config)
|
self.do_command(command, &mut config)
|
||||||
.await
|
.await
|
||||||
.unwrap_or_else(|err| warn!("{}", err));
|
.unwrap_or_else(|err| warn!("{}", err));
|
||||||
@@ -191,7 +191,7 @@ impl CtrlKbdBacklight {
|
|||||||
config.write();
|
config.write();
|
||||||
info!("LED brightness set to {:#?}", n);
|
info!("LED brightness set to {:#?}", n);
|
||||||
}
|
}
|
||||||
AuraModes::RGB(v) => {
|
AuraModes::PerKey(v) => {
|
||||||
if v.is_empty() || v[0].is_empty() {
|
if v.is_empty() || v[0].is_empty() {
|
||||||
let bytes = KeyColourArray::get_init_msg();
|
let bytes = KeyColourArray::get_init_msg();
|
||||||
self.write_bytes(&bytes).await?;
|
self.write_bytes(&bytes).await?;
|
||||||
@@ -214,7 +214,7 @@ impl CtrlKbdBacklight {
|
|||||||
#[inline]
|
#[inline]
|
||||||
async fn write_mode(&mut self, mode: &AuraModes) -> Result<(), Box<dyn Error>> {
|
async fn write_mode(&mut self, mode: &AuraModes) -> Result<(), Box<dyn Error>> {
|
||||||
match mode {
|
match mode {
|
||||||
AuraModes::RGB(v) => {
|
AuraModes::PerKey(v) => {
|
||||||
if v.is_empty() || v[0].is_empty() {
|
if v.is_empty() || v[0].is_empty() {
|
||||||
let bytes = KeyColourArray::get_init_msg();
|
let bytes = KeyColourArray::get_init_msg();
|
||||||
self.write_bytes(&bytes).await?;
|
self.write_bytes(&bytes).await?;
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ pub const PULSE: u8 = 0x0a;
|
|||||||
pub const COMET: u8 = 0x0b;
|
pub const COMET: u8 = 0x0b;
|
||||||
pub const FLASH: u8 = 0x0c;
|
pub const FLASH: u8 = 0x0c;
|
||||||
pub const MULTISTATIC: u8 = 0x0d;
|
pub const MULTISTATIC: u8 = 0x0d;
|
||||||
pub const RGB: u8 = 0xff;
|
pub const PER_KEY: u8 = 0xff;
|
||||||
|
|
||||||
#[derive(Clone, Deserialize, Serialize)]
|
#[derive(Clone, Deserialize, Serialize)]
|
||||||
pub struct Colour(pub u8, pub u8, pub u8);
|
pub struct Colour(pub u8, pub u8, pub u8);
|
||||||
@@ -180,7 +180,7 @@ pub enum AuraModes {
|
|||||||
MultiStatic(MultiColour),
|
MultiStatic(MultiColour),
|
||||||
LedBrightness(u8),
|
LedBrightness(u8),
|
||||||
// TODO: use a serializable structure for this (KeyColourArray)
|
// TODO: use a serializable structure for this (KeyColourArray)
|
||||||
RGB(Vec<Vec<u8>>),
|
PerKey(Vec<Vec<u8>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl From<SetAuraBuiltin> for AuraModes {
|
impl From<SetAuraBuiltin> for AuraModes {
|
||||||
@@ -234,7 +234,7 @@ impl From<&AuraModes> for u8 {
|
|||||||
AuraModes::Comet(_) => COMET,
|
AuraModes::Comet(_) => COMET,
|
||||||
AuraModes::Flash(_) => FLASH,
|
AuraModes::Flash(_) => FLASH,
|
||||||
AuraModes::MultiStatic(_) => MULTISTATIC,
|
AuraModes::MultiStatic(_) => MULTISTATIC,
|
||||||
AuraModes::RGB(_) => RGB,
|
AuraModes::PerKey(_) => PER_KEY,
|
||||||
_ => panic!("Invalid mode"),
|
_ => panic!("Invalid mode"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -256,13 +256,13 @@ impl From<&AuraModes> for &str {
|
|||||||
AuraModes::Comet(_) => "Comet",
|
AuraModes::Comet(_) => "Comet",
|
||||||
AuraModes::Flash(_) => "Flash",
|
AuraModes::Flash(_) => "Flash",
|
||||||
AuraModes::MultiStatic(_) => "4-Zone Static Colours",
|
AuraModes::MultiStatic(_) => "4-Zone Static Colours",
|
||||||
AuraModes::RGB(_) => "RGB per-key",
|
AuraModes::PerKey(_) => "RGB per-key",
|
||||||
_ => panic!("Invalid mode"),
|
_ => panic!("Invalid mode"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Exists to convert back from correct bytes. RGB byte intentionally left off as it
|
/// Exists to convert back from correct bytes. PER_KEY byte intentionally left off as it
|
||||||
/// does not correspond to an actual pre-set mode, nor does brightness.
|
/// does not correspond to an actual pre-set mode, nor does brightness.
|
||||||
impl From<u8> for AuraModes {
|
impl From<u8> for AuraModes {
|
||||||
fn from(byte: u8) -> Self {
|
fn from(byte: u8) -> Self {
|
||||||
@@ -280,7 +280,7 @@ impl From<u8> for AuraModes {
|
|||||||
COMET => AuraModes::Comet(SingleColour::default()),
|
COMET => AuraModes::Comet(SingleColour::default()),
|
||||||
FLASH => AuraModes::Flash(SingleColour::default()),
|
FLASH => AuraModes::Flash(SingleColour::default()),
|
||||||
MULTISTATIC => AuraModes::MultiStatic(MultiColour::default()),
|
MULTISTATIC => AuraModes::MultiStatic(MultiColour::default()),
|
||||||
RGB => AuraModes::RGB(vec![]),
|
PER_KEY => AuraModes::PerKey(vec![]),
|
||||||
_ => panic!("Invalid mode byte"),
|
_ => panic!("Invalid mode byte"),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ impl AuraDbusClient {
|
|||||||
/// the keyboard LED EC in the correct mode
|
/// the keyboard LED EC in the correct mode
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn init_effect(&self) -> Result<(), Box<dyn std::error::Error>> {
|
pub fn init_effect(&self) -> Result<(), Box<dyn std::error::Error>> {
|
||||||
let mode = AuraModes::RGB(vec![vec![]]);
|
let mode = AuraModes::PerKey(vec![vec![]]);
|
||||||
let mut msg =
|
let mut msg =
|
||||||
Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "SetKeyBacklight")?
|
Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "SetKeyBacklight")?
|
||||||
.append1(serde_json::to_string(&mode)?);
|
.append1(serde_json::to_string(&mode)?);
|
||||||
@@ -67,7 +67,7 @@ impl AuraDbusClient {
|
|||||||
for v in group {
|
for v in group {
|
||||||
vecs.push(v.to_vec());
|
vecs.push(v.to_vec());
|
||||||
}
|
}
|
||||||
let mode = AuraModes::RGB(vecs);
|
let mode = AuraModes::PerKey(vecs);
|
||||||
let mut msg =
|
let mut msg =
|
||||||
Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "SetKeyBacklight")?
|
Message::new_method_call(DBUS_NAME, DBUS_PATH, DBUS_IFACE, "SetKeyBacklight")?
|
||||||
.append1(serde_json::to_string(&mode)?);
|
.append1(serde_json::to_string(&mode)?);
|
||||||
|
|||||||
Reference in New Issue
Block a user