summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2008-10-08 12:15:09 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2008-10-08 12:15:09 +0200
commit2db2d39af8cba3883756d21a0634722f37bdfef0 (patch)
treed0e93c56e1e2ff22b735f6c6424dc6d4ece85ace /audio
parentfdd1cc6f1deb3d4410d7f6583b6364b58179a7a0 (diff)
Reject non-voice calls in headset.c
Basicly reverts the previous commit since data calls just don't make sense with HFP. Check for proper voice call dial string and pass the number without the terminating semicolon to the telephony driver.
Diffstat (limited to 'audio')
-rw-r--r--audio/headset.c15
-rw-r--r--audio/telephony-dummy.c16
2 files changed, 16 insertions, 15 deletions
diff --git a/audio/headset.c b/audio/headset.c
index 31955490..a4fe84fe 100644
--- a/audio/headset.c
+++ b/audio/headset.c
@@ -785,7 +785,20 @@ int telephony_dial_number_rsp(void *telephony_device, cme_error_t err)
static int dial_number(struct audio_device *device, const char *buf)
{
- telephony_dial_number_req(device, &buf[3]);
+ char number[BUF_SIZE];
+ size_t buf_len;
+
+ buf_len = strlen(buf);
+
+ if (buf[buf_len - 1] != ';') {
+ debug("Rejecting non-voice call dial request");
+ return -EINVAL;
+ }
+
+ memset(number, 0, sizeof(number));
+ strncpy(number, &buf[3], buf_len - 4);
+
+ telephony_dial_number_req(device, number);
return 0;
}
diff --git a/audio/telephony-dummy.c b/audio/telephony-dummy.c
index 0e3c833b..976150f3 100644
--- a/audio/telephony-dummy.c
+++ b/audio/telephony-dummy.c
@@ -29,7 +29,6 @@
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
-#include <string.h>
#include <glib.h>
#include <dbus/dbus.h>
#include <gdbus.h>
@@ -133,21 +132,10 @@ void telephony_answer_call_req(void *telephony_device)
void telephony_dial_number_req(void *telephony_device, const char *number)
{
- char last;
-
- last = number[strlen(number) - 1];
-
g_free(active_call_number);
+ active_call_number = g_strdup(number);
- if (last == ';') {
- active_call_number = g_strndup(number, strlen(number) - 1);
- debug("telephony-dummy: voice call dial request to %s",
- active_call_number);
- } else {
- active_call_number = g_strdup(number);
- debug("telephony-dummy: data call dial request to %s",
- active_call_number);
- }
+ debug("telephony-dummy: dial request to %s", active_call_number);
telephony_dial_number_rsp(telephony_device, CME_ERROR_NONE);