Giter Club home page Giter Club logo

litra-driver's People

Contributors

ccouzens avatar colmeirin avatar dayer4b avatar kharyam avatar luthes avatar massimeddu-sj avatar tverbeke avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

litra-driver's Issues

Increase/Decrease brightness/color temperature

Great tool, thank you for your effort!

If you should be able to get the current state from the device as hinted on in #22, could you please also introduce commands to increase/decrease the brightness/color temperature?

Windows NotImplementedError

In windows getting NotImplementedError: is_kernel_driver_active after installing libusb. This Exception should be caught instead of AttributeError in the driver.

Different idProduct for the Litra Beam

Thank you for making this software. I just got a Litra Beam which is very similar to the Litra Glow. So I am optimistic that this software will work for the Litra Beam as well. The output of the lsusb command shows the following for the Litra Beam

Bus 001 Device 113: ID 046d:c901 Logitech, Inc. Litra Beam

As far as I can tell, the only change that should be necessary is that the udev rule should mention ATTR{idProduct}=="c901" instead of "c900". However, I also noticed that the c900 is hard coded as the PRODUCT_ID in src/llgd/lib/llgd_lib.py. Is there a way to specify the product id via the command line or a config file, so that this will work with the Litra Beam too?

Thanks in advance.

Limited brightness range using hidapi

I've set up my Litra Beam control through hidapi. However, I've found the brightness control range to not be as wide as with using G-Hub.

With hidapi, the maximum brightness value of 250/ 0xfa translates to only about 65% of the max brightness capability of the litra beam as configurable in G-Hub. Any chance there is more range for setting a higher brighness using hidapi?

Deleting a Profile

I delete profiles, and after I restart the app, or open it again, after closing it, the deleted profiles come back.

Unable to start lcui, after perform a quick install.

I ran thru the Quick start process and ran into the following error:

[jb@thehat ~]$ lcui
Traceback (most recent call last):
  File "/home/jb/.local/bin/lcui", line 5, in <module>
    from llgd.ui.__main__ import main
  File "/home/jb/.local/lib/python3.11/site-packages/llgd/ui/__main__.py", line 4, in <module>
    import PySimpleGUI as sg  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jb/.local/lib/python3.11/site-packages/PySimpleGUI/__init__.py", line 2, in <module>
    from .PySimpleGUI import *
  File "/home/jb/.local/lib/python3.11/site-packages/PySimpleGUI/PySimpleGUI.py", line 136, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'

Tried to do a:

pip install tk

Then tried to run lcui and got the following error:

jb@thehat ~]$ pip install tk
Defaulting to user installation because normal site-packages is not writeable
Collecting tk
  Downloading tk-0.1.0-py3-none-any.whl (3.9 kB)
Installing collected packages: tk
Successfully installed tk-0.1.0
[jb@thehat ~]$ lcui
Traceback (most recent call last):
  File "/home/jb/.local/bin/lcui", line 5, in <module>
    from llgd.ui.__main__ import main
  File "/home/jb/.local/lib/python3.11/site-packages/llgd/ui/__main__.py", line 4, in <module>
    import PySimpleGUI as sg  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jb/.local/lib/python3.11/site-packages/PySimpleGUI/__init__.py", line 2, in <module>
    from .PySimpleGUI import *
  File "/home/jb/.local/lib/python3.11/site-packages/PySimpleGUI/PySimpleGUI.py", line 136, in <module>
    import tkinter as tk
ModuleNotFoundError: No module named 'tkinter'

On my latest attempt I ran sudo dnf install python3-tkinter and then tried lcui and got the following:

jb@thehat ~]$ sudo dnf install python3-tkinter
[sudo] password for jb: 
Last metadata expiration check: 3:45:05 ago on Tue 10 Jan 2023 12:30:50 PM EST.
Dependencies resolved.
================================================================================================================================================================
 Package                                    Architecture                      Version                                  Repository                          Size
================================================================================================================================================================
Installing:
 python3-tkinter                            x86_64                            3.11.1-1.fc37                            updates                            417 k

Transaction Summary
================================================================================================================================================================
Install  1 Package

Total download size: 417 k
Installed size: 2.3 M
Is this ok [y/N]: y
Downloading Packages:
python3-tkinter-3.11.1-1.fc37.x86_64.rpm                                                                                        1.5 MB/s | 417 kB     00:00    
----------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                           602 kB/s | 417 kB     00:00     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                        1/1 
  Installing       : python3-tkinter-3.11.1-1.fc37.x86_64                                                                                                   1/1 
  Running scriptlet: python3-tkinter-3.11.1-1.fc37.x86_64                                                                                                   1/1 
  Verifying        : python3-tkinter-3.11.1-1.fc37.x86_64                                                                                                   1/1 

Installed:
  python3-tkinter-3.11.1-1.fc37.x86_64                                                                                                                          

Complete!
[jb@thehat ~]$ lcui
Traceback (most recent call last):
  File "/home/jb/.local/bin/lcui", line 5, in <module>
    from llgd.ui.__main__ import main
  File "/home/jb/.local/lib/python3.11/site-packages/llgd/ui/__main__.py", line 5, in <module>
    from psgtray import SystemTray  # pylint: disable=import-error
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jb/.local/lib/python3.11/site-packages/psgtray/__init__.py", line 2, in <module>
    from .psgtray import *
  File "/home/jb/.local/lib/python3.11/site-packages/psgtray/psgtray.py", line 1, in <module>
    import pystray, io, base64, threading, time
  File "/home/jb/.local/lib/python3.11/site-packages/pystray/__init__.py", line 48, in <module>
    Icon = backend().Icon
           ^^^^^^^^^
  File "/home/jb/.local/lib/python3.11/site-packages/pystray/__init__.py", line 40, in backend
    return importlib.import_module(__package__ + '._' + module)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib64/python3.11/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jb/.local/lib/python3.11/site-packages/pystray/_appindicator.py", line 22, in <module>
    gi.require_version('AppIndicator3', '0.1')
  File "/usr/lib64/python3.11/site-packages/gi/__init__.py", line 126, in require_version
    raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace AppIndicator3 not available

Currently running Fedora 37, Workstation Edition, 64-bit.

Any thoughts?

multiple Litras?

I would like this to work with multiple Litras. I was able to tweak the code to get it to work for my purposes. I'll open a PR...

libusb error in windows

Windows gives a no backend error when attempting to access libusb. Got past this by downloading libusb-win32 from source forge and copying bin/amd64/libusb0.* to c:\Windows\system32. Next error is:

  File "C:\Users\khary\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0\LocalCache\local-packages\Python310\site-packages\llgd\lib\llgd_lib.py", line 31, in setup
    if dev.is_kernel_driver_active(0):
AttributeError: 'NoneType' object has no attribute 'is_kernel_driver_active'

Unable to use cli - The device has no langid

I am unable to get the cli to start.

System info:

Ubuntu 22.04.3 LTS
i3 4.22
Bus 001 Device 007: ID 046d:c900 Logitech, Inc. Litra Glow

Steps to reproduce:

pip install litra-driver

sudo tee /etc/udev/rules.d/82-litra-glow.rules <<< 'SUBSYSTEM=="usb", ATTR{idVendor}=="046d", ATTR{idProduct}=="c900",MODE="0666"'

lc --help
Traceback (most recent call last):
  File "/home/ace/.local/bin/lc", line 5, in <module>
    from llgd.cli.cli import main
  File "/home/ace/.local/lib/python3.10/site-packages/llgd/cli/cli.py", line 8, in <module>
    from llgd.lib.llgd_lib import light_on, light_off, set_brightness, set_temperature
  File "/home/ace/.local/lib/python3.10/site-packages/llgd/lib/llgd_lib.py", line 153, in <module>
    find_devices()
  File "/home/ace/.local/lib/python3.10/site-packages/llgd/lib/llgd_lib.py", line 41, in find_devices
    logging.info('Found Device "%s"', product_device.product)
  File "/home/ace/.local/lib/python3.10/site-packages/usb/core.py", line 875, in product
    self._product = util.get_string(self, self.iProduct)
  File "/home/ace/.local/lib/python3.10/site-packages/usb/util.py", line 313, in get_string
    raise ValueError("The device has no langid"
ValueError: The device has no langid (permission issue, no string descriptors supported or device error)

Get tools working on mac without sudo

Hi,

Firstly thanks for this. I was able to control my light via command line on mac, but it needs to run via sudo due to the usb libs used currently. I'm able to use the codes you've discovered to turn on/off the light via https://github.com/todbot/hidapitester.

Light On

hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c,0x01

Light Off

hidapitester --vidpid 046D/C900 --open --length 20 --send-output 0x11,0xff,0x04,0x1c

This works without sudo. As far as I can tell udev roles don't exists on mac.

I understand your project is written in python and the other referenced project is written in C. I wanted to post this question here incase anyone else found it helpful.

"ValueError: Device not found" on Windows

Maybe Windows isn't supported, but I'm trying to find a relatively simple solution for using my streamdeck to control the Litra Glow, without getting into all the hid stuff myself. I love the simplicity of this, but unfortunately it's not working "out of the box" for me. I already had python and pip installed, so I updated pip, installed litra-driver and tried to run it. The UI comes up, but when I select the on button or when I try the lc on command it fails and says "ValueError: Device not found" Here's the complete output:

C:\Users\Jeff>lc on Traceback (most recent call last): File "c:\users\jeff\appdata\local\programs\python\python39\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\jeff\appdata\local\programs\python\python39\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\Jeff\AppData\Local\Programs\Python\Python39\Scripts\lc.exe\__main__.py", line 7, in <module> File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\llgd\cli\cli.py", line 77, in main fire.Fire({ File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\fire\core.py", line 141, in Fire component_trace = _Fire(component, args, parsed_flag_args, context, name) File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\fire\core.py", line 466, in _Fire component, remaining_args = _CallAndUpdateTrace( File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\fire\core.py", line 681, in _CallAndUpdateTrace component = fn(*varargs, **kwargs) File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\llgd\cli\cli.py", line 28, in on light_on() File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\llgd\lib\llgd_lib.py", line 68, in light_on dev, reattach = setup() File "c:\users\jeff\appdata\local\programs\python\python39\lib\site-packages\llgd\lib\llgd_lib.py", line 34, in setup raise ValueError('Device not found') ValueError: Device not found

I also ran pip install libusb since I saw it referenced in previous issues. Oh, and I made sure GHub isn't running, and unplugged/replugged already. Got the same result in commandline and powershell, haven't tried WSL yet. Sorry if I'm just making a dumb mistake here, I'm not a coder, but I do design and support software for a living, so I can usually follow developer directions.

lcui crashes when started

โฏ lcui Traceback (most recent call last): File "/home/m/.local/bin/lcui", line 8, in <module> sys.exit(main()) File "/home/m/.local/lib/python3.10/site-packages/llgd/ui/__main__.py", line 40, in main profile_layout = [sg.Combo(config.get_profile_names(), key='profiles', File "/home/m/.local/lib/python3.10/site-packages/llgd/config/llgd_config.py", line 113, in get_profile_names profiles.remove(self.CURRENT_PROFILE_NAME) ValueError: list.remove(x): x not in list

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.