Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Robot/Keyboard test doesn't work at first attempt (Bugfix) #1459

Merged
merged 1 commit into from
Sep 25, 2024

Conversation

p-gentili
Copy link
Collaborator

@p-gentili p-gentili commented Sep 9, 2024

WARNING: This modifies com.canonical.certification::sru

Description

See https://certification.canonical.com/hardware/202406-34144/submission/385662/test/203749/result/43085479/

When loading the ZapperHid robot library, two things happen:

  1. HID device is re-configured to mouse,pointer,keyboard
  2. HID status gets reset

Since this happens within the same API call, the keyboard disappears for a moment making the input event listener crash.

Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.12/threading.py", line 1073, in _bootstrap_inner
    self.run()
  File "/tmp/nest-dte_n5h3.406f1a6a482f12570d1010bc16fdf8c76a09be410a66e78ecff990bfc353620b/zapper_keyboard_test.py", line 60, in run
    self._read_keyboard_events()
  File "/tmp/nest-dte_n5h3.406f1a6a482f12570d1010bc16fdf8c76a09be410a66e78ecff990bfc353620b/zapper_keyboard_test.py", line 71, in _read_keyboard_events
    data = os.read(self._event_no, self.EVENT_BIN_SIZE)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [Errno 19] No such device

This PR adds another small robot API call, with an empty body just for the sake of re-configuring the HID device. Then, a busy loop waits until the device comes back.

Resolved issues

N/A

Documentation

N/A

Tests

Tested side-loading the device. Problem happens 100% of the time if

  1. Zapper FW is up to date
  2. The test case runs for the first time

@p-gentili
Copy link
Collaborator Author

DRAFT because pending approval of another related change.

Copy link

codecov bot commented Sep 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 46.14%. Comparing base (5ebfbaf) to head (57b5e7d).
Report is 136 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1459   +/-   ##
=======================================
  Coverage   46.13%   46.14%           
=======================================
  Files         367      367           
  Lines       39206    39212    +6     
  Branches     6633     6634    +1     
=======================================
+ Hits        18088    18094    +6     
  Misses      20421    20421           
  Partials      697      697           
Flag Coverage Δ
provider-base 20.69% <100.00%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@p-gentili p-gentili marked this pull request as ready for review September 24, 2024 13:00
@p-gentili p-gentili requested a review from a team September 24, 2024 13:00
@p-gentili
Copy link
Collaborator Author

DRAFT because pending approval of another related change.

Not the case anymore, compatibility will be maintained.

@fernando79513 fernando79513 self-assigned this Sep 25, 2024
Copy link
Collaborator

@fernando79513 fernando79513 left a comment

Choose a reason for hiding this comment

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

LGTM +1!

@fernando79513 fernando79513 merged commit 09cf5e3 into main Sep 25, 2024
43 checks passed
@fernando79513 fernando79513 deleted the wait-keyboard-after-reset branch September 25, 2024 11:22
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.

2 participants