[PATCH BlueZ 01/35] android/avctp: Make browsing handler return ssize_t

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

This makes possible to return errors such as -EAGAIN to indicate the
request would block and a response will be sent asynchronously.
---
 android/avctp.c | 12 +++++++++---
 android/avctp.h |  2 +-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/android/avctp.c b/android/avctp.c
index 2271d2c..4556ceb 100644
--- a/android/avctp.c
+++ b/android/avctp.c
@@ -839,9 +839,15 @@ static gboolean session_browsing_cb(GIOChannel *chan, GIOCondition cond,
 		goto send;
 	}
 
-	packet_size += handler->cb(session, avctp->transaction,
-						operands, operand_count,
-						handler->user_data);
+	ret = handler->cb(session, avctp->transaction, operands, operand_count,
+							handler->user_data);
+	if (ret < 0) {
+		if (ret == -EAGAIN)
+			return TRUE;
+		goto failed;
+	}
+
+	packet_size += ret;
 
 send:
 	if (packet_size != 0) {
diff --git a/android/avctp.h b/android/avctp.h
index 6bfc4cb..b395188 100644
--- a/android/avctp.h
+++ b/android/avctp.h
@@ -128,7 +128,7 @@ typedef gboolean (*avctp_rsp_cb) (struct avctp *session, uint8_t code,
 typedef gboolean (*avctp_browsing_rsp_cb) (struct avctp *session,
 					uint8_t *operands, size_t operand_count,
 					void *user_data);
-typedef size_t (*avctp_browsing_pdu_cb) (struct avctp *session,
+typedef ssize_t (*avctp_browsing_pdu_cb) (struct avctp *session,
 					uint8_t transaction,
 					uint8_t *operands, size_t operand_count,
 					void *user_data);
-- 
1.9.0

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux