Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add support for Razer Naga V2 Pro (Wired + Wireless) #2113

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ The devices below are fully feature supported by OpenRazer, which means all avai
| Razer DeathAdder V2 Lite | 1532:00A1 |
| Razer Viper V2 Pro (Wired) | 1532:00A5 |
| Razer Viper V2 Pro (Wireless) | 1532:00A6 |
| Razer Naga V2 Pro (Wired) | 1532:00A7 |
| Razer Naga V2 Pro (Wireless) | 1532:00A8 |
| Razer Basilisk V3 Pro (Wired) | 1532:00AA |
| Razer Basilisk V3 Pro (Wireless) | 1532:00AB |
| Razer DeathAdder V3 | 1532:00B2 |
Expand Down
53 changes: 53 additions & 0 deletions daemon/openrazer_daemon/hardware/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1098,6 +1098,59 @@ def _close(self):
self._battery_manager.close()


class RazerNagaV2ProWired(__RazerDeviceBrightnessSuspend):
"""
Class for the Razer Naga V2 Pro (Wired)
"""
USB_VID = 0x1532
USB_PID = 0x00A7
HAS_MATRIX = True
WAVE_DIRS = (1, 2)
MATRIX_DIMS = [1, 3]

DEDICATED_MACRO_KEYS = True
METHODS = ['get_device_type_mouse', 'max_dpi', 'get_dpi_xy', 'set_dpi_xy', 'get_poll_rate', 'set_poll_rate', 'get_dpi_stages', 'set_dpi_stages',
# Macros
'get_macros', 'delete_macro', 'add_macro',
# Battery
'get_battery', 'is_charging', 'get_idle_time', 'set_idle_time', 'get_low_battery_threshold', 'set_low_battery_threshold',
# Logo
'get_logo_brightness', 'set_logo_brightness',
'set_logo_wave', 'set_logo_static', 'set_logo_spectrum', 'set_logo_none', 'set_logo_reactive', 'set_logo_breath_random', 'set_logo_breath_single', 'set_logo_breath_dual',
# Thumbgrid
'set_static_effect', 'set_spectrum_effect', 'set_reactive_effect', 'set_none_effect', 'set_breath_random_effect', 'set_breath_single_effect', 'set_breath_dual_effect',
# Custom frame
'set_custom_effect', 'set_key_row']

DPI_MAX = 30000

DEVICE_IMAGE = "https://dl.razerzone.com/src2/6292/6292-1-en-v1.png"


class RazerNagaV2ProWireless(RazerNagaV2ProWired):
"""
Class for the Razer Naga V2 Pro (Wireless)
"""
USB_PID = 0x00A8
METHODS = RazerNagaV2ProWired.METHODS + ['set_charge_effect', 'set_charge_colour']

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)

self._battery_manager = _BatteryManager(self, self._device_number, 'Razer Naga V2 Pro (Wireless)')
self._battery_manager.active = self.config.getboolean('Startup', 'battery_notifier', fallback=False)
self._battery_manager.frequency = self.config.getint('Startup', 'battery_notifier_freq', fallback=10 * 60)
self._battery_manager.percent = self.config.getint('Startup', 'battery_notifier_percent', fallback=33)

def _close(self):
"""
Close the key manager
"""
super()._close()

self._battery_manager.close()


class RazerDeathAdder1800(__RazerDevice):
"""
Class for the Razer DeathAdder 1800
Expand Down
158 changes: 158 additions & 0 deletions driver/razermouse_driver.c

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions driver/razermouse_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@
#define USB_DEVICE_ID_RAZER_DEATHADDER_V2_LITE 0x00A1
#define USB_DEVICE_ID_RAZER_VIPER_V2_PRO_WIRED 0x00A5
#define USB_DEVICE_ID_RAZER_VIPER_V2_PRO_WIRELESS 0x00A6
#define USB_DEVICE_ID_RAZER_NAGA_V2_PRO_WIRED 0x00A7
#define USB_DEVICE_ID_RAZER_NAGA_V2_PRO_WIRELESS 0x00A8
#define USB_DEVICE_ID_RAZER_BASILISK_V3_PRO_WIRED 0x00AA
#define USB_DEVICE_ID_RAZER_BASILISK_V3_PRO_WIRELESS 0x00AB
#define USB_DEVICE_ID_RAZER_DEATHADDER_V3 0x00B2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@
<modalias>usb:v1532p00A1d*</modalias>
<modalias>usb:v1532p00A5d*</modalias>
<modalias>usb:v1532p00A6d*</modalias>
<modalias>usb:v1532p00A7d*</modalias>
<modalias>usb:v1532p00A8d*</modalias>
<modalias>usb:v1532p00AAd*</modalias>
<modalias>usb:v1532p00ABd*</modalias>
<modalias>usb:v1532p00B2d*</modalias>
Expand Down
2 changes: 1 addition & 1 deletion install_files/udev/99-razer.rules
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GOTO="razer_end"
LABEL="razer_vendor"

# Mice
ATTRS{idProduct}=="0013|0016|0020|0024|0025|0029|002e|002f|0032|0034|0036|0037|0038|0039|003e|003f|0040|0041|0042|0043|0044|0045|0046|0048|004c|004f|0050|0053|0054|0059|005a|005b|005c|005e|0060|0062|0064|0065|0067|006a|006b|006c|006e|006f|0070|0071|0072|0073|0077|0078|007a|007b|007c|007d|0080|0083|0084|0085|0086|0088|008a|008c|008d|008f|0090|0091|0094|0095|0096|0098|0099|009a|009c|009e|009f|00a1|00a5|00a6|00aa|00ab|00b2|00b3|00b6|00b7", \
ATTRS{idProduct}=="0013|0016|0020|0024|0025|0029|002e|002f|0032|0034|0036|0037|0038|0039|003e|003f|0040|0041|0042|0043|0044|0045|0046|0048|004c|004f|0050|0053|0054|0059|005a|005b|005c|005e|0060|0062|0064|0065|0067|006a|006b|006c|006e|006f|0070|0071|0072|0073|0077|0078|007a|007b|007c|007d|0080|0083|0084|0085|0086|0088|008a|008c|008d|008f|0090|0091|0094|0095|0096|0098|0099|009a|009c|009e|009f|00a1|00a5|00a6|00a7|00a8|00aa|00ab|00b2|00b3|00b6|00b7", \
ATTRS{idVendor}=="1532", \
ENV{ID_RAZER_CHROMA}="1", ENV{RAZER_DRIVER}="razermouse"

Expand Down
32 changes: 32 additions & 0 deletions pylib/openrazer/_fake_driver/razernagav2prowired.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# DO NOT EDIT THIS FILE!
# You can regenerate all fake driver files with ./scripts/generate_all_fake_drivers.sh -f
[device]
dir_name = 0003:1532:00A7.0001
name = Razer Naga V2 Pro (Wired)
files = r,charge_level,255
rw,charge_low_threshold,38
r,charge_status,1
rw,device_idle_time,600
rw,device_mode,0x0000
r,device_serial,XX00000000A7
r,device_type,%(name)s
rw,dpi,800:800
rw,dpi_stages,0x010320032005dc05dc
r,firmware_version,v1.0
rw,logo_led_brightness,0
w,logo_matrix_effect_breath
w,logo_matrix_effect_none
w,logo_matrix_effect_reactive
w,logo_matrix_effect_spectrum
w,logo_matrix_effect_static
w,logo_matrix_effect_wave
rw,matrix_brightness,0
w,matrix_custom_frame
w,matrix_effect_breath
w,matrix_effect_custom
w,matrix_effect_none
w,matrix_effect_reactive
w,matrix_effect_spectrum
w,matrix_effect_static
rw,poll_rate,500
r,version,1.0.0
34 changes: 34 additions & 0 deletions pylib/openrazer/_fake_driver/razernagav2prowireless.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# DO NOT EDIT THIS FILE!
# You can regenerate all fake driver files with ./scripts/generate_all_fake_drivers.sh -f
[device]
dir_name = 0003:1532:00A8.0001
name = Razer Naga V2 Pro (Wireless)
files = w,charge_colour
w,charge_effect
r,charge_level,255
rw,charge_low_threshold,38
r,charge_status,1
rw,device_idle_time,600
rw,device_mode,0x0000
r,device_serial,XX00000000A8
r,device_type,%(name)s
rw,dpi,800:800
rw,dpi_stages,0x010320032005dc05dc
r,firmware_version,v1.0
rw,logo_led_brightness,0
w,logo_matrix_effect_breath
w,logo_matrix_effect_none
w,logo_matrix_effect_reactive
w,logo_matrix_effect_spectrum
w,logo_matrix_effect_static
w,logo_matrix_effect_wave
rw,matrix_brightness,0
w,matrix_custom_frame
w,matrix_effect_breath
w,matrix_effect_custom
w,matrix_effect_none
w,matrix_effect_reactive
w,matrix_effect_spectrum
w,matrix_effect_static
rw,poll_rate,500
r,version,1.0.0
2 changes: 1 addition & 1 deletion scripts/generate_all_fake_drivers.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ set -e

if [ "$1" = "-f" ]; then
echo "Removing existing fake driver files..."
rm $(dirname "$0")/../pylib/openrazer/_fake_driver/*.cfg
rm -f $(dirname "$0")/../pylib/openrazer/_fake_driver/*.cfg
fi

drivers=$(ls driver/razer*_driver.c | cut -d'/' -f2 | cut -d'_' -f1)
Expand Down