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

Add check for get_low_battery_threshold capability #71

Merged
merged 1 commit into from
Jun 27, 2023

Conversation

sk8ersteve
Copy link
Contributor

Not every device that has "battery" capability also supports the get_low_battery_threshold method. This capability must be explicitly checked, so I've added the check for this method as well as for get_idle_time. You can see how capabilities are set in openrazer here:
https://github.com/openrazer/openrazer/blob/43b4a605e84f7530d8763a804eb875936e7bd5d7/pylib/openrazer/client/devices/__init__.py#L50

See issues:
#66
#70

Tested on Viper Ultimate. Needs testing on a device that does support the two above methods.

@LoLei
Copy link
Owner

LoLei commented Jun 6, 2023

Thanks! 👍

@lipovac @ifohancroft @GM-Script-Writer-62850
If you can test / review this we can merge it.

@GM-Script-Writer-62850
Copy link

GM-Script-Writer-62850 commented Jun 6, 2023

just looked at the code, my mouse does not have a battery (i hate batteries, give me a wire)

I think we should add a indent to lines 49-53

These features should only exist if there is a battery correct? there is no need to test for these if there is not battery. furthermore is somehow they were supported without a battery the data would look odd as printed as subsection of DPI settings, polling rate, or a sub section of the device type

Here is a feature test script people can just run and post the output of
razer_feature_test_script.zip

$ python /tmp/razer_feature_test_script.py 
Razer DeathAdder Elite:
   name: True
   type: True
   dpi: True
   available_dpi: False
   dpi_stages: False
   poll_rate: True
   device_image: False
   battery: False
   get_low_battery_threshold: False
   get_idle_time: False

if you take a battery out and use it plugged in does it change the output?

@sk8ersteve
Copy link
Contributor Author

I agree with your idea to indent @GM-Script-Writer-62850. The patch has been updated. I could imagine that get_idle_time could be a capability for wired devices but I don't any wired-only devices with it in openrazer, so I think this assumption is ok for now.

Unfortunately, I don't have a wire handy that fits this mouse but based on my reading of the openrazer code, it wouldn't make a difference since Razer Viper Ultimate (Wireless) inherits most capabalities including "battery" from the (Wired) device variant. Basically the main difference between these variants from the API standpoint is the USB ID.

@LoLei LoLei merged commit 63be3c7 into LoLei:master Jun 27, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants