Quick and dirty virtual xserver forwarded to ledpanel, enjoy

master
informatic 2018-05-12 14:54:51 +02:00
parent 465c0885ea
commit 99a8cf5b9b
2 changed files with 50 additions and 0 deletions

29
launch-led Executable file
View File

@ -0,0 +1,29 @@
#!/bin/bash
#
# Usage: PULSE_SERVER=sound.waw.hackerspace.pl ./launch-led projectM-pulseaudio
#
trap 'pkill -P $$' SIGINT
Xephyr -br -ac -noreset -screen 128x128 :1 &
export DISPLAY=:1
(while true; do
gst-launch-1.0 -q ximagesrc use-damage=0 show-pointer=false endx=128 endy=128 ! queue ! videoconvert ! videorate ! video/x-raw,format=RGB,width=128,height=128 ! fdsink | python send.py 10.8.1.26 128 128
sleep 0.5
done) &
# ...resize current window to screen size
(#while true; do
sleep 2
xdotool search --onlyvisible . windowmove 0 0 windowsize 129 129
sleep 10
xdotool search --onlyvisible . windowmove 0 0 windowsize 129 129
#done
) &
sleep 1
$*
pkill -P $$

21
send.py Normal file
View File

@ -0,0 +1,21 @@
import sys
import struct
import socket
if __name__ == "__main__":
target = sys.argv[1]
width = int(sys.argv[2])
height = int(sys.argv[3])
size = width*height*3
prefix = struct.pack(
'!BBHBB', 0x9c, 0xda, size, 0, 1)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
while True:
buf = prefix + sys.stdin.read(size) + '\x36'
if len(buf) == 7:
exit(1)
sock.sendto(buf, (target, 65506))