From e34f08588023ec4e05521e21f5fdc31f7f2c737e Mon Sep 17 00:00:00 2001 From: Luke Date: Sun, 19 Apr 2020 16:58:38 +1200 Subject: [PATCH] Update readme --- README.md | 4 +++- rog-lib/src/core.rs | 10 ++++------ rog-lib/src/laptops.rs | 3 ++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 6b0baeb2..635c4c5a 100644 --- a/README.md +++ b/README.md @@ -4,6 +4,8 @@ rog-core is a utility for Linux to control many aspects (eventually) of the ASUS The laptop I currently have is the GX502RW and so I'll be using that for the basis of this app. If I get wireshark captures from others with different ROG laptops then I should be able to add something like laptop and feature detection. +This is not the optimal solution as I'm using libusb to capture the interface that contains the unread keys (kernel doesn't read them), which removes the volume+media control keys also. I'm now looking at the kernel source to see if I can add the inputs correctly so they show up as proper evdev events. + ## Requirements - `rustc`, `cargo` @@ -101,4 +103,4 @@ Then do `lsusb -vd 0b05:1866 > ~/laptop_info` and give that to me. ## License -Mozilla Public License 2 (MPL-2.0) \ No newline at end of file +Mozilla Public License 2 (MPL-2.0) diff --git a/rog-lib/src/core.rs b/rog-lib/src/core.rs index dbac2825..827a6fd2 100644 --- a/rog-lib/src/core.rs +++ b/rog-lib/src/core.rs @@ -67,6 +67,9 @@ impl RogCore { } dev_handle.set_auto_detach_kernel_driver(true).unwrap(); + dev_handle + .claim_interface(keys_interface_num) + .map_err(|err| AuraError::UsbError(err))?; Ok(RogCore { handle: dev_handle, @@ -164,9 +167,6 @@ impl RogCore { } pub fn poll_keyboard(&mut self, buf: &mut [u8; 32]) -> Result, AuraError> { - self.handle - .claim_interface(self.keys_interface_num) - .map_err(|err| AuraError::UsbError(err))?; let res = match self .handle @@ -174,6 +174,7 @@ impl RogCore { { Ok(o) => { if self.laptop.borrow().hotkey_group_bytes().contains(&buf[0]) { + println!("{:?}", buf); Ok(Some(o)) } else { Ok(None) @@ -181,9 +182,6 @@ impl RogCore { } Err(err) => Err(AuraError::UsbError(err)), }; - self.handle - .release_interface(self.keys_interface_num) - .map_err(|err| AuraError::UsbError(err))?; res } diff --git a/rog-lib/src/laptops.rs b/rog-lib/src/laptops.rs index 2bf557d0..334fcb6e 100644 --- a/rog-lib/src/laptops.rs +++ b/rog-lib/src/laptops.rs @@ -141,10 +141,11 @@ impl Laptop for LaptopGX502GW { } _ => { if key_byte != 0 { - info!("Unmapped key: {:X?}", &key_byte); + info!("Unmapped key: {:?}, {:X?}", &key_byte, &key_byte); } } } + info!("Pressed: {:?}, {:X?}", &key_byte, &key_byte); Ok(()) } fn hotkey_group_bytes(&self) -> &[u8] {