Skip to content

Make firmware probe only react on specific error - #158

Open
mchack-work wants to merge 1 commit into
mainfrom
fix-firmware-probe
Open

Make firmware probe only react on specific error#158
mchack-work wants to merge 1 commit into
mainfrom
fix-firmware-probe

Conversation

@mchack-work

@mchack-work mchack-work commented Sep 1, 2026

Copy link
Copy Markdown
Member

Description

Instead of thinking a TKey is running a device app on any error from the firmware probe, just report a device app if we get the specific ErrResponseStatusNotOK error.

Fixes #157

Type of change

Please tick any that are relevant to this PR and remove any that aren't.

  • Bugfix (non breaking change which resolve an issue)

Submission checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my changes
  • I have tested and verified my changes on target
  • My changes are well written and CI is passing
  • I have squashed my work to relevant commits and rebased on main for linear history
  • I have added a "Co-authored-by: x" if several people contributed, either pair programming or by squashing commits from different authors.
  • I have updated the documentation where relevant (readme, dev.tillitis.se etc.)
  • QEMU is updated to reflect changes

Instead of thinking a TKey is running a device app on any error from
the firmware probe, just report a device app if we get the specific
ErrResponseStatusNotOK error.
func (s *Signer) isFirmwareMode() bool {
nameVer, err := s.tk.GetNameVersion()
if err != nil {
if errors.Is(err, tkeyclient.ErrResponseStatusNotOK) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From GetNameVersion, if any other error than ErrResponseStatusNotOK occurs, it will do

return nil, err

Which is not handled, so

return nameVer.Name0 == wantFWName0 &&
		nameVer.Name1 == wantFWName1

will compare against nil. Isn't that a problem?

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.

Firmware probe mistakes all errors for device app

2 participants