How to make sensor wakeup Android?

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

How to make sensor wakeup Android?

3,370件の閲覧回数
petarbajic
Contributor III

I have accelerometer driver lis3dh and I want to wakeup Android from deep sleep when device is moved.

My current implementation has additional driver registered as input device that sends power key code to Android. I call this drivers function from lis3dh and that is how I wake up Android.

I figure there has to be another way to properly wake up Android by sensor driver but couldn't find anything on google.. Anyone has experience with this?

0 件の賞賛
返信
3 返答(返信)

2,209件の閲覧回数
chenguoyin
NXP Employee
NXP Employee

the wakelock only help you to keep system alive but not screen. If you need screen, you need your android application to catch the sensor event and hold the screen on.

But why you need your screen on with sensor event.

0 件の賞賛
返信

2,209件の閲覧回数
chenguoyin
NXP Employee
NXP Employee

You can just acquire a timeout wakelock in your sensor driver once its irq triggered.

0 件の賞賛
返信

2,209件の閲覧回数
petarbajic
Contributor III

I see drivers/rtc/alarm.c calls this function when it should wake up the system:

wake_lock_timeout(&alarm_rtc_wake_lock, 1 * HZ);

but when I add something like this to my irq interrupt, the screen is not turned on.

(I have log showing that function is called)

I initialize wakelock in driver probe like this:

wake_lock_init(&lis3dh_wake_lock, WAKE_LOCK_SUSPEND, "lis3dh_wakeup");

0 件の賞賛
返信