[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Help with powerbutton handling



Hello, I have an LG NAS based on Debian 6, armel arch.
I have root access on it.

I recently broke a couple of things on it, but now it's almost back.
I found it is highly customized about services to start and other system handling.

The last thing I haven't been able to restore is the handling of the powerbutton: before me touching things, I could turn it off keeping it pressed for 2/3 seconds; a longer press would turn it off immediately.

Now it loose the 2/3 seconds reaction, I must log in and shutdown manually.

I found some ACPI scripts and services, but they all start with a testing of an env variable "micom" that it must not be set to "emul", otherwise they exit instantly.

As "micom" is not "emul", they are useless.
I even tried starting "acpid -f" from command line, but it says it lacks some "input" file somewhere, so the handling must be something custom again.

The whole NAS platform is started from a bunch of python scripts and I found they do list the button reactions, listing "shutdown" with code 45, but I can't understand how it gets called.

This is the action defined:
    @classmethod
    def action_shutdown(cls):
        """ action shutdown - evnet code: 45 """
        buzzer.Buzzer().enable()
        initd.Initd().shutdown()

If I search for "action_shutdown" in the scripts, I find:

class ButtondService(persistent_service.PersistentService):
    """ Buttond Service Class """
    _sleep_duration = 0
    __button = None
    __action_functions = {'IP_DHCP': button_action.ButtonAction.action_ip_dhcp,
[...]
     'SHUTDOWN': button_action.ButtonAction.action_shutdown,
[...]
    __conf_table = []
    __conf_table_file = '/etc/nas/button.conf'

/etc/nas/button.conf is a list of buttons and codes.

Searching for SHUTDOWN, I find it is used in here:
    @classmethod
    def _shutdown(cls, args):
        """ Stop all service and umount volumes under platformd

This function is mapped in an array:
class SystemService(EphemeralService):
    """ System Service Class """
    _locked = False
    _actions = {'get_greeting': ['_get_greeting', ()],
[...]
     'shutdown': ['_shutdown', ()],

I then lose traces of the calls and I'm not sure what really should triggers these calls.

Can anybody suggest any string I could search for to understand what system event would trigger a powerbutton press reaction?

Thank you!

Reply to: