From 21f631f68ca961715b1b00ab15c7c14441697904 Mon Sep 17 00:00:00 2001 From: xzeldon Date: Wed, 11 Dec 2024 01:54:26 +0300 Subject: [PATCH] feat: add DeathAdder V3 HyperSpeed support (#1) --- README.md | 4 ++-- src/devices.rs | 17 +++++++++++++---- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index caa814a..51310a5 100644 --- a/README.md +++ b/README.md @@ -10,9 +10,9 @@ Show your wireless Razer devices battery levels in your system tray. -> This is a work in progress and currently support only **Razer DeathAdder V3 Pro**. +> This is a work in progress and currently support only **Razer DeathAdder V3 Pro** and **Razer DeathAdder V3 HyperSpeed**. -> Currently, this works only on **Windows**, should work on **Linux** if you _add udev rule to get access to usb devices_ (see [here](https://github.com/libusb/hidapi/blob/master/udev/69-hid.rules)) and remove/`cfg(windows)` some platform-specific code. But I haven't tested yet. +> Currently, this works only on **Windows**. ## Usage diff --git a/src/devices.rs b/src/devices.rs index d97ca2d..b0f0c08 100644 --- a/src/devices.rs +++ b/src/devices.rs @@ -28,7 +28,9 @@ impl DeviceInfo { pub const fn transaction_id(&self) -> u8 { match self.pid { pid if pid == RAZER_DEATHADDER_V3_PRO_WIRED.pid - || pid == RAZER_DEATHADDER_V3_PRO_WIRELESS.pid => + || pid == RAZER_DEATHADDER_V3_PRO_WIRELESS.pid + || pid == RAZER_DEATHADDER_V3_HYPERSPEED_WIRED.pid + || pid == RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS.pid => { 0x1F } @@ -38,11 +40,18 @@ impl DeviceInfo { } pub const RAZER_DEATHADDER_V3_PRO_WIRED: DeviceInfo = - DeviceInfo::new("Razer DeathAdder V3 Pro", 0x00B6, 0, 1, 2); + DeviceInfo::new("Razer DeathAdder V3 Pro (Wired)", 0x00B6, 0, 1, 2); pub const RAZER_DEATHADDER_V3_PRO_WIRELESS: DeviceInfo = - DeviceInfo::new("Razer DeathAdder V3 Pro", 0x00B7, 0, 1, 2); + DeviceInfo::new("Razer DeathAdder V3 Pro (Wireless)", 0x00B7, 0, 1, 2); -pub const RAZER_DEVICE_LIST: [DeviceInfo; 2] = [ +pub const RAZER_DEATHADDER_V3_HYPERSPEED_WIRED: DeviceInfo = + DeviceInfo::new("Razer DeathAdder V3 HyperSpeed (Wired)", 0x00C4, 0, 1, 2); +pub const RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS: DeviceInfo = + DeviceInfo::new("Razer DeathAdder V3 HyperSpeed (Wireless)", 0x00C5, 0, 1, 2); + +pub const RAZER_DEVICE_LIST: [DeviceInfo; 4] = [ RAZER_DEATHADDER_V3_PRO_WIRED, RAZER_DEATHADDER_V3_PRO_WIRELESS, + RAZER_DEATHADDER_V3_HYPERSPEED_WIRED, + RAZER_DEATHADDER_V3_HYPERSPEED_WIRELESS, ];