Git Product home page Git Product logo

cec-daemon's Introduction

CECdaemon

An attempt at daemonizing the cecclient.

Using libCEC python frontend, this library implements a cecclient in python, and using daemonocle and click, it daemonize said client. The daemon can receive user input while running. Communication between the running daemon and the command line is done through named pipe, with a file lock for the daemon's input.

Launching and closing the client for every single command isn't an option if you want to have some registered callback monitoring the status and making adjustement to the the HDMI connection at all time, because only a single instance of libCEC can connect to the physical CEC device at any time. Hence a daemon. And even if you don't need any callbacks doing background work, libcec has a lot of communication to do at launch and that takes some time (several seconds). Whatever it is you want to do will be done much quicker if the CECclient is already running and waiting for user input.

dependencies

ATTENTION: all the dependencies must be install in a way that make them available to the user that will own the daemon process.

  • libcec: A manual install might be necessary to have the python frontend. The AUR-git does the trick on arch and its derivatives.
  • daemonocle: A python library that takes care of the forking, signal handling, cleanup and all other subtleties of creating a unix daemon.
  • click: A python library for the command line interface of the daemon.
  • filelock: A python library that supplies a syncronization device for interprocess communication.

installation

(This instructions aren't nearly detailed enough as of now)

  • create a user for the daemon, make it member of the group that has access to the cecdevice (uucp with Archlinux and a USB connected device.) ($ useradd -M -s /usr/bin/nologin -G uucp cecdaemon)
  • create any call back you might need and modify the daemon's worker to register them. (for now only one callback function per type of callback possible...)
  • put the cecdaemon in the PATH.
  • make adjustements to the service file (folders , paths, user and such)
  • make sure the cecdaemon user has access to the daemon's working directory.
  • copy the service file to systemd.
  • activate the service.

TODO

  • Make all the function that expect strings in pyCECclient robust to bad input. Must protect libCEC from it for better stability.
  • improve the situation regarding files and working directory. currently "hardcoded" just after the import statements of cecdaemon.py
  • Make the installation robust and easy. That is probably the hardest thing to do for that project and I might never do it.

License

copyright 2021 Alexandre Foley ([email protected])

The source files of this project are licensed under the GNU General Public License See LICENSE file in the project root for full license information.

cec-daemon's People

Contributors

alexandrefoley avatar

Watchers

James Cloos avatar  avatar

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.