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

Implement updater tool #60

Open
wants to merge 5 commits into
base: icedream-experiments
Choose a base branch
from

Conversation

icedream
Copy link
Owner

@icedream icedream commented Jul 7, 2024

This tool is entirely written from scratch to replace the original Denon one we have been using thus far for releases of the custom firmware.

Implementation

The updater uses Google's Go wrapper around libusb to reimplement FastBoot, the protocol used for flashing inMusic devices (and various other Linux-based devices).

It can be built with either a purely Go implementation of xz or, if go build tag libxz is set, a cgo wrapper around the native xz library for efficient on-the-fly image decompression. The variable in go/Makefile defaults to setting the libxz tag. Some code had to be copied over to my repository to allow determining the exact amount of data to be transferred to the device as it is required for the flashing procedure. This is also then used for progress display purposes.

Matching device IDs as well as firmware version is read from the generated Device Tree Blob file, SHA1 checksum verification for the images contained in the DTB is also implemented. All other info is read from a supplied config.toml file of which its entire structure is packed into a Go struct type.

The GUI is implemented using gioui. This allows clear separation of state and UI rendering without over-complications usually encountered with other frameworks I've so far tried. A Go-side built-in font is used for rendering the UI to avoid system font rendering issues in Wine during testing. It was originally even slower while I was using a data copy buffer in the FastBoot code of 4096 bytes, increasing that to 16384 bytes helped. I suspect I could set it even higher for more performance but didn't test it yet.

This is not the most optimized implementation as the fastboot CLI is able to flash the entire firmware within 30 seconds whereas this implementation takes slightly over twice as long.

The updater generation script has been modified to use this file and to not copy the updater file to manipulate 7z to include all files without paths anymore.

The devices list also has been updated to carry proper display names for every device, the name is used as part of the generated config.toml file for the new updater.

Screenshots

image

Known issues

  • Updater does not properly handle quitting the application yet as it will allow immediate termination using the Close button. This is meant to be blocked during the flashing process.
  • The updater has to reinitialize libusb after every command issued to the device. It is unclear whether that is a limitation of the fastboot implementation on the device or whether it's an implementation issue in the updater code.
  • The updater sometimes runs into the device being busy due to its own interactions with libusb.
  • A purely Go implementation of libusb could not be used as it refuses to detect most of the USB devices, including the Denon PRIME 4 I tested against when it was hooked up via USB/IP. With native libusb it worked without issues whatsoever and libusb is also easy to cross-compile.

References

@icedream icedream self-assigned this Jul 7, 2024
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 this pull request may close these issues.

1 participant