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

tools: Make dfu.py work with python3 again. #7931

Closed
wants to merge 1 commit into from

Conversation

dhylands
Copy link
Contributor

Without this change, running:

python3 ../../tools/dfu.py -d build-PYBV11/firmware.dfu

produces the following error:

File: "build-PYBV11/firmware.dfu"
b'DfuSe' v1, image size: 367757, targets: 1
Traceback (most recent call last):
  File "../../tools/dfu.py", line 160, in <module>
    parse(infile, dump_images=options.dump_images)
  File "../../tools/dfu.py", line 42, in parse
    tprefix["name"] = cstring(tprefix["name"])
  File "../../tools/dfu.py", line 23, in cstring
    return string.split("\0", 1)[0]
TypeError: a bytes-like object is required, not 'str'

With the PR applied, the following output is produced:

File: "build-PYBV11/firmware.dfu"
b'DfuSe' v1, image size: 367757, targets: 1
b'Target' 0, alt setting: 0, name: "b'ST...'", size: 367472, elements: 2
  0, address: 0x08000000, size: 14632
    DUMPED IMAGE TO "build-PYBV11/firmware.dfu.target0.image0.bin"
  1, address: 0x08020000, size: 352824
    DUMPED IMAGE TO "build-PYBV11/firmware.dfu.target0.image1.bin"
usb: 0483:df11, device: 0x0000, dfu: 0x011a, b'UFD', 16, 0x1264d2f5

@codecov-commenter
Copy link

codecov-commenter commented Oct 25, 2021

Codecov Report

Merging #7931 (8815203) into master (7f14344) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #7931   +/-   ##
=======================================
  Coverage   98.24%   98.24%           
=======================================
  Files         154      154           
  Lines       20007    20007           
=======================================
  Hits        19656    19656           
  Misses        351      351           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7f14344...8815203. Read the comment docs.

@dpgeorge
Copy link
Member

dpgeorge commented Nov 1, 2021

Thank you! Merged in cb99ca9

@dpgeorge dpgeorge closed this Nov 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants