Closed Qlink84 closed 4 years ago
Does the script work in a normal terminal?
I think this might be a dietpi issue. I looked online and you may need to configure your systemd unit service: Reddit answer
Also, you could set default to ignore display-manager:
systemctl set-default multi-user.target
as taken from here
ignoring display-manager didn't help .... :(
`root@DietPi:~# systemctl set-default multi-user.target
Created symlink /etc/systemd/system/default.target → /lib/systemd/system/multi-user.target.
root@DietPi:~/backlight_dimmer# sudo ./timeout 30 event0
Using input device: /dev/input/event0
Starting...
No protocol specified
Unable to connect to X server
No protocol specified
Unable to connect to X server
Setting Brightness...
Done setting Brightness!
Failed to restart display-manager.service: Unit display-manager.service not found.
Setting Brightness...
Done setting Brightness!
No protocol specified
xset: unable to open display ":0"
No protocol specified
Unable to connect to X server
Touchscreen's ID: 5633952, actual_brightness 255, max_brightness 255
No protocol specified
couldn't open display
Idle Time: -4686321242549361664
No protocol specified
couldn't open display
Idle Time: -4686321242549361664
No protocol specified
couldn't open display
Idle Time: -4686321242549361664
^CSetting Brightness...
Done setting Brightness!
`
are you ssh into the Pi? To start with an X-server you must add something extra -X
ssh -X pi@[your-ip]
I'd recommend connecting directly to the pi with VNC and access the local terminal from there. That way, you don't need to add the -X
No, i'm directly connected to the pi using the touch screen as display and a usb keyboard...
try commenting out this line:
restart_xprintidle();
And type in a terminal
sudo systemctl restart display-manager
This will close the terminal, so repoen it and type in the following in the project directory:
make -j4
sudo ./timeout 30 event0
For some reason, your X server isn't starting. Do you know if this problem is related to dietpi?
Try typing xprintidle
in a terminal, what happens?
ok, so I changed my code. See if it works with the new instructions in the Readme.md
I think it wasn't working earlier because your username for your pi wasn't pi
like mine was. So now, I made an extra argument so that you can change that in the command line(systemd file).
okay, i've deleted the old backlight_dimmer folder and did the following steps:
sudo apt-get install git
sudo apt-get install make
git clone https://github.com/nathanRamaNoodles/backlight_dimmer
cd backlight_dimmer
and then i get the following errors when i try the commands from readme.md in terminal:
`root@DietPi:~/backlight_dimmer# make
cc -c -o timeout.o timeout.c
make: cc: Kommando nicht gefunden
make: *** [<eingebaut>: timeout.o] Fehler 127
root@DietPi:~/backlight_dimmer# sudo ./timeout root 30 event0
sudo: ./timeout: Befehl nicht gefunden
root@DietPi:~/backlight_dimmer# `
That error means you don't have GCC make: https://askubuntu.com/a/1095184
okay sudo apt install gcc did the trick i think...
now i get:
root@DietPi:~/backlight_dimmer# make
cc -c -o timeout.o timeout.c
cc -o timeout timeout.o -lm -lpcre
root@DietPi:~/backlight_dimmer# sudo ./timeout root 30 event0
Failed to restart display-manager.service: Unit display-manager.service not found.
when hitting enter after timeout command the screen fades off smoothly right away once then comes back instantly and error message appears...
Make sure you have lightdm installed: https://askubuntu.com/a/1098949/1044540
Also, comment out the part in the main code where it says restart_xprintidle();
this is just for testing purposes. When you are done testing it, uncomment it.
The fact that the screen is dimming initially means that's its working. :)
Don't forget to remake the file
lightdm is already installed...
where exactly do i have to comment out restart_xprintidle(); ?
when i change following line "static void restart_xprintidle();" into "//static void restart_xprintidle();"
nothing changes ... still the same error msg...
Comment out here
Also, enable debug mode, by changing this value from 0 to 1
Then re-make files.
Try to start the light-dm service:
sudo systemctl daemon-reload
sudo systemctl enable display-manager.service
sudo systemctl restart display-manager.service
i commented out as you described and it seems dimming is working now :)
problem is wake on touch does not work :( wake with mouse works (mouse moved) -> wake with keyboard works (touch detected!) -> but when i touch the screen nothing happens :(
root@DietPi:~/backlight_dimmer# sudo ./timeout root 10 event0
User: root
Using input devices: /dev/input/event0 /dev/input/event0
Starting...
Setting Brightness...
Done setting Brightness!
Setting Brightness...
Done setting Brightness!
Touchscreen's ID: 9, actual_brightness 255, max_brightness 255
Setting Brightness...
Done setting Brightness!
Time: 1587370635
Idle Time: 48692
Idle Time: 59412
Idle Time: 70112
Idle Time: 80812
Idle Time: 91512
Idle Time: 102222
Idle Time: 112922
Idle Time: 123622
Idle Time: 134362
Idle Time: 145092
Touch screen check ended
Screen dim: 156422
Setting Brightness...
Done setting Brightness!
Idle Time: 167212
Idle Time: 178542
Idle Time: 189852
Idle Time: 201182
Idle Time: 212472
Idle Time: 223772
Idle Time: 235052
Mouse moved
Setting Brightness...
Done setting Brightness!
Idle Time: 1912
Idle Time: 13222
Idle Time: 24532
Idle Time: 35972
Idle Time: 47272
Idle Time: 58572
Idle Time: 69872
Idle Time: 81172
Idle Time: 92472
Screen dim: 103792
Setting Brightness...
Done setting Brightness!
Idle Time: 114612
Idle Time: 125912
Touch Detected!
Setting Brightness, Time: 1587370674
Setting Brightness...
Done setting Brightness!
Idle Time: 4892
Idle Time: 15602
Idle Time: 26312
Idle Time: 37152
Idle Time: 47892
Idle Time: 58592
Idle Time: 69332
Idle Time: 80062
Idle Time: 90782
Touch screen check ended
Screen dim: 102322
Setting Brightness...
Done setting Brightness!
Idle Time: 113082
Idle Time: 124352
Idle Time: 135662
Idle Time: 146952
Touch Detected!
Setting Brightness, Time: 1587370689
Setting Brightness...
Done setting Brightness!
Idle Time: 7702
^CSetting Brightness...
Done setting Brightness!
root@DietPi:~/backlight_dimmer#
and after i have rebooted and tried again it seems like inputs are recognized other way round:
wake on touch still not working wake on mouse working, but it says "Touch Detected!" wake on keyboard working but it says "Mouse moved"
after another reboot it stays the same:
using touch -> nothing happens using mouse -> "Touch Detected!" using keyboard -> "Mouse moved"
mouse + keyboard are hooked up directly via pi USB ports
Can you give me the output of the command:
xinput --list
root@DietPi:~# xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ USB Mouse id=6 [slave pointer (2)]
⎜ ↳ FT5406 memory based driver id=10 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard id=7 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard System Control id=8 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard Consumer Control id=9 [slave keyboard (3)]
root@DietPi:~#
That's weird, the regex in my code is supposed to pick up your touch_screen_id = 10, but it gives me 9 which is your keyboard...
Can you give me the output of this command?:
sudo -u $USER env DISPLAY=:0 xinput --list
root@DietPi:~# sudo -u $USER env DISPLAY=:0 xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ FT5406 memory based driver id=10 [slave pointer (2)]
⎜ ↳ USB Mouse id=6 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard id=7 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard System Control id=8 [slave keyboard (3)]
↳ Fujitsu Fujitsu Keyboard Consumer Control id=9 [slave keyboard (3)]
root@DietPi:~#
can you run the timeout code again? I can't believe the regex id detection isn't working.
root@DietPi:~/backlight_dimmer# sudo ./timeout root 5 event0
User: root
Using input devices: /dev/input/event0 /dev/input/event0
Starting...
Setting Brightness...
Done setting Brightness!
Setting Brightness...
Done setting Brightness!
Touchscreen's ID: 10, actual_brightness 255, max_brightness 255
Setting Brightness...
Done setting Brightness!
Idle Time: 48752
Idle Time: 59612
Idle Time: 70342
Idle Time: 81052
Idle Time: 91762
Touch screen check ended
Screen dim: 103132
Setting Brightness...
Done setting Brightness!
Idle Time: 114002
Idle Time: 125382
Idle Time: 136702
Idle Time: 148002
Idle Time: 159312
Mouse moved
Setting Brightness...
Done setting Brightness!
Idle Time: 11382
Idle Time: 22692
Idle Time: 33972
Idle Time: 45312
Screen dim: 56602
Setting Brightness...
Done setting Brightness!
Idle Time: 67562
Idle Time: 79012
Touch Detected!
Setting Brightness, Time: 1587392535
Setting Brightness...
Done setting Brightness!
Idle Time: 6652
Idle Time: 17412
Idle Time: 28162
Time: 1587392539
Idle Time: 2442
Idle Time: 13212
^CSetting Brightness...
Done setting Brightness!
root@DietPi:~/backlight_dimmer#
same problem... touch not regonized first wake through keyboard -> mouse moved second wake through mouse -> touch detected
Oh, at least it got the id
right; does your touch-screen work?
Go to a terminal, a type
xprintidle
Before and after touching the screen, give both values printed
Also give output for following:
cd /dev/input/
ls
root@DietPi:~/backlight_dimmer# xprintidle
14
root@DietPi:~/backlight_dimmer# xprintidle
13
root@DietPi:/dev/input# ls
by-id by-path event0 event1 event2 event3 event4 mice mouse0 mouse1
root@DietPi:/dev/input#
oh, there's the problem.
You have different events
try the different ones instead of event0
and tell which one works with touchinput
I only have mice, mouse0, and event0
event4 is working with wake on touch !!!
is there anything i have to do about this or just use event4 instead of event0 in scripts and so on ...?
Yay! :)
I think I might as well get rid of the fourth parameter for the future. That way we don't have to specify the events. Though, in the original repo, the author made it like that. I'm not sure if there is a time when the user doesn't want a specific input to wake up the device, like a Bluetooth device?
anyway, many thanks for your great support and help ! greatly appreciate it!
Now that this issue is solved I can close it, and we can discuss features in another thread.
Can you make another issue separate from this one with your feature request? We'll talk there...
hi nathan,
i'm trying to get this working with dietpi on my raspi 4 with 7 inch touch screen. when i'm trying to start it it get "display-manager.service not found". i don't know if the cause is dietpi or backlight_dimmer... can you help me on that ?
best regards