<s> import argparse <EOL> import time <EOL> from button_map import BUTTONS <EOL> from serial_reader import SerialReader <EOL> from serial_uinput import Input <EOL> from Queue import Queue , Empty <EOL> def main ( ) : <EOL> parser = argparse . ArgumentParser ( ) <EOL> parser . add_argument ( "<STR_LIT:port>" , help = "<STR_LIT>" ) <EOL> args = parser . parse_args ( ) <EOL> inp = Input ( ) <EOL> time . sleep ( <NUM_LIT:5> ) <EOL> q = Queue ( ) <EOL> s = SerialReader ( args . port , q ) <EOL> s . start ( ) <EOL> while True : <EOL> try : <EOL> item = q . get ( block = False ) <EOL> keycode = BUTTONS . get ( item [ <NUM_LIT:0> ] , False ) <EOL> if keycode : <EOL> inp . inject_event ( keycode , item [ <NUM_LIT:1> ] ) <EOL> except Empty : <EOL> pass <EOL> except KeyboardInterrupt : <EOL> break <EOL> s . stop ( ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( ) </s>
