view src/cs/services/fcbm/fcbm_kpd_if.c @ 287:3dee79757ae4

UI fw: load handheld audio mode on boot We have now reached the point where use of audio mode config files should be considered mandatory. In ACI usage we can tell users that they need to perform an AT@AUL of some appropriate audio mode, but in UI-enabled fw we really need to have the firmware load audio modes on its own, so that correct audio config gets established when the handset or development board runs on its own, without a connected host computer. Once have FC Venus with both main and headset audio channels and headset plug insertion detection, our fw will need to automatically load the handheld mode or the headset mode depending on the plug insertion state. For now we load only the handheld mode, which has been tuned for FC-HDS4 on FC Luna.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 13 Nov 2021 03:20: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;
}