You already got some good advice where to start but I would also say these kind of sporadic issues are very hard to resolve. Also worth thinking about is the next version of Debian is about to release and is frozen right now so safe to upgrade to (bookworm). These kind of issues might already be fixed in a newer version if upgrading was possible. Try what was suggested by Parsnip in the other comments and report back on how you feel and want to progress. Can provide the sources.list for bookworm.
Debian operating system
Debian is a free operating system (OS) for your computer. An operating system is the set of basic programs and utilities that make your computer run. Debian provides more than a pure OS: it comes with over 59000 packages, precompiled software bundled up in a nice format for easy installation on your machine.
I had a very similar issue, the touchpad in my Dell laptop would randomly stop working but I could still click. I couldn’t work out why until one of my keys stopped working. I replaced the keyboard and the touchpad issues disappeared. I suspect the cause was the faulty keyboard not sending the key up event as I had noticed pressing keys sometimes unfroze it. It could also have been a loose connection though.
If you’re using GNOME, you could try disabling the “disable touchpad on while typing” setting: gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing false
Verify the keyboard is not disabled when pressing keys and see if the issue still happens. If that fixes it then it might be keyboard that’s the problem.
To enable “disable touchpad while typing”: gsettings set org.gnome.desktop.peripherals.touchpad disable-while-typing true
I'm not an expert in this but why don't you run dmesg -T
and find out if anything shows up in the kernel logs when it stops working? That can be a good starting point.
Are you using libinput or synaptics driver? (I don't know which one is bundled in Debian now). If you're on libinput, you might have to make a custom config file for your device?
I'm honestly not even sure how to check which I'm running. I'll check dmesg for any error logs though, thanks!
libinput list-devices
is your friend. You can also look for config files in /etc/x11/xorg.conf.d/
Once you have something from dmesg I would be glad to help.