hfpmodem: fix hf features

check audio gateway version and only set right features
This commit is contained in:
Frédéric Danis 2011-08-08 16:34:40 +02:00 committed by Denis Kenzior
parent 41c8b30ce6
commit b8730eb47d
4 changed files with 12 additions and 4 deletions

View File

@ -52,7 +52,7 @@ struct slc_establish_data {
gpointer userdata; gpointer userdata;
}; };
void hfp_slc_info_init(struct hfp_slc_info *info) void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version)
{ {
info->ag_features = 0; info->ag_features = 0;
info->ag_mpty_features = 0; info->ag_mpty_features = 0;
@ -60,9 +60,14 @@ void hfp_slc_info_init(struct hfp_slc_info *info)
info->hf_features = HFP_HF_FEATURE_3WAY; info->hf_features = HFP_HF_FEATURE_3WAY;
info->hf_features |= HFP_HF_FEATURE_CLIP; info->hf_features |= HFP_HF_FEATURE_CLIP;
info->hf_features |= HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL; info->hf_features |= HFP_HF_FEATURE_REMOTE_VOLUME_CONTROL;
if (version < HFP_VERSION_1_5)
goto done;
info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_STATUS; info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_STATUS;
info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_CONTROL; info->hf_features |= HFP_HF_FEATURE_ENHANCED_CALL_CONTROL;
done:
memset(info->cind_val, 0, sizeof(info->cind_val)); memset(info->cind_val, 0, sizeof(info->cind_val));
memset(info->cind_pos, 0, sizeof(info->cind_pos)); memset(info->cind_pos, 0, sizeof(info->cind_pos));
} }

View File

@ -27,6 +27,9 @@
#define AG_CHLD_3 0x20 #define AG_CHLD_3 0x20
#define AG_CHLD_4 0x40 #define AG_CHLD_4 0x40
#define HFP_VERSION_1_5 0x0105
#define HFP_VERSION_LATEST 0xFFFF
enum hfp_indicator { enum hfp_indicator {
HFP_INDICATOR_SERVICE = 0, HFP_INDICATOR_SERVICE = 0,
HFP_INDICATOR_CALL, HFP_INDICATOR_CALL,
@ -49,7 +52,7 @@ struct hfp_slc_info {
unsigned int cind_val[HFP_INDICATOR_LAST]; unsigned int cind_val[HFP_INDICATOR_LAST];
}; };
void hfp_slc_info_init(struct hfp_slc_info *info); void hfp_slc_info_init(struct hfp_slc_info *info, guint16 version);
void hfp_slc_info_free(struct hfp_slc_info *info); void hfp_slc_info_free(struct hfp_slc_info *info);
void hfp_slc_establish(struct hfp_slc_info *info, hfp_slc_cb_t connect_cb, void hfp_slc_establish(struct hfp_slc_info *info, hfp_slc_cb_t connect_cb,

View File

@ -223,7 +223,7 @@ static int hfp_hf_probe(const char *device, const char *dev_addr,
if (data == NULL) if (data == NULL)
goto free; goto free;
hfp_slc_info_init(&data->info); hfp_slc_info_init(&data->info, HFP_VERSION_1_5);
data->handsfree_path = g_strdup(device); data->handsfree_path = g_strdup(device);
if (data->handsfree_path == NULL) if (data->handsfree_path == NULL)

View File

@ -880,7 +880,7 @@ static int localhfp_enable(struct ofono_modem *modem)
g_at_chat_set_disconnect_function(chat, slc_failed, modem); g_at_chat_set_disconnect_function(chat, slc_failed, modem);
hfp_slc_info_init(info); hfp_slc_info_init(info, HFP_VERSION_LATEST);
info->chat = chat; info->chat = chat;
hfp_slc_establish(info, slc_established, slc_failed, modem); hfp_slc_establish(info, slc_established, slc_failed, modem);