Raspberry Pi keeps going into screensaver no matter what I do

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
I had to reboot one of my Raspberry Pi's and now it keeps going into screensaver. I've followed every tutorial I could find on Google and nothing is working to kill this stupid screensaver. What is even the point of screensavers anymore anyway, I hate that it's always on by default on everything.

It's a fairly stock setup using Raspbian. There is no actual control panel or anything. Most tutorials refer to editing a file in /etc/xdg/lxsession/LXDE/autostart but none of that is working.

Anything else I can try?
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
This is ridiculous there are so many different config files - each tutorial is different. This seems to be a common problem. Why do they make it so complicated? So far all the ones I tried don't do anything. It's weird because I have two that are setup more or less identical and the other one is fine.

Trying to see if I can solve this through a program that simulates a key press, as I've done this in Windows before at work for systems that force screensavers but not getting any luck here either. This is what I have so far:


Code:
#include <unistd.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>

int main()
{
	Display *display;
	unsigned int keycode;
	display = XOpenDisplay(NULL);

	keycode = XKeysymToKeycode(display, XK_Scroll_Lock);

	while(1)
	{
		sleep(60);

		XTestFakeKeyEvent(display, keycode, true, 0);
		XTestFakeKeyEvent(display, keycode, false, 0);
		XTestFakeKeyEvent(display, keycode, true, 0);
		XTestFakeKeyEvent(display, keycode, false, 0);
	}

	XFlush(display);
	
	return 0;
}

This is not working though. Anything else I can try? I just found this through random searching and kind of pieced the code together. Would be nice to find a list of all the possibilities for XKeysymToKeycode() but can't seem to find one. I'd like to replace that with an actual character to see if it's even doing anything.

Failing this, going to have to start experimenting with HID chips and just use a USB based solution. This is ridiculous.
 
Last edited:

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
Ok so I got it to work. Had to install a package called xscreensaver and then it gave me a GUI option to disable it. I still find this weird, because there's like at least 10 different config files all in weird places and doing edits in those worked on one Pi but not on this one. Oh well at least it works now.

Given how much of a pain that is, and based on my googling and finding lot of people having issues too, I'm thinking a hardware solution might actually work nicely and could sell. a USB dongle that simply toggles a certain key or something. It could show up as a serial interface and have a console to configure it too. Could make a fun arduino project. :p
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
I can't disagree. Too much inconsistencies between distros - even within the same distro! They really need to get together and cleanup all that crap and streamline things better. You should see some of the weird config files I had to try to edit. Why can't it just be something simple like /etc/screensaver.conf and have it work on all systems?
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
Pretty sure I tried that too, though it was another file, and I had to put @ before it. I'll have to try that particular file and see what happens. Right now it seems to be really hit and miss. Like instead of it coming on after a minute of inactivity, it will just come on at complete random, like within hours.

Based on all my googling and landing on different forums etc this seems like a serious issue a lot of people have a problem with. Hopefully they may fix that in the next Raspberry PI, maybe at the hardware level it can simulate a key press once a minute or something.
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
What a freaking pain. Every time I think it's working, it just randomly starts to stop working again. I don't get it, it was good for over a year and just randomly decided to give me trouble, and only one of them. They are both the same config. I think I'm going to have to read up on USB protocol and just do a hardware based solution. I'm thinking something I can plug in that emulates a keyboard and just hits a key once every 30 seconds or something. Can probably just make it toggle num lock really fast. Not sure how involved that is. I imagine they must make some dedicated ICs that can take care of all that and I can just press keys by activating pins or using i2c or something. I'll have to do further research.
 

accguy9009

Senior member
Oct 21, 2007
504
10
81
What a freaking pain. Every time I think it's working, it just randomly starts to stop working again. I don't get it, it was good for over a year and just randomly decided to give me trouble, and only one of them. They are both the same config. I think I'm going to have to read up on USB protocol and just do a hardware based solution. I'm thinking something I can plug in that emulates a keyboard and just hits a key once every 30 seconds or something. Can probably just make it toggle num lock really fast. Not sure how involved that is. I imagine they must make some dedicated ICs that can take care of all that and I can just press keys by activating pins or using i2c or something. I'll have to do further research.

Sorry your having issues with your Pi. I have 3 of the Pi 3's, all running the newest Libre Elec. Used with Kodi, no problems. Did use one with Ubuntu and Raspian in the past. You are far more knowledgeable about Linux than I, but I have a bunch of micro SD cards around and I re-install the OS as needed. It can be a pain but it doesn't take long. Hopefully you will get your issue resolved.
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
That's the odd part, all of the other ones I have are fine. This seems to be an issue with the 3 more than anything though, but I have a couple 3's and those ones are ok. This seems to be a rather isolated issue, where it affects some people but not every. It's not really an issue with the Pi itself but the Raspbian OS which is the standard OS for it. So if it's running something completely different like XBMC it's probably not an issue.
 

ultimatebob

Lifer
Jul 1, 2001
25,134
2,450
126
What window manager are you using, anyway? It is was straight up XWindows, the xset commands I sent you earlier should have killed the screen saver. If you were using Gnome, deleting the Gnome power manager will do the job.
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
No idea. Whatever is default with Raspbian. It's a fairly standard install, I just use it to keep a couple SSH consoles up and a web app. Basically rather than do a true 3 monitor setup I use 2 RPIs for the side monitors with synergy. It's kinda a pain in the ass though since Synergy crashes all the time so I do have plans to eventually change out this whole setup and go with a single 4k monitor. Though I would maybe still setup the RPIs as stand alone and just remote into them. I typically put stuff on those screens that I just want to be able to monitor so I just want it up all the time.
 

Red Squirrel

No Lifer
May 24, 2003
69,705
13,329
126
www.betteroff.ca
Ugh I really need to ditch this retarded cripple setup. So it looks like Synergy is the culprit. That crashes ALL THE FREAKING TIME, and it looks like when it does, it resets whatever changes I did that stop the screensaver. I hate how Linux (and even windows) handles triple monitors, because it keeps wanting to open stuff on the left monitor instead of the centre one even if it's set as primary, so to remedy this issue I have two raspberry PIs for the side monitors and use Synergy, but it's a piece of crap. I really need to just bite the bullet and upgrade to a single 4k. None of the issues with multi monitor and 4x the screen real estate. Will be a simpler setup. If I end up making enough money from mining it might be the first thing I spend it on.