zigpy / bellows

A Python 3 project to implement EZSP for EmberZNet devices
GNU General Public License v3.0
184 stars 87 forks source link

Handle null-terminated `MFG_` strings #473

Closed puddly closed 2 years ago

puddly commented 2 years ago

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
}
MattWestb commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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.

anbugge commented 2 years ago

Your assumptions are correct :)

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