[PATCH] android/gatt: Fix handling write cmd.

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

 



We should not response on write cmd. This patch fixed that.
---
 android/gatt.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/android/gatt.c b/android/gatt.c
index 8e0d72a..36a1a7a 100644
--- a/android/gatt.c
+++ b/android/gatt.c
@@ -4648,7 +4648,7 @@ static uint8_t find_by_type_request(const uint8_t *cmd, uint16_t cmd_len,
 	return 0;
 }
 
-static uint8_t write_cmd_request(const uint8_t *cmd, uint16_t cmd_len,
+static void write_cmd_request(const uint8_t *cmd, uint16_t cmd_len,
 						struct gatt_device *dev)
 {
 	uint8_t value[ATT_DEFAULT_LE_MTU];
@@ -4658,13 +4658,9 @@ static uint8_t write_cmd_request(const uint8_t *cmd, uint16_t cmd_len,
 
 	len = dec_write_cmd(cmd, cmd_len, &handle, value, &vlen);
 	if (!len)
-		return ATT_ECODE_INVALID_PDU;
-
-	if (!gatt_db_write(gatt_db, handle, 0, value, vlen, cmd[0],
-								&dev->bdaddr))
-		return ATT_ECODE_UNLIKELY;
+		return;
 
-	return 0;
+	gatt_db_write(gatt_db, handle, 0, value, vlen, cmd[0], &dev->bdaddr);
 }
 
 static uint8_t write_req_request(const uint8_t *cmd, uint16_t cmd_len,
@@ -4750,10 +4746,9 @@ static void att_handler(const uint8_t *ipdu, uint16_t len, gpointer user_data)
 			return;
 		break;
 	case ATT_OP_WRITE_CMD:
-		status = write_cmd_request(ipdu, len, dev);
-		if (!status)
-			return;
-		break;
+		write_cmd_request(ipdu, len, dev);
+		/* No response on write cmd */
+		return;
 	case ATT_OP_PREP_WRITE_REQ:
 		status = write_prep_request(ipdu, len, dev);
 		if (!status)
-- 
1.8.4

--
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