#!/bin/bash
xrandr -s 0 --output DSI-1
xrandr -s 0 --output HDMI-1
xrandr --fb 1024x600 --output DSI-1 --mode 1024x600 --panning 0x0*
xrandr --output HDMI-1 --primary --mode 1920x1080 --output DSI-1 --off
xrandr --output HDMI-1 --primary --mode 1920x1080 --pos 0x0 --output DSI-1 --mode 1024x600 --pos 1920x0
gst-launch-1.0 v4l2src device=/dev/video11 ! videoconvert ! video/x-raw,format=NV12,width=1920,height=1080 ! xvimagesink
自身和外接显示器同屏
#!/bin/bash
#
xrandr -s 0 --output DSI-1 # 设置默认分辨率,一般默认为最高分辨率
xrandr -s 0 --output HDMI-1 # 设置默认分辨率,一般默认为最高分辨率
xrandr --fb 1024x600 --output DSI-1 --mode 1024x600 --panning 0x0*
# 复制屏幕操作,两块屏幕显示一致:
#xrandr --fb 1280x800 --output DSI-1 --primary --mode 1024x600 --panning 1280x800* --output HDMI-1 --mode 1280x800 --same-as DSI-1
xrandr --fb 1024x600 --output DSI-1 --primary --mode 1024x600 --panning 1024x600* --output HDMI-1 --mode 1920x1080 --same-as DSI-1
双屏同显
#!/bin/bash
echo 111 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio111/direction
echo 0 > /sys/class/gpio/gpio111/value
echo 112 > /sys/class/gpio/export
echo in > /sys/class/gpio/gpio112/direction
xrandr -s 0 --output DSI-1
xrandr --fb 1024x600 --output DSI-1 --mode 1024x600 --panning 0x0* --output HDMI-1 --off
value=`cat /sys/class/gpio/gpio112/value`
cam=0
pos=0
function startcam {
gst-launch-1.0 v4l2src device=/dev/video11 ! video/x-raw,width=1920,height=1080 ! videoscale ! 'video/x-raw,width=1024,height=600' ! videoconvert ! video/x-raw,format=NV12,width=1024,height=600 ! xvimagesink &
cam=$!
echo 1 > /sys/class/gpio/gpio111/value
}
echo "$value"
while [ true ]
do
value=`cat /sys/class/gpio/gpio112/value`
if [ "$pos" = "0" ]
then
if [ "$value" = "0" ]
then
echo "key pressed"
pos=1
if [ "$cam" = "0" ]
then
echo "start cam"
startcam
else
echo "kill cam = kill $cam"
/bin/bash -c "kill $cam"
cam=0
echo 0 > /sys/class/gpio/gpio111/value
fi
else
echo "key not pressed"
fi
else
if [ "$value" = "0" ]
then
echo "key keep pressed"
else
echo "key not pressed"
pos=0
fi
fi
sleep 0.1
done