Sahara end-of-image and done packets report compact status values from
the target. Including protocol-defined end-of-image descriptions and
the done transfer state alongside the numeric values makes
authentication, hash verification, and transfer-completion results
easier to identify from logs.
Add descriptions for Sahara status codes when logging end-of-image
results, and print done status as pending or complete.
Signed-off-by: Veera, Bhavya <bveera@qti.qualcomm.com>
Some UFS programmers reset the device right after committing the
configuration descriptor, dropping the USB link before sending the
ACK, so qdl reports a failure although provisioning succeeded.
Map LIBUSB_ERROR_NO_DEVICE to -ENODEV in usb_read() and, when the
device disappears after commit=1, treat it as success and skip the
final reset. Any real descriptor error would already have been
NAKed during the earlier exchange. A disconnect during the commit=0
dry run remains a hard error.
Signed-off-by: Zhirong Chen <zhirongc@qti.qualcomm.com>
With qdl_parse_args() in cli.c it is now unit testable. Cover the
option-to-struct mapping for valid inputs: the defaults, storage and
backend selection, --dry-run/--create-digests pinning the SIM backend
(and a later --backend being ignored), the skipblock mode, the flag
and value options, and that --help/--version report "done" while
too-few positional arguments report a usage error.
Invalid storage/backend/skipblock values errx() out of the process
and so are
left to the integration tests.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
With qdl_parse_args() self-contained, move it plus print_usage() and
the shared long-option ids into cli.c, out of main()'s compilation
unit, so unit tests can link the option parser directly.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
qdl_flash() mixed three concerns in 330 lines: option decoding, the
positional-argument walk and the device session. Split them into
qdl_parse_args() (filling struct qdl_opts), qdl_build_op_list() and a
plain session sequence, so each can be reasoned about - and tested -
alone. Options, messages and run order are unchanged; the op-list
builder takes the options mutably because the reset verb overrides
skip-reset.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
patch_load_xml() and read_op_load() turn XML into firehose op lists
and had no direct coverage. Add a cmocka suite (linking util.c for
the real attribute accessors and stubbing the device/ux layers) that
checks a valid entry produces the expected op, that an unrecognized
child tag is skipped, and - locking in the recently fixed error
propagation - that a malformed entry or a missing file makes the
loader return an error instead of reporting success.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Sahara and Firehose traces carry a "SAHARA: " or "FIREHOSE: " tag, but
most VIP messages have none and the few that do mix "VIP:" with a bare
"VIP TABLE DIGESTS" or a Firehose-tagged packet digest.
Prefix every message from vip.c and the VIP negotiation in firehose.c
with "VIP: ", drop the now redundant "VIP" from message bodies, and
move the packet digest trace under the VIP tag since it belongs to
table generation. The sim's own "sim: VIP ..." messages keep their
prefix.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
All diagnostics go through the ux_warn()/ux_die() helpers now, so the
err(3)-style shims and the <err.h> include are dead code.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Sahara diagnostics are now tagged "SAHARA: ", while the Firehose
traces use a mix of "FIREHOSE READ:", "FIREHOSE WRITE:" and a bare
"LOG:" for device log lines, so the two stages do not line up in a
debug log.
Use "FIREHOSE: <TAG>: " for every Firehose trace, including device
logs and raw binary writes, so all protocol output
follows the same "<STAGE>: " format.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Firehose traces are tagged FIREHOSE READ/WRITE, but Sahara messages
such as "HELLO version" or "READ image" carry no hint of where they
come from, and only a few had an ad-hoc "Sahara:" prefix. In a
timestamped debug log this makes the two protocol stages hard to tell
apart.
Prefix every message emitted by sahara.c with "SAHARA: ", fold the
existing ad-hoc prefixes into it, and drop the now redundant "Sahara"
from message bodies. The chipinfo report table is command output
rather than a diagnostic and is left unchanged.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
libxml2 dumps a document with a newline after the declaration and at
the end, and some devices terminate their responses the same way. With
timestamped debug output every FIREHOSE WRITE therefore spans two lines
and is followed by a blank one, which makes the trace hard to scan.
Strip newlines from the XML before printing so each read and write is
one line, matching how devices format their responses.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
USB warnings, Sahara ramdump failures, fatal CLI and archive errors,
and packet hex dumps bypass the ux helpers, so they never get a
--debug timestamp and leave gaps in the protocol timeline.
Route them through shared logging via new warn and die helpers that
keep the program-name prefix, errno text, and exit status. Output
without --debug is unchanged and hex dumps stay visible in both modes.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
The error prefix comes from __progname, a BSD-ism that glibc and the
Apple libc export but Windows lacks, so qdl.c and every unit test that
links util.c define their own copy. The nbdkit plugin links neither.
Keep the name in ux.c with a "qdl" default and set it through
ux_set_progname(): from argv[0] in main() and from the plugin's load
hook. Move print_version() into qdl.c, its only caller, so util.c and
the tests no longer need the symbol.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Debug logs give no indication of when a message was emitted, which
makes stalls and timeouts hard to pin down and host activity hard to
correlate with device logs.
Prefix every message with the local time at millisecond resolution
when --debug is enabled. Keep multi-line messages aligned and track
partial lines per stream so split messages stay readable. Output
without --debug is unchanged.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
qdl cannot be packaged for EPEL 9, because RHEL 9 ships meson 0.63.3
and the build stops at the version check:
meson.build:1:0: ERROR: Meson version is 0.63.3 but project
requires >=1.1.0
The only thing in the build actually requiring meson 1.1 is the
meson.options file name. The build rules themselves need nothing newer
than project_source_root() and project_build_root() from 0.56. Rename
the options file to the older meson_options.txt spelling, which every
meson version understands, and lower the floor to what the rules
require.
Verified by building with meson 0.56.2 (the new floor), 0.63.3 (EL9)
and 1.10.1, each with the zip container both enabled and disabled.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
The repology.org service is no longer available, so the badge renders
as broken. Remove it; the Debian package badge still shows distribution
packaging status.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Top-level sections ran straight into each other when rendered. Put a
horizontal rule before each one so the boundaries are visible.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
The README had grown into one long page where the basic flashing
workflow was buried between VIP, multi-programmer, ramdump, kickstart,
WSL2 and raw sector guides. Keep only the generic material in the
README and move each specialised workflow into its own file under
docs/, linked from a new "Documentation" index. The moved text is
unchanged apart from heading levels and two cross-references.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>
Add the cmocka package to every install list (unit tests are silently
skipped without it) and describe all meson feature options in one
place. Replace the fixed product ID list with the vendor ID based
matching qdl actually performs, and filter the usbipd re-attach snippet
on the vendor ID as well. Document the usb/qud/auto device backends, the
test suites, the remaining flashing options and the erase, sha256,
chipinfo and reset commands.
Signed-off-by: Igor Opaniuk <igor.opaniuk@oss.qualcomm.com>