Table of Contents

#!html
<h1 style="text-align: left; color: red">
This program is not part of the current lcd4linux. This wiki entry was created for discussion about a program prototype.
<br><br>
</h1>

ctrl_fifo

\

1. Description

This external program is a Controller to interact with the Control plugin.

It reads bytes form a FIFO and writes these bytes to stdout. This may be used to control LCD4Linux from several external scripts (may be started with plugin Run).

2. Download and make

Download and extract the sources.

glibc will be needed.

Create executable with:

gcc -o ctrl_fifo ctrl_fifo.c util.c 

3. Testmode

Run the program in test mode (option -t) to check if it works correctly.

Example:

/home/test/lcd/ctrl/ctrl_fifo -p /tmp/ctrl.fifo -t

Start another Terminal an try:

echo "ABC" > /tmp/ctrl.fifo

To avoid the line break character at the end and send any byte value:

echo -n -e "\x00" > /tmp/ctrl.fifo
...
echo -n -e "\xff" > /tmp/ctrl.fifo

4. Configuration

The structure in the config-file looks like this example which configures a FIFO controller to navigate within different Layouts:

Plugin Control {

    active 1
   
    Controller1 {

        name 'C_fifo'

        prog '/home/test/lcd/ctrl/ctrl_fifo'
        arg1 '-p'
        arg2 '/tmp/ctrl.fifo'

        Key100.action   layout::layout('G_Messages','L_DownloadReady')  # echo -n d > /tmp/ctrl.fifo
        Key101.action   layout::layout('G_Messages','L_Error')          # echo -n e > /tmp/ctrl.fifo
        Key109.action   layout::layout('G_Messages','L_MailRecieved')   # echo -n m > /tmp/ctrl.fifo
    }

    ...
}

' Edit prog path and arg2! '

5. Default behavior

This controller does not read its stdin. So it's useless to call control::send(…) for this controller. The controller will write any byte it has read from the fifo to its stdout.

6. Options

OptionDescription
-hHelp
-p <fifo_path>set FIFO path
-tTestmode, see chapter 3