Skip to content

Commit

Permalink
Add Razer Naga Epic
Browse files Browse the repository at this point in the history
Fixes #197
  • Loading branch information
terricain authored and z3ntu committed Oct 13, 2020
1 parent 2399787 commit 11f9679
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ The below devices are fully feature supported by OpenRazer which means all avail
| --------------------------------------------- | ----------- |
| Razer Orochi 2011 | 1532:0013 |
| Razer DeathAdder 3.5G | 1532:0016 |
| Razer Naga Epic | 1532:001F |
| Razer Abyssus 1800 | 1532:0020 |
| Razer Mamba 2012 (Wired) | 1532:0024 |
| Razer Mamba 2012 (Wireless) | 1532:0025 |
Expand Down
44 changes: 44 additions & 0 deletions daemon/openrazer_daemon/hardware/mouse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1982,3 +1982,47 @@ def _close(self):
super(RazerBasiliskXHyperSpeed, self)._close()

self._battery_manager.close()


class RazerNagaEpic(__RazerDevice):
"""
Class for the Razer Naga Hex
"""
EVENT_FILE_REGEX = re.compile(r'.*Razer_Razer_Naga_Epic-if01-event-kbd')

USB_VID = 0x1532
USB_PID = 0x001F
DEDICATED_MACRO_KEYS = True
METHODS = ['get_device_type_mouse', 'max_dpi', 'get_dpi_xy_byte', 'set_dpi_xy_byte', 'get_poll_rate', 'set_poll_rate',
'get_scroll_effect', 'get_scroll_brightness', 'set_scroll_brightness', 'set_scroll_static', 'set_scroll_spectrum',
'get_battery', 'is_charging', 'set_idle_time', 'set_low_battery_threshold']

# DEVICE_IMAGE = "TODO"

DPI_MAX = 5600

def _suspend_device(self):
"""
Suspend the device
Get the current brightness level, store it for later and then set the brightness to 0
"""
self.suspend_args.clear()
self.suspend_args['brightness'] = _da_get_scroll_brightness(self)

# Todo make it context?
self.disable_notify = True
_da_set_scroll_brightness(self, 0)
self.disable_notify = False

def _resume_device(self):
"""
Resume the device
Get the last known brightness and then set the brightness
"""
scroll_brightness = self.suspend_args.get('brightness', 255)

self.disable_notify = True
_da_set_scroll_brightness(self, scroll_brightness)
self.disable_notify = False
32 changes: 32 additions & 0 deletions driver/razermouse_driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,10 @@ static ssize_t razer_attr_read_device_type(struct device *dev, struct device_att
device_type = "Razer Naga 2012\n";
break;

case USB_DEVICE_ID_RAZER_NAGA_EPIC:
device_type = "Razer Naga Epic\n";
break;

case USB_DEVICE_ID_RAZER_NAGA_2014:
device_type = "Razer Naga 2014\n";
break;
Expand Down Expand Up @@ -1140,6 +1144,7 @@ static ssize_t razer_attr_write_mouse_dpi(struct device *dev, struct device_attr
break;

// Damn naga hex only uses 1 byte per x, y dpi
case USB_DEVICE_ID_RAZER_NAGA_EPIC:
case USB_DEVICE_ID_RAZER_NAGA_HEX_RED:
case USB_DEVICE_ID_RAZER_NAGA_HEX:
case USB_DEVICE_ID_RAZER_NAGA_2012:
Expand Down Expand Up @@ -1273,6 +1278,7 @@ static ssize_t razer_attr_read_mouse_dpi(struct device *dev, struct device_attri
return sprintf(buf, "%u:%u\n", device->orochi2011_dpi, device->orochi2011_dpi);
break;

case USB_DEVICE_ID_RAZER_NAGA_EPIC:
case USB_DEVICE_ID_RAZER_NAGA_HEX_RED:
case USB_DEVICE_ID_RAZER_NAGA_HEX:
case USB_DEVICE_ID_RAZER_NAGA_2012:
Expand Down Expand Up @@ -1320,6 +1326,7 @@ static ssize_t razer_attr_read_mouse_dpi(struct device *dev, struct device_attri
device->usb_pid == USB_DEVICE_ID_RAZER_NAGA_HEX_RED ||
device->usb_pid == USB_DEVICE_ID_RAZER_NAGA_2012 ||
device->usb_pid == USB_DEVICE_ID_RAZER_DEATHADDER_2013 ||
device->usb_pid == USB_DEVICE_ID_RAZER_NAGA_EPIC ||
device->usb_pid == USB_DEVICE_ID_RAZER_ABYSSUS_1800) { // NagaHex is crap uses only byte for dpi
dpi_x = response.arguments[0];
dpi_y = response.arguments[1];
Expand Down Expand Up @@ -3736,6 +3743,18 @@ static int razer_mouse_probe(struct hid_device *hdev, const struct hid_device_id
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_charge_low_threshold);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_device_idle_time);
break;

case USB_DEVICE_ID_RAZER_NAGA_EPIC:
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_dpi);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_poll_rate);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_charge_low_threshold);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_device_idle_time);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_charge_level);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_charge_status);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_scroll_led_brightness);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_scroll_led_rgb);
CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_scroll_led_effect);
break;
}

}
Expand Down Expand Up @@ -4178,6 +4197,18 @@ static void razer_mouse_disconnect(struct hid_device *hdev)
device_remove_file(&hdev->dev, &dev_attr_charge_low_threshold);
device_remove_file(&hdev->dev, &dev_attr_device_idle_time);
break;

case USB_DEVICE_ID_RAZER_NAGA_EPIC:
device_remove_file(&hdev->dev, &dev_attr_dpi);
device_remove_file(&hdev->dev, &dev_attr_poll_rate);
device_remove_file(&hdev->dev, &dev_attr_charge_low_threshold);
device_remove_file(&hdev->dev, &dev_attr_device_idle_time);
device_remove_file(&hdev->dev, &dev_attr_charge_level);
device_remove_file(&hdev->dev, &dev_attr_charge_status);
device_remove_file(&hdev->dev, &dev_attr_scroll_led_brightness);
device_remove_file(&hdev->dev, &dev_attr_scroll_led_rgb);
device_remove_file(&hdev->dev, &dev_attr_scroll_led_effect);
break;
}

}
Expand Down Expand Up @@ -4243,6 +4274,7 @@ static const struct hid_device_id razer_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_DEATHADDER_2000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_ATHERIS_RECEIVER) },
{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_BASILISK_X_HYPERSPEED) },
{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_NAGA_EPIC) },
{ 0 }
};

Expand Down
1 change: 1 addition & 0 deletions driver/razermouse_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

#define USB_DEVICE_ID_RAZER_OROCHI_2011 0x0013
#define USB_DEVICE_ID_RAZER_DEATHADDER_3_5G 0x0016
#define USB_DEVICE_ID_RAZER_NAGA_EPIC 0x001F
#define USB_DEVICE_ID_RAZER_ABYSSUS_1800 0x0020
#define USB_DEVICE_ID_RAZER_MAMBA_2012_WIRED 0x0024
#define USB_DEVICE_ID_RAZER_MAMBA_2012_WIRELESS 0x0025
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|002e|002f|0032|0034|0036|0037|0038|0039|0040|0041|0042|0043|0044|0045|0046|0048|004c|004f|0050|0053|0054|0059|005a|005b|005c|005e|0060|0062|0064|0067|006a|006b|006c|006e|006f|0070|0071|0072|0073|0078|007a|007b|0083|0084|008a", \
ATTRS{idProduct}=="0013|0016|001f|0020|0024|0025|002e|002f|0032|0034|0036|0037|0038|0039|0040|0041|0042|0043|0044|0045|0046|0048|004c|004f|0050|0053|0054|0059|005a|005b|005c|005e|0060|0062|0064|0067|006a|006b|006c|006e|006f|0070|0071|0072|0073|0078|007a|007b|0083|0084|008a", \
ATTRS{idVendor}=="1532", \
ENV{ID_RAZER_CHROMA}="1", ENV{RAZER_DRIVER}="razermouse"

Expand Down

0 comments on commit 11f9679

Please sign in to comment.