From 6afb190527a456e1d9df3e2bac5d8b6cf2558fcc Mon Sep 17 00:00:00 2001
From: Dennis Lambe Jr <malsyned@malsyned.net>
Date: Tue, 5 May 2020 17:09:36 -0400
Subject: [PATCH] driver: raise maximum DPI to 20000

This is required for several new devices.

Fixes #1379
---
 driver/razerchromacommon.c                  | 4 ++--
 scripts/razer_mouse/driver/set_mouse_dpi.py | 8 ++++----
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/driver/razerchromacommon.c b/driver/razerchromacommon.c
index 31a44a09..b66767cd 100644
--- a/driver/razerchromacommon.c
+++ b/driver/razerchromacommon.c
@@ -1068,8 +1068,8 @@ struct razer_report razer_chroma_misc_set_dpi_xy(unsigned char variable_storage,
     struct razer_report report = get_razer_report(0x04, 0x05, 0x07);
 
     // Keep the DPI within bounds
-    dpi_x = clamp_u16(dpi_x, 128, 16000);
-    dpi_y = clamp_u16(dpi_y, 128, 16000);
+    dpi_x = clamp_u16(dpi_x, 100, 20000);
+    dpi_y = clamp_u16(dpi_y, 100, 20000);
 
     report.arguments[0] = VARSTORE;
 
diff --git a/scripts/razer_mouse/driver/set_mouse_dpi.py b/scripts/razer_mouse/driver/set_mouse_dpi.py
index 05b63587..46bc0f8c 100644
--- a/scripts/razer_mouse/driver/set_mouse_dpi.py
+++ b/scripts/razer_mouse/driver/set_mouse_dpi.py
@@ -22,8 +22,8 @@ def parse_args():
     parser = argparse.ArgumentParser(description="Set the mouse DPI")
     parser.add_argument('-d', '--device', type=str, help="Device string like \"0003:1532:0045.000C\"")
 
-    parser.add_argument('--dpi_x', required=True, type=int, help="DPI on the X axis (100, 16000)")
-    parser.add_argument('--dpi_y', type=int, help="DPI on the Y axis (if omitted, dpi_x is used), (100, 16000)")
+    parser.add_argument('--dpi_x', required=True, type=int, help="DPI on the X axis (100, 20000)")
+    parser.add_argument('--dpi_y', type=int, help="DPI on the Y axis (if omitted, dpi_x is used), (100, 20000)")
 
     args = parser.parse_args()
     return args
@@ -50,11 +50,11 @@ def run():
         print("Multiple mouse directories found. Rerun with -d", file=sys.stderr)
         sys.exit(1)
 
-    dpi_x = clamp_to_min_max(args.dpi_x, 100, 16000)
+    dpi_x = clamp_to_min_max(args.dpi_x, 100, 20000)
     if args.dpi_y is None:
         byte_string = struct.pack(">H", dpi_x)
     else:
-        dpi_y = clamp_to_min_max(args.dpi_y, 100, 16000)
+        dpi_y = clamp_to_min_max(args.dpi_y, 100, 20000)
         byte_string = struct.pack(">HH", dpi_x, dpi_y)
 
     set_mouse_dpi_filepath = os.path.join(mouse_dir, "dpi")
-- 
GitLab