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

LogEntry init bug results in empty messages #30

Closed
lm2s opened this issue Oct 17, 2019 · 2 comments
Closed

LogEntry init bug results in empty messages #30

lm2s opened this issue Oct 17, 2019 · 2 comments

Comments

@lm2s
Copy link
Contributor

lm2s commented Oct 17, 2019

Incorrect initializer in LogEntry results in empty log entry message.
Tries to cast cbor?["msg"] as CBOR.byteString, but it fails because cbor?["msg"] is of type utf8String.

if case let CBOR.byteString(msg)? = cbor?["msg"] {self.msg = msg} (McuMgrResponse.swift:524)

Debugger output:

(lldb) p cbor?["msg"]
(SwiftCBOR.CBOR?) $R0 = utf8String {
  utf8String = "rsn:SOFT, cnt:1, img:0.0.8.3, hash:ac50b09683a5bbbed0429b02dc8b4e0aee4e0bf5282edc9aa0ca50bcca479f4d"
}

As such LogEntry.msg stays nil.

To fix this, LogEntry.msg should be of type CBOR and the casting should be performed on the getMessage() method, which already has partially the necessary logic to do so and just needs minor adjustments.

I'll submit a PR with a fix.

@bgiori
Copy link
Contributor

bgiori commented Oct 22, 2019

JuulLabs-OSS/mcumgr-android#58

It seems you're firmware log version is old. This library only supports LOG_VERSION=3

@lm2s
Copy link
Contributor Author

lm2s commented Nov 13, 2019

Yes, this was the issue. Thank you :)

@lm2s lm2s closed this as completed Nov 13, 2019
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 a pull request may close this issue.

2 participants