keyboard_smt

Source code: keyboard_smt.py

Tests keyboard pin connectivity in SMT factory test.

Description

Unlike keyboard test, it only expects a key sequence where keys are the keyboard scan lines’ row-column crossing points. It also can trigger a SMT testing fixture to send out signals to simulate key presses on the key sequence.

Test Procedure

  • A keycode_sequence is required for the expected key sequence.

  • If bft_fixture is set the test calls the fixture to simulate key press events.

  • Listen to keyboard events, the received keycode must match the expected sequence.

Dependency

Depends on ‘evdev’ module to monitor key presses.

Examples

Here is an example:

{
  "pytest_name": "keyboard_smt",
  "args": {
    "keycode_sequence": [1, 61, 19, 68, 27, 22, 42, 12, 67, 56, 57, 106, 29],
    "timeout_secs": 10,
    "bft_fixture": { ... }
  }
}

Test Arguments

Name

Type

Description

device_filter

int, str, None

(optional; default: None) Keyboard input event id or evdev name.

timeout_secs

int

(optional; default: 30) Timeout for the test.

keycode_sequence

list

Expected keycode sequence generated by a keyboard scan module in the fixture.

bft_fixture

dict, None

(optional; default: None) A dictionary with the following items:

class_name

Fully-qualified class name of the BFTFixture implementation to use.

params

A dictionary of parameters for the BFTFixture class’s Init() method.

The default value of None means that no BFT fixture is used.

debug

bool

(optional; default: False) True to disable timeout and never fail. Used to observe keystrokes.