Skip to content
Hika van den Hoven edited this page Oct 25, 2022 · 4 revisions

Installation

In the package you will find several files:

  • LICENCE
  • README.md
  • lircradio.py
  • radioFunctions.py
  • sample_lircrc
  • gentoo-runscript/init.d/lircradio
  • gentoo-runscript/conf.d/lircradio

The two phython files you place in /usr/bin. Make sure they are executable

chmod +x /usr/bin/lircradio.py
chmod +x /usr/bin/radioFunctions.py

If you use Gentoo, place the last two files in /etc/init.d and /etc/conf.d. Also make the run-script executable:

chmod +x /etc/init.d/lircradio

The python script should be loaded as a daemon. For that purpose the run-script is included. Unfortunately as I run Gentoo it is written for that distribution. Later I will add an Ubuntu open-rc runscript, but that will take time. And maybe once I will give systemd a try.
In the mean time you will have to try something yourself. If you get something working, I would love to include it. Look at the Gentoo init-script for hints.
You can also start it in a console like:

lircradio.py &
echo start /tmp/mythtv-fiforadio

it then will daemonize. The second line is needed to activate ircat. For some reason ircat won't react until after starting up at least one keyword is processed.

But before you run it you have to configure by running lircradio.py --configure. Several things will be done and checked.

  • It tries to detect available tv and audio cards. If more then one is found, it will select the first audio-card and the first ivtv-compatible tv-card or if not found the first not compatible card. For the audio-card it will check available mixers. First prefering 'Front', 'Master' or 'PCM' it will select the first. You can overrule this by specifying another together with --configure. See lircradio.py --help.
    Run lircradio.py --list-alsa-cards for a list of audio-cards.
    Run lircradio.py --list-mixers [--audio-card <cardname>] for a list of available mixer-controls on the given card.
  • It will scan the radio for available frequencies.
  • If it doesn't already exists, it will create an .ivtv directory in your homedirectory.
  • In there it creates two files:
    • radioFunctions.conf
      In here it will save the found settings. Inside you will find documentation.
    • Command.sh
      In here are the suspend, hibernate, reboot and powerdown commands. You can edit them and add your own command sections. See inside radioFunctions.conf. If you want, you can move it for global access to /usr/bin.

Every time it starts a few things are checked:

  • Is radioFunctions.py found and of the right version.
  • Is Command.sh found in ~/.ivtv or /usr/bin and is it executable. If not a new Command.sh is created in ~/.ivtv.
  • is lircd running. If not, the ircat daemon is not started.
  • is pyalsaaudio available. If not radio and alsa functionality is didabled.
  • are ivtv-utils and v4l-utils available. If not radio functionality is didabled.
  • are suspend, reboot, etc. commands available.

For functionality sudo is used. The user running the daemon must be able to run the following commands WITHOUT a password:
which, reboot, poweroff and either pm-suspend/pm-hibernate or hibernate-ram/hibernate as specified in Commands.sh. the which command is used to find the previous commands. As they normally are in /sbin or /usr/sbin an ordinary user won't find them and is not allowed to run them.

By default it logs to ~/.ivtv/lircradio.log The run-script sets up logging to /var/log/lircradio/lircradio.log. If you want to log other then to ~/.ivtv/lircradio.log and you're not using the runscript, you have to setup the location with the right permissions. There is a log-rotate functionality. Max log size is set to 1048576 bytes and 5 old files are kept.

Clone this wiki locally