From a0de686d2e0aedf91d7f3573099c43a3ebb79c7b Mon Sep 17 00:00:00 2001 From: Edwin Wu Date: Fri, 27 Jun 2025 16:17:51 +0800 Subject: [PATCH] Resume device output after user program restart kxo has a critical issue: if the userspace program xo-user exits while the game is paused, restarting the program will cause it to hang. The userspace program communicates the game state to the kernel module via the 'kxo_state' attribute exposed through sysfs. This attribute reflects the current game state (e.g., paused, quitting) and controls whether the kernel module continues to produce output. However, if the userspace program exits while the game is paused, the 'display' flag is not cleared. As a result, the kernel module does not resume producing output when the program is relaunched, even though it is still functioning correctly. This patch resolves the issue by resetting the 'display' flag when the userspace program exits. --- main.c | 1 + 1 file changed, 1 insertion(+) diff --git a/main.c b/main.c index fb23a0b..2efceae 100644 --- a/main.c +++ b/main.c @@ -437,6 +437,7 @@ static int kxo_release(struct inode *inode, struct file *filp) } pr_info("release, current cnt: %d\n", atomic_read(&open_cnt)); attr_obj.end = 48; + attr_obj.display = 49; return 0; }