diff --git a/Cargo.lock b/Cargo.lock index 7d6c79a2..4c41c106 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -344,9 +344,9 @@ dependencies = [ [[package]] name = "hermit-abi" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d737e0f947a1864e93d33fdef4af8445a00d1ed8dc0c8ddb73139ea6abf15" +checksum = "61565ff7aaace3525556587bd2dc31d4a07071957be715e63ce7b1eccf51a8f4" dependencies = [ "libc", ] @@ -689,9 +689,9 @@ checksum = "8ea5119cdb4c55b55d432abb513a0429384878c15dde60cc77b1c99de1a95a6a" [[package]] name = "syn" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0df0eb663f387145cab623dea85b09c2c5b4b0aef44e945d928e682fce71bb03" +checksum = "410a7488c0a728c7ceb4ad59b9567eb4053d02e8cc7f5c0e0eeeb39518369213" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index f4cec2c7..09f1fcaa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,7 +17,7 @@ rusb = "^0.5.5" gumdrop = "^0.8.0" dbus = { version = "^0.8.2", features = ["futures"] } dbus-tokio = "^0.5.1" -tokio = { version = "0.2.19", features = ["rt-threaded", "macros"] } +tokio = { version = "0.2.4", features = ["rt-threaded", "macros"] } serde = "1.0" serde_derive = "1.0" diff --git a/README.md b/README.md index 159c64ef..7b08017b 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,14 @@ Fan mode toggling requires a newer kernel. I'm unsure when the patches required **Supported:** -- GX502 (Tested on GX502GW) +- GX502 (product 0x1866) (Tested on GX502GW) **Please help test or provide info for:** -- GA502 (attempts to use same profile as GX502GW) -- GL753 (attempted support from researching 2nd-hand info, multizone may work) +- GL703(0x1869), GA502 (attempts to use same profile as GX502GW) +- GL553(0x1854) GL753 (attempted support from researching 2nd-hand info, multizone may work) + +If the USB product ID is 0x1866 or 0x1869 then the per-key profile with hotkeys *should* work - 0x1866 is tested as this is what I have. ## Wireshark captures diff --git a/src/aura.rs b/src/aura.rs index 3e72526c..60844819 100644 --- a/src/aura.rs +++ b/src/aura.rs @@ -54,7 +54,7 @@ pub fn aura_brightness_bytes(brightness: u8) -> [u8; 17] { /// - 01 = breathe (can set two colours) /// - 02 = cycle (through all colours) /// - 03 = rainbow -/// - 04 = rain +/// - 04 = rain (byte 9 sets random colour) /// - 05 = random keys, red, white, turquoise /// - 06 = pressed keys light up and fade /// - 07 = pressed key emits laser @@ -137,8 +137,14 @@ impl From for [u8; LED_MSG_LEN] { msg[7] = settings.speed as u8; msg[8] = settings.direction as u8; } + SetAuraBuiltin::Rain(settings) => { + msg[4] = settings.colour.0; + msg[5] = settings.colour.1; + msg[6] = settings.colour.2; + msg[7] = settings.speed as u8; + msg[9] = settings.colour2.2; + } SetAuraBuiltin::Breathe(settings) => { - msg[3] = 0x01; msg[4] = settings.colour.0; msg[5] = settings.colour.1; msg[6] = settings.colour.2; @@ -150,8 +156,7 @@ impl From for [u8; LED_MSG_LEN] { SetAuraBuiltin::Cycle(settings) | SetAuraBuiltin::Disco(settings) => { msg[7] = settings.speed as u8; } - SetAuraBuiltin::Rain(settings) - | SetAuraBuiltin::Highlight(settings) + SetAuraBuiltin::Highlight(settings) | SetAuraBuiltin::Laser(settings) | SetAuraBuiltin::Ripple(settings) => { msg[4] = settings.colour.0; @@ -271,7 +276,7 @@ impl Default for BuiltInModeBytes { rainbow: <[u8; LED_MSG_LEN]>::from(SetAuraBuiltin::Rainbow( SingleSpeedDirection::default(), )), - rain: <[u8; LED_MSG_LEN]>::from(SetAuraBuiltin::Rain(SingleColourSpeed::default())), + rain: <[u8; LED_MSG_LEN]>::from(SetAuraBuiltin::Rain(TwoColourSpeed::default())), random: <[u8; LED_MSG_LEN]>::from(SetAuraBuiltin::Disco(SingleSpeed::default())), highlight: <[u8; LED_MSG_LEN]>::from(SetAuraBuiltin::Highlight( SingleColourSpeed::default(), diff --git a/src/cli_options.rs b/src/cli_options.rs index aa8852e8..5f6b712e 100644 --- a/src/cli_options.rs +++ b/src/cli_options.rs @@ -159,7 +159,7 @@ pub enum SetAuraBuiltin { #[options(help = "rainbow cycling in one of four directions")] Rainbow(SingleSpeedDirection), #[options(help = "random pattern mimicking raindrops")] - Rain(SingleColourSpeed), + Rain(TwoColourSpeed), #[options(help = "random pattern of three preset colours")] Disco(SingleSpeed), #[options(help = "pressed keys are highlighted to fade")] diff --git a/src/core.rs b/src/core.rs index 9b60da49..9620ef75 100644 --- a/src/core.rs +++ b/src/core.rs @@ -53,8 +53,13 @@ pub(crate) struct RogCore { } impl RogCore { - pub(crate) fn new(laptop: &dyn Laptop) -> Result { - let mut dev_handle = RogCore::get_device(laptop.usb_vendor(), laptop.usb_product())?; + pub(crate) fn new( + vendor: u16, + product: u16, + led_endpoint: u8, + key_endpoint: u8, + ) -> Result { + let mut dev_handle = RogCore::get_device(vendor, product)?; dev_handle.set_active_configuration(0).unwrap_or(()); let dev_config = dev_handle.device().config_descriptor(0).unwrap(); @@ -63,7 +68,7 @@ impl RogCore { for iface in dev_config.interfaces() { for desc in iface.descriptors() { for endpoint in desc.endpoint_descriptors() { - if endpoint.address() == laptop.key_endpoint() { + if endpoint.address() == key_endpoint { debug!("INTERVAL: {:?}", endpoint.interval()); debug!("MAX: {:?}", endpoint.max_packet_size()); debug!("SYNC: {:?}", endpoint.sync_type()); @@ -83,8 +88,8 @@ impl RogCore { Ok(RogCore { handle: dev_handle, initialised: false, - led_endpoint: laptop.led_endpoint(), - keys_endpoint: laptop.key_endpoint(), + led_endpoint: led_endpoint, + keys_endpoint: key_endpoint, config: Config::default().read(), virt_keys: VirtKeys::new(), }) diff --git a/src/daemon.rs b/src/daemon.rs index 461de199..2796c42f 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -28,7 +28,13 @@ type EffectType = Arc>>>>; // DBUS processing takes 6ms if not tokiod pub async fn start_daemon() -> Result<(), Box> { let laptop = match_laptop(); - let mut rogcore = RogCore::new(&*laptop).map_or_else( + let mut rogcore = RogCore::new( + laptop.usb_vendor(), + laptop.usb_product(), + laptop.led_endpoint(), + laptop.key_endpoint(), + ) + .map_or_else( |err| { error!("{}", err); panic!("{}", err); diff --git a/src/laptops/mod.rs b/src/laptops/mod.rs index 135c43b2..87ee3729 100644 --- a/src/laptops/mod.rs +++ b/src/laptops/mod.rs @@ -17,7 +17,7 @@ pub(crate) fn match_laptop() -> Box { let device_desc = device.device_descriptor().unwrap(); if device_desc.vendor_id() == 0x0b05 { match device_desc.product_id() { - 0x1866 => { + 0x1869 | 0x1866 => { info!("Found GX502 or similar"); return Box::new(LaptopGX502::new()); }