Browse Source

fix python script

main
Hendrik Langer 6 years ago
parent
commit
814c92c43d
  1. 52
      README.md
  2. 35
      doc/README.md
  3. 8
      raspberry-environment/cmd.txt
  4. 28
      raspberry-environment/pythonscript.py
  5. 15
      windows-snapshot-tool/src/main.cpp

52
README.md

@ -1,35 +1,49 @@
https://blog.danman.eu/new-version-of-lenkeng-hdmi-over-ip-extender-lkv373a/
https://github.com/gkralik/python-gst-tutorial
https://github.com/brettviren/pygst-tutorial-org
## Parts
* Mini-HDMI <-> HDMI Adapter
* Mini-USB <-> USB A Cable
* Micro-SD-Card >= 2GB
* Raspberry Pi Zero or Zero W or Model A (Model B/2B/3 not supported!)
gst-launch-1.0 -v udpsrc multicast-iface="eth0" multicast-group=239.255.42.42 auto-multicast=true port=5004 caps="video/mpegts, media=(string)video" ! tsdemux ! decodebin ! videoconvert ! autovideosink sync=false
## Hardware
______________________
| :::::::::::::::::::: |
| |
|_HDMI________USB__PWR_|
| | nc
v v
Beamer PC
vlc -vvv udp://@239.255.42.42:5004
## Build windows snapshot-tool
cd windows-snapshot-tool
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-cross-mingw32-linux.cmake ../
make
raspi: ! omxh264dec ! autovideosink
fbdevsink device=/dev/fb0
h264parse ! omxh264dec ! glimagesink
gst-launch-1.0 videotestsrc ! eglglessink
g_mass_storage
stall=0 ro=1
## prepare raspberry pi
install raspbian lite
(gstreamer-1.0) python3-gi (or python3-gst-1.0 ??) gstreamer1.0-omx gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
sudo raspi-config
* ??
* ??
sudo su -
apt update
apt dist-upgrade
apt install python3-pyinotify python3-rpi.gpio
length: 1324 (packet: 1358)
pid: 0x7d1 cc=0 1 2 12 13 14 15
echo "dtoverlay=dwc2" >> /boot/config.txt
readonly-root
how to build:
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-cross-mingw32-linux.cmake ../
make
## ToDo
* readonly-root
* dritte led für boot?
* screenshot-tool option für sofortigen screenshot

35
doc/README.md

@ -0,0 +1,35 @@
https://blog.danman.eu/new-version-of-lenkeng-hdmi-over-ip-extender-lkv373a/
https://github.com/gkralik/python-gst-tutorial
https://github.com/brettviren/pygst-tutorial-org
gst-launch-1.0 -v udpsrc multicast-iface="eth0" multicast-group=239.255.42.42 auto-multicast=true port=5004 caps="video/mpegts, media=(string)video" ! tsdemux ! decodebin ! videoconvert ! autovideosink sync=false
vlc -vvv udp://@239.255.42.42:5004
raspi: ! omxh264dec ! autovideosink
fbdevsink device=/dev/fb0
h264parse ! omxh264dec ! glimagesink
gst-launch-1.0 videotestsrc ! eglglessink
g_mass_storage
stall=0 ro=1
(gstreamer-1.0) python3-gi (or python3-gst-1.0 ??) gstreamer1.0-omx gstreamer1.0-plugins-good gstreamer1.0-plugins-bad
length: 1324 (packet: 1358)
pid: 0x7d1 cc=0 1 2 12 13 14 15
how to build:
mkdir build && cd build
cmake -DCMAKE_TOOLCHAIN_FILE=../Toolchain-cross-mingw32-linux.cmake ../
make

8
raspberry-environment/cmd.txt

@ -119,11 +119,11 @@ done
ToDo:
inotify only once!!
recreate image on boot
repartition for usbimage?
memory split? (hdmi ausgabe u framebuffer beachten!)
readonly-root
dritte led für boot?
python3-pyinotify
screenshot-tool option für sofortigen screenshot

28
raspberry-environment/pythonscript.py

@ -120,7 +120,18 @@ if __name__ == '__main__':
GPIO.output(23, GPIO.LOW)
try:
subprocess.run(['modprobe', 'g_mass_storage', 'file=/usbdisk.img', 'stall=0', 'removable=1', 'iSerialNumber=1234567890'], shell=False, check=True)
subprocess.run(['dd', 'if=/dev/zero', 'of=/tmp/usbdisk.img', 'bs=1M', 'count=96'], shell=False, check=True)
#sfdisk
#loop-mount
#mkfs
subprocess.run(['mkfs', '-t', 'vfat', '-n', 'SCREENSHOTS', '/tmp/usbdisk.img'], shell=False, check=True)
#subprocess.run(['mount', '-o', 'loop,ro', '-t', 'vfat', '/tmp/usbdisk.img', '/mnt'], shell=False, check=True)
# copy screenshot-tool.exe
# copy background.png
#subprocess.run(['umount', '/mnt'], shell=False, check=False)
subprocess.run(['modprobe', 'g_mass_storage', 'file=/tmp/usbdisk.img', 'stall=0', 'removable=1', 'iSerialNumber=1234567890'], shell=False, check=True)
#tvservice -p
# tvservice -e "DMT 82"
# fbset -g 1920 1080 1920 1080 16
@ -134,17 +145,20 @@ if __name__ == '__main__':
print('file changed')
subprocess.run(['killall', 'fim'], shell=False)
subprocess.run(['umount', '/mnt'], shell=False, check=False)
subprocess.run(['mount', '-o', 'loop,ro,offset=1048576', '-t', 'vfat', '/usbdisk.img', '/mnt'], shell=False, check=True)
subprocess.run(['mount', '-o', 'loop,ro', '-t', 'vfat', '/tmp/usbdisk.img', '/mnt'], shell=False, check=True)
list_of_files = glob.glob('/mnt/*')
latest_file = max(list_of_files, key=os.path.getctime)
print (latest_file)
list_of_files = glob.glob('/mnt/*.png')
list_of_files.extend(glob.glob('/mnt/*.jpg'))
list_of_files.extend(glob.glob('/mnt/*.bmp'))
subprocess.run('fim -d /dev/fb0 -T 1 --autozoom --quiet '+paths[0], shell=True)
if list_of_files:
latest_file = max(list_of_files, key=os.path.getctime)
print(latest_file)
subprocess.run('fim -d /dev/fb0 -T 1 --autozoom --quiet "'+latest_file+'" &', shell=True)
GPIO.output(23, GPIO.LOW)
watch_delay_call('/usbdisk.img', callback, 0.5, True, pyinotify.IN_MODIFY)
watch_delay_call('/tmp/usbdisk.img', callback, 0.5, True, pyinotify.IN_MODIFY)
finally:
GPIO.output(23, GPIO.LOW)

15
windows-snapshot-tool/src/main.cpp

@ -236,6 +236,21 @@ void getRaspiStorage() {
// GetLogicalDrives()
// for result
// if result.GetDriveType() == DRIVE_REMOVABLE
TCHAR szName[MAX_PATH];
TCHAR szTemp[512];
TCHAR szDrive[3] = TEXT(" :");
szTemp[0] = '\0';
if (GetLogicalDriveStrings(BUFSIZE-1, szTemp))
{
BOOL bFound = FALSE;
for (TCHAR* p = szTemp; !bFound && *p; *p++;) {
*szDrive = *p;
if (QueryDosDevice(szDrive, szName, MAX_PATH))
{
}
}
}
}

Loading…
Cancel
Save