Skip to content

Commit f027bfa

Browse files
Bluetooth: audio: Fix error message in PACS
Change error code in PACS source/sink write operation to Write Request Rejected. Signed-off-by: Szymon Czapracki <[email protected]>
1 parent 53af1ba commit f027bfa

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

subsys/bluetooth/audio/pacs.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -307,25 +307,25 @@ static ssize_t snk_loc_write(struct bt_conn *conn,
307307
}
308308

309309
if (len != sizeof(location)) {
310-
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
310+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
311311
}
312312

313313
if (pacs_cb == NULL ||
314314
pacs_cb->write_location == NULL) {
315315
BT_WARN("No callback for write_location");
316-
return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
316+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
317317
}
318318

319319
location = (enum bt_audio_location)sys_get_le32(data);
320320
if (location > BT_AUDIO_LOCATION_MASK || location == 0) {
321321
BT_DBG("Invalid location value: 0x%08X", location);
322-
return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED);
322+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
323323
}
324324

325325
err = pacs_cb->write_location(conn, BT_AUDIO_DIR_SINK, location);
326326
if (err != 0) {
327327
BT_DBG("write_location returned %d", err);
328-
return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION);
328+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
329329
}
330330

331331
return len;
@@ -403,25 +403,25 @@ static ssize_t src_loc_write(struct bt_conn *conn,
403403
}
404404

405405
if (len != sizeof(location)) {
406-
return BT_GATT_ERR(BT_ATT_ERR_INVALID_ATTRIBUTE_LEN);
406+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
407407
}
408408

409409
if (pacs_cb == NULL ||
410410
pacs_cb->write_location == NULL) {
411411
BT_WARN("No callback for write_location");
412-
return BT_GATT_ERR(BT_ATT_ERR_UNLIKELY);
412+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
413413
}
414414

415415
location = (enum bt_audio_location)sys_get_le32(data);
416416
if (location > BT_AUDIO_LOCATION_MASK || location == 0) {
417417
BT_DBG("Invalid location value: 0x%08X", location);
418-
return BT_GATT_ERR(BT_ATT_ERR_VALUE_NOT_ALLOWED);
418+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
419419
}
420420

421421
err = pacs_cb->write_location(conn, BT_AUDIO_DIR_SOURCE, location);
422422
if (err != 0) {
423423
BT_DBG("write_location returned %d", err);
424-
return BT_GATT_ERR(BT_ATT_ERR_AUTHORIZATION);
424+
return BT_GATT_ERR(BT_ATT_ERR_WRITE_REQ_REJECTED);
425425
}
426426

427427
return len;

0 commit comments

Comments
 (0)