Closed DocTdb closed 4 years ago
Hi, Try running with sudo, usually I get the same error when I forget it.
When I ran it with sudo it gave me a "Command not found"
So I reinstalled it with sudo pip install cm-rgb
and then sudo pip install --upgrade cm-rgb
and now when I run your example :
sudo cm-rgb-cli logo --mode=breathe --color=#00ff00 --speed=3 --brightness=5 fan --mode=breathe --color=#0000ff --speed=4 --brightness=1 ring --mode=swirl --color=#ff0000 --speed=1 --brightness=1
Traceback (most recent call last):
File "/usr/local/bin/cm-rgb-cli", line 3, in <module>
from cm_rgb.ctrl import LedChannel, LedMode, CMRGBController
File "/usr/local/lib/python2.7/dist-packages/cm_rgb/ctrl.py", line 1, in <module>
import hid
ImportError: No module named hid
Maybe a problem with hidapi though it has been installed with cm-rgb. Thanks for your time.
Probably the package was only installed for your user initially.
Try lsusb
and find Cooler Master
Then sudo chmod 777 /dev/bus/usb/<bus>/<device>
This should enable access without sudo until next reboot.
If you still have problem with hid please try following installation procedure: https://github.com/trezor/cython-hidapi
Oddly with lsusb
I found a vendor matching CoolerMaster and an id 0051 but no mention of the brand evidently.
It works great now, I updated Setuptools
and reinstalled Hidapi
both with sudo, thanks for your help.
One thing though, for a leek like me, could you precise how to specify a RANGE in brightness and speed ? Thanks a lot.
Edit : tried it Python style range(3, 5)
but failed.
Edit 2 : tried it Bash style {3..5}
but nop.
I'm glad it has worked out for you :)
I'm not sure I understand the part about the range. Are you referring to CLI or direct usage of ctrl.py ?
Are you trying to 'animate' brightness and speed ?
I'm refering to CLI, the syntax to pass a range as argument. In the help ( For clarity, you already know it cause...you wrote it.)
sudo cm-rgb-cli fan --help
Usage: cm-rgb-cli fan [OPTIONS]
Options:
--color TEXT
--mode [off|static|breathe]
--speed INTEGER RANGE
--brightness INTEGER RANGE
--help Show this message and exit.
In speed and brightness you propose INTEGER or RANGE, at the moment the fan goes from totally dark to full bright and so on. I think that range would allow to go from half bright to full bright and repeat.
Actually this message is generated by click library and it's misguiding.
@cli.command('logo')
@click.option('--color','color', default='#00FFFF')
@click.option('--mode', type=click.Choice(['off', 'static', 'breathe'], case_sensitive=False), default='static')
@click.option('--speed', type=click.IntRange(1, 5, clamp=True), default=3)
@click.option('--brightness', type=click.IntRange(1, 5, clamp=True), default=3)
@click.pass_context
def setup_logo(ctx, mode, color, brightness, speed):
This means that speed/brightness accept single value within predefined range. (1 to 5 in both cases)
To achieve the the effect you are describing currently breathe
mode can be used,
but only max value of brightness can be defined. This is a limitation of the controller.
I hope this clears it up a bit :)
Yep ! All is clear now. Thanks a Bunch.
Hi, I can't manage to make your project work on my Mint 19.2 but I'm not a python master so it's surely my mistake. Install went great with pip. I can access --help so it's installed but when I try your example :
Did I miss something ?