Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions api/firmware/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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 {
Expand Down
Loading