From a53ec295a6d2c50a6b2e2b4b5cad36e0eb3951d4 Mon Sep 17 00:00:00 2001 From: Nikolas De Giorgis Date: Thu, 18 Sep 2025 11:00:05 +0100 Subject: [PATCH] maintenance: expose Info method. This way, the Bitbox backend, when running in simulator mode, can query for the simulated device's version and product. --- api/firmware/device.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/api/firmware/device.go b/api/firmware/device.go index 0d981b2..91fc05c 100644 --- a/api/firmware/device.go +++ b/api/firmware/device.go @@ -170,14 +170,13 @@ func NewDevice( } } -// info uses the opInfo api endpoint to learn about the version, platform/edition, and unlock +// Info uses the opInfo api endpoint to learn about the version, platform/edition, and unlock // status (true if unlocked). -func (device *Device) info() (*semver.SemVer, common.Product, bool, error) { - +func Info(communication Communication) (*semver.SemVer, common.Product, bool, error) { // CAREFUL: hwwInfo is called on the raw transport, not on device.rawQuery, which behaves // differently depending on the firmware version. Reason: the version is not // available (this call is used to get the version), so it must work for all firmware versions. - response, err := device.communication.Query([]byte(hwwInfo)) + response, err := communication.Query([]byte(hwwInfo)) if err != nil { return nil, "", false, err } @@ -227,6 +226,10 @@ func (device *Device) info() (*semver.SemVer, common.Product, bool, error) { return version, product, unlocked, nil } +func (device *Device) info() (*semver.SemVer, common.Product, bool, error) { + return Info(device.communication) +} + // Version returns the firmware version. func (device *Device) Version() *semver.SemVer { if device.version == nil {