From 0d112063ea18a1b6fd3f858b9eaab9d090c39df2 Mon Sep 17 00:00:00 2001 From: WrathofthePast <75559873+WrathofthePast@users.noreply.github.com> Date: Fri, 25 Feb 2022 15:22:34 -0500 Subject: Resolve kIOMasterPortDefault Deprecation (#27) * Cynosa Chroma Pro Support Seems the PR from the front didn't make the update to the DeathAdder Essential 2021, so that's included in this. * Fix for Basilisk Ultimate (Wired & Receiver) For `is_charging` & `get_battery`, the Basilisk Ultimate had the wrong transaction id. * Resolve kIOMasterPortDefault Deprecation * Update razerdevice.c --- src/lib/razerdevice.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lib') diff --git a/src/lib/razerdevice.c b/src/lib/razerdevice.c index e5c9553..3f0896b 100755 --- a/src/lib/razerdevice.c +++ b/src/lib/razerdevice.c @@ -239,7 +239,7 @@ IOUSBDeviceInterface **getRazerUSBDeviceInterface(int type) io_iterator_t iter; kern_return_t kReturn = - IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter); + IOServiceGetMatchingServices(MACH_PORT_NULL, matchingDict, &iter); if (kReturn != kIOReturnSuccess) { return NULL; @@ -385,7 +385,7 @@ RazerDevices getAllRazerDevices() io_iterator_t iter; kern_return_t kReturn = - IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDict, &iter); + IOServiceGetMatchingServices(MACH_PORT_NULL, matchingDict, &iter); if (kReturn != kIOReturnSuccess) { return allDevices; -- cgit v1.2.3 From 9404d4475fff9656c6a4307c642507817b8eb485 Mon Sep 17 00:00:00 2001 From: WrathofthePast <75559873+WrathofthePast@users.noreply.github.com> Date: Fri, 25 Feb 2022 15:23:05 -0500 Subject: Parity improvements with openrazer and bug fixes (#28) * Parity improvements with openrazer - Allows Basilisk V3 to utilize its full 26000 DPI (this was missed in the PR that added support) - Fixes the minimum DPI - Prepares files to be setup as dependencies of openrazer * Update razermouse_driver.c --- src/lib/razerchromacommon.c | 6 ++++-- src/lib/razercommon.c | 3 ++- src/lib/razermouse_driver.c | 11 +++++++++++ 3 files changed, 17 insertions(+), 3 deletions(-) (limited to 'src/lib') diff --git a/src/lib/razerchromacommon.c b/src/lib/razerchromacommon.c index 6f6410e..1bc6b8a 100644 --- a/src/lib/razerchromacommon.c +++ b/src/lib/razerchromacommon.c @@ -552,6 +552,8 @@ struct razer_report razer_chroma_extended_matrix_effect_wave(unsigned char varia // Others use values 0x01, 0x02 direction = clamp_u8(direction, 0x00, 0x02); + // Razer has also added a "Fast Wave" effect for at least one device + // which uses the same effect command but a speed parameter of 0x10 report.arguments[3] = direction; report.arguments[4] = speed; // Speed, lower values are faster (). The default used to be 0x28 return report; @@ -1070,8 +1072,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, 20000); - dpi_y = clamp_u16(dpi_y, 128, 20000); + dpi_x = clamp_u16(dpi_x, 100, 26000); + dpi_y = clamp_u16(dpi_y, 100, 26000); report.arguments[0] = VARSTORE; diff --git a/src/lib/razercommon.c b/src/lib/razercommon.c index 4c8424a..c888445 100644 --- a/src/lib/razercommon.c +++ b/src/lib/razercommon.c @@ -121,7 +121,8 @@ struct razer_report get_empty_razer_report(void) { * The checksum is generated by XORing all the bytes in the report starting * at byte number 2 (0 based) and ending at byte 88. */ -unsigned char razer_calculate_crc(struct razer_report *report) { +unsigned char razer_calculate_crc(struct razer_report *report) +{ /*second to last byte of report is a simple checksum*/ /*just xor all bytes up with overflow and you are done*/ unsigned char crc = 0; diff --git a/src/lib/razermouse_driver.c b/src/lib/razermouse_driver.c index a10521e..336f2af 100644 --- a/src/lib/razermouse_driver.c +++ b/src/lib/razermouse_driver.c @@ -64,6 +64,10 @@ static int razer_get_report(IOUSBDeviceInterface **usb_dev, struct razer_report return razer_get_usb_response(usb_dev, 0x00, request_report, 0x00, response_report, RAZER_NEW_MOUSE_RECEIVER_WAIT_MIN_US); break; + case USB_DEVICE_ID_RAZER_ATHERIS_RECEIVER: + return razer_get_usb_response(usb_dev, 0x00, request_report, 0x00, response_report, RAZER_ATHERIS_RECEIVER_WAIT_MIN_US); + break; + case USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRELESS: case USB_DEVICE_ID_RAZER_VIPER_ULTIMATE_WIRED: case USB_DEVICE_ID_RAZER_NAGA_TRINITY: @@ -1699,6 +1703,7 @@ ssize_t razer_attr_read_get_battery(IOUSBDeviceInterface **usb_dev, char *buf) break; case USB_DEVICE_ID_RAZER_BASILISK_ULTIMATE_RECEIVER: case USB_DEVICE_ID_RAZER_BASILISK_ULTIMATE: + case USB_DEVICE_ID_RAZER_ATHERIS_RECEIVER: case USB_DEVICE_ID_RAZER_LANCEHEAD_WIRELESS_RECEIVER: case USB_DEVICE_ID_RAZER_LANCEHEAD_WIRELESS_WIRED: report.transaction_id.id = 0x1f; @@ -1721,6 +1726,12 @@ ssize_t razer_attr_read_is_charging(IOUSBDeviceInterface **usb_dev, char *buf) (*usb_dev)->GetDeviceProduct(usb_dev, &product); switch(product) { + // Wireless mice that don't support is_charging + // Use AA batteries + case USB_DEVICE_ID_RAZER_ATHERIS_RECEIVER: + return sprintf(buf, "0\n"); + break; + case USB_DEVICE_ID_RAZER_LANCEHEAD_WIRED: case USB_DEVICE_ID_RAZER_LANCEHEAD_WIRELESS: case USB_DEVICE_ID_RAZER_MAMBA_WIRELESS_RECEIVER: -- cgit v1.2.3