Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

doc: Documentation issue in 'services/device_mgmt/smp_protocol' #81727

Open
mscharrer-ask opened this issue Nov 21, 2024 · 1 comment
Open

doc: Documentation issue in 'services/device_mgmt/smp_protocol' #81727

mscharrer-ask opened this issue Nov 21, 2024 · 1 comment

Comments

@mscharrer-ask
Copy link

Describe the bug

The byte offsets of the SMP header are displayed in an confusing way which strikes me as incorrect.
The first row of the header table "3, 2, 1, 0" should be in the opposite order "0, 1, 2, 3".

According to the description further below and the actual implementation of struct smp_hdr the first byte (#0) contains Res, Version and OP, but the table shows that as byte #3 in the first row / table header. Flags is the second byte (#1) but shown as the third (#2), etc.

The fix would be to swap the order of the first row. Also the description table could also include byte offsets for clarity.

+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| **Byte Offset** | **Field**        | **Type**            | **Bit-Field Size**       | **Description**                                      |
+===============+===================+=====================+==========================+====================================================+
| 0             | `_res1`           | `uint8_t`           | 3 bits                   | Reserved field, not currently used.                |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 0             | `nh_version`      | `uint8_t`           | 2 bits                   | Protocol version (e.g., version number).           |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 0             | `nh_op`           | `uint8_t`           | 3 bits                   | Operation code (e.g., MGMT_OP_[...]).              |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 1             | `nh_flags`        | `uint8_t`           | Full byte                | Reserved for future flags.                         |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 2             | `nh_len`          | `uint16_t`          | Full size                | Length of the payload.                             |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 4             | `nh_group`        | `uint16_t`          | Full size                | Group ID (e.g., MGMT_GROUP_ID_[...]).              |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 6             | `nh_seq`          | `uint8_t`           | Full byte                | Sequence number for tracking requests.             |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+
| 7             | `nh_id`           | `uint8_t`           | Full byte                | Message ID within the group.                       |
+---------------+-------------------+---------------------+--------------------------+----------------------------------------------------+

Environment

  • Page: services/device_mgmt/smp_protocol
  • Version: main
  • SHA-1: 3613f94
Copy link

Hi @mscharrer-ask! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. 🤖💙

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants