diff --git a/.gitignore b/.gitignore index ea8c4bf7..99a7d022 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ /target +vendor.tar.xz \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b6b3e320..bd35b50b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,13 +5,18 @@ 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.11.1] - 2020-11-06 ### 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-09-05 +## [0.11.0] - 2020-09-06 ### 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 diff --git a/Cargo.lock b/Cargo.lock index 1436fec9..35627db9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -716,7 +716,7 @@ dependencies = [ [[package]] name = "rog-daemon" -version = "0.11.0" +version = "0.11.1" dependencies = [ "dbus", "dbus-tokio", diff --git a/README.md b/README.md index 8ce57f1b..e62542bd 100644 --- a/README.md +++ b/README.md @@ -222,4 +222,5 @@ Mozilla Public License 2 (MPL-2.0) - [flukejones](https://github.com/flukejones/), project maintainer. - [tuxuser](https://github.com/tuxuser/) - [aspann](https://github.com/aspann) +- [meumeu](https://github.com/Meumeu) - Anyone missed? Please contact me \ No newline at end of file diff --git a/debian/changelog b/debian/changelog index 36e3eb87..8f6c32e5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,15 @@ +rog-core (0.11.1) focal; urgency=medium + + * 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 + + -- Luke Jones Thu, 11 Jun 2020 20:57:56 +1200 + rog-core (0.11.0) focal; urgency=medium * BREAKING CHANGE: diff --git a/reverse_eng/ga401/hid_desc_consumer_GA401IV_GA401IV.md b/reverse_eng/ga401/hid_desc_consumer_GA401IV_GA401IV.md new file mode 100644 index 00000000..688c7c14 --- /dev/null +++ b/reverse_eng/ga401/hid_desc_consumer_GA401IV_GA401IV.md @@ -0,0 +1,35 @@ +0x05, 0x01, // Usage Page (Generic Desktop Ctrls) +0x09, 0x06, // Usage (Keyboard) +0xA1, 0x01, // Collection (Application) +0x85, 0x09, // Report ID (9) +0x75, 0x01, // Report Size (1) +0x95, 0x08, // Report Count (8) +0x05, 0x07, // Usage Page (Kbrd/Keypad) +0x19, 0xE0, // Usage Minimum (0xE0) +0x29, 0xE7, // Usage Maximum (0xE7) +0x15, 0x00, // Logical Minimum (0) +0x25, 0x01, // Logical Maximum (1) +0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x95, 0x08, // Report Count (8) +0x75, 0x01, // Report Size (1) +0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x95, 0x05, // Report Count (5) +0x75, 0x01, // Report Size (1) +0x05, 0x08, // Usage Page (LEDs) +0x19, 0x01, // Usage Minimum (Num Lock) +0x29, 0x05, // Usage Maximum (Kana) +0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0x95, 0x01, // Report Count (1) +0x75, 0x03, // Report Size (3) +0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0x95, 0xF0, // Report Count (-16) +0x75, 0x01, // Report Size (1) +0x05, 0x07, // Usage Page (Kbrd/Keypad) +0x19, 0x00, // Usage Minimum (0x00) +0x29, 0xEF, // Usage Maximum (0xEF) +0x15, 0x00, // Logical Minimum (0) +0x25, 0x01, // Logical Maximum (1) +0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0xC0, // End Collection + +// 65 bytes diff --git a/reverse_eng/ga401/hid_desc_keyboad_GA401IV_GA401IV.md b/reverse_eng/ga401/hid_desc_keyboad_GA401IV_GA401IV.md new file mode 100644 index 00000000..89ca9af1 --- /dev/null +++ b/reverse_eng/ga401/hid_desc_keyboad_GA401IV_GA401IV.md @@ -0,0 +1,77 @@ +0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31) +0x09, 0x76, // Usage (0x76) +0xA1, 0x01, // Collection (Application) +0x85, 0x5A, // Report ID (90) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x05, // Report Count (5) +0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x3F, // Report Count (63) +0xB1, 0x00, // Feature (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0xC0, // End Collection +0x05, 0x0C, // Usage Page (Consumer) +0x09, 0x01, // Usage (Consumer Control) +0xA1, 0x01, // Collection (Application) +0x85, 0x02, // Report ID (2) +0x19, 0x00, // Usage Minimum (Unassigned) +0x2A, 0x3C, 0x02, // Usage Maximum (AC Format) +0x15, 0x00, // Logical Minimum (0) +0x26, 0x3C, 0x02, // Logical Maximum (572) +0x75, 0x10, // Report Size (16) +0x95, 0x02, // Report Count (2) +0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +0xC0, // End Collection +0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31) +0x09, 0x79, // Usage (0x79) +0xA1, 0x01, // Collection (Application) +0x85, 0x5D, // Report ID (93) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x1F, // Report Count (31) +0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x3F, // Report Count (63) +0x91, 0x00, // Output (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x3F, // Report Count (63) +0xB1, 0x00, // Feature (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0xC0, // End Collection +0x06, 0x31, 0xFF, // Usage Page (Vendor Defined 0xFF31) +0x09, 0x80, // Usage (0x80) +0xA1, 0x01, // Collection (Application) +0x85, 0x5E, // Report ID (94) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x05, // Report Count (5) +0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x75, 0x08, // Report Size (8) +0x95, 0x3F, // Report Count (63) +0xB1, 0x00, // Feature (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0xC0, // End Collection + diff --git a/reverse_eng/ga401/hid_desc_other_GA401IV_GA401IV.md b/reverse_eng/ga401/hid_desc_other_GA401IV_GA401IV.md new file mode 100644 index 00000000..957de8f1 --- /dev/null +++ b/reverse_eng/ga401/hid_desc_other_GA401IV_GA401IV.md @@ -0,0 +1,43 @@ +0x05, 0x01, // Usage Page (Generic Desktop Ctrls) +0x09, 0x06, // Usage (Keyboard) +0xA1, 0x01, // Collection (Application) +0x85, 0x01, // Report ID (1) +0x75, 0x01, // Report Size (1) +0x95, 0x08, // Report Count (8) +0x05, 0x07, // Usage Page (Kbrd/Keypad) +0x19, 0xE0, // Usage Minimum (0xE0) +0x29, 0xE7, // Usage Maximum (0xE7) +0x15, 0x00, // Logical Minimum (0) +0x25, 0x01, // Logical Maximum (1) +0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x95, 0x01, // Report Count (1) +0x75, 0x08, // Report Size (8) +0x81, 0x03, // Input (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x95, 0x05, // Report Count (5) +0x75, 0x01, // Report Size (1) +0x05, 0x08, // Usage Page (LEDs) +0x19, 0x01, // Usage Minimum (Num Lock) +0x29, 0x05, // Usage Maximum (Kana) +0x91, 0x02, // Output (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0x95, 0x01, // Report Count (1) +0x75, 0x03, // Report Size (3) +0x91, 0x03, // Output (Const,Var,Abs,No Wrap,Linear,Preferred State,No Null Position,Non-volatile) +0x95, 0x06, // Report Count (6) +0x75, 0x08, // Report Size (8) +0x15, 0x00, // Logical Minimum (0) +0x26, 0xFF, 0x00, // Logical Maximum (255) +0x05, 0x07, // Usage Page (Kbrd/Keypad) +0x19, 0x00, // Usage Minimum (0x00) +0x2A, 0xFF, 0x00, // Usage Maximum (0xFF) +0x81, 0x00, // Input (Data,Array,Abs,No Wrap,Linear,Preferred State,No Null Position) +0x95, 0xC0, // Report Count (-64) +0x75, 0x01, // Report Size (1) +0x05, 0x07, // Usage Page (Kbrd/Keypad) +0x19, 0x00, // Usage Minimum (0x00) +0x29, 0xEF, // Usage Maximum (0xEF) +0x15, 0x00, // Logical Minimum (0) +0x25, 0x01, // Logical Maximum (1) +0x81, 0x02, // Input (Data,Var,Abs,No Wrap,Linear,Preferred State,No Null Position) +0xC0, // End Collection + +// 83 bytes diff --git a/reverse_eng/ga401/lsusb_GA401IV_GA401IV.md b/reverse_eng/ga401/lsusb_GA401IV_GA401IV.md new file mode 100644 index 00000000..2dea5eb0 --- /dev/null +++ b/reverse_eng/ga401/lsusb_GA401IV_GA401IV.md @@ -0,0 +1,129 @@ +Bus 003 Device 002: ID 0b05:1866 ASUSTek Computer, Inc. N-KEY Device +Device Descriptor: + bLength 18 + bDescriptorType 1 + bcdUSB 2.00 + bDeviceClass 0 + bDeviceSubClass 0 + bDeviceProtocol 0 + bMaxPacketSize0 64 + idVendor 0x0b05 ASUSTek Computer, Inc. + idProduct 0x1866 + bcdDevice 0.02 + iManufacturer 1 ASUSTeK Computer Inc. + iProduct 2 N-KEY Device + iSerial 0 + bNumConfigurations 1 + Configuration Descriptor: + bLength 9 + bDescriptorType 2 + wTotalLength 0x005b + bNumInterfaces 3 + bConfigurationValue 1 + iConfiguration 0 + bmAttributes 0xe0 + Self Powered + Remote Wakeup + MaxPower 100mA + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 0 + bAlternateSetting 0 + bNumEndpoints 1 + bInterfaceClass 3 Human Interface Device + bInterfaceSubClass 1 Boot Interface Subclass + bInterfaceProtocol 1 Keyboard + iInterface 3 (error) + HID Device Descriptor: + bLength 9 + bDescriptorType 33 + bcdHID 1.10 + bCountryCode 0 Not supported + bNumDescriptors 1 + bDescriptorType 34 Report + wDescriptorLength 83 + Report Descriptors: + ** UNAVAILABLE ** + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x81 EP 1 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 1 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 1 + bAlternateSetting 0 + bNumEndpoints 1 + bInterfaceClass 3 Human Interface Device + bInterfaceSubClass 1 Boot Interface Subclass + bInterfaceProtocol 1 Keyboard + iInterface 1 ASUSTeK Computer Inc. + HID Device Descriptor: + bLength 9 + bDescriptorType 33 + bcdHID 1.10 + bCountryCode 0 Not supported + bNumDescriptors 1 + bDescriptorType 34 Report + wDescriptorLength 65 + Report Descriptors: + ** UNAVAILABLE ** + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x82 EP 2 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 1 + Interface Descriptor: + bLength 9 + bDescriptorType 4 + bInterfaceNumber 2 + bAlternateSetting 0 + bNumEndpoints 2 + bInterfaceClass 3 Human Interface Device + bInterfaceSubClass 1 Boot Interface Subclass + bInterfaceProtocol 1 Keyboard + iInterface 1 ASUSTeK Computer Inc. + HID Device Descriptor: + bLength 9 + bDescriptorType 33 + bcdHID 1.10 + bCountryCode 0 Not supported + bNumDescriptors 1 + bDescriptorType 34 Report + wDescriptorLength 167 + Report Descriptors: + ** UNAVAILABLE ** + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x83 EP 3 IN + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 1 + Endpoint Descriptor: + bLength 7 + bDescriptorType 5 + bEndpointAddress 0x04 EP 4 OUT + bmAttributes 3 + Transfer Type Interrupt + Synch Type None + Usage Type Data + wMaxPacketSize 0x0040 1x 64 bytes + bInterval 1 +Device Status: 0x0001 + Self Powered diff --git a/reverse_eng/ga502/dmi_info b/reverse_eng/ga502/dmi_info new file mode 100644 index 00000000..8e6277ee --- /dev/null +++ b/reverse_eng/ga502/dmi_info @@ -0,0 +1,7 @@ +cat /sys/class/dmi/id/product_name +ROG Zephyrus G15 GA502IU_GA502IU +cat /sys/class/dmi/id/product_family +ROG Zephyrus G15 +cat /sys/class/dmi/id/board_name +GA502IU + diff --git a/rog-core/Cargo.toml b/rog-core/Cargo.toml index ac0609b3..c0c912cd 100644 --- a/rog-core/Cargo.toml +++ b/rog-core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "rog-daemon" -version = "0.11.0" +version = "0.11.1" license = "MPL-2.0" readme = "README.md" authors = ["Luke "] diff --git a/rog-core/src/config.rs b/rog-core/src/config.rs index 7d98dad4..e03b0509 100644 --- a/rog-core/src/config.rs +++ b/rog-core/src/config.rs @@ -37,8 +37,8 @@ impl Config { .unwrap_or_else(|_| panic!("Could not deserialise {}", CONFIG_PATH)); self = c; } else { - self = - toml::from_str(&buf).expect(&format!("Could not deserialise {}", CONFIG_PATH)); + self = toml::from_str(&buf) + .unwrap_or_else(|_| panic!("Could not deserialise {}", CONFIG_PATH)); } } self diff --git a/rog-core/src/led_control.rs b/rog-core/src/led_control.rs index 97eb5272..1b6dee65 100644 --- a/rog-core/src/led_control.rs +++ b/rog-core/src/led_control.rs @@ -238,14 +238,17 @@ where #[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()) - .ok_or(AuraError::NotSupported)? - .to_owned(); - println!("{:X?}", &mode_next); - self.set_and_save(&mode_next, config).await?; - info!("Switched LED mode to {:#?}", self.supported_modes[index]); - Ok(()) + if let Some(mode) = self.supported_modes.get(index) { + let mode_next = config + .builtin_modes + .get_field_from(mode.to_owned().into()) + .ok_or(AuraError::NotSupported)? + .to_owned(); + println!("{:X?}", &mode_next); + self.set_and_save(&mode_next, config).await?; + info!("Switched LED mode to {:#?}", self.supported_modes[index]); + return Ok(()); + } + Err(AuraError::NotSupported) } } diff --git a/rog-core/src/main.rs b/rog-core/src/main.rs index 8cceebaf..858b0886 100644 --- a/rog-core/src/main.rs +++ b/rog-core/src/main.rs @@ -8,7 +8,7 @@ use rog_client::{ AuraDbusWriter, LED_MSG_LEN, }; -static VERSION: &str = "0.11.0"; +static VERSION: &str = "0.11.1"; #[derive(Debug, Options)] struct CLIStart {