aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel/button-hotplug/src/button-hotplug.c
Commit message (Collapse)AuthorAgeFilesLines
* button-hotplug: remove #ifdef CONFIG_HOTPLUG, it is gone in newer kernelsFelix Fietkau2014-05-231-7/+0
| | | | | | Signed-off-by: Felix Fietkau <nbd@openwrt.org> SVN-Revision: 40839
* gpio-button-hotplug: add wwan buttonHauke Mehrtens2014-01-141-2/+1
| | | | | | | | | | | The wimax key will be used as a generic wwan key starting with Linux 3.13. The brcm47xx target uses this key for the 3g buttons. Also remove the ifdef around KEY_WPS_BUTTON, this is in the kernel for a long time now. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de> SVN-Revision: 39290
* button-hotplug: sync list of supported keys with gpio-button-hotplugJohn Crispin2013-11-071-0/+1
| | | | | | Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 38676
* button-hotplug: Add KEY_POWER handlingJohn Crispin2013-07-041-0/+1
| | | | | | | | | | | | When running OpenWrt within KVM KEY_POWER is generated from the ACPI button driver when restarting or powering down the VM. Extend button-hotplug to allow user space handlers for these events. Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com> Patchwork: http://patchwork.openwrt.org/patch/3799/ SVN-Revision: 37160
* packages: clean up the package folderJohn Crispin2013-06-211-0/+349
Signed-off-by: John Crispin <blogic@openwrt.org> SVN-Revision: 37007
r.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
from xen.sv.NodeInfo import NodeInfo
from xen.sv.DomInfo  import DomInfo
from xen.sv.CreateDomain import CreateDomain
from xen.sv.RestoreDomain import RestoreDomain

from xen.sv.util import getVar

# adapter to make this all work with mod_python
# as opposed to Twisted
# (c) Tom Wilkie 2005

class Args:
    def __init__( self, req ):
        from mod_python.util import FieldStorage
        self.fieldStorage = FieldStorage( req, True )

    # return a list of values for the given key,
    # or None if key not there
    def get( self, var ):
        retVar = self.fieldStorage.getlist( var )
        if len( retVar ) == 0:
            return None
        else:
            return retVar

    # return a list of tuples,
    # (key, value) where value is a list of values
    def items( self ):
        result = [];
        for key in self.fieldStorage.keys():
            result.append( (key, self.fieldStorage.getlist( key ) ) )
        return result
                                                                                                                                                            
# This is the Main class
# It pieces together all the modules

class Main:
    def __init__( self ):
        self.modules = { "node": NodeInfo, 
                         "create": CreateDomain,
                         "restore" : RestoreDomain,
                         "info": DomInfo }

        self.init_done = False

    def init_modules( self, request ):
        for moduleName, module in self.modules.iteritems():
            self.modules[ moduleName ] = module( self.urlWriter( moduleName, request.url ) )             

    def render_menu( self, request ):
        if not self.init_done:
            self.init_modules( request )
            self.init_done = True
            
        for _, module in self.modules.iteritems():
            module.write_MENU( request )
            request.write( "\n" )

    def render_main( self, request ):
        if not self.init_done:
            self.init_modules( request )
            self.init_done = True
                                   
        moduleName = getVar('mod', request)
        if moduleName not in self.modules:
            request.write( '<p>Please select a module</p>' )
        else:
            module = self.modules[ moduleName ]
            module.write_BODY( request )

    def do_POST( self, request ): 
        if not self.init_done:
            self.init_modules( request )
            self.init_done = True                       
        
    	moduleName = getVar( 'mod', request )      
        if moduleName in self.modules:
            self.modules[ moduleName ].perform( request )

    def urlWriter( self, module, url ):
        return lambda x: "%s?mod=%s%s" % ( url, module, x )