~fader/checkbox-certification/bug570376

« back to all changes in this revision

Viewing changes to scripts/suspend_resume

  • Committer: Marc Tardif
  • Date: 2010-04-23 21:23:53 UTC
  • Revision ID: marc.tardif@canonical.com-20100423212353-20zy0kf3insqmsat
Added newline when writing to wakealarm and moved initial write to try/finally block.

Show diffs side-by-side

added added

removed removed

Lines of Context:
142
142
        hardware and system clocks.
143
143
 
144
144
        '''
145
 
        wakealarm_fh = open('/sys/class/rtc/rtc0/wakealarm','w',0)
146
 
        wakealarm_fh.write('0')
147
145
        self.last_time = self.GetCurrentTime()
148
146
        logging.debug('Current epoch time: %s' % self.last_time)
 
147
 
 
148
        wakealarm_fh = open('/sys/class/rtc/rtc0/wakealarm','w',0)
 
149
 
149
150
        try:
150
 
            wakealarm_fh.write('+%s' % time)
151
 
            logging.debug('Wake alarm in %s seconds' % time)
 
151
            wakealarm_fh.write('0\n')
 
152
            wakealarm_fh.flush()
 
153
 
 
154
            wakealarm_fh.write('+%s\n' % time)
152
155
            wakealarm_fh.flush()
153
156
        finally:
154
157
            wakealarm_fh.close()
155
158
 
 
159
        logging.debug('Wake alarm in %s seconds' % time)
 
160
 
156
161
    def DoSuspend(self):
157
162
        ''' 
158
163
        Suspend the system and hope it wakes up.