-
-
Notifications
You must be signed in to change notification settings - Fork 515
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add fan_speed and fan_mode to kernel module
- Loading branch information
1 parent
ff7c268
commit b4c19cb
Showing
8 changed files
with
227 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import colorsys | ||
import random | ||
|
||
from openrazer.client import DeviceManager | ||
from openrazer.client import constants as razer_constants | ||
|
||
# Create a DeviceManager. This is used to get specific devices | ||
device_manager = DeviceManager() | ||
|
||
|
||
print("Found {} Razer devices".format(len(device_manager.devices))) | ||
print() | ||
|
||
# Disable daemon effect syncing. | ||
# Without this, the daemon will try to set the lighting effect to every device. | ||
device_manager.sync_effects = False | ||
|
||
# List of effect I've chosen to make an example for | ||
effects = [ | ||
'fan_mode', | ||
'fan_speed' | ||
] | ||
|
||
mode_manual = 0x01 | ||
mode_automatic = 0x01 | ||
high_speed = 0x36 | ||
low_speed = 0x2b | ||
|
||
# Iterate over each device and set a random effect that it supports. | ||
for device in device_manager.devices: | ||
# Check which effect this device supports. | ||
device_effects = [effect for effect in effects if device.fx.has(effect)] | ||
# print("{} supports {}".format(device.name, device_effects)) | ||
|
||
if len(device_effects) == 0: | ||
print("Device {} doesn't support any of the effects".format(device.name)) | ||
continue | ||
effect = random.choice(device_effects) | ||
print("Setting {} to effect {}".format(device.name, effect)) | ||
|
||
# Ad an example for each effect | ||
if effect == 'fan_mode': | ||
device.fx.fan_mode(mode_automatic) | ||
|
||
elif effect == 'fan_speed': | ||
device.fx.fan_speed(high_speed) | ||
device.fx.fan_mode(mode_manual) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters