I have written a program that runs with ROOT permission in Terminal following login but fails when XOpenDisplay(NULL) call is made following reboot. The program is started up via rc.local but doesn't appear to be able to see X11.
I need ROOT because I make LibUSB calls and these fail if not ROOT. I can see the program is running with ROOT permission but inspection of environment variables shows DISPLAY not set. I have a delay loop running and checks are made after user login and user can see DISPLAY set in environment variables but program cannot. If program is terminated and run in Terminal it works perfectly so the problem is that the program cannot interact with X11 when it is started and this state persists.
I want the program to be up and running without user login.
Can anyone let me know what I need to do?
David
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…