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

Progress bar when executing nrfutil in Nodejs

I see a progress bar when executing nrfutil on the command line followed by a 'Device programmed.' message after it finishes, but when I try to execute nrfutil in a nodejs app using exec and listening on 'data' event from stdout I don't see any output for the progress bar. I only see 'Device programmed.' when it finishes flashing. Is there a way to get that progress so that I can display it in the UI for my app? 

Parents
  • Hi,

    DFU progress in nrfutil is displayed on screen, but not ending up in the console log. This has to do with how to display and update ascii based "graphics" in a terminal, through the use of ANSI escape codes.

    Please note that nrfutil is an application, not a library, and so it is not written for interactive use from a different computer program.

    Since you are using nodejs, it would probably be a better idea to have a look at javascript implementations of DFU. We do have an implementation for BLE DFU in pc-ble-driver-js, and for USB DFU in pc-nrf-dfu-js.

    If you still want to use nrfutil, and want to e.g. get status percentages from stdout and parse those, then you can always customize nrfutil by changing the update_progress callback function in order to get the behavior that you want.

    Alternatively you can figure out how to get javascript exec (or similar command) to play well with command line tools using ANSI escape codes for displaying status information, but I am afraid that is outside of the scope of what we can provide support for here. I recommend visiting a javascript forum if you want to pursue that path.

    Regards,
    Terje

Reply
  • Hi,

    DFU progress in nrfutil is displayed on screen, but not ending up in the console log. This has to do with how to display and update ascii based "graphics" in a terminal, through the use of ANSI escape codes.

    Please note that nrfutil is an application, not a library, and so it is not written for interactive use from a different computer program.

    Since you are using nodejs, it would probably be a better idea to have a look at javascript implementations of DFU. We do have an implementation for BLE DFU in pc-ble-driver-js, and for USB DFU in pc-nrf-dfu-js.

    If you still want to use nrfutil, and want to e.g. get status percentages from stdout and parse those, then you can always customize nrfutil by changing the update_progress callback function in order to get the behavior that you want.

    Alternatively you can figure out how to get javascript exec (or similar command) to play well with command line tools using ANSI escape codes for displaying status information, but I am afraid that is outside of the scope of what we can provide support for here. I recommend visiting a javascript forum if you want to pursue that path.

    Regards,
    Terje

Children
Related