HI Guru, 

Also, if you can use RTC hardware to do so , infact the android alarm 
manager internally uses the RTC hw to wakeup from suspend. 
(As that is one of the area of board that is still powered , when we in 
suspend. )

Usually the RTC is exposed as an sys file entry with name like RTC0 or RTC1 
depending on the type of SOC chipset used. 

To set and unset the a future wakeup is as easy as doing a echo in sys file 
entry. 
Like  Echo an enrty of 2 min in future and remove USB cable , see if it 
wakes up, if u have serial cable , looks for the kernel logs to confirm the 
wakeup interrupt.  

Please refer 
https://www.linux.com/learn/docs/672849-wake-up-linux-with-an-rtc-alarm-clock
.

Note : I had done some work on the abovem, setting alarm works fine when 
value is greater than 5sec or so. But setting lower values fails most of 
the times.(i guess some h/w dependency). 

Hope it helps. 

-Anirudh

On Tuesday, October 1, 2013 12:45:41 AM UTC+5:30, Guru Prasad wrote:
>
> Hi,
>
> I'm working with a fairly old version of the Linux kernel (v3.0) on
> the Android platform (4.1.1_r4).
>
> From my understanding, it should be possible to wake the system from 
> suspend so as long as I can
> request an alarm from ANDROID_ALARM_ELAPSED_REALTIME
>
> I'm trying to look at the Android platform AlarmManager code; both
> Java and native, to try and figure out exactly how I'm supposed to use
> this interface. 
>
> So far, after looking at 
> frameworks/base/services/jni/com_android_server_AlarmManagerService.cpp
> frameworks/base/services/java/com/android/server/AlarmManagerService.java
>
> I'm now trying to set an alarm using something like
> struct timespec ts;
> ts.tv_nsec     = 0;
> ts.tv_sec       = 15;
>
> int alarm_fd = open("/dev/alarm", O_RDWR);
> int result = ioctl(alarm_fd,
> ANDROID_ALARM_SET(ANDROID_
> ALARM_ELAPSED_REALTIME), &ts);
>
>
> However, upon execution, kmsg shows me the following
> [  430.304171] alarm_release: clear alarm, pending 0
>
>
> I've also confirmed that the device does not wake up from suspend
> using the above snippet.
>
> I'm not sure what I'm doing wrong..I've tried to replicate most of what 
> the AlarmMAnagerService.cpp is doing..
>
>
> I would greatly appreciate it if someone could help me with the Android 
> alarm interface
>
>
> Thanks
>
>

-- 
-- 
unsubscribe: android-kernel+unsubscr...@googlegroups.com
website: http://groups.google.com/group/android-kernel
--- 
You received this message because you are subscribed to the Google Groups 
"Android Linux Kernel Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-kernel+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to