mirror of
https://gitlab.com/asus-linux/asusctl.git
synced 2026-02-06 00:15:04 +01:00
Better handling
This commit is contained in:
@@ -23,12 +23,7 @@ pub fn match_laptop() -> Result<Box<dyn Laptop>, AuraError> {
|
||||
/// has 3 explicit groups: main, vol+media, and the ones that the Linux kernel doesn't
|
||||
/// map.
|
||||
pub trait Laptop {
|
||||
fn do_hotkey_action(
|
||||
&self,
|
||||
core: &mut RogCore,
|
||||
key_byte: u8,
|
||||
virt: Box<dyn Fn(u8)>,
|
||||
) -> Result<(), AuraError>;
|
||||
fn do_hotkey_action(&self, core: &mut RogCore, key_byte: u8) -> Result<(), AuraError>;
|
||||
fn hotkey_group_bytes(&self) -> &[u8];
|
||||
fn led_iface_num(&self) -> u8;
|
||||
fn supported_modes(&self) -> &[BuiltInModeByte];
|
||||
@@ -82,12 +77,7 @@ impl LaptopGX502GW {
|
||||
}
|
||||
}
|
||||
impl Laptop for LaptopGX502GW {
|
||||
fn do_hotkey_action(
|
||||
&self,
|
||||
rogcore: &mut RogCore,
|
||||
key_byte: u8,
|
||||
virt: Box<dyn Fn(u8)>,
|
||||
) -> Result<(), AuraError> {
|
||||
fn do_hotkey_action(&self, rogcore: &mut RogCore, key_byte: u8) -> Result<(), AuraError> {
|
||||
match GX502GWKeys::from(key_byte) {
|
||||
GX502GWKeys::LedBrightUp => {
|
||||
let mut bright = rogcore.config().brightness;
|
||||
@@ -159,7 +149,7 @@ impl Laptop for LaptopGX502GW {
|
||||
"Unmapped key, attempt to pass to virtual device: {:?}, {:X?}",
|
||||
&key_byte, &key_byte
|
||||
);
|
||||
virt(key_byte);
|
||||
rogcore.virt_keys().press(key_byte);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user