diff options
-rw-r--r-- | audio/headset.c | 13 | ||||
-rw-r--r-- | audio/headset.h | 2 | ||||
-rw-r--r-- | audio/manager.c | 15 |
3 files changed, 16 insertions, 14 deletions
diff --git a/audio/headset.c b/audio/headset.c index 2b343d0d..d2dc7416 100644 --- a/audio/headset.c +++ b/audio/headset.c @@ -74,8 +74,9 @@ #define AG_FEATURE_ENHANCES_CALL_STATUS 0x0040 #define AG_FEATURE_ENHANCES_CALL_CONTROL 0x0080 #define AG_FEATURE_EXTENDED_ERROR_RESULT_CODES 0x0100 -/*Audio Gateway features.Default is In-band Ringtone*/ -static unsigned int ag_features; + +static uint32_t ag_features = 0; + static gboolean sco_hci = TRUE; static char *str_state[] = { @@ -84,7 +85,7 @@ static char *str_state[] = { "HEADSET_STATE_CONNECTED", "HEADSET_STATE_PLAY_IN_PROGRESS", "HEADSET_STATE_PLAYING", - }; +}; struct pending_connect { DBusMessage *msg; @@ -1674,7 +1675,7 @@ register_iface: return hs; } -int headset_config_init(GKeyFile *config) +uint32_t headset_config_init(GKeyFile *config) { GError *err = NULL; gboolean value; @@ -1682,7 +1683,7 @@ int headset_config_init(GKeyFile *config) /* Use the default values if there is no config file */ if (config == NULL) - return 0; + return ag_features; str = g_key_file_get_string(config, "General", "SCORouting", &err); @@ -1781,7 +1782,7 @@ int headset_config_init(GKeyFile *config) } else if (value) ag_features |= AG_FEATURE_EXTENDED_ERROR_RESULT_CODES; - return 0; + return ag_features; } void headset_free(struct device *dev) diff --git a/audio/headset.h b/audio/headset.h index a70ad973..67155f73 100644 --- a/audio/headset.h +++ b/audio/headset.h @@ -47,7 +47,7 @@ struct headset *headset_init(struct device *dev, sdp_record_t *record, void headset_free(struct device *dev); -int headset_config_init(GKeyFile *config); +uint32_t headset_config_init(GKeyFile *config); void headset_update(struct device *dev, sdp_record_t *record, uint16_t svc); diff --git a/audio/manager.c b/audio/manager.c index dd580f8c..931af069 100644 --- a/audio/manager.c +++ b/audio/manager.c @@ -1226,7 +1226,7 @@ static int hsp_ag_record(sdp_buf_t *buf, uint8_t ch) return ret; } -static int hfp_ag_record(sdp_buf_t *buf, uint8_t ch) +static int hfp_ag_record(sdp_buf_t *buf, uint8_t ch, uint32_t feat) { sdp_list_t *svclass_id, *pfseq, *apseq, *root; uuid_t root_uuid, svclass_uuid, ga_svclass_uuid; @@ -1234,9 +1234,9 @@ static int hfp_ag_record(sdp_buf_t *buf, uint8_t ch) sdp_profile_desc_t profile; sdp_list_t *aproto, *proto[2]; sdp_record_t record; - uint16_t u16 = 0x0009; sdp_data_t *channel, *features; uint8_t netid = 0x01; + uint16_t sdpfeat; sdp_data_t *network = sdp_data_alloc(SDP_UINT8, &netid); int ret; @@ -1267,7 +1267,8 @@ static int hfp_ag_record(sdp_buf_t *buf, uint8_t ch) proto[1] = sdp_list_append(proto[1], channel); apseq = sdp_list_append(apseq, proto[1]); - features = sdp_data_alloc(SDP_UINT16, &u16); + sdpfeat = (uint16_t) feat & 0xF; + features = sdp_data_alloc(SDP_UINT16, &sdpfeat); sdp_attr_add(&record, SDP_ATTR_SUPPORTED_FEATURES, features); aproto = sdp_list_append(0, apseq); @@ -1541,6 +1542,7 @@ static int headset_server_init(DBusConnection *conn, GKeyFile *config) sdp_buf_t buf; gboolean no_hfp = FALSE; GError *err = NULL; + uint32_t features; if (!(enabled.headset || enabled.gateway)) return 0; @@ -1585,7 +1587,9 @@ static int headset_server_init(DBusConnection *conn, GKeyFile *config) if (!hf_server) return -1; - if (hfp_ag_record(&buf, chan) < 0) { + features = headset_config_init(config); + + if (hfp_ag_record(&buf, chan, features) < 0) { error("Unable to allocate new service record"); return -1; } @@ -1685,9 +1689,6 @@ int audio_init(DBusConnection *conn, GKeyFile *config) } if (enabled.headset) { - if (headset_config_init(config) < 0) - goto failed; - if (headset_server_init(conn, config) < 0) goto failed; } |