view src/cs/services/fcbm/fcbm_kpd_if.c @ 288:25d3ee009d19

audio tone amplitudes: band-aid fix for FC Luna
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Nov 2021 05:02:57 +0000
parents baa738eeb842
children
line wrap: on
line source

/*
 * This module implements the interface to KPD for FCBM.
 */

#include "fcbm/fcbm_env.h"
#include "fcbm/fcbm_func_i.h"
#include "kpd/kpd_api.h"
#include "rv/rv_general.h"
#include "rvf/rvf_api.h"
#include "rvm/rvm_use_id_list.h"

static T_KPD_SUBSCRIBER fcbm_kpd_sub;

T_RV_RET fcbm_subscribe_kpd(void)
{
	T_RV_RET rc;
	T_RV_RETURN return_path;
	T_KPD_VIRTUAL_KEY_TABLE notified_keys;

	return_path.callback_func = 0;
	return_path.addr_id = fcbm_addr_id;

	notified_keys.nb_notified_keys = KPD_NB_PHYSICAL_KEYS;
	notified_keys.notified_keys[0] = KPD_KEY_0;
	notified_keys.notified_keys[1] = KPD_KEY_1;
	notified_keys.notified_keys[2] = KPD_KEY_2;
	notified_keys.notified_keys[3] = KPD_KEY_3;
	notified_keys.notified_keys[4] = KPD_KEY_4;
	notified_keys.notified_keys[5] = KPD_KEY_5;
	notified_keys.notified_keys[6] = KPD_KEY_6;
	notified_keys.notified_keys[7] = KPD_KEY_7;
	notified_keys.notified_keys[8] = KPD_KEY_8;
	notified_keys.notified_keys[9] = KPD_KEY_9;
	notified_keys.notified_keys[10] = KPD_KEY_UP;
	notified_keys.notified_keys[11] = KPD_KEY_DOWN;
	notified_keys.notified_keys[12] = KPD_KEY_SOFT_LEFT;
	notified_keys.notified_keys[13] = KPD_KEY_SOFT_RIGHT;
	notified_keys.notified_keys[14] = KPD_KEY_CONNECT;
	notified_keys.notified_keys[15] = KPD_KEY_DISCONNECT;
	notified_keys.notified_keys[16] = KPD_KEY_STAR;
	notified_keys.notified_keys[17] = KPD_KEY_DIESE;
	notified_keys.notified_keys[18] = KPD_KEY_LEFT;
	notified_keys.notified_keys[19] = KPD_KEY_RIGHT;
	notified_keys.notified_keys[20] = KPD_KEY_ENTER;
	notified_keys.notified_keys[21] = KPD_KEY_VOL_UP;
	notified_keys.notified_keys[22] = KPD_KEY_VOL_DOWN;
	notified_keys.notified_keys[23] = KPD_KEY_RECORD;

	rc = kpd_subscribe(&fcbm_kpd_sub, KPD_DEFAULT_MODE, &notified_keys,
			   return_path);
	if (rc != RV_OK) {
		rvf_send_trace("kpd_subscribe() failed", 22, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
		return rc;
	}

	/* long press and repeat times are dummies copied from MFW */
	rc = kpd_define_key_notification(fcbm_kpd_sub, &notified_keys,
					 KPD_FIRST_PRESS_NOTIF |
					 KPD_RELEASE_NOTIF, 30, 50);
	if (rc != RV_OK)
		rvf_send_trace("kpd_define_key_notification() failed", 36, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
	return rc;
}

T_RV_RET fcbm_unsubscribe_kpd(void)
{
	T_RV_RET rc;

	rc = kpd_unsubscribe(&fcbm_kpd_sub);
	if (rc != RV_OK)
		rvf_send_trace("kpd_unsubscribe() failed", 24, rc,
				RV_TRACE_LEVEL_ERROR, FCBM_USE_ID);
	return rc;
}