summaryrefslogtreecommitdiff
path: root/android/avctp.c
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-02-28 11:36:00 +0200
committerLuiz Augusto von Dentz <luiz.von.dentz@intel.com>2014-03-04 11:32:42 +0200
commit7efeeb014e124cb2ec7ceb9f7953e4f0d09f403b (patch)
tree765862964b8448e5f1c35642cfc4dbfd83c5a4c6 /android/avctp.c
parentec6e9a9e1368a12301ef54bfbb9ec4c1f4b2372d (diff)
downloadbluez-7efeeb014e124cb2ec7ceb9f7953e4f0d09f403b.tar.gz
android/avctp: Make handler return ssize_t
This makes possible to return errors such as -EAGAIN to indicate the request would block and a response will be sent asynchronously.
Diffstat (limited to 'android/avctp.c')
-rw-r--r--android/avctp.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/android/avctp.c b/android/avctp.c
index f7c99ea31..abf94498d 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -311,7 +311,7 @@ static gboolean auto_release(gpointer user_data)
return FALSE;
}
-static size_t handle_panel_passthrough(struct avctp *session,
+static ssize_t handle_panel_passthrough(struct avctp *session,
uint8_t transaction, uint8_t *code,
uint8_t *subunit, uint8_t *operands,
size_t operand_count, void *user_data)
@@ -402,7 +402,7 @@ done:
return operand_count;
}
-static size_t handle_unit_info(struct avctp *session,
+static ssize_t handle_unit_info(struct avctp *session,
uint8_t transaction, uint8_t *code,
uint8_t *subunit, uint8_t *operands,
size_t operand_count, void *user_data)
@@ -428,7 +428,7 @@ static size_t handle_unit_info(struct avctp *session,
return operand_count;
}
-static size_t handle_subunit_info(struct avctp *session,
+static ssize_t handle_subunit_info(struct avctp *session,
uint8_t transaction, uint8_t *code,
uint8_t *subunit, uint8_t *operands,
size_t operand_count, void *user_data)
@@ -849,8 +849,9 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
uint8_t *operands, code, subunit;
struct avctp_header *avctp;
struct avc_header *avc;
- int ret, packet_size, operand_count, sock;
+ int packet_size, operand_count, sock;
struct avctp_pdu_handler *handler;
+ ssize_t ret;
if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL))
goto failed;
@@ -910,10 +911,16 @@ static gboolean session_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
code = avc->code;
subunit = avc->subunit_type;
- packet_size += handler->cb(session, avctp->transaction, &code,
+ ret = handler->cb(session, avctp->transaction, &code,
&subunit, operands, operand_count,
handler->user_data);
+ if (ret < 0) {
+ if (ret == -EAGAIN)
+ return TRUE;
+ goto failed;
+ }
+ packet_size += ret;
avc->code = code;
avc->subunit_type = subunit;