This commit is contained in:
刘可亮
2024-10-30 16:50:31 +08:00
parent 0ef85b55da
commit 661e71562d
458 changed files with 46555 additions and 12133 deletions

View File

@@ -504,14 +504,6 @@ if LPKG_USING_CHERRYUSB
bool "ARGB8888"
endchoice
config AIC_USB_DISP_SCALE_DOWN_X
int "scale down for X two sides"
default 0
config AIC_USB_DISP_SCALE_DOWN_Y
int "scale down for Y two sides"
default 0
config AIC_USB_DISP_SW_GPIO_EN
bool "Using gpio switch"
default n

View File

@@ -50,17 +50,6 @@ uint32_t usb_disp_rotate = AIC_FB_ROTATE_DEGREE;
uint32_t usb_disp_rotate = 0;
#endif
#ifdef AIC_USB_DISP_SCALE_DOWN_X
uint32_t usb_disp_scale_down_x = AIC_USB_DISP_SCALE_DOWN_X;
#else
uint32_t usb_disp_scale_down_x = 0;
#endif
#ifdef AIC_USB_DISP_SCALE_DOWN_Y
uint32_t usb_disp_scale_down_y = AIC_USB_DISP_SCALE_DOWN_Y;
#else
uint32_t usb_disp_scale_down_y = 0;
#endif
#ifdef AIC_USB_DISP_DEF_DIS
uint8_t usb_display_en = 0;
#else

View File

@@ -204,7 +204,7 @@ static int sensor_get_fmt(void)
ret = mpp_dvp_ioctl(DVP_IN_G_FMT, &f);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err %d\n", ret);
USB_LOG_ERR("Failed to get sensor format! err %d\n", ret);
return -1;
}
@@ -222,7 +222,7 @@ static int sensor_set_infmt(void)
ret = mpp_dvp_ioctl(DVP_IN_S_FMT, &g_uvc_video.src_fmt);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err %d\n", ret);
USB_LOG_ERR("Failed to set DVP in-format! err %d\n", ret);
return -1;
}
@@ -241,7 +241,7 @@ static int sensor_set_outfmt(int width, int height, int format)
ret = mpp_dvp_ioctl(DVP_OUT_S_FMT, &f);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err -%d\n", -ret);
USB_LOG_ERR("Failed to set DVP out-format! err -%d\n", -ret);
return -1;
}
return 0;
@@ -252,7 +252,7 @@ static int sensor_request_buf(struct vin_video_buf *vbuf)
int i = 0;
if (mpp_dvp_ioctl(DVP_REQ_BUF, (void *)vbuf) < 0) {
USB_LOG_ERR("ioctl() failed!\n");
USB_LOG_ERR("Failed to request buf!\n");
return -1;
}
@@ -265,13 +265,18 @@ static int sensor_request_buf(struct vin_video_buf *vbuf)
vbuf->planes[i * vbuf->num_planes + 1].len);
}
if (vbuf->num_buffers < 3) {
pr_err("The number of video buf must >= 3!\n");
return -1;
}
return 0;
}
static int sensor_queue_buf(int index)
{
if (mpp_dvp_ioctl(DVP_Q_BUF, (void *)(ptr_t)index) < 0) {
USB_LOG_ERR("ioctl() failed!\n");
USB_LOG_ERR("Q failed! Maybe buf state is invalid.\n");
return -1;
}
@@ -284,7 +289,7 @@ static int sensor_dequeue_buf(int *index)
ret = mpp_dvp_ioctl(DVP_DQ_BUF, (void *)index);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err %d\n", ret);
USB_LOG_ERR("DQ failed! Maybe cannot receive data from Camera. err %d\n", ret);
return -1;
}
@@ -302,10 +307,10 @@ static int sensor_start(void)
ret = mpp_dvp_ioctl(DVP_STREAM_ON, NULL);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err %d\n", ret);
USB_LOG_ERR("Failed to start streaming! err %d\n", ret);
return -1;
} else {
USB_LOG_DBG("start sensor, ret:%d\n", ret);
USB_LOG_DBG("Start sensor\n");
}
return 0;
@@ -317,7 +322,7 @@ static int sensor_stop(void)
ret = mpp_dvp_ioctl(DVP_STREAM_OFF, NULL);
if (ret < 0) {
USB_LOG_ERR("ioctl() failed! err -%d\n", -ret);
USB_LOG_ERR("Failed to start streaming! err -%d\n", -ret);
return -1;
}

View File

@@ -0,0 +1,170 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 ArtInChip Technology Co., Ltd
MY_NAME=$0
TOPDIR=$PWD
AIC_UD_PKG="AicUSBDisplay"
# Return value
ERR_CANCEL=100
ERR_UNSUPPORTED=110
ERR_PKG_UNVAILABLE=111
ERR_NET_UNVAILABLE=112
COLOR_BEGIN="\033["
COLOR_RED="${COLOR_BEGIN}41;37m"
COLOR_YELLOW="${COLOR_BEGIN}43;30m"
COLOR_WHITE="${COLOR_BEGIN}47;30m"
COLOR_END="\033[0m"
pr_err()
{
echo -e "${COLOR_RED}*** $*${COLOR_END}"
}
pr_warn()
{
echo -e "${COLOR_YELLOW}!!! $*${COLOR_END}"
}
pr_info()
{
echo
echo -e "${COLOR_WHITE}>>> $*${COLOR_END}"
}
check_root()
{
CUR_USER=$(whoami)
if [ "$CUR_USER" = "root" ]; then
return
fi
sudo -l -U $(whoami) | grep ALL > /dev/null
if [ $? -eq 0 ]; then
return
fi
pr_warn $MY_NAME "must install package with 'sudo'. "
pr_warn "Your passward will be safe and always used locally."
}
check_os()
{
if [ -f /etc/lsb-release ]; then
OS_VER=$(cat /etc/lsb-release | grep RELEASE | awk -F '=' '{print $2}')
OS_TYPE="Ubuntu"
elif [ -f /etc/issue ]; then
cat /etc/issue 2>&1 | grep Debian > /dev/null
if [ $? -eq 0 ]; then
OS_VER=$(cat /etc/issue | awk '{print $3}')
OS_TYPE="Debian"
fi
else
pr_err "Unknow system OS"
exit $ERR_UNSUPPORTED
fi
}
check_arch()
{
uname -m | grep aarch64 > /dev/null
if [ $? -eq 0 ]; then
ARCH_TYPE='arm64'
return
fi
uname -m | grep x86_64 > /dev/null
if [ $? -eq 0 ]; then
ARCH_TYPE='amd64'
return
fi
pr_err "Unsupported CPU architecture: "
exit $ERR_UNSUPPORTED
}
check_pi()
{
uname -r | grep "rpi" > /dev/null
if [ $? -eq 0 ]; then
echo It is Raspberry PI
IS_RPI=YES
XORG_CFG_WAY="sudo raspi-config\n\t-> 6 Advanced Options\n\t\t-> A6 X11/Xwayland\n"
else
XORG_CFG_WAY="sudo vim /etc/gdm3/custom.conf\n\tthen unncomment \"#WaylandEnable=false\"\n"
fi
}
check_xorg()
{
ps -ef | grep Xorg | grep -v grep > /dev/null
if [ $? -ne 0 ]; then
pr_err "Only support Xorg server as to now!"
pr_info "Try switch to Xorg in this way:"
echo ------------------------------------------------
printf "$XORG_CFG_WAY"
echo ------------------------------------------------
exit $ERR_UNSUPPORTED
fi
}
check_root
check_os
check_arch
check_pi
check_xorg
pr_info "Current system is $OS_TYPE $OS_VER $ARCH_TYPE"
echo
PKG_NAME=$(find . -name "${AIC_UD_PKG}*${ARCH_TYPE}*.deb" | xargs ls -t -1 | head -1)
if [ "x$PKG_NAME" = "x" ]; then
pr_warn "Can not find $AIC_UD_PKG DEB package for current system"
exit $ERR_PKG_UNVAILABLE
else
echo Found $PKG_NAME
fi
if [ "$OS_TYPE" = "Debian" ] && [ "$OS_VER" -lt "12" ] && [ "x$IS_RPI" = "xYES" ]; then
pr_info Check Xorg ...
XORG_PKG_NAME=$(find . -name "xserver-xorg-core_1.20.11*.deb" | xargs ls -t -1 | head -1)
if [ "x$XORG_PKG_NAME" = "x" ]; then
pr_warn "Can not find Xorg package for $OS_TYPE $OS_VER"
exit $ERR_PKG_UNVAILABLE
else
echo Install $XORG_PKG_NAME first ...
fi
echo
sudo dpkg -i $XORG_PKG_NAME
if [ $? -ne 0 ]; then
pr_err "Failed to install $XORG_PKG_NAME"
exit $ERR_CANCEL
fi
fi
pr_info Check dkms ...
sudo apt install dkms
if [ $? -ne 0 ]; then
pr_err "Failed to install dkms"
pr_err "Maybe the software source is not accessable! Please check it"
exit $ERR_NET_UNVAILABLE
fi
echo
dpkg -s $AIC_UD_PKG | grep "Status" | grep "installed" > /dev/null
if [ $? -eq 0 ]; then
pr_info "$AIC_UD_PKG was already installed, so remove it first ..."
sudo dpkg -r $AIC_UD_PKG
fi
pr_info Install $PKG_NAME ...
sudo dpkg -i $PKG_NAME
if [ $? -ne 0 ]; then
pr_err "Failed to install $PKG_NAME"
exit $ERR_CANCEL
fi
pr_info $AIC_UD_PKG installed successfully!

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# SPDX-License-Identifier: Apache-2.0
#
# Copyright (C) 2024 ArtInChip Technology Co., Ltd
AIC_UD_PKG="AicUSBDisplay"
sudo dpkg -r $AIC_UD_PKG