U
K��^bA � @ s6 d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlZd dl m
Z
d dlmZ d dl
mZ d dlmZmZ d dlmZ d dlmZ d dlmZmZ d d lmZ d d
lmZ d dlmZ e�d�Z d Z!d
Z"dZ#dZ$dZ%dZ&dZ'dd� Z(G dd� d�Z)G dd� d�Z*G dd� dej+�Z+G dd� d�Z,dS )� N)�
schedule_task)�Context)�Skip)�
PALETTE_COLOR�PALETTE_MONO)�
ControllerSet)�Prober)�is_linux_tty�make_screen)�Signal)�SubiquityCoreUI)�arun_commandzsubiquitycore.core� � � � iDK iEK c C sf t jj�td�dtd�dtd�dtd�dtd �d
td�dtd
�dtd�dtd�t jjtd� i � d S )Nu ▸�>u ◂�<u ▾�vu ▴�^u ✓�+u •�*u ▄�=u ▀u █u │)�urwid�escapeZDEC_SPECIAL_CHARMAP�update�ord� r r �*/usr/share/subiquity/subiquitycore/core.py�extend_dec_special_charmap7 s, ��r c @ s0 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
S )�KeyCodesFiltera� input_filter that can pass (medium) raw keycodes to the application
See http://lct.sourceforge.net/lct/x60.html for terminology.
Call enter_keycodes_mode()/exit_keycodes_mode() to switch into and
out of keycodes mode. In keycodes mode, the only events passed to
the application are "press $N" / "release $N" where $N is the
keycode the user pressed or released.
Much of this is cribbed from the source of the "showkeys" utility.
c C s( t �dttj�� � t j�| _d| _d S )Nz/proc/self/fd/F) �os�open�str�sys�stdin�fileno�O_RDWR�_fd� filtering��selfr r r �__init__S s zKeyCodesFilter.__init__c C sN t �d� d| _td�}t�| jt|� t� d|�d | _
t�| jtt� d S )N�enter_keycodes_modeTr �ir )
�log�debugr) � bytearray�fcntl�ioctlr( � KDGKBMODE�structZunpack� _old_mode� KDSKBMODE�K_MEDIUMRAW)r+ �or r r r- W s
z"KeyCodesFilter.enter_keycodes_modec C s& |