lid_switch ========== **Source code:** `lid_switch.py `_ Tests lid switch functionality. Description ----------- Test lid switch functionality by listening to lid switch event. Test Procedure -------------- If a BFT fixture is set: - ask the fixture to simulate a lid close event - confirm the event is received - ask the fixture to simulate a lid open event - confirm the event is received If there is no BFT fixture, the operator should close and open the lid manually. Dependency ---------- - Depends on 'evdev' module to monitor events. - If ``ok_audio_path`` is set, depends on audio function to play a sound to indicate the lid close event is received. Examples -------- ``LidSwitch`` is defined in the generic_common test list, it calls this test with default arguments. Test Arguments -------------- .. list-table:: :widths: 20 10 60 :header-rows: 1 :align: left * - Name - Type - Description * - timeout_secs - int - (optional; default: ``30``) Timeout value for the test. * - ok_audio_path - str, None - (optional; default: ``None``) Path to the OK audio file which is played after detecting lid closesignal. Defaults to play ok_*.ogg in /sounds. * - audio_volume - int - (optional; default: ``100``) Percentage of audio volume to use when playing OK audio file. * - device_filter - int, str, None - (optional; default: ``None``) Event ID or name for evdev. None for auto probe. * - 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. * - bft_retries - int - (optional; default: ``3``) Number of retries for BFT lid open / close. * - bft_pause_secs - int, float - (optional; default: ``0.5``) Pause time before issuing BFT command. * - brightness_path - str, None - (optional; default: ``None``) Path to control brightness level. * - brightness_when_closed - int, None - (optional; default: ``None``) Value to brightness when lid switch closed. * - check_delayed_backlight - bool - (optional; default: ``False``) True to check delayed backlight. * - bft_control_name - str - (optional; default: ````) Controller name on BFT fixture to trigger Lid switch