Kommen wir zu der installation (angelehnt an Teil 1, Tvheadend) 1.Installation OSCam 2.Erstellen der Konfigurations Dateien 3.Cardreader Installieren 4.Autostart Konfigurieren 5.Tvheadend mit OSCam verbinden ab in die Konsole 😉 1. Installation OSCam sudo -s cd /usr/src apt-get install subversion dialog libusb-dev build-essential git pkg-config libssl-dev bzip2 wget svn checkout http://www.streamboard.tv/svn/oscam/trunk oscam-svn cd oscam-svn make allyesconfig make CONF_DIR=/etc/oscam Anschliesend Wird das OSCam binary gebaut, es befindet sich im Unterordner Distribution. Wir kopieren es nach /usr/bin/ und bennenen das Binary in oscam um. cd Distribution cp oscam-1.20_svn(AktuellGebauteOSCamRevision)-x86_64-linux-gnu-ssl /usr/bin/oscam Oder (ARM) cp oscam-1.20_(AktuellGebauteOSCAMRevision)-arm-linux-gnueabihf-ssl /usr/bin/oscam 2. Erstellen der Konfigurationsdateien oscam.conf mkdir /etc/oscam joe /etc/oscam/oscam.conf Folgendes einfĂŒgen + Abspeichern! # oscam.server generated automatically by Streamboard OSCAM 1.20_svn SVN r11434 # Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.server.txt [global] logfile = /var/log/oscam.log maxlogsize = 2048 [cache] [dvbapi] enabled = 1 au = 1 pmt_mode = 4 listen_port = 9000 user = tvheadend boxtype = pc [webif] httpport = 8888 httpuser = DeinBenutzernameZurAnmeldung httppwd = DeinKennwortZurAnmeldung httphideidleclients = 0 httpallowed = 127.0.0.1,192.168.0.0-192.168.255.255 oscam.user joe /etc/oscam/oscam.user Folgendes einfĂŒgen + Abspeichern! # oscam.user generated automatically by Streamboard OSCAM 1.20_svn SVN r11432 # Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.user.txt [account] user = tvheadend pwd = PseudoKennwortVergeben monlevel = 4 au = 1 group = 1 oscam.server joe /etc/oscam/oscam.server Folgendes einfĂŒgen + Abspeichern! # oscam.server generated automatically by Streamboard OSCAM 1.20_svn SVN r11434 # Read more: http://www.streamboard.tv/svn/oscam/trunk/Distribution/doc/txt/oscam.server.txt [reader] label = HD01 description = HD01 protocol = mouse device = /dev/hd01 autospeed = 0 caid = 1830 boxkey = A7.....7C rsakey = BF....D5 detect = cd mhz = 600 cardmhz = 368 ident = 1830:000000,003411,008011 group = 1 emmcache = 1,1,2,0 blockemm-unknown = 1 blockemm-g = 1 Anmerkung : Boxkey und RSAkey könnt ihr euch z.b hier suchen : RSA_BOX_key oscam.dvbapi joe /etc/oscam/oscam.dvbapi Folgendes einfĂŒgen + Abspeichern! P: 1830 Logfile und Cache anlegen, Berechtigungen anpassen touch /var/log/oscam.log mkdir /tmp/.oscam chown -R hts:users /etc/oscam/* chown -R hts:users /tmp/.oscam/* chown -R hts:users /var/log/oscam.log User hts zur Gruppe Dialout hinzufĂŒgen Anmerkung : So erlauben wir User hts auf das USB Device (den Kartenleser) zuzugreifen. usermod -aG dialout hts Geschafft! 3. Cardreader Installieren Nach dem anschließen des Kartenlesers wird das GerĂ€t meistens unter /dev/ttyusb0 angesprochen, es kann allerdings sein, insbesondere nach einem reboot, dass der Kartenleser plötzlich unter /dev/ttyusb1-9 zur verfĂŒgung steht. Das ist schlecht und wollen wir nicht, denn wir haben in der oscam.server eingetragen, dass der Kartenleser unter /dev/hd01 angesprochen wird! Die Lösung ist eine "udev rule" anzulegen, der Kernel identifiziert das GerĂ€t anhand der Hardware ID, oder Seriennummer und ist in der Lage den Kartenleser an jedem usb-port zu identifizieren. Wir erstellen also eine Rule die Den Kartenleser Identifiziert, und bei Anschluss unter /dev/hd01 zur verfĂŒgung stellt. In diesem Beispiel wird der Kartenleser unter seiner Vendor ID identifiziert joe /lib/udev/rules.d/49-easymouse.rules Folgendes einfĂŒgen + Abspeichern! # Konfiguration fĂŒr Smartcards ĂŒber Easymouse2 # # ID 0403:6001 Future Technology Devices International, Ltd FT232 USB-Serial (UART) IC SUBSYSTEMS=="usb", ATTRS{idProduct}=="6001", ATTRS{idVendor}=="0403",SYMLINK+="hd01", KERNEL=="ttyUSB[0123456789]" Jetzt noch die Positionen der "Dipschalter" 1.unten ; 5V 2.unten; Phoenix 3.oben ; --> 4.oben ; 6MHz 4.Autostart Konfigurieren joe /lib/systemd/system/oscam.service Folgendes einfĂŒgen + Abspeichern! [Unit] Description=OScam After=network.target Requires=network.target [Service] User=hts Group=users Type=forking ExecStart=/usr/bin/oscam -b -B /var/run/oscam.pid ExecStop=/bin/rm /var/run/oscam.pid TimeoutStopSec=1 Restart=always RestartSec=5 StartLimitInterval=0 [Install] WantedBy=multi-user.target Autostart aktivieren systemctl daemon-reload systemctl enable oscam.service OSCam Startup Script for Ubuntu and other linux distros (systemd compatible) February 5, 2013 / snippets Updated on 14.05.2017 Create a file called /etc/init.d/oscam with the following contents: #!/bin/sh ### BEGIN INIT INFO # Provides: oscam # Required-Start: $local_fs $network $remote_fs # Required-Stop: $local_fs $network $remote_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: start and stop service oscam # Description: oscam ### END INIT INFO DAEMON=/usr/local/bin/oscam PIDFILE=/var/run/oscam.pid DAEMON_OPTS="-p 4096 -r 2 -B ${PIDFILE} -c /usr/local/etc/ -t /tmp/.oscam" test -x ${DAEMON} || exit 0 . /lib/lsb/init-functions case "$1" in start) log_daemon_msg "Starting OScam..." /sbin/start-stop-daemon --start --quiet --background --name oscam --exec ${DAEMON} -- ${DAEMON_OPTS} log_end_msg $? ;; stop) log_daemon_msg "Stopping OScam..." /sbin/start-stop-daemon -R 5 --stop --name oscam --exec ${DAEMON} log_end_msg $? ;; restart) $0 stop $0 start ;; force-reload) $0 stop /bin/kill -9 `pidof oscam` /usr/bin/killall -9 oscam $0 start ;; *) echo "Usage: /etc/init.d/oscam {start|stop|restart|force-reload}" exit 1 ;; esac This assumes that you have the oscam binary located in /usr/local/bin/oscam. Remember you have to create this file as the root user. To “enable” the script and the starting up of oscam on reboot, use the following commands on Ubuntu/Debian: sudo chmod +x /etc/init.d/oscam sudo update-rc.d oscam defaults systemd compatibility The script will also work on systemd systems (like Ubuntu 16.04 and so on). To force systemd to detect the service, you have to do: systemctl daemon-reload To enable the system to start at boot: systemctl enable oscam crontab checks Furthermore, for a simple crontab script to check if oscam has crashed and didn’t restart by itself, let’s create a file and call it /usr/local/bin/oscamchk: #!/bin/bash PIDFILE=/var/run/oscam.pid if (kill -0 `cat $PIDFILE`) then echo "it's alive!" > /dev/null else rm $PIDFILE /etc/init.d/oscam start > /dev/null echo "OSCAM restarted at `date`" >> /var/log/oscam-crash.log fi And let’s make this run every minute: sudo chmod +x /usr/local/bin/oscamchk sudo crontab -e Once the crontab editor has started, add the following line: * * * * * /usr/local/bin/oscamchk >/dev/null 2>&1