Skip to content

Commit

Permalink
documentation: rename OP_INFO to REQ_INFO
Browse files Browse the repository at this point in the history
Rename OP_INFO to REQ_INFO because the name changed after this commit:
BitBoxSwiss/bitbox02-firmware@a785012
The name should be the same as in the firmware repositroy so that the
code base is easier to understand.
  • Loading branch information
NicolaLS committed Aug 1, 2024
1 parent fd97755 commit 02bafe6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
14 changes: 7 additions & 7 deletions api/firmware/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,10 @@ type DeviceInfoREQ_INFO struct {
//
// Can be given if known at the time of instantiation, e.g. by parsing the USB HID product string.
// It must be provided if the version could be less than 4.3.0.
// If nil, the version will be queried from the device using the OP_INFO api endpoint. Do this
// If nil, the version will be queried from the device using the REQ_INFO api endpoint. Do this
// when you are sure the firmware version is bigger or equal to 4.3.0.
//
// product: same deal as with the version, after 4.3.0 it can be inferred by OP_INFO.
// product: same deal as with the version, after 4.3.0 it can be inferred by REQ_INFO.
func NewDevice(
version *semver.SemVer,
product *common.Product,
Expand Down Expand Up @@ -232,13 +232,13 @@ func (device *Device) Version() *semver.SemVer {
return device.version
}

// inferVersionAndProduct either sets the version and product by using OP_INFO if they were not
// provided. In this case, the firmware is assumed to be >=v4.3.0, before that OP_INFO was not
// inferVersionAndProduct either sets the version and product by using REQ_INFO if they were not
// provided. In this case, the firmware is assumed to be >=v4.3.0, before that REQ_INFO was not
// available.
func (device *Device) inferVersionAndProduct(version *semver.SemVer, product common.Product) {
// The version has not been provided, so we try to get it from OP_INFO.
// The version has not been provided, so we try to get it from REQ_INFO.
if device.version == nil {
device.log.Info(fmt.Sprintf("OP_INFO: version=%s, product=%s", version, product))
device.log.Info(fmt.Sprintf("REQ_INFO: version=%s, product=%s", version, product))
device.version = version
device.product = &product
}
Expand All @@ -263,7 +263,7 @@ func (device *Device) Init() error {
deviceInfo, err := device.info()
if err != nil {
return errp.New(
"OP_INFO unavailable; need to provide version and product via the USB HID descriptor")
"REQ_INFO unavailable; need to provide version and product via the USB HID descriptor")
}
// Does nothing if device.version == nil
device.inferVersionAndProduct(deviceInfo.version, deviceInfo.product)
Expand Down
2 changes: 1 addition & 1 deletion api/firmware/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const (
hwwReqRetry = "\x01"
// Cancel any outstanding request.
// hwwReqCancel = "\x02"
// INFO api call (used to be OP_INFO api call), graduated to the toplevel framing so it works
// REQ_INFO api call (used to be OP_INFO api call), graduated to the toplevel framing so it works
// the same way for all firmware versions.
hwwInfo = "i"

Expand Down

0 comments on commit 02bafe6

Please sign in to comment.