Update for Orange Pi 5 v1.0.8

This commit is contained in:
orangepi-xunlong
2022-12-22 18:59:57 +08:00
parent 653f94c660
commit 1e88c5d827
18 changed files with 239 additions and 31 deletions

View File

@@ -3,7 +3,7 @@
#mirror_url=http://mirrors.ustc.edu.cn
mirror_url=https://repo.huaweicloud.com
if [[ -n $1 ]]; then
if [[ -n $1 && $1 =~ ros1|ros2 ]]; then
version=$1
else
echo "usage: install_ros.sh ros1/ros2"

View File

@@ -0,0 +1,87 @@
#!/bin/bash
if [[ -n $1 && $1 =~ left|right|inverted|none ]]; then
type=$1
else
echo "usage: set_lcd_rotate.sh [left|right|inverted|none]"
exit
fi
user=$(cat /etc/lightdm/lightdm.conf.d/22-orangepi-autologin.conf | grep "autologin-user=" | cut -d "=" -f 2)
#echo $user
if [[ $user == "root" ]]; then
lcd_num=$(sudo xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | wc -l)
[[ $lcd_num == 1 ]] && id=$(sudo xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | cut -d '=' -f2 | cut -d " " -f 1 | cut -d "[" -f 1)
if [[ $lcd_num == 2 ]]; then
id1=$(sudo xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | head -1 | cut -d "=" -f2 | cut -d "[" -f1)
id2=$(sudo xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | tail -1 | cut -d "=" -f2 | cut -d "[" -f1)
#echo "id1 = $id1"
#echo "id2 = $id2"
fi
fi
if [[ $user != "root" ]]; then
lcd_num=$(xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | wc -l)
[[ $lcd_num == 1 ]] && id=$(xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | cut -d '=' -f2 | cut -d " " -f 1 | cut -d "[" -f 1)
if [[ $lcd_num == 2 ]]; then
id1=$(xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | head -1 | cut -d "=" -f2 | cut -d "[" -f1)
id2=$(xinput | grep "Goodix Capacitive TouchScreen" | grep "pointer" | tail -1 | cut -d "=" -f2 | cut -d "[" -f1)
#echo "id1 = $id1"
#echo "id2 = $id2"
fi
fi
#echo $lcd_num
#echo $id
case $1 in
left)
rotate=3
matrix="0 -1 1 1 0 0 0 0 1"
;;
right)
rotate=1
matrix="0 1 0 -1 0 1 0 0 1"
;;
inverted)
rotate=2
matrix="-1 0 1 0 -1 1 0 0 1"
;;
none)
rotate=0
matrix="1 0 0 0 1 0 0 0 1"
;;
esac
[[ -f /etc/profile.d/lcd.sh ]] && sudo rm /etc/profile.d/lcd.sh
sudo bash -c "echo '#!/bin/bash' >> /etc/profile.d/lcd.sh"
sudo bash -c "echo ' ' >> /etc/profile.d/lcd.sh"
sudo bash -c "echo '[[ \$XDG_SESSION_TYPE == x11 ]] && \' >> /etc/profile.d/lcd.sh"
if [[ $lcd_num == 2 ]]; then
sudo bash -c "echo xinput set-prop $id1 \'Coordinate Transformation Matrix\' ${matrix} >> /etc/profile.d/lcd.sh"
sudo bash -c "echo '[[ \$XDG_SESSION_TYPE == x11 ]] && \' >> /etc/profile.d/lcd.sh"
sudo bash -c "echo xinput set-prop $id2 \'Coordinate Transformation Matrix\' ${matrix} >> /etc/profile.d/lcd.sh"
else
sudo bash -c "echo xinput set-prop $id \'Coordinate Transformation Matrix\' ${matrix} >> /etc/profile.d/lcd.sh"
fi
#xrandr -o $1
#sed -i '/xrandr -o/d' ~/.bashrc
#echo "xrandr -o $1" >> ~/.bashrc
sudo sed -i '/extraargs=fbcon=rotate/d' /boot/orangepiEnv.txt
sudo bash -c "echo extraargs=fbcon=rotate:${rotate} >> /boot/orangepiEnv.txt"
sudo sync
sudo reboot

View File

@@ -10,14 +10,14 @@ export XDG_RUNTIME_DIR=/run/user/1000
if [[ -c /dev/video51 ]]; then
gst-launch-1.0 v4l2src device=/dev/video33 io-mode=4 ! video/x-raw,format=NV12,width=1080,height=720,framerate=15/1 ! xvimagesink > /dev/null 2>&1 &
gst-launch-1.0 v4l2src device=/dev/video33 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1 &
gst-launch-1.0 v4l2src device=/dev/video42 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1 &
gst-launch-1.0 v4l2src device=/dev/video51 io-mode=4 ! video/x-raw,format=NV12,width=640,height=480,framerate=15/1 ! xvimagesink > /dev/null 2>&1
gst-launch-1.0 v4l2src device=/dev/video51 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1
elif [[ -c /dev/video31 ]]; then
gst-launch-1.0 v4l2src device=/dev/video22 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1 &
gst-launch-1.0 v4l2src device=/dev/video31 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1
elif [[ -c /dev/video11 ]]; then
gst-launch-1.0 v4l2src device=/dev/video11 io-mode=4 ! video/x-raw,format=NV12,width=2112,height=1568,framerate=15/1 ! xvimagesink > /dev/null 2>&1
gst-launch-1.0 v4l2src device=/dev/video11 io-mode=4 ! video/x-raw,format=NV12,width=720,height=576,framerate=15/1 ! xvimagesink > /dev/null 2>&1
else
echo "Can not find camera!!!"
fi

View File

@@ -5,4 +5,7 @@ export DISPLAY=:0.0
#export GST_DEBUG_FILE=/tmp/2.txt
# xv vo
mpv --hwdec=rkmpp --vd-lavc-software-fallback=no --vo=xv /usr/local/test.mp4
while true
do
mpv --hwdec=rkmpp --vd-lavc-software-fallback=no --vo=xv /usr/local/test.mp4
done

View File

@@ -0,0 +1,14 @@
#!/bin/bash
export DISPLAY=:0.0
if [[ -z $1 ]]; then
video=/usr/local/test.mp4
else
video=$1
fi
while true
do
gst-play-1.0 $video --videosink=xvimagesink
done

View File

@@ -0,0 +1,43 @@
#!/bin/bash
if [[ -n $1 && $1 =~ main|headset ]]; then
type=$1
else
echo "usage: test_record.sh main/headset"
exit
fi
card=$(aplay -l | grep "es8388" | cut -d ':' -f 1 | cut -d ' ' -f 2)
if [[ $type == "main" ]]; then
tinymix -D 2 3 4
tinymix -D 2 4 2
tinymix -D 2 14 192
tinymix -D 2 16 0
tinymix -D 2 17 0
tinymix -D 2 31 1
tinymix -D 2 32 1
tinymix -D 2 33 1
else
tinymix -D 2 3 2
tinymix -D 2 4 1
tinymix -D 2 14 192
tinymix -D 2 16 0
tinymix -D 2 17 0
tinymix -D 2 31 0
tinymix -D 2 32 0
tinymix -D 2 33 0
fi
echo "Start recording: /tmp/test.wav"
arecord -D hw:${card},0 -d 5 -f cd -t wav /tmp/test.wav
echo "Start playing"
aplay /tmp/test.wav -D hw:1,0
aplay /tmp/test.wav -D hw:2,0
#aplay /tmp/test.wav -D hw:0,0