mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Many small fixes
- Flip writing order of effect colour blocks every other block write to try and even out. Previously the bottom rows were always last to be written. - Add more examples: ball, comet, pulser. - Refine the keyboard layout grid for GX502. - Use tokio to delay main loop, not thread::sleep - Minor tweaks to error handling. Needs refactor of errors.
This commit is contained in:
@@ -5,12 +5,15 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
## [0.9.5] - 2020-22-05
|
||||
### Changed
|
||||
- Flip writing order of effect colour blocks every other block write to try
|
||||
and even out. Previously the bottom rows were always last to be written.
|
||||
- Add more examples: ball, comet, pulser.
|
||||
- Refine the keyboard layout grid for GX502.
|
||||
- Use tokio to delay main loop, not thread::sleep
|
||||
- Minor tweaks to error handling. Needs refactor of errors.
|
||||
|
||||
## [0.9.4] - 2020-05-05
|
||||
### Changed
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rog-aura"
|
||||
version = "0.9.1"
|
||||
version = "0.9.2"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
authors = ["Luke <luke@ljones.dev>"]
|
||||
|
||||
6
debian/changelog
vendored
6
debian/changelog
vendored
@@ -1,3 +1,9 @@
|
||||
rog-core (0.9.5) focal; urgency=medium
|
||||
|
||||
* Internal fixes to many small issues
|
||||
|
||||
-- Luke Jones <luke@ljones.dev> Fri, 22 May 2020 15:10:24 +1200
|
||||
|
||||
rog-core (0.9.4) focal; urgency=medium
|
||||
|
||||
* Fix reloading last keyboard brightness on boot
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "rog-daemon"
|
||||
version = "0.9.4"
|
||||
version = "0.9.5"
|
||||
license = "MPL-2.0"
|
||||
readme = "README.md"
|
||||
authors = ["Luke <luke@ljones.dev>"]
|
||||
|
||||
@@ -31,6 +31,7 @@ impl Config {
|
||||
let mut c = Config::default();
|
||||
c.current_mode[0] = 0x5d;
|
||||
c.current_mode[1] = 0xb3;
|
||||
// Should be okay to unwrap this as is since it is a Default
|
||||
let toml = toml::to_string(&c).unwrap();
|
||||
file.write_all(toml.as_bytes())
|
||||
.expect("Writing default config failed");
|
||||
|
||||
@@ -72,8 +72,8 @@ impl RogCore {
|
||||
vendor: u16,
|
||||
product: u16,
|
||||
) -> Result<DeviceHandle<rusb::GlobalContext>, rusb::Error> {
|
||||
for device in rusb::devices().unwrap().iter() {
|
||||
let device_desc = device.device_descriptor().unwrap();
|
||||
for device in rusb::devices()?.iter() {
|
||||
let device_desc = device.device_descriptor()?;
|
||||
if device_desc.vendor_id() == vendor && device_desc.product_id() == product {
|
||||
return device.open();
|
||||
}
|
||||
|
||||
@@ -56,8 +56,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
rogcore
|
||||
.fan_mode_reload(&mut config)
|
||||
.await
|
||||
.map_err(|err| warn!("Fan mode: {}", err))
|
||||
.unwrap();
|
||||
.unwrap_or_else(|err| warn!("Fan mode: {}", err));
|
||||
let mut led_writer = LedWriter::new(
|
||||
rogcore.get_raw_device_handle(),
|
||||
laptop.led_endpoint(),
|
||||
@@ -104,8 +103,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
laptop
|
||||
.run(&mut rogcore, &config1, bytes, acs)
|
||||
.await
|
||||
.map_err(|err| warn!("{:?}", err))
|
||||
.unwrap();
|
||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -122,8 +120,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
led_writer
|
||||
.do_command(command, &mut config)
|
||||
.await
|
||||
.map_err(|err| warn!("{:?}", err))
|
||||
.unwrap();
|
||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
||||
|
||||
connection
|
||||
.send(
|
||||
@@ -131,7 +128,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
.msg(&DBUS_PATH.into(), &DBUS_IFACE.into())
|
||||
.append1(true),
|
||||
)
|
||||
.unwrap();
|
||||
.unwrap_or_else(|_| 0);
|
||||
// Clear any possible queued effect
|
||||
let mut effect = effect.lock().await;
|
||||
*effect = None;
|
||||
@@ -144,8 +141,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
led_writer
|
||||
.do_command(AuraCommand::WriteBytes(bytes), &mut config)
|
||||
.await
|
||||
.map_err(|err| warn!("{:?}", err))
|
||||
.unwrap();
|
||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
||||
// Also cancel any effect client
|
||||
connection
|
||||
.send(
|
||||
@@ -164,8 +160,7 @@ pub async fn start_daemon() -> Result<(), Box<dyn Error>> {
|
||||
led_writer
|
||||
.do_command(AuraCommand::WriteEffect(effect), &mut config)
|
||||
.await
|
||||
.map_err(|err| warn!("{:?}", err))
|
||||
.unwrap();
|
||||
.unwrap_or_else(|err| warn!("{:?}", err));
|
||||
time_mark = Instant::now();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,30 +108,32 @@ where
|
||||
AuraCommand::BuiltinNext => {
|
||||
// TODO: different path for multi-zone (byte 2 controlled, non-zero)
|
||||
let mode_curr = config.current_mode[3];
|
||||
let idx = self
|
||||
.supported_modes
|
||||
.binary_search(&mode_curr.into())
|
||||
.unwrap();
|
||||
let idx_next = if idx < self.supported_modes.len() - 1 {
|
||||
idx + 1
|
||||
if let Ok(idx) = self.supported_modes.binary_search(&mode_curr.into()) {
|
||||
let idx_next = if idx < self.supported_modes.len() - 1 {
|
||||
idx + 1
|
||||
} else {
|
||||
0
|
||||
};
|
||||
self.set_builtin(config, idx_next).await?;
|
||||
} else {
|
||||
0
|
||||
};
|
||||
self.set_builtin(config, idx_next).await?;
|
||||
warn!("Tried to step to next LED mode while in non-supported mode");
|
||||
self.set_builtin(config, 0).await?;
|
||||
}
|
||||
}
|
||||
AuraCommand::BuiltinPrev => {
|
||||
// TODO: different path for multi-zone (byte 2 controlled, non-zero)
|
||||
let mode_curr = config.current_mode[3];
|
||||
let idx = self
|
||||
.supported_modes
|
||||
.binary_search(&mode_curr.into())
|
||||
.unwrap();
|
||||
let idx_next = if idx > 0 {
|
||||
idx - 1
|
||||
if let Ok(idx) = self.supported_modes.binary_search(&mode_curr.into()) {
|
||||
let idx_next = if idx > 0 {
|
||||
idx - 1
|
||||
} else {
|
||||
self.supported_modes.len() - 1
|
||||
};
|
||||
self.set_builtin(config, idx_next).await?;
|
||||
} else {
|
||||
self.supported_modes.len() - 1
|
||||
};
|
||||
self.set_builtin(config, idx_next).await?;
|
||||
warn!("Tried to step to next LED mode while in non-supported mode");
|
||||
self.set_builtin(config, 0).await?;
|
||||
}
|
||||
}
|
||||
AuraCommand::WriteBytes(bytes) => self.set_and_save(&bytes, config).await?,
|
||||
AuraCommand::WriteEffect(effect) => self.write_effect(effect).await?,
|
||||
@@ -183,7 +185,6 @@ where
|
||||
}
|
||||
}
|
||||
self.flip_effect_write = !self.flip_effect_write;
|
||||
let now = std::time::Instant::now();
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -206,14 +207,13 @@ where
|
||||
Err(AuraError::NotSupported)
|
||||
}
|
||||
|
||||
/// Used to set a builtin mode and save the settings for it
|
||||
#[inline]
|
||||
async fn reload_last_builtin(&self, config: &Config) -> Result<(), AuraError> {
|
||||
let mode_curr = config.current_mode[3];
|
||||
let mode = config
|
||||
.builtin_modes
|
||||
.get_field_from(mode_curr)
|
||||
.unwrap()
|
||||
.ok_or(AuraError::NotSupported)?
|
||||
.to_owned();
|
||||
self.write_bytes(&mode).await?;
|
||||
// Reload brightness too
|
||||
@@ -224,15 +224,12 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Select next Aura effect
|
||||
///
|
||||
/// If the current effect is the last one then the effect selected wraps around to the first.
|
||||
#[inline]
|
||||
async fn set_builtin(&self, config: &mut Config, index: usize) -> Result<(), AuraError> {
|
||||
let mode_next = config
|
||||
.builtin_modes
|
||||
.get_field_from(self.supported_modes[index].into())
|
||||
.unwrap()
|
||||
.ok_or(AuraError::NotSupported)?
|
||||
.to_owned();
|
||||
println!("{:X?}", &mode_next);
|
||||
self.set_and_save(&mode_next, config).await?;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
use log::error;
|
||||
use uhid_virt::{Bus, CreateParams, UHIDDevice};
|
||||
|
||||
/// Create a virtual device to emit key-presses
|
||||
@@ -91,7 +92,8 @@ impl VirtKeys {
|
||||
]
|
||||
.to_vec(),
|
||||
})
|
||||
.unwrap(),
|
||||
.map_err(|err| error!("Could not create virtual device: {:?}", err))
|
||||
.expect("Could not create virtual device"),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user