diff --git a/README.md b/README.md index 668dcffb37d181ed1756827ae6d0278ba0fbd37e..bc655a41d1e05dcecfecc5643537c04612be1944 100644 --- a/README.md +++ b/README.md @@ -161,6 +161,7 @@ The devices below are fully feature supported by OpenRazer, which means all avai | Razer Base Station Chroma | 1532:0F08 | | Razer Chroma Hardware Development Kit (HDK) | 1532:0F09 | | Razer Mouse Bungee V3 Chroma | 1532:0F1D | +| Razer Base Station V2 Chroma | 1532:0F20 | #### Determining the Device ID Razer devices use a USB VID (Vendor ID) of `1532`. You can identify the USB PID (Product ID) by typing: diff --git a/daemon/openrazer_daemon/hardware/accessory.py b/daemon/openrazer_daemon/hardware/accessory.py index 43d3b9f3da07bf2ec39a5598c5920f00c1dfce19..c9b87591c05fb4888e5d11c178ca10100b4bbed1 100644 --- a/daemon/openrazer_daemon/hardware/accessory.py +++ b/daemon/openrazer_daemon/hardware/accessory.py @@ -99,3 +99,20 @@ class RazerMouseBungeeV3Chroma(_RazerDeviceBrightnessSuspend): 'set_custom_effect', 'set_key_row'] DEVICE_IMAGE = "https://assets2.razerzone.com/images/pnx.assets/03970e1bd220f3d2985c5e0060fb3bbf/razer-mouse-bungee-v3-chroma.png" + + +class RazerBaseStationV2Chroma(_RazerDeviceBrightnessSuspend): + """ + Class for the Razer Base Station V2 Chroma + """ + EVENT_FILE_REGEX = re.compile(r'.*RAZER_Razer_Base_Station_V2_Chroma-if01-event-kbd') + + USB_VID = 0x1532 + USB_PID = 0x0F20 + HAS_MATRIX = True + MATRIX_DIMS = [1, 8] + METHODS = ['get_device_type_accessory', 'set_static_effect', 'set_wave_effect', 'set_spectrum_effect', + 'set_none_effect', 'set_breath_random_effect', 'set_breath_single_effect', 'set_breath_dual_effect', + 'set_custom_effect', 'set_key_row'] + + DEVICE_IMAGE = "https://dl.razerzone.com/src/3897-1-EN-v2.png" diff --git a/driver/razeraccessory_driver.c b/driver/razeraccessory_driver.c index 05d55c12acd3275bb0fe90cf8ea5b15dc20fe5e6..1067e1ce35c6f1e08b6cc38f334c8e6b8a3ee452 100644 --- a/driver/razeraccessory_driver.c +++ b/driver/razeraccessory_driver.c @@ -148,6 +148,10 @@ static ssize_t razer_attr_read_device_type(struct device *dev, struct device_att device_type = "Razer Base Station Chroma\n"; break; + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: + device_type = "Razer Base Station V2 Chroma\n"; + break; + case USB_DEVICE_ID_RAZER_NOMMO_PRO: device_type = "Razer Nommo Pro\n"; break; @@ -222,6 +226,7 @@ static ssize_t razer_attr_write_mode_spectrum(struct device *dev, struct device_ break; case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_effect_spectrum(VARSTORE, ZERO_LED); report.transaction_id.id = 0x1F; break; @@ -337,6 +342,7 @@ static ssize_t razer_attr_write_mode_none(struct device *dev, struct device_attr case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_effect_none(VARSTORE, ZERO_LED); report.transaction_id.id = 0x1F; break; @@ -411,6 +417,7 @@ static ssize_t razer_attr_write_mode_custom(struct device *dev, struct device_at case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_effect_custom_frame(); report.transaction_id.id = 0x1F; break; @@ -459,6 +466,7 @@ static ssize_t razer_attr_write_mode_static(struct device *dev, struct device_at case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_effect_static(VARSTORE, ZERO_LED, (struct razer_rgb*) & buf[0]); report.transaction_id.id = 0x1F; break; @@ -509,6 +517,7 @@ static ssize_t razer_attr_write_mode_wave(struct device *dev, struct device_attr break; case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_effect_wave(VARSTORE, ZERO_LED, direction); report.transaction_id.id = 0x1F; break; @@ -563,6 +572,7 @@ static ssize_t razer_attr_write_mode_breath(struct device *dev, struct device_at case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: switch(count) { case 3: // Single colour mode report = razer_chroma_extended_matrix_effect_breathing_single(VARSTORE, ZERO_LED, (struct razer_rgb *)&buf[0]); @@ -683,6 +693,7 @@ static ssize_t razer_attr_write_set_key_row(struct device *dev, struct device_at case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_set_custom_frame2(row_id, start_col, stop_col, (unsigned char*)&buf[offset], 0); report.transaction_id.id = 0x1F; break; @@ -737,6 +748,7 @@ static ssize_t razer_attr_read_get_serial(struct device *dev, struct device_attr case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report.transaction_id.id = 0x1F; response_report = razer_send_payload(device->usb_dev, &report); strncpy(&serial_string[0], &response_report.arguments[0], 22); @@ -765,6 +777,7 @@ static ssize_t razer_attr_read_get_firmware_version(struct device *dev, struct d switch(device->usb_pid) { case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report.transaction_id.id = 0x1F; break; @@ -807,6 +820,7 @@ static ssize_t razer_attr_write_device_mode(struct device *dev, struct device_at switch(device->usb_pid) { case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report.transaction_id.id = 0x1F; break; } @@ -846,6 +860,7 @@ static ssize_t razer_attr_read_device_mode(struct device *dev, struct device_att switch(device->usb_pid) { case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report.transaction_id.id = 0x1F; break; } @@ -884,6 +899,7 @@ static ssize_t razer_attr_write_set_brightness(struct device *dev, struct device case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: report = razer_chroma_extended_matrix_brightness(VARSTORE, ZERO_LED, brightness); report.transaction_id.id = 0x1F; device->saved_brightness = brightness; @@ -932,6 +948,7 @@ static ssize_t razer_attr_read_set_brightness(struct device *dev, struct device_ case USB_DEVICE_ID_RAZER_GOLIATHUS_CHROMA_EXTENDED: case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: brightness = device->saved_brightness; break; @@ -1052,6 +1069,7 @@ static bool razer_accessory_match(struct hid_device *hdev, bool ignore_special_d switch (usb_dev->descriptor.idProduct) { case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: if (intf->cur_altsetting->desc.bInterfaceNumber != 0) { dev_info(&intf->dev, "skipping secondary interface\n"); return false; @@ -1088,6 +1106,7 @@ static int razer_accessory_probe(struct hid_device *hdev, const struct hid_devic case USB_DEVICE_ID_RAZER_CORE: case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: expected_protocol = 0; break; @@ -1143,6 +1162,7 @@ static int razer_accessory_probe(struct hid_device *hdev, const struct hid_devic case USB_DEVICE_ID_RAZER_CHROMA_BASE: case USB_DEVICE_ID_RAZER_CHROMA_HDK: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_matrix_effect_spectrum); // Spectrum effect } @@ -1155,6 +1175,7 @@ static int razer_accessory_probe(struct hid_device *hdev, const struct hid_devic case USB_DEVICE_ID_RAZER_NOMMO_PRO: case USB_DEVICE_ID_RAZER_NOMMO_CHROMA: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: CREATE_DEVICE_FILE(&hdev->dev, &dev_attr_matrix_effect_wave); // Wave effect break; } @@ -1229,6 +1250,7 @@ static void razer_accessory_disconnect(struct hid_device *hdev) case USB_DEVICE_ID_RAZER_CORE: case USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: expected_protocol = 0; break; @@ -1275,6 +1297,7 @@ static void razer_accessory_disconnect(struct hid_device *hdev) case USB_DEVICE_ID_RAZER_CHROMA_BASE: case USB_DEVICE_ID_RAZER_CHROMA_HDK: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: device_remove_file(&hdev->dev, &dev_attr_matrix_effect_spectrum); // Spectrum effect } @@ -1287,6 +1310,7 @@ static void razer_accessory_disconnect(struct hid_device *hdev) case USB_DEVICE_ID_RAZER_NOMMO_PRO: case USB_DEVICE_ID_RAZER_NOMMO_CHROMA: case USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA: + case USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA: device_remove_file(&hdev->dev, &dev_attr_matrix_effect_wave); // Wave effect break; } @@ -1357,6 +1381,7 @@ static const struct hid_device_id razer_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_NOMMO_CHROMA) }, { HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION) }, { HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA) }, + { HID_USB_DEVICE(USB_VENDOR_ID_RAZER,USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA) }, { 0 } }; diff --git a/driver/razeraccessory_driver.h b/driver/razeraccessory_driver.h index cdbfb54b2079e272a2a63ee4458973702ca98010..edc0dcc76685ffc998bf46181b979ac18319732c 100644 --- a/driver/razeraccessory_driver.h +++ b/driver/razeraccessory_driver.h @@ -24,6 +24,7 @@ #define USB_DEVICE_ID_RAZER_CHROMA_HDK 0x0F09 #define USB_DEVICE_ID_RAZER_KRAKEN_KITTY_EDITION 0x0F19 #define USB_DEVICE_ID_RAZER_MOUSE_BUNGEE_V3_CHROMA 0x0F1D +#define USB_DEVICE_ID_RAZER_BASE_STATION_V2_CHROMA 0x0F20 #define RAZER_ACCESSORY_WAIT_MIN_US 600 #define RAZER_ACCESSORY_WAIT_MAX_US 1000 diff --git a/install_files/appstream/io.github.openrazer.openrazer.metainfo.xml b/install_files/appstream/io.github.openrazer.openrazer.metainfo.xml index f45940b83dc7474cfb7e85c6b79bc1c3df9a38d9..d24d097d51e51205bae92bb6941056022fa649d2 100644 --- a/install_files/appstream/io.github.openrazer.openrazer.metainfo.xml +++ b/install_files/appstream/io.github.openrazer.openrazer.metainfo.xml @@ -143,5 +143,6 @@ <modalias>usb:v1532p0F09d*</modalias> <modalias>usb:v1532p0F19d*</modalias> <modalias>usb:v1532p0F1Dd*</modalias> + <modalias>usb:v1532p0F20d*</modalias> </provides> </component> diff --git a/install_files/udev/99-razer.rules b/install_files/udev/99-razer.rules index d26b716660adb37997f0b439131c77e8d7dd4693..f416e3f71ae6c6a4bec547b0a599736bf96f2bfc 100644 --- a/install_files/udev/99-razer.rules +++ b/install_files/udev/99-razer.rules @@ -20,7 +20,7 @@ ATTRS{idProduct}=="0501|0504|0506|0510|0527", \ ENV{ID_RAZER_CHROMA}="1", ENV{RAZER_DRIVER}="razerkraken" # Accessories (Speakers, Mousemats, Razer Core, etc) -ATTRS{idProduct}=="0068|0215|0517|0518|0c00|0c01|0c02|0f07|0f08|0f09|0f19|0f1d", \ +ATTRS{idProduct}=="0068|0215|0517|0518|0c00|0c01|0c02|0f07|0f08|0f09|0f19|0f1d|0f20", \ ATTRS{idVendor}=="1532", \ ENV{ID_RAZER_CHROMA}="1", ENV{RAZER_DRIVER}="razeraccessory" diff --git a/pylib/openrazer/_fake_driver/razerbasestationv2chroma.cfg b/pylib/openrazer/_fake_driver/razerbasestationv2chroma.cfg new file mode 100644 index 0000000000000000000000000000000000000000..8dcfffd67e529d46e3cb2292860217dbc94a0661 --- /dev/null +++ b/pylib/openrazer/_fake_driver/razerbasestationv2chroma.cfg @@ -0,0 +1,15 @@ +[device] +dir_name = 0003:1532:0F20.0001 +name = Razer Base Station V2 Chroma +files = r,device_serial,XX0000000F20 + r,device_type,%(name)s + r,firmware_version,v1.0 + rw,matrix_brightness,0 + w,matrix_custom_frame + w,matrix_effect_breath + w,matrix_effect_custom + w,matrix_effect_none + w,matrix_effect_spectrum + w,matrix_effect_static + w,matrix_effect_wave + r,version,1.0.0