Merge "[Feature][T106][task-view-1450]add emmc io test in lynq-at-factory"
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/fscheck.sh b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/fscheck.sh
index b5ccf20..56a4b0d 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/fscheck.sh
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/init.d/fscheck.sh
@@ -25,6 +25,11 @@
reboot
fi
+#xy.he@20250512 add for bug-view-1113
+if [ ! -L /etc_rw/localtime ]; then
+ln -s "/usr/share/zoneinfo/Asia/Shanghai" /etc_rw/localtime
+fi
+
#l.yang modify for T106BUG-387 start
if [ -e /dev/mmcblk1p1 ]; then
mount -t ext4 /dev/mmcblk1p1 /var/log
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/rc.local b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/rc.local
index fc9a630..3c14b25 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/rc.local
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-core/images/files/zx297520v3/vehicle_dc_ref/fs/normal/rootfs/etc/rc.local
@@ -33,12 +33,13 @@
rm -rf /etc_rw/udhcpd*.pid
+#xy.he@20250512 delete for bug-view-1113
#ln -sf "/etc/zoneinfo/Asia/Shanghai" /etc/localtime
-ln -sf "/etc_rw/localtime" /etc/localtime
-if [ ! -L /etc_rw/localtime ]; then
-ln -sf "/usr/share/zoneinfo/Asia/Shanghai" /etc_rw/localtime
-fi
+#ln -sf "/etc_rw/localtime" /etc/localtime
+#if [ ! -L /etc_rw/localtime ]; then
+#ln -sf "/usr/share/zoneinfo/Asia/Shanghai" /etc_rw/localtime
+#fi
echo "open nvserver at_ctl nv-rpc-daemon zxic_mainctrl rtc-service" > /proc/abnormal_exit_task
#jb.qi@20230918 delete for autosuspend
-zxic_ramdump > /tmp/ramdump.txt 2>&1 &
\ No newline at end of file
+zxic_ramdump > /tmp/ramdump.txt 2>&1 &
diff --git a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp
index 7a3a333..2d94df9 100755
--- a/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp
+++ b/cap/zx297520v3/sources/meta-zxic-custom/recipes-lynq/lynq-audio-demo/files/lynq-audio-demo.cpp
@@ -2,15 +2,77 @@
#include <stdio.h>
#include <string.h>
#include <errno.h>
+#include <atomic>
+#include <csignal>
+#include <signal.h>
#include "ring_tele.h"
#include <include/lynq-qser-audio.h>
+// Add atomic flag for one-time cleanup
+namespace {
+ std::atomic<bool> g_cleanup_done{false}; // Atomic flag for one-time cleanup
+}
+
typedef int (*audio_test_func)(void);
int g_audio_owner_id = 0;
char player_device[] = "device1";
char recorder_device[] = "device2";
+/********************************************************************
+* @brief: Signal handler for audio resource cleanup
+* @param sig [IN]: Signal number received
+* @note: Ensures audio resources are properly released on termination
+*********************************************************************/
+static void audio_signal_handler(int sig)
+{
+ if(!g_cleanup_done.exchange(true)) {
+ printf("[Audio Demo] Received termination signal:%d, performing hardware-level cleanup...\n", sig);
+ fflush(stdout); // Ensure log integrity
+ fflush(stderr);
+ qser_Audio_Deinit();
+ }
+ _Exit(sig); // Use _Exit to avoid atexit handlers
+}
+
+/********************************************************************
+* @brief: Signal handler registration (auto-executed before main())
+* @note: 1. Registers common termination signals
+* 2. Uses sigaction for better signal masking
+* 3. Blocks related signals during handling
+*********************************************************************/
+__attribute__((constructor))
+static void register_signal_handlers()
+{
+ struct sigaction act;
+ memset(&act, 0, sizeof(act));
+ act.sa_handler = audio_signal_handler;
+
+ // Block related signals during handling
+ sigemptyset(&act.sa_mask);
+ sigaddset(&act.sa_mask, SIGTERM); // Termination request
+ sigaddset(&act.sa_mask, SIGINT); // Terminal interrupt (Ctrl+C)
+ sigaddset(&act.sa_mask, SIGQUIT); // Terminal quit (Ctrl+\)
+ sigaddset(&act.sa_mask, SIGHUP); // Terminal hangup detection
+
+ // Register standard POSIX signals
+ sigaction(SIGINT, &act, NULL); // Terminal interrupt (Ctrl+C)
+ sigaction(SIGTERM, &act, NULL); // Default kill signal
+ sigaction(SIGQUIT, &act, NULL); // Terminal quit (Ctrl+\)
+ sigaction(SIGHUP, &act, NULL); // Terminal hangup
+
+ // Register critical error signals
+ struct sigaction crash_act;
+ memset(&crash_act, 0, sizeof(crash_act));
+ crash_act.sa_handler = audio_signal_handler;
+ crash_act.sa_flags = SA_RESETHAND; // Single-shot handler
+
+ sigaction(SIGSEGV, &crash_act, NULL); // Invalid memory access
+ sigaction(SIGILL, &crash_act, NULL); // Illegal instruction
+ sigaction(SIGFPE, &crash_act, NULL); // Floating-point exception
+ sigaction(SIGBUS, &crash_act, NULL); // Bus error (bad alignment)
+}
+
_cb_onPlayer cb_fun = [](int result)
{
if (result == 0)
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
index 5eead08..5255025 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
+++ b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/main.cpp
@@ -3,12 +3,13 @@
#include <unistd.h>
#include <stdlib.h>
#include <stdint.h>
+#include <liblog/lynq_deflog.h>
#include "lynq_timer.h"
#ifdef __cplusplus
extern "C" {
#endif
-
+#define USER_LOG_TAG "LYNQ_SDK_READY"
int main(void){
start_timer_request();
@@ -19,6 +20,7 @@
return 0;
}
+DEFINE_LYNQ_EXE_LOG(LYNQ_SDK_READY)
#ifdef __cplusplus
}
#endif
diff --git a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
index 56280dd..50b9b84 100755
--- a/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
+++ b/cap/zx297520v3/src/lynq/framework/lynq-sdk-ready/makefile
@@ -44,6 +44,7 @@
-lbinder \
-lpthread \
-llynq-uci \
+ -llynq-log \
LOCAL_SRC_FILES_CPP = $(wildcard *.cpp)
EXECUTABLE = lynq-sdk-ready
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
index d1ca261..afa272e 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/include/liblog/liblog.h
@@ -28,7 +28,7 @@
int lynq_set_special_log_level(const char * exe_name, const char * module_name, log_level_enum level);
int lynq_get_special_log_level(const char * exe_name, const char * module_name, log_level_enum *level);
int lynq_notify_recalc_log_level(pid_t pid);
-
+int lynq_notify_recalc_log_level_bottom(char *log_level);
#ifdef __cplusplus
}
#endif
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
index 6256d4f..51c209f 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/log.cpp
@@ -13,6 +13,7 @@
#ifdef MOBILETEK_TARGET_PLATFORM_T106
extern "C" {
#include <cfg_api.h>
+extern int log_level(char *level_name);
}
#endif
@@ -546,14 +547,74 @@
return system(cmd_buf);
}
+#define MAX_PIDS 128
+int kill_pid(char *command,int signal)
+{
+ int pids[MAX_PIDS];
+ int pid_count = 0;
+ FILE *fp = popen(command, "r");
+ if (fp == NULL)
+ {
+ perror("popen failed");
+ return -1;
+ }
+ char line[1024];
+ while(fgets(line, sizeof(line), fp) != NULL)
+ {
+ if (pid_count < MAX_PIDS)
+ {
+ pids[pid_count] = atoi(line);
+ kill(pids[pid_count], signal);
+ pid_count++;
+ }
+ }
+ pclose(fp);
+ return 0;
+}
+
+int lynq_notify_recalc_log_level_bottom(char *log_level)
+{
+ sc_cfg_set("print_level", log_level);
+ sc_cfg_set("syslog_level", log_level);
+
+ const char* process_names[] = {
+ "at_ctl",
+ "mnet_whitelist_proxy",
+ "rtc-service",
+ "msm_svr",
+ "zxic_mainctrl",
+ "zxic_mmi",
+ "lynq-ril-service"
+ };
+ const int process_count = sizeof(process_names) / sizeof(process_names[0]);
+
+
+ char command[1024] = "";
+ for (int i = 0; i < process_count; i++)
+ {
+ strcat(command, "pidof ");
+ strcat(command, process_names[i]);
+ if (i < process_count - 1)
+ strcat(command, " && ");
+ }
+/*close zxic-process kill SIGUSR2*/
+ kill_pid(command, SIGUSR2);
+/*close lynq-process kill SIGUSR1*/
+ kill_pid("ls /tmp/log_level/", SIGUSR1);
+ return 0;
+}
+
+
static void log_signal_handler(int signum) {
if (SIGUSR1 != signum)
return;
// 处理信号
+ log_level("syslog_level");
+ log_level("print_level");
for(int i=0; i < s_curr_reg_count; i++)
{
get_module_log_level(s_log_module_entries[i]);
- }
+ }
}
void __attribute__((constructor)) lynq_log_init()
diff --git a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
index 017fc6a..d08765c 100755
--- a/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
+++ b/cap/zx297520v3/src/lynq/lib/liblynq-log/log-riltel/makefile
@@ -18,15 +18,16 @@
LOCAL_C_INCLUDES = \
-I. \
-I$(LOCAL_PATH)/../include/liblog \
- -I$(ROOT)$(includedir)/logger \
+ -I$(ROOT)$(includedir)/logger \
LOCAL_LIBS := \
-L. \
-ldl \
- -lstdc++ \
+ -lstdc++ \
-llynq-uci \
-llog \
+ -lbinder
ifeq ($(strip $(TARGET_PLATFORM)), T106)
LOCAL_CFLAGS += -DMOBILETEK_TARGET_PLATFORM_T106
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/block.c b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/block.c
old mode 100644
new mode 100755
index 6622e32..af57016
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/block.c
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/block.c
@@ -132,6 +132,9 @@
/* debugfs files (only in main mmc_blk_data) */
struct dentry *status_dentry;
struct dentry *ext_csd_dentry;
+//cz.li@20250420 for emmc health begin
+ struct dentry *health_dentry;
+//cz.li@20250420 for emmc health begin
};
/* Device type for RPMB character devices */
@@ -1042,6 +1045,12 @@
ext_csd = mq_rq->drv_op_data;
ret = mmc_get_ext_csd(card, ext_csd);
break;
+//cz.li@20250420 for emmc health begin
+ case MMC_DRV_OP_GET_HEALTH:
+ ext_csd = mq_rq->drv_op_data;
+ ret = mmc_get_ext_csd(card, ext_csd);
+ break;
+//cz.li@20250420 for emmc health end
default:
pr_err("%s: unknown driver specific operation\n",
md->disk->disk_name);
@@ -2837,6 +2846,92 @@
.llseek = default_llseek,
};
+//cz.li@20250420 for emmc health begin
+#define HEALTH_STR_LEN 2
+static int mmc_health_open(struct inode *inode, struct file *filp)
+{
+ struct mmc_card *card = inode->i_private;
+ struct mmc_blk_data *md = dev_get_drvdata(&card->dev);
+ struct mmc_queue *mq = &md->queue;
+ struct request *req;
+ char *buf;
+ u8 *ext_csd = NULL;
+ int err;
+ ssize_t n;
+ unsigned int health;
+ char health_buf[64];
+ //printk("cy-health open\n");
+ buf = kmalloc(EXT_CSD_STR_LEN + 1, GFP_KERNEL);
+ if (!buf)
+ return -ENOMEM;
+
+ /* Ask the block layer for the EXT CSD */
+ req = blk_get_request(mq->queue, REQ_OP_DRV_IN, 0);
+ if (IS_ERR(req)) {
+ err = PTR_ERR(req);
+ goto out_free;
+ }
+ req_to_mmc_queue_req(req)->drv_op = MMC_DRV_OP_GET_HEALTH;
+ req_to_mmc_queue_req(req)->drv_op_data = &ext_csd;
+ //printk("cy- blk_execute_rq begin\n");
+ blk_execute_rq(mq->queue, NULL, req, 0);
+ //printk("cy- blk_execute_rq end\n");
+ err = req_to_mmc_queue_req(req)->drv_op_result;
+ //printk("cy-blk_put_request begin\n");
+ blk_put_request(req);
+ //printk("cy-blk_put_request end\n");
+ if (ext_csd == NULL) {
+ printk("EXT_CSD IF NULL\n");
+ goto out_free;
+ }
+ if (err) {
+ pr_err("FAILED %d\n", err);
+ if (ext_csd != NULL)
+ kfree(ext_csd);
+ goto out_free;
+ }
+
+ health = ext_csd[269];
+ //printk("cy-bad health %d\n",ext_csd[269]);
+ n = sprintf(buf, "%02x", health);
+ if (n != HEALTH_STR_LEN) {
+ //printk("cy-bad count %d , %d\n", (int)n , HEALTH_STR_LEN);
+ err = -EINVAL;
+ kfree(ext_csd);
+ goto out_free;
+ }
+
+ filp->private_data = buf;
+ kfree(ext_csd);
+ return 0;
+out_free:
+ kfree(buf);
+ return err;
+}
+
+static ssize_t mmc_health_read(struct file *filp, char __user *ubuf,
+ size_t cnt, loff_t *ppos)
+{
+ char *buf = filp->private_data;
+ printk("cy-mmc_ext_csd_read\n");
+ return simple_read_from_buffer(ubuf, cnt, ppos,
+ buf, HEALTH_STR_LEN);
+}
+
+static int mmc_health_release(struct inode *inode, struct file *file)
+{
+ kfree(file->private_data);
+ return 0;
+}
+
+static const struct file_operations mmc_dbg_health_fops = {
+ .open = mmc_health_open,
+ .read = mmc_health_read,
+ .release = mmc_health_release,
+ .llseek = default_llseek,
+};
+//cz.li@20250420 for emmc health end
+
static int mmc_blk_add_debugfs(struct mmc_card *card, struct mmc_blk_data *md)
{
struct dentry *root;
@@ -2862,7 +2957,13 @@
if (!md->ext_csd_dentry)
return -EIO;
}
-
+//cz.li@20250420 for emmc health begin
+ if (mmc_card_mmc(card)) {
+ md->health_dentry=
+ debugfs_create_file("health", S_IRUSR, root, card,
+ &mmc_dbg_health_fops);
+ }
+//cz.li@20250420 for emmc health end
return 0;
}
@@ -2881,6 +2982,13 @@
debugfs_remove(md->ext_csd_dentry);
md->ext_csd_dentry = NULL;
}
+
+//cz.li@20250420 for emmc health begin
+ if (!IS_ERR_OR_NULL(md->health_dentry)) {
+ debugfs_remove(md->health_dentry);
+ md->health_dentry= NULL;
+ }
+//cz.li@20250420 for emmc health end
}
#else
diff --git a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/queue.h b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/queue.h
old mode 100644
new mode 100755
index fd11491..6713585
--- a/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/queue.h
+++ b/cap/zx297520v3/zxic_code/zxic_source/linux-5.10/drivers/mmc/core/queue.h
@@ -59,6 +59,9 @@
MMC_DRV_OP_BOOT_WP,
MMC_DRV_OP_GET_CARD_STATUS,
MMC_DRV_OP_GET_EXT_CSD,
+//cz.li@20250420 for emmc health begin
+ MMC_DRV_OP_GET_HEALTH,
+//cz.li@20250420 for emmc health end
};
struct mmc_queue_req {