Exemplo n.º 1
0
/** Use sysfs interface to disable a wakelock.
 *
 * @param name The name of the wakelock to release
 *
 * Note: This will not delete the wakelocks.
 */
void wakelock_unlock(const char *name)
{
	if( lwl_enabled() ) {
		char tmp[64];
		lwl_concat(tmp, sizeof tmp, name, "\n", NULL);
		lwl_write_file(lwl_unlock_path, tmp);
	}
}
Exemplo n.º 2
0
/** Use sysfs interface to disable a wakelock.
 *
 * @param name The name of the wakelock to release
 *
 * Note: This will not delete the wakelocks.
 */
void wakelock_unlock(const char *name)
{
	if( lwl_probe() > SUSPEND_TYPE_NONE ) {
		char tmp[64];
		lwl_concat(tmp, sizeof tmp, name, "\n", NULL);
		lwl_write_file(lwl_unlock_path, tmp);
	}
}
Exemplo n.º 3
0
/** Use sysfs interface to create and enable a wakelock.
 *
 * @param name The name of the wakelock to obtain
 * @param ns   Time in nanoseconds before the wakelock gets released
 *             automatically, or negative value for no timeout.
 */
void wakelock_lock(const char *name, long long ns)
{
	if( lwl_enabled() && !lwl_shutting_down ) {
		char tmp[64];
		char num[64];
		if( ns < 0 ) {
			lwl_concat(tmp, sizeof tmp, name, "\n", NULL);
		} else {
			lwl_concat(tmp, sizeof tmp, name, " ",
				   lwl_number(num, sizeof num, ns),
				   "\n", NULL);
		}
		lwl_write_file(lwl_lock_path, tmp);
	}
}
Exemplo n.º 4
0
/** Use sysfs interface to create and enable a wakelock.
 *
 * @param name The name of the wakelock to obtain
 * @param ns   Time in nanoseconds before the wakelock gets released
 *             automatically, or negative value for no timeout.
 */
void wakelock_lock(const char *name, long long ns)
{
	if( lwl_shutting_down )
		goto EXIT;

	if( lwl_probe() > SUSPEND_TYPE_NONE ) {
		char tmp[64];
		char num[64];
		if( ns < 0 ) {
			lwl_concat(tmp, sizeof tmp, name, "\n", NULL);
		} else {
			lwl_concat(tmp, sizeof tmp, name, " ",
				   lwl_number(num, sizeof num, ns),
				   "\n", NULL);
		}
		lwl_write_file(lwl_lock_path, tmp);
	}

EXIT:
	return;
}
Exemplo n.º 5
0
/** Use sysfs interface to block automatic entry to suspend
 *
 * The device will not enter suspend mode with or without
 * active wakelocks.
 */
void wakelock_block_suspend(void)
{
	if( lwl_enabled() ) {
		lwl_write_file(lwl_state_path, "on\n");
	}
}
Exemplo n.º 6
0
/** Use sysfs interface to allow automatic entry to suspend
 *
 * After this call the device will enter suspend mode once all
 * the wakelocks have been released.
 *
 * Android kernels will enter early suspend (i.e. display is
 * turned off etc) even if there still are active wakelocks.
 */
void wakelock_allow_suspend(void)
{
	if( lwl_enabled() && !lwl_shutting_down ) {
		lwl_write_file(lwl_state_path, "mem\n");
	}
}