mouse and keyboard disconnect after 10 seconds m1 macbook

On windows the mouse and keyboard which are connected to raspberry pi stay connected even if they idle for 10 seconds.
On my macbook the mouse and keyboard work instantly and for as long as you activley use it. If you either stop typing or moving the mouse for 10 seconds, you have to repair the device and constantly move it. I cannot figure out what is wrong.

#2

It seems like the mouse is going to sleep and not waking. What mouse/keyboard model is it? A logitech?

#3

using a wired evga keyboard and wired evga mouse.
I tried using a 2.4ghz wireless mouse and that did not even work for a second.

#5

OK unfortunately i dont think there is a way to disable selective suspend on macos at the moment