diff options
author | Denis Kenzior <denkenz@gmail.com> | 2011-10-13 13:47:56 -0500 |
---|---|---|
committer | Denis Kenzior <denkenz@gmail.com> | 2011-10-13 13:47:56 -0500 |
commit | 066690b17f16ccc98e027b481cd26baeaaade68f (patch) | |
tree | 0503e4c656e04c018eba05f92672cf64eb03ad8e | |
parent | 86cb93d410816b43ea7d5407cb5b76337bbb4ca2 (diff) | |
download | ofono-066690b17f16ccc98e027b481cd26baeaaade68f.tar.bz2 |
handsfree: Pass the error information to the core
if available. This is the preferred way, so that the core can take into
account the error information in the future if required.
-rw-r--r-- | drivers/hfpmodem/handsfree.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/hfpmodem/handsfree.c b/drivers/hfpmodem/handsfree.c index 16a395b9..c9bae653 100644 --- a/drivers/hfpmodem/handsfree.c +++ b/drivers/hfpmodem/handsfree.c @@ -95,14 +95,18 @@ static void hfp_request_phone_number_cb(gboolean ok, GAtResult *result, { struct cb_data *cbd = user_data; ofono_handsfree_phone_cb_t cb = cbd->cb; - void *data = cbd->data; GAtResultIter iter; + struct ofono_error error; const char *num; int type; struct ofono_phone_number phone_number; - if (!ok) - goto fail; + decode_at_error(&error, g_at_result_final_response(result)); + + if (!ok) { + cb(&error, NULL, cbd->data); + return; + } g_at_result_iter_init(&iter, result); @@ -122,11 +126,11 @@ static void hfp_request_phone_number_cb(gboolean ok, GAtResult *result, phone_number.number[OFONO_MAX_PHONE_NUMBER_LENGTH] = '\0'; phone_number.type = type; - CALLBACK_WITH_SUCCESS(cb, &phone_number, data); + cb(&error, &phone_number, cbd->data); return; fail: - CALLBACK_WITH_FAILURE(cb, NULL, data); + CALLBACK_WITH_FAILURE(cb, NULL, cbd->data); } static void hfp_request_phone_number(struct ofono_handsfree *hf, |