Hallo,
damit die ganze Sache unter Gen2VDR 4 läuft habe ich folgendes gemacht:
python Serial wird installiert
emerge dev-python/pyserial
dann das Script geändert und unter /bin/tvcontrol.py gespeichert
#!/usr/bin/python
#allows you to capture the command switches
import sys
#get serial features for python
import serial
#this next line sets up the serial port to allow for communication
#and opens the serial port you may need to change
#ttyS0 to S1, S2, ect. The rest shouldn't need to change.
ser = serial.Serial('/dev/ttyUSB0', 9600, 8, serial.PARITY_NONE,serial.STOPBITS_ONE, xonxoff=0, rtscts=0, timeout=1)
#default COMMAND is bogus
COMMAND = "nope"
aspect169 = "kc 01 02"
aspect43 = "kc 01 01"
poweron = "ka 01 01"
poweroff = "ka 01 00"
inputdtv = "kb 01 00"
inputav1 = "kb 01 02"
inputcomp1 = "kb 01 04"
inputpc = "kb 01 06"
if sys.argv[1:] == ['--aspect169'] :
COMMAND = aspect169
if sys.argv[1:] == ['--aspect43'] :
COMMAND = aspect43
if sys.argv[1:] == ['--poweron'] :
COMMAND = poweron
if sys.argv[1:] == ['--poweroff'] :
COMMAND = poweroff
if sys.argv[1:] == ['--inputdtv'] :
COMMAND = inputdtv
if sys.argv[1:] == ['--inputav1'] :
COMMAND = inputav1
if sys.argv[1:] == ['--inputcomp1'] :
COMMAND = inputcomp1
if sys.argv[1:] == ['--inputpc'] :
COMMAND = inputpc
#This is when it actually writes the command to the serial port.
ser.write(bytes(COMMAND+'\r', encoding = 'ascii'))
#ser.write(COMMAND+'\r')
#all done now close the port.
ser.close()
Display More
wichtig war die Zeile mit der Abänderung des Sende-Command.
Dann noch ausführbar machen:
chmod 755 /bin/tvcontrol.py
Dann kann mit
den Fernseher ausschalten.
Als Hardware habe ich einen Prolific-Nachbau-USB-Seriell Adapter von dx.com genommen (~2,50€). Zusätzlich habe ich zwei DSUB 9 Buchsen an ein 3poliges Kabel gelötet.
Belegung:
2 -- 3
3 -- 2
5 -- 5
wennes