This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Master Control Panel DFU code uses device name instead of UUID for

During testing I changed the device name in the DFU. After making the change the DFU client in the master control panel would no longer work.

Is it possible to make the master control panel select the device based on the custom UUID instead of the device name?

My thought is that a device name should be user friendly, and a UUID is intended for machines. Therefore the DFU code which is not a person should use the UUID and not the device name designation.

  • I agree that this should work, and as far as I can see, this works as expected with the current Master Control Panel. When trying it, I'm able to use MCP to upload a new firmware to the device no matter what name it advertises with.

    Edit: The default implementation checks both the name and the address, and if both are not in the advertising packet, it will not work properly. However, you can actually change this by editing the files in lib/dfu/. The method you're looking for is the _discover_peer_named() function in master_emulator.py, and the easiest way to fix this is actually to just not check the name at all, and just succeed if the address is correct.

  • Hi Ole,

    I tested more today and better identified the problem. First I agree this is NOT an issue with the name in the advertisement data. However when I move the name to the scan response data the DFU upload fails.

    I'm attaching a log of the failed update and a log with the successful update.

    mcp_with_sr_fail_log.txt

    mcp_success_log.txt

  • I notice in the successful log file that the "Device Discovery" completes with text:

    257;09:48:59.6837 [480105755][MainThread] [09:48:59.683] device CompleteLocalName 'Dfu' address 'FB1E9EDACE72'

    258;09:48:59.6887 [480105755][MainThread] [09:48:59.687] Found peer device

    259;09:48:59.7087 [480105755][MainThread] [09:48:59.708] [Emulator] Connecting

    The text "Found peer device" is never displayed in the failed log.

    It appears the "Device Discovery" mechanism is relying on the device name in the advertisement data. Since the device name in my case was too long to fit in the advertisement data I have moved the device name into the scan response data. Unfortunately with the 128-bit UUIDs there is very little space remaining for other data, therefore it is necessary to use the scan response fields.

  • You're right, it will only evaluate what is in the advertising packet itself, not what's in the scan response. I edited my answer above to explain how this can be changed, but I'll also report it internally so that it can be fixed in a future release. Thanks for letting us know!

  • I confirmed that by editing master_emulator.py, I was able to make the dfu update work.

    Also very cool that the dfu is implemented as python scripts! This has opened up a whole new level for my use of the master control panel!

Related