2023-11-29 16:30:52

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 1/2] test-micp: Fix endianess error

From: Luiz Augusto von Dentz <[email protected]>

On big endian the followin error can be observed:

MICP/CL/CGGIT/SER/BV-01-C - init
MICP/CL/CGGIT/SER/BV-01-C - setup
MICP/CL/CGGIT/SER/BV-01-C - setup complete
MICP/CL/CGGIT/SER/BV-01-C - run
micp_write_value handle: 3
**
ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
(memcmp(buf, iov->iov_base, len) == 0)
Bail out! ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
(memcmp(buf, iov->iov_base, len) == 0)
Aborted
---
unit/test-micp.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/unit/test-micp.c b/unit/test-micp.c
index e2975c298ec5..a7fc7fb321bd 100644
--- a/unit/test-micp.c
+++ b/unit/test-micp.c
@@ -147,7 +147,7 @@ static void micp_write_value(struct bt_micp *micp, void *user_data)
struct bt_mics *mics = micp_get_mics(micp);
uint16_t value_handle;
int ret;
- const uint16_t value = 0x0001;
+ uint16_t value = cpu_to_le16(0x0001);

gatt_db_attribute_get_char_data(mics->ms, NULL, &value_handle,
NULL, NULL, NULL);
--
2.43.0



2023-11-29 16:31:08

by Luiz Augusto von Dentz

[permalink] [raw]
Subject: [PATCH BlueZ v1 2/2] shared/vcp: Fix endianess errors

From: Luiz Augusto von Dentz <[email protected]>

On big endian the followin error can be observed:
VOCS/SR/SGGIT/CHA/BV-02-C - init
VOCS/SR/SGGIT/CHA/BV-02-C - setup
VOCS/SR/SGGIT/CHA/BV-02-C - setup complete
VOCS/SR/SGGIT/CHA/BV-02-C - run
**
ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
(memcmp(buf, iov->iov_base, len) == 0)
Bail out! ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
(memcmp(buf, iov->iov_base, len) == 0)
Aborted
---
src/shared/vcp.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)

diff --git a/src/shared/vcp.c b/src/shared/vcp.c
index 263da4c30c29..f2c04d184a08 100644
--- a/src/shared/vcp.c
+++ b/src/shared/vcp.c
@@ -714,7 +714,7 @@ static uint8_t vocs_set_vol_offset(struct bt_vocs *vocs, struct bt_vcp *vcp,
DBG(vcp, "error: Value Out of Range");
return BT_ATT_ERROR_VALUE_OUT_OF_RANGE;
}
- vstate->vol_offset = req->set_vol_offset;
+ vstate->vol_offset = le16_to_cpu(req->set_vol_offset);
vstate->counter = -~vstate->counter; /*Increment Change Counter*/

gatt_db_attribute_notify(vdb->vocs->vos, (void *)vstate,
@@ -926,13 +926,13 @@ static void vocs_state_read(struct gatt_db_attribute *attrib,
void *user_data)
{
struct bt_vocs *vocs = user_data;
- struct iovec iov;
+ struct vol_offset_state state;

- iov.iov_base = vocs->vostate;
- iov.iov_len = sizeof(*vocs->vostate);
+ state.vol_offset = cpu_to_le16(vocs->vostate->vol_offset);
+ state.counter = vocs->vostate->counter;

- gatt_db_attribute_read_result(attrib, id, 0, iov.iov_base,
- iov.iov_len);
+ gatt_db_attribute_read_result(attrib, id, 0, (void *)&state,
+ sizeof(state));
}

static void vcs_flag_read(struct gatt_db_attribute *attrib,
@@ -958,7 +958,7 @@ static void vocs_voal_read(struct gatt_db_attribute *attrib,
struct bt_vocs *vocs = user_data;
struct iovec iov;

- iov.iov_base = &vocs->vocs_audio_loc;
+ iov.iov_base = &cpu_to_le32(vocs->vocs_audio_loc);
iov.iov_len = sizeof(vocs->vocs_audio_loc);

gatt_db_attribute_read_result(attrib, id, 0, iov.iov_base,
@@ -1376,8 +1376,8 @@ static void read_vol_offset_state(struct bt_vcp *vcp, bool success,
return;
}

- DBG(vcp, "Vol Set:%x", vos->vol_offset);
- DBG(vcp, "Vol Counter:%x", vos->counter);
+ DBG(vcp, "Vol Offset: 0x%04x", le16_to_cpu(vos->vol_offset));
+ DBG(vcp, "Vol Counter: 0x%02x", vos->counter);
}

static void read_vocs_audio_location(struct bt_vcp *vcp, bool success,
@@ -1386,6 +1386,7 @@ static void read_vocs_audio_location(struct bt_vcp *vcp, bool success,
void *user_data)
{
uint32_t vocs_audio_loc;
+ struct iovec iov;

if (!value) {
DBG(vcp, "Unable to get VOCS Audio Location");
@@ -1398,9 +1399,15 @@ static void read_vocs_audio_location(struct bt_vcp *vcp, bool success,
return;
}

- memcpy(&vocs_audio_loc, value, length);
+ iov.iov_base = (void *)value;
+ iov.iov_len = length;

- DBG(vcp, "VOCS Audio Loc: %x", vocs_audio_loc);
+ if (!util_iov_pull_le32(&iov, &vocs_audio_loc)) {
+ DBG(vcp, "Invalid size for VOCS Audio Location");
+ return;
+ }
+
+ DBG(vcp, "VOCS Audio Loc: 0x%8x", vocs_audio_loc);
}


--
2.43.0


2023-11-29 17:37:53

by bluez.test.bot

[permalink] [raw]
Subject: RE: [BlueZ,v1,1/2] test-micp: Fix endianess error

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=805347

---Test result---

Test Summary:
CheckPatch FAIL 1.04 seconds
GitLint PASS 0.57 seconds
BuildEll PASS 24.38 seconds
BluezMake PASS 558.67 seconds
MakeCheck PASS 10.92 seconds
MakeDistcheck PASS 151.97 seconds
CheckValgrind PASS 212.07 seconds
CheckSmatch PASS 319.44 seconds
bluezmakeextell PASS 97.57 seconds
IncrementalBuild PASS 1026.37 seconds
ScanBuild PASS 925.83 seconds

Details
##############################
Test: CheckPatch - FAIL
Desc: Run checkpatch.pl script
Output:
[BlueZ,v1,1/2] test-micp: Fix endianess error
WARNING:TYPO_SPELLING: 'endianess' may be misspelled - perhaps 'endianness'?
#57:
Subject: [PATCH BlueZ v1 1/2] test-micp: Fix endianess error
^^^^^^^^^

/github/workspace/src/src/13473187.patch total: 0 errors, 1 warnings, 8 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13473187.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.


[BlueZ,v1,2/2] shared/vcp: Fix endianess errors
WARNING:TYPO_SPELLING: 'endianess' may be misspelled - perhaps 'endianness'?
#59:
Subject: [PATCH BlueZ v1 2/2] shared/vcp: Fix endianess errors
^^^^^^^^^

/github/workspace/src/src/13473188.patch total: 0 errors, 1 warnings, 68 lines checked

NOTE: For some of the reported defects, checkpatch may be able to
mechanically convert to the typical style using --fix or --fix-inplace.

/github/workspace/src/src/13473188.patch has style problems, please review.

NOTE: Ignored message types: COMMIT_MESSAGE COMPLEX_MACRO CONST_STRUCT FILE_PATH_CHANGES MISSING_SIGN_OFF PREFER_PACKED SPDX_LICENSE_TAG SPLIT_STRING SSCANF_TO_KSTRTO

NOTE: If any of the errors are false positives, please report
them to the maintainer, see CHECKPATCH in MAINTAINERS.




---
Regards,
Linux Bluetooth

2023-11-29 22:40:45

by patchwork-bot+bluetooth

[permalink] [raw]
Subject: Re: [PATCH BlueZ v1 1/2] test-micp: Fix endianess error

Hello:

This series was applied to bluetooth/bluez.git (master)
by Luiz Augusto von Dentz <[email protected]>:

On Wed, 29 Nov 2023 11:30:39 -0500 you wrote:
> From: Luiz Augusto von Dentz <[email protected]>
>
> On big endian the followin error can be observed:
>
> MICP/CL/CGGIT/SER/BV-01-C - init
> MICP/CL/CGGIT/SER/BV-01-C - setup
> MICP/CL/CGGIT/SER/BV-01-C - setup complete
> MICP/CL/CGGIT/SER/BV-01-C - run
> micp_write_value handle: 3
> **
> ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
> (memcmp(buf, iov->iov_base, len) == 0)
> Bail out! ERROR:src/shared/tester.c:954:test_io_recv: assertion failed:
> (memcmp(buf, iov->iov_base, len) == 0)
> Aborted
>
> [...]

Here is the summary with links:
- [BlueZ,v1,1/2] test-micp: Fix endianess error
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=3a2d3b31a3b5
- [BlueZ,v1,2/2] shared/vcp: Fix endianess errors
https://git.kernel.org/pub/scm/bluetooth/bluez.git/?id=4db4d5fa1c4f

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html