AsteroidOS / asteroid

Build script for AsteroidOS, an open-source operating system for smartwatches
http://asteroidos.org
GNU General Public License v2.0
881 stars 64 forks source link

[Feature Request] Inactivity = complete suspend #140

Open Doomsdayrs opened 3 years ago

Doomsdayrs commented 3 years ago

I noticed a behavior of my SW3, in which after a certain period of time off my hand. The screen (even in theater mode) would turn off. Turning back on again when picked up (gyrosensor likely or acceleration)

So essentially a feature to add that above

MagneFire commented 3 years ago

This behavior sounds really nice to have.

Depending on what we want the behavior to be we could disable the following:

I just had a quick look at the test_sensors output, it looks like we need to implement another sensor for this to work, the relevant sensor, I think, is:

Name: huawei Significant motion Sensor
Vendor: Huawei SensorHub
Version: 0x1
Handle: 0x11
Type: 17
maxRange: 1.0
resolution: 1.0
power: 0.230000 mA
minDelay: 0

(Ignore the mentions of huawei this sensor, there is nothing specific to huawei when it comes to this sensor, other vendors likely have this sensor available too.) Sensor 17 is described as the following from the hardware/libhardware/include/hardware/sensors.h:

/*
 * SENSOR_TYPE_SIGNIFICANT_MOTION
 * reporting-mode: one-shot
 *
 * A sensor of this type triggers an event each time significant motion
 * is detected and automatically disables itself.
 * For Significant Motion sensor to be useful, it must be defined as a
 * wake-up sensor. (set SENSOR_FLAG_WAKE_UP). Implement the wake-up significant motion
 * sensor. A non wake-up version is not useful.
 * The only allowed value to return is 1.0.
 */

#define SENSOR_TYPE_SIGNIFICANT_MOTION              (17)
#define SENSOR_STRING_TYPE_SIGNIFICANT_MOTION       "android.sensor.significant_motion"
Doomsdayrs commented 3 years ago

I suppose it can be called "Complete Sleep" then? not many ways one can name this