Support library and daemon for SteelSeries keyboards on MSI laptops
Project description
# MSI Keyboard Service ## Description
It is a service that controls certain types of keyboard backlights installed on some MSI laptops (e.g. MSI GT60 2PC). These keyboard usually have “Keyboard by SteelSeries” label.
## Functions
Configure and use some (later - all) modes from SteelSeries app (on Windows) and also some undocumented (i.e. discovered by accident) modes
React on lid close/open and sleep/resume events
More functions later on
## Dependencies
python3
dbus
python3-hidapi
python3-dbus
python3-yaml
systemd (optional, if you want to install the service as described below)
## Installation
Install this package from PyPI or from source using setup.py
Copy the file ‘data/org.morozzz.MSIKeyboardService.conf’ to directory ‘/etc/dbus-1/system.d/’
Copy the file ‘data/msikeyboardd.service’ to directory ‘/lib/systemd/system/’
In the root terminal (or with sudo), execute following commands:
- > systemctl daemon-reload
systemctl reload dbus systemctl enable msikeyboardd systemctl start msikeyboardd
## Control methods
This service exposes several methods to DBus system bus:
SetMode(t) -> b - selects backlight mode by index (i.e. by index in ‘modes’ configuration list), returns true if selected successfully
SetDefaultMode() - selects default (i.e. bright white) backlight mode.
SetOffMode() - selects off mode (i.e. no backlight at all).
RestoreLastMode() -> b - restores last mode set by index. Helpful after SetDefaultMode and SetOffMode invocations.
Furthermore, the service connects to PropertiesChanged signal to react on lid events. When lid closes, backlight enters Off mode, when opens – restores last mode set by index.
You can create your own tool that can control this service via DBus or use standard tool ‘dbus-send’ for the same purposes. For example, to set mode #0 (first mode from configuration), you can invoke dbus-send as follows:
> dbus-send –system –dest=”org.morozzz.MSIKeyboardService” –type=method_call /org/morozzz/MSIKeyboardService org.morozzz.MSIKeyboardService.SetMode uint64:0
As Ubuntu user I bound keys Ctrl-Alt-{0-9} to SetMode({0-9}) invocations, Ctrl-Alt– (‘minus’, key that comes after ‘0’ key) to SetOffMode invocation, Ctrl-Alt-= (‘equals’, the key that comes after ‘minus’ and before ‘backspace’) to SetDefaultMode invoacation and Ctrl-Alt-Backspace to RestoreLastMode invocation via dbus-send, using System Settings – Keyboard – Shortcuts settings.
## Configuration
Configuration is stored in ‘/etc/msikeyboard/config.yaml’ file in [YAML](https://en.wikipedia.org/wiki/YAML) serialization format. Configuration keys:
default_index (int) - Mode index that will be set immediately after service starts
handle_lid (bool) - Handle lid events
handle_sleep (bool) - Handle sleep events
resume_to_connect_delay (float) - Delay between connection attempts in ‘resume from sleep’ event handler
- modes (list) - List of mode configurations
type (str) - Mode type name
config (dict) - Mode configuration
Available modes:
- Off (note quotes) - Disabled backlight
No (empty) configuration
- Default - Bright white backlight
No (empty) configuration
- Normal - Colored backlight, each zone (left, middle and right) has its own color
each zone has dict of three keys - ‘r’, ‘g’, ‘b’ that stand for red, green and blue color intensity (0-255)
zones have names ‘left’, ‘middle’ and ‘right’
- DualColor - Slow transition from first color to second:
‘color_a’ - first color
‘color_b’ - second color
‘fade_times’ - transition time periods (for each color)
each key has dict of three keys - ‘r’, ‘g’, ‘b’, that stand for red, green and blue color intensity
times are approximately in seconds (0 - fastest, but not immediate, 255 - slowest)
- Gaming - only left zone illuminated:
dict of three keys - ‘r’, ‘g’, ‘b’, that stand for red, green and blue color intensity
- Breathing - Colored backlight, fading to black and vice versa:
three zones named ‘left’, ‘middle’ and ‘right’
each zone has dict of two keys - ‘color’ and ‘fade_times’
‘color’ and ‘fade_times’ each have dict of three keys - ‘r’, ‘g’, ‘b’, that stand for red, green and blue color intensity / fade times
- Wave - Colored backlight, one zone at a time, fading to black and appearing again in a sequence, left-to-right:
parameters defined in analogy to “Breathing” mode
- Audio - Backlight responding to sounds from built-in speakers. No idea how it works, but is seems to me that for normal functioning on Linux this mode needs some black magic.
No (empty) configuration
## TODO:
Expose DualColorAdvanced mode (like DualColor, but each zone has different colors/times, msikbapi already has appropriate methods)
Expose ‘plain’ modes (16-28, looks like plain one-color backlight, also changes behavior of Normal mode)
Explore modes 8,9 and 11-15 (8 looks like DualColor, 9 looks like Waves but it needs thorough research)
Move service daemon from root to less privileged system user
Add console daemon control tool
Add GUI daemon control tool?
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file msikeyboard-0.1.1.tar.gz
.
File metadata
- Download URL: msikeyboard-0.1.1.tar.gz
- Upload date:
- Size: 24.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f757e0d837cd084f3cd9b37ff7715f83f3c803d92684da20d17b84721c863332 |
|
MD5 | 33851657fda6c29326cf51f62025907e |
|
BLAKE2b-256 | 69093054e5778bdf90ddb16910b30efe797633fd8988aaf5243ac64a22830f74 |
File details
Details for the file msikeyboard-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: msikeyboard-0.1.1-py3-none-any.whl
- Upload date:
- Size: 22.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.18.4 setuptools/39.0.1 requests-toolbelt/0.8.0 tqdm/4.25.0 CPython/3.6.5
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9104198dcbd888becf2eac6b4da1092367220bb06382964d3f33313c607618a3 |
|
MD5 | 632bc9279f49c65431678b69b8ed3347 |
|
BLAKE2b-256 | 15222d95007befc5248229967b27faccdf00c6e899c4b51cff3de40896db6880 |