~ubuntu-branches/ubuntu/oneiric/fso-usaged/oneiric

« back to all changes in this revision

Viewing changes to src/plugins/lowlevel_kernel26/plugin.vala

  • Committer: Bazaar Package Importer
  • Author(s): Heiko Stuebner
  • Date: 2009-09-07 21:56:10 UTC
  • Revision ID: james.westby@ubuntu.com-20090907215610-h33rhol7rnrmz6mx
Tags: upstream-0.9.0+git20090818
ImportĀ upstreamĀ versionĀ 0.9.0+git20090818

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * Copyright (C) 2009 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
 
3
 *
 
4
 * This library is free software; you can redistribute it and/or
 
5
 * modify it under the terms of the GNU Lesser General Public
 
6
 * License as published by the Free Software Foundation; either
 
7
 * version 2.1 of the License, or (at your option) any later version.
 
8
 
 
9
 * This library is distributed in the hope that it will be useful,
 
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 
12
 * Lesser General Public License for more details.
 
13
 
 
14
 * You should have received a copy of the GNU Lesser General Public
 
15
 * License along with this library; if not, write to the Free Software
 
16
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 
17
 *
 
18
 */
 
19
 
 
20
using GLib;
 
21
 
 
22
using FsoUsage;
 
23
 
 
24
class LowLevel.Kernel26 : FsoUsage.LowLevel, FsoFramework.AbstractObject
 
25
{
 
26
    construct
 
27
    {
 
28
        logger.info( "Registering kernel26 low level suspend/resume handling" );
 
29
        // grab sysfs paths
 
30
        var sysfs_root = config.stringValue( "cornucopia", "sysfs_root", "/sys" );
 
31
        sys_power_state = Path.build_filename( sysfs_root, "power", "state" );
 
32
    }
 
33
 
 
34
    public override string repr()
 
35
    {
 
36
        return "<>";
 
37
    }
 
38
 
 
39
    public void suspend()
 
40
    {
 
41
        FsoFramework.FileHandling.write( "mem\n", sys_power_state );
 
42
    }
 
43
 
 
44
    public string resume()
 
45
    {
 
46
        return "unknown";
 
47
    }
 
48
}
 
49
 
 
50
string sys_power_state;
 
51
 
 
52
/**
 
53
 * This function gets called on plugin initialization time.
 
54
 * @return the name of your plugin here
 
55
 * @note that it needs to be a name in the format <subsystem>.<plugin>
 
56
 * else your module will be unloaded immediately.
 
57
 **/
 
58
public static string fso_factory_function( FsoFramework.Subsystem subsystem ) throws Error
 
59
{
 
60
    debug( "lowlevel_kernel26 fso_factory_function" );
 
61
    return "fsousaged.lowlevel_kernel26";
 
62
}
 
63
 
 
64
[ModuleInit]
 
65
public static void fso_register_function( TypeModule module )
 
66
{
 
67
    // do not remove this function
 
68
}