Skip to content

Conversation

@puddly
Copy link
Contributor

@puddly puddly commented Jul 25, 2022

Backups were being created with invalid metadata:

"ezsp": {
    "manufacturer": "Nabu Casa\u0000",
    "board": "SkyBlue v0.1\u0000",
    "version": "7.1.0.0 build 191",
    "stack_version": 9,
    "can_write_custom_eui64": false
}

@puddly puddly force-pushed the puddly/null-terminated-mfg-strings branch from 29d9097 to d0aee30 Compare July 25, 2022 17:23
@puddly puddly force-pushed the puddly/null-terminated-mfg-strings branch from d0aee30 to 6610dd7 Compare July 25, 2022 17:28
@MattWestb
Copy link
Contributor

The manufacture and board name token is normal terminated with one space.
But if writing one long string you is getting one warning (from Commander) that is no space between the token but its being written OK in the device flash.

Example for 15 charter long token that is not generating error (16 do but working OK in ZHA):
MW-Marcus-RNP.txt

@puddly
Copy link
Contributor Author

puddly commented Jul 25, 2022

These tokens seem to be 16 bytes long. Maybe Commander adds \x00 at the end to terminate the string, which means that you will have only 15 characters to work with.

Both should work with bellows but I think the \x00 at the end is the "correct" way.

@MattWestb
Copy link
Contributor

MattWestb commented Jul 25, 2022

I think the same that commander adding the \x00 for strings that is under 16 chaster but i thing the flash is not having it then using 16 chaster tokens so dont make it braking if its not coming on stop charter 👍

Great work as normal from you Puddly !!!

PS: My old Billy token was 16 charters then using EZSP and now NCP or RCP and it was working OK in ZHA only warning then flashing the tokens.

Copy link
Collaborator

@Adminiuga Adminiuga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@puddly puddly merged commit 0382806 into zigpy:dev Jul 26, 2022
@anbugge
Copy link

anbugge commented Aug 7, 2022

Your assumptions are correct :)

This was actually a change in Commander a few years ago. From the change log:

  • The MFG string tokens "MFG_STRING" and "MFG_BOARD_NAME" will now be zero terminated when written by Commander
    • Previously the string was unterminated, and unused token space is filled with 0xFF
    • If the string is exactly 16 bytes, filling the token, a warning will be raised and the string will be unterminated

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants