[HOWTO] YaVDR USB Displays (ax206-Chip) für verschiedene Zwecke verwenden

  • (Sysmon / Status-Display / Senderlogo / Live-Bild (Snapshot alle 5 Sekunden) / Terminal-Session)

    Hier findet ihr Infos, wie man gepatchte ax206-Bilderrahmen am YaVDR konfigurieren und einsetzen kann.
    In meinem Fall sind das 1,5-Zoll Fotoframes mit 128x128 Pixeln
    .

    BITTE BEACHTET: Alles was ihr tut geschieht auf Eure eigene Verantwortung!
    Ich versuche hier - so gut ich kann - Euch Hilfestellung zu geben.
    Fehler sind jedoch nicht ausgeschlossen!

    Wenn ihr welche entdeckt bitte PN, dann bessere ich nach.


    Vorbereitung:

    Software installieren:
    VDR-Plugin GraphLCD / SVN / XPM-Lib / dpf-ax / LCD4Linux / Python3 / Gimp
    ImageMagick / NetPBM
    Hinweise: Wird die XPM-Lib nicht vor dem Build installiert, kann das Display keine Grafikdateien anzeigen! "Class Image not supported"
    Gimp, NetPBM und ImageMagick werden zum (Batch-)Konvertieren / Skalieren / Zuschneiden der
    Senderlogos bzw. der Live-Snapshots auf 128x128 Pixel benötigt

    Code
    sudo aptitude install make automake autoconf subversion libgd2-xpm libgd2-xpm-dev vdr-plugin-graphlcd gimp gimp-plugin-registry netpbm imagemagick python3-dbus python3-dbus2vdr python3-gi (python3)
    cd /opt
    svn co https://svn.code.sf.net/p/dpf-ax/code/trunk dpf-ax
    cd dpf-ax
    ./build-dpf-lcd4linux.sh



    Zum automatischen Starten von 1) bis 4) verwende ich ein Startup-Script, das in der /etc/rc.local aufgerufen wird:

    Display Spoiler


    #!/bin/sh -e
    #
    # rc.local
    #
    # This script is executed at the end of each multiuser runlevel.
    # Make sure that the script will "exit 0" on success or any other
    # value on error.
    #
    # In order to enable or disable this script just change the execution
    # bits.
    #
    # By default this script does nothing.
    /usr/local/bin/my-startup-script.sh
    exit 0

    1) Sysmon-Ausgabe (CPU-Last / Systemauslastung / Disk- und Netzwerk-Aktivität / Uptime)

    Eintrag in der /usr/local/bin/my-startup-script.sh

    Code
    /opt/dpf-ax/lcd4linux/lcd4linux -Ff /opt/dpf-ax/dpf_128x128_sysmon.conf &


    Die dpf_128x128_sysmon.conf

    Display Spoiler


    Display dpf {
    Driver 'DPF'
    Port 'usb3'
    Font '6x8'
    Foreground 'ffffff'
    Background '000000'
    Basecolor '000000'
    Orientation 3 # 0 = standard, 1 = rotate 90° CW
    # 2 = rotate 180°, 3 = rotate 90° CCW
    Backlight backlight # Backlight variable control, 0..7 (0=off, 7=max)
    }

    Widget OS {
    class 'Text'
    expression '*** '.uname('sysname').' '.uname('release').' - dpf-ax driver by hackfin & superelchi ***'
    width 20
    align 'M'
    update tick
    Background '008000'
    Foreground 'ffffff'
    }

    Widget CPU {
    class 'Text'
    expression uname('machine')
    prefix 'CPU '
    width 10
    align 'L'
    update tick
    Background 'FFFFFF00'
    }


    Widget RAM {
    class 'Text'
    expression meminfo('MemTotal')/1024
    postfix ' MB RAM'
    width 11
    precision 0
    align 'R'
    update tick
    Background 'FFFFFF00'
    }

    Widget Busy {
    class 'Text'
    expression proc_stat::cpu('busy', 500)
    prefix 'Busy'
    postfix '%'
    width 10
    precision 1
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget System {
    class 'Text'
    expression proc_stat::cpu('system', 500)
    prefix 'Sys'
    postfix '%'
    width 10
    precision 1
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget User {
    class 'Text'
    expression proc_stat::cpu('user', 500)
    prefix 'User'
    postfix '%'
    width 10
    precision 1
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget BusyBar {
    class 'Bar'
    expression proc_stat::cpu('busy', 500)
    expression2 proc_stat::cpu('system', 500)
    length 20
    direction 'E'
    update tack
    Foreground 'ffffff'
    Background '00000080'
    BarColor0 '5f5fff'
    BarColor1 'ff5f5f'
    }

    Widget Load {
    class 'Text'
    expression loadavg(1)
    prefix 'Load'
    postfix loadavg(1)>1.0?'!':' '
    width 10
    precision 1
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget LoadBar {
    class 'Bar'
    expression loadavg(1)
    max 2.0
    length 20
    direction 'E'
    update tack
    Foreground 'ffffff'
    Background '00000080'
    BarColor0 '5f5fff'
    BarColor1 'ff5f5f'
    }


    Widget Disk {
    class 'Text'
    # disk.[rw]blk return blocks, we assume a blocksize of 512
    # to get the number in kB/s we would do blk*512/1024, which is blk/2
    # expression (proc_stat::disk('.*', 'rblk', 500)+proc_stat::disk('.*', 'wblk', 500))/2
    # with kernel 2.6, disk_io disappeared from /proc/stat but moved to /proc/diskstat
    # therefore you have to use another function called 'diskstats':
    expression diskstats('hd.', 'read_sectors', 500) + diskstats('hd.', 'write_sectors', 500)
    prefix 'disk'
    postfix ' '
    width 10
    precision 0
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget DiskBar {
    class 'Bar'
    #expression proc_stat::disk('.*', 'rblk', 500)
    #expression2 proc_stat::disk('.*', 'wblk', 500)
    # for kernel 2.6:
    expression diskstats('sd.', 'read_sectors', 500)
    expression2 diskstats('sd.', 'write_sectors', 500)
    length 20
    direction 'E'
    update tack
    Foreground 'ffffff'
    Background '00000080'
    BarColor0 '5f5fff'
    BarColor1 'ff5f5f'
    }

    Widget Eth0 {
    class 'Text'
    expression (netdev('eth0', 'Rx_bytes', 500)+netdev('wlan0', 'Tx_bytes', 500))/1024
    prefix 'LAN'
    postfix ' '
    width 10
    precision 0
    align 'R'
    update tick
    Foreground 'ffffff'
    Background 'FFFFFF00'
    }

    Widget Eth0Bar {
    class 'Bar'
    expression netdev('eth0', 'Rx_bytes', 500)
    expression2 netdev('eth0', 'Tx_bytes', 500)
    length 20
    direction 'E'
    update tack
    Foreground 'ffffff'
    Background '00000080'
    BarColor0 '5f5fff'
    BarColor1 'ff5f5f'
    }

    Widget Uptime {
    class 'Text'
    expression uptime('%d days %H:%M:%S')
    width 20
    align 'R'
    prefix 'Up '
    update 1000
    Background 'FFFFFF00'
    }

    #Widget Bgnd {
    # class 'Image'
    # file 'bgnd.png'
    # reload 1
    # update 5000
    # inverted 0
    # visible 1
    #}

    Display 'DPF'

    Layout layout_128x128 {
    Row01.Col01 'OS'
    Row02.Col01 'CPU'
    Row03.Col09 'RAM'
    Row06.Col01 'Busy'
    Row07.Col01 'BusyBar'
    Row08.Col01 'Load'
    Row09.Col01 'LoadBar'
    Row10.Col01 'Disk'
    Row11.Col01 'DiskBar'
    Row12.Col01 'Eth0'
    Row13.Col01 'Eth0Bar'
    Row16.Col01 'Uptime'
    # Layer 2 {
    # X1.Y1 'Bgnd'
    # }
    }

    Layout 'layout_128x128'

    Variables {
    backlight 7
    tick 500
    tack 200
    minute 60000
    }



    2)
    Standard VDR-Statusdisplay über Graph-LCD und passendem Skin

    Treiber-Section für ax206 in der /etc/graphlcd.conf

    Display Spoiler


    [ax206dpf]
    # THIS IS AN EXPERIMENTAL DRIVER!
    # You have to uncomment the variable HAVE_DRIVER_AX206DPF
    # in Make.config to use this driver.
    # READ the READDME.ax206dpf before use!
    #
    # ax206dpf driver
    # This is a driver module for an AX 206 based hacked photoframe.
    #
    # Default size: 320 x 240 or 240 x 320 (see "Portrait")
    Driver=ax206dpf
    #Width=320
    Width=128
    #Height=240
    Height=128
    #
    # UpsideDown
    # Rotates the display output by 180 degrees. This might be useful, if
    # the LCD is mounted upside-down.
    # Possible values: 'yes', 'no'
    # Default value: 'no'
    UpsideDown=yes
    #
    # Brightness
    # Sets the brightness of the display's backlight
    # Possible values: 0 <= x <= 100)
    # Default value: 100
    #Brightness=100
    #
    # Device
    # Selects a specific display
    # 'dpf0' = first detected display, 'dpf1' = second detected display, ...
    # Default value: 'dpf0'
    #Device=dpf0
    #
    # Portrait
    # Select portrait or landscape mode
    # Rotate display output by 90 degrees if necessary
    # Possible values: 'yes' -> default size = 240 x 320
    # 'no' -> default size = 320 x 240
    # Default value: 'no'
    Portrait=yes
    #
    # Zoom
    # Determines if pixels should be magnified.
    # Possible values: 1, 2, 3, 4
    # Default value: 1
    Zoom=1
    #
    # The following parameters are for multi-display setups only!
    #
    # Horizontal
    # Sets the number of displays in horizontal direction.
    # Possible values if Vertical=1: 1, 2, 3, 4
    # if Vertical=2: 1, 2
    # Default value: 1
    #Horizontal=1
    #
    # Vertical
    # Sets the number of displays in vertical direction.
    # Possible values if Horizontal=1: 1, 2, 3, 4
    # if Horizontal=2: 1, 2
    # Default value: 1
    #Vertical=1
    #
    # Flip
    # Rotates a single displays output by 180 degrees. This might be useful, if
    # some LCDs are mounted upside-down.
    # Possible values for every display : 'y', 'n'
    # Default value: 'nnnn'
    #Flip=nnnn
    #


    VDR Aufrufparameter für das GraphLCD-Plugin in der /etc/vdr/plugins/plugin.graphlcd.conf

    Code
    -c /etc/graphlcd.conf -d ax206dpf -s wofritz_128x128


    Skin-Ordner /usr/share/vdr/plugins/graphlcd/skins/wofritz_128x128 siehe unten als Anhang!


    3) Senderlogo

    Einträge in der /usr/local/bin/my-startup-script.sh

    Code
    /usr/local/bin/vdr-sender-logo-link-fuer-lcd4linux.py &/opt/dpf-ax/lcd4linux/lcd4linux -Ff /opt/dpf-ax/dpf_128x128_vdr-sender-logo.conf &


    Die Datei /usr/local/bin/
    vdr-sender-logo-link-fuer-lcd4linux.py

    Display Spoiler

    #!/usr/bin/env python3
    import dbus2vdr
    import dbus
    from dbus.mainloop.glib import DBusGMainLoop
    dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
    from gi.repository import GObject
    import os

    logopath = '/var/lib/vdr/senderlogos/128x128_png'
    target = '/tmp/aktueller-fernsehkanal.png'

    def on_channel_change(*args,**kwargs):
    device, channel_nr, live = args
    if live and channel_nr > 0:
    print("Live-TV switched to channel {0} on device {1}".format(channel_nr, device))
    channel = vdr.Channels.List(channel_nr)[0][0]
    channel_name = channel[1].split(';',1)[0]
    print("channel name:", channel_name)
    # delete old symlink, if existing
    try:
    os.unlink(target)
    except:
    pass
    try:
    os.symlink(os.path.join(logopath, "{0}.png".format(channel_name.lower())), target)
    except Exception as e:
    print(e)


    if __name__ == '__main__':
    DBusGMainLoop(set_as_default=True)
    vdr = dbus2vdr.DBus2VDR(watchdog='True')
    vdr.onSignal('ChannelSwitch',on_channel_change)
    loop = GObject.MainLoop()
    loop.run()


    Die Datei /opt/dpf-ax/dpf_128x128_vdr-sender-logo.conf

    Display Spoiler


    #
    # Siehe /usr/local/bin/my-startup-script.sh fuer Zusammenhaenge
    #
    Display dpf {
    Driver 'DPF'
    Port 'usb1'
    Font '6x8'
    Foreground 'ffffff'
    Background '000000'
    Basecolor '000000'
    Orientation 3 # 0 = standard, 1 = rotate 90° CW
    # 2 = rotate 180°, 3 = rotate 90° CCW
    Backlight backlight # Backlight variable control, 0..7 (0=off, 7=max)
    }

    Widget Bgnd {
    class 'Image'
    file '/tmp/aktueller-fernsehkanal.png'
    reload 1
    update 500
    inverted 0
    visible 1
    }

    Display 'DPF'

    Layout layout_128x128 {
    Layer 2 {
    X1.Y1 'Bgnd'
    }
    }

    Layout 'layout_128x128'

    Variables {
    backlight 7
    tick 500
    tack 200
    minute 60000
    }

    Hier und hier gibt es Logopacks. Die dann auf 128x128 Pixel geänderten Logos müssen nach /var/lib/vdr/senderlogos/128x128_png kopiert werden.Hier ein kleiner Ausschnitt, wie das bei mir aussieht:

    Code
    lrwxrwxrwx 1 root root	26 Jul 18 17:32 prosieben maxx.png -> prosieben-maxx_128x128.pnglrwxrwxrwx 1 root root	52 Jul 17 22:47 prosieben.png -> {a0bacf2a-3492-43dd-89b4-e08c63953fb4}-ProSieben.pnglrwxrwxrwx 1 root root	47 Jul 17 22:43 rtl2.png -> {a062a8fa-8fc7-4c1f-a20e-acf560c2605e}-RTL2.pnglrwxrwxrwx 1 root root	13 Jul 17 23:18 rtlnitro.png -> rtl nitro.png


    Die Namen der Dateien müssen der Ausgabe des Python-Scripts beim Umschalten entsprechen.
    Hierfür z.B. die
    /usr/local/bin/vdr-sender-logo-link-fuer-lcd4linux.py einfach mal auf der Konsole ausführen
    und Kanäle umschalten oder den Link
    /tmp/aktueller-fernsehkanal.png kontrollieren.


    4) Live-Bild Snapshots

    Einträge in der /usr/local/bin/my-startup-script.sh

    Code
    /usr/local/bin/vdr-live-bild-fuer-lcd4linux.sh &/opt/dpf-ax/lcd4linux/lcd4linux -Ff /opt/dpf-ax/dpf_128x128_vdr-live-snapshot.conf &


    Die Datei /usr/local/bin/vdr-live-bild-fuer-lcd4linux.sh

    Bash
    #!/bin/bashtempdir=/tmpcd $tempdirprefix=live-bildwhile true; do#  svdrpsend GRAB $prefix.pnm 100 128 128  svdrpsend GRAB $prefix.pnm 100 240 180  convert -shave 56x26 $prefix.pnm $prefix-shaved.pnm  sleep 0.200  pnmtopng $prefix-shaved.pnm > $prefix.png  sleep 4.800done

    Info: Da ein direkt auf 128x128 Pixel gegrabtes Images auch noch Ränder hat
    grabbe ich es etwas größer und schneide das Image mithilfe von convert ringsum zu.
    Wer will kann das Image auch auf das /run Filesytem auslagern, dann wird nicht die Festplatte sondern der Arbeitsspeicher als Zwischenspeicher genutzt!

    5) XTERM

    Kompilieren von ax206term und librote

    Code
    aptitude install libncurses5-devwget -nd http://forum.doozan.com/file.php?9,file=326,filename=st2205term-0.12.tar.bz2,download=1 --output-document=st2205term-0.12.tar.bz2tar -xvjf st2205term-0.12.tar.bz2cd st2205term-0.12wget -nd http://downloads.sourceforge.net/project/rote/rote/rote-0.2.8/rote-0.2.8.tar.gztar -xvzf rote-0.2.8.tar.gzcd rote-0.2.8./configure && makesudo make installcd ..vi mak-dpf      ->  Auskommentieren der "sudo apt-get install"-Zeile./mak-dpf


    Hilfsscript /usr/local/bin/ax206term.sh, damit die Terminalsitzung nicht sofort aktiv geschalten wird

    Bash
    #!/bin/bashwhile true; do	read -p "*************************\*                   	*\* Um das  Root-Terminal *\* zu starten  muss  auf *\* der Tastatur das Wort *\*                   	*\*    	'rOOt'     	*\*                   	*\*  eingegeben  werden.  *\*                   	*\*                   	*\* 	Deaktivieren  	*\* 	der  Sitzung  	*\* 	mit  'exit'!  	*\*                   	*\*************************\" antwort	case $antwort in    	rOOt ) /bin/bash --login;	esacdone


    ax206term als root starten

    Code
    su -cd /tmpexport LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH; cd /tmp; /opt/dpf-ax/st2205term-0.12/ax206term --blink --command=/usr/local/bin/ax206term.sh


    Wichtige Info zu ax206term: Alles, was ihr nach gestartetem ax206term auf Eurer Tastatur eingebt wird ZUSÄTZLICH am Display angezeigt und wenn die Terminalsitzung aktiv ist sogar ausgeführt (als root!)!
    Ein <strg> + <c> wird somit auch interpretiert und führt somit zum Schließen der Sitzung. Vielleicht hat ja aus dem Forum noch jemad ne Idee, wie man das hier verbessern kann?


    Ich wünsch Euch viel Spaß mit den Displays!

    Vielen Dank an WoFritz, Superelchi und Seahawk1986 für Ihre Unterstützung!

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!