Releasing

This commit is contained in:
Luke D Jones
2020-08-13 14:28:40 +12:00
parent 760d5be8eb
commit 53c1a0ffcf
5 changed files with 121 additions and 213 deletions

View File

@@ -5,201 +5,6 @@ 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]
### Added
- Support for G531
- Support for G731
## [0.15.3] - 2020-07-21
## Changed
- GX531 reverted to zone profile, G531 moved to per-key profile
## [0.15.2] - 2020-07-21
## Changed
- GX531 now supports same LED features as GX502
## Added
- Support for G532
## [0.15.0] - 2020-07-09
### Changed
- Support "Calc" fn key on G712
- ROG key has limited customization, see README.md for details.
+ Power
+ Sleep
+ MediaRecord
+ MediaFastFwd
+ MediaRewind
+ MediaNext
+ MediaPrev
+ MediaStop
+ MediaPlayPause
+ MediaVolMute
+ MediaVolUp
+ MediaVolDown
+ BacklightInc
+ BacklightDec
+ ControlConfig
+ LaunchTextEditor
+ LaunchEmailApp
+ LaunchNewsReader
+ LaunchCalendar
+ LaunchCalculator
+ LaunchWebBrowser
+ FileBrowser
### BREAKING
- `"rog_key": "ControlConfig",` is required to be added below line 1 in `/etc/rogcore.conf`
alternatively the config can be removed, allowing it to be recreated.
## [0.14.5] - 2020-07-07
### Changed
- Correct some device handling and order of operations
### BREAKING
- Not quite breaking, but the serice should now be static (not enabled) and
the udev rule `data/rog-core.rules` used to start the service. This ensures
the device is actually initialised fully before the service starts.
## [0.14.4] - 2020-07-07
### Changed
- Changes to the way rog-core is initialised
## [0.14.3] - 2020-07-05
### Changed
- Proper fix of laptop mode conversion bug
## [0.14.2] - 2020-07-04
### Changed
- Try to correct how laptop modes are handled
## [0.14.1] - 2020-07-04
### Added
- Support for G512 series
- Support for GU502 (variant of GA15)
## [0.14.0] - 2020-07-01
### Changed
- Further refine the way setting LED modes works so it is more universal, this
also allows for setting the brightness through `SetKeyBacklight`
### Added
- `README_DBUS.md` to document DBUS interface
- Dbus method `GetKeyBacklight`
- Dbus method `GetKeyBacklightModes`
## [0.13.1] - 2020-06-29
### Fixed
- Properly initialise the device
- Better log formatting
## [0.13.0] - 2020-06-29
### Changed
- Dbus command `LedWriteBytes` renamed to `SetKeyBacklight`
- Dbus command `SetKeyBacklight` will now take a JSON string instead of an array of bytes
+ Example:
```
{
"Breathe": {
"help": false,
"colour": [
254,
5,
171
],
"colour2": [
0,
156,
156
],
"speed": "High"
}
}
```
note that `help` is unused but required as a side-effect of using `gumdrop`
for CLI.
- Dbus signal `LedCancelEffect` renamed to `KeyBacklightChanged`
- Config file is now in JSON format, and will store only the LED modes that a laptop
supports rather than the whole set
## [0.12.2] - 2020-06-29
### Changed
- "FanMode", "ChargeLimit" to "SetFanMode", "SetChargeLimit"
### Added
- Dbus signals "FanModeChanged", "ChargeLimitChanged"
- Dbus methods "GetFanMode", "GetChargeLimit"
- Support for ROG Strix G712
## [0.12.0] - 2020-06-26
### Changed
- Add modes for FX531 LEDs
- Change where USB reset is called
- Add support for G531GT
- Remove duplicated code: it looks like there is at least *some* consistency in Consumer-Device keycodes that ASUS uses
### BREAKING CHANGE
- `bat_charge_limit = 100` must be appended to the top of `/etc/rogcore.conf`
## [0.11.1] - 2020-06-11
### Changed
- Use DBUS_NAME instead of DBUS_IFACE when requesting the name
- Give different names for the bytearray arguments so that pydbus is not confused
- Add org.freedesktop.DBus.Method.NoReply annotations
- Remove dbus reply for multizone writes
- Move led_writer to a main loop due to strange mpsc behaviour, this combined with
mpsc channels offers a more reactive app
- Small fix for unreported mode indexing issue
## [0.11.0] - 2020-06-09
### BREAKING CHANGE
- Many of the RGB built-in modes have been renamed to match Armory-Crate names,
this means that the `/etc/rogcore.conf` needs to be removed so it can be
regenerated using the updated names.
### Changed
- Add better examples for AniMe display, and fix many small issues
- Don't halt app iff AniMe display not found when running on GA14/GA15 laptops
- Rename client crate to better suit
- Added a device reset for both keyboard and AniMe devices before configuring them
## [0.10.0] - 2020-05-23
### Changed
- Correctly set AMD boost
- Add animatrix support for G14 laptops
## [0.9.7] - 2020-05-23
### Changed
- Start differentiating between models using the 0x1866 USB device
- Refactor how to send multizone over dbus, and how to write it (write 4 packets before writing SET/APPLY)
- Begin implementing profiles per board_name
- Boost toggle for AMD (not freq adjustment yet)
## [0.9.6] - 2020-05-22
### Changed
- Fix needing to double-tap fan-mode to change mode
## [0.9.5] - 2020-05-22
### 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
- Fix reloading last keyboard brightness on boot
## [0.9.3] - 2020-05-04
### Changed
- Fixed return of rog-core in client mode
- Fixed writing of customised builtin LED modes
## [0.9.2] - 2020-05-04
### Added
- Begin keeping a Changelog
### Changed
- Internal structure changes to reduce the possibility of mutex await deadlocks when
writing to the LED endpoint
## [1.0.0] - 2020-08-13
- Major fork and refactor to use asus-hid patch for ASUS N-Key device

70
asus-nb-ctrl.spec Normal file
View File

@@ -0,0 +1,70 @@
%if %{defined fedora}
%global debug_package %{nil}
%endif
# Use hardening ldflags.
%global rustflags -Clink-arg=-Wl,-z,relro,-z,now
Name: asus-nb-ctrl
Version: 1.0.0
Release: 0
Summary: Text editor for terminal
License: MPLv2
Group: Productivity/Text/Editors
URL: https://gitlab.com/asus-linux/asus-nb-ctrl
Source: %{name}-%{version}.tar.gz
# cargo vendor &&
# tar cfJ vendor.tar.xz vendor
Source1: vendor.tar.xz
BuildRequires: clang-devel
BuildRequires: cargo
BuildRequires: rust
BuildRequires: rust-std-static
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libudev)
%description
ASUS Laptop control
%prep
%setup -q -n %name-next
%setup -q -n %name-next -D -T -a 1
mkdir .cargo
cat >.cargo/config <<EOF
[source.crates-io]
replace-with = "vendored-sources"
[source.vendored-sources]
directory = "vendor"
EOF
%build
export RUSTFLAGS="%{rustflags}"
RUST_BACKTRACE=1 cargo build --release
%install
export RUSTFLAGS="%{rustflags}"
mkdir -p "%{buildroot}%{_bindir}"
install -D -m 0755 target/release/asusd %{buildroot}%{_bindir}/asusd
install -D -m 0755 target/release/asusctl %{buildroot}%{_bindir}/asusctl
install -D -m 0644 data/asusd.rules %{buildroot}%{_udevrulesdir}/90-asusd.rules
install -D -m 0644 data/asusd.conf %{buildroot}%{_sysconfdir}/dbus-1/system.d/asusd.conf
install -D -m 0644 data/asusd.service %{buildroot}%{_unitdir}/asusd.service
install -D -m 0644 data/asusd-ledmodes.toml %{buildroot}%{_sysconfdir}/asusd/asusd-ledmodes.toml
mkdir -p "%{buildroot}%{_datadir}/licenses/%{name}"
cp LICENSE "%{buildroot}%{_datadir}/licenses/%{name}/"
mkdir -p "%{buildroot}/bin"
%files
%license LICENSE
%{_bindir}/asusd
%{_bindir}/asusctl
%{_unitdir}/asusd.service
%{_udevrulesdir}/90-asusd.rules
%{_sysconfdir}/dbus-1/system.d/asusd.conf
%{_sysconfdir}/asusd/asusd-ledmodes.toml
%changelog

View File

@@ -18,7 +18,8 @@ use tokio::sync::Mutex;
use tokio::task::JoinHandle;
pub struct CtrlKbdBacklight {
dev_node: String,
led_node: String,
kbd_node: String,
bright_node: String,
supported_modes: Vec<u8>,
flip_effect_write: bool,
@@ -130,32 +131,58 @@ impl crate::Controller for CtrlKbdBacklight {
impl CtrlKbdBacklight {
#[inline]
pub fn new(id_product: &str, supported_modes: Vec<u8>) -> Result<Self, std::io::Error> {
Ok(CtrlKbdBacklight {
led_node: Self::scan_led_node(id_product)?,
kbd_node: Self::scan_kbd_node(id_product)?,
// brightness node path should always be constant but this *might* change?
bright_node: "/sys/class/leds/asus::kbd_backlight/brightness".to_string(),
supported_modes,
flip_effect_write: false,
})
}
fn scan_led_node(id_product: &str) -> Result<String, std::io::Error> {
let mut enumerator = udev::Enumerator::new()?;
enumerator.match_subsystem("hidraw")?;
for device in enumerator.scan_devices()? {
if let Some(parent) = device.parent_with_subsystem_devtype("usb", "usb_device")? {
if parent.attribute_value("idProduct").unwrap() == id_product
if parent.attribute_value("idProduct").unwrap() == id_product {
// && device.parent().unwrap().sysnum().unwrap() == 3
{
if let Some(dev_node) = device.devnode() {
info!("Device has keyboard backlight control");
info!("Using device at: {:?} for LED control", dev_node);
return Ok(CtrlKbdBacklight {
dev_node: dev_node.to_string_lossy().to_string(),
bright_node: "/sys/class/leds/asus::kbd_backlight/brightness"
.to_string(),
supported_modes,
flip_effect_write: false,
});
return Ok(dev_node.to_string_lossy().to_string());
}
}
}
}
Err(std::io::Error::new(
let err = std::io::Error::new(
std::io::ErrorKind::NotFound,
"Device node not found",
))
"ASUS LED device node not found",
);
Err(err)
}
fn scan_kbd_node(id_product: &str) -> Result<String, std::io::Error> {
let mut enumerator = udev::Enumerator::new()?;
enumerator.match_subsystem("input")?;
enumerator.match_property("ID_MODEL_ID", id_product)?;
for device in enumerator.scan_devices()? {
if let Some(dev_node) = device.devnode() {
if let Some(inum) = device.property_value("ID_USB_INTERFACE_NUM") {
if inum == "02" {
info!("Using device at: {:?} for keyboard polling", dev_node);
return Ok(dev_node.to_string_lossy().to_string());
}
}
}
}
let err = std::io::Error::new(
std::io::ErrorKind::NotFound,
"ASUS N-Key Consumer Device node not found",
);
Err(err)
}
fn let_bright_check_change(&mut self, config: &mut Config) -> Result<(), Box<dyn Error>> {
@@ -188,7 +215,7 @@ impl CtrlKbdBacklight {
/// Should only be used if the bytes you are writing are verified correct
#[inline]
async fn write_bytes(&self, message: &[u8]) -> Result<(), Box<dyn Error>> {
if let Ok(mut file) = OpenOptions::new().write(true).open(&self.dev_node) {
if let Ok(mut file) = OpenOptions::new().write(true).open(&self.led_node) {
file.write_all(message).unwrap();
return Ok(());
}

View File

@@ -18,3 +18,4 @@ impl fmt::Display for AuraError {
}
}
}

View File

@@ -18,9 +18,14 @@ prod_family = "ROG Strix"
board_names = ["G512LI", "G712LI"]
led_modes = [0, 1, 2, 3, 10]
[[led_modes]]
prod_family = "Strix Scar 3"
board_names = ["G531GW"]
led_modes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 10, 11, 12, 255]
[[led_modes]]
prod_family = "Strix"
board_names = ["G731GV", "G731GW", "G531GV", "G531GW"]
board_names = ["G731GV", "G731GW", "G531GV"]
led_modes = [0, 1, 2, 3, 13]
[[led_modes]]