ge0rg / samsung-nx-hacks

Firmware Hacks for the Linux-based Samsung NX mirrorless camera models (NX300, NX2000, ???)
115 stars 11 forks source link

OLED screen turn off #4

Open FABIO-CARNEIRO-LOBO opened 9 years ago

FABIO-CARNEIRO-LOBO commented 9 years ago

Could it be possible to turn the OLED screen off with a combinations of Key events (such (+/-) and (trash) pressed together)?

The aim is, when using the camera with an remote shooter, reduce the battery consumption.

I have no experience on programming (nothing at all...) If it could be done by you, I would gladly pay (not so much...) for the development.

Nikolas-LFDesigns commented 9 years ago

Camera has screen off delay by its own which works on RVF mode too. Lower it when using RVF and here you go. The only key I know which turns screen off is a power key, which of course turns camera off as well.

ge0rg commented 9 years ago

It looks like the usual X11 screen saver controls fall short on this device:

$ xset q
...
Screen Saver:
  prefer blanking:  yes    allow exposures:  yes
  timeout:  0    cycle:  600
DPMS (Energy Star):
  Display is not capable of DPMS

Changing the screensaver parameters does not have any effect, and neither is it activated.

Going the framebuffer route seems to have no effect either:

echo 1 > /sys/class/graphics/fb0/blank
ge0rg commented 8 years ago

You can disable and enable the LCD from the command line using the st tool:

Display off: st lcd set 4

Display on: st lcd set 3

Full documentation of st lcd:

nx300:/# st lcd
usage: st LCD [command]
       st LCD help
       st LCD set [n]
                0 : lcd power on
                1 : lcd power off
                2 : lcd reset
                3 : lcd light on
                4 : lcd light off
                5 : lcd init
                6 : Han Q init
                7 : H-flip On
                8 : H-flip Off
                9 : V-flip On
                10 : V-flip Off

I tried to make a script that monitors xinput test keyboard1 for events, but it does not report key pressed in parallel (maybe this is the reason why there are two logical keyboards in X11?).

As an alternative, I've written a script that counts how often you press the +/- EV button, and turns off the LCD after three consecutive presses:

#!/bin/sh

export DISPLAY=:0
powersaving=0
counter=0

script -q -c "xinput test keyboard1" | while read key press id ignore ; do
        if [ "$press" = "press" ] ; then
                if [[ $powersaving -eq 1 ]] ; then
                        st lcd set 3
                        powersaving=0
                        counter=0
                else
                        if [[ "$id" = 181 ]] ; then
                                counter=$((counter+1))
                                if [[ $counter -eq 3 ]] ; then
                                        powersaving=1
                                        st lcd set 4
                                        counter=0
                                fi
                        else
                                counter=0
                        fi
                fi
        fi
done

Unfortunately, I can not get this script to run from autoexec.sh, as it immediately terminates without any output. If you have telnetd enabled, you can telnet onto the camera and run the script from there.