diff --git a/py/create.py b/py/create.py index 2d067cb..2e19e73 100644 --- a/py/create.py +++ b/py/create.py @@ -16,23 +16,32 @@ import optparse parser = optparse.OptionParser(description='Create input devices. ' 'TODO') -parser.add_option('-c', '--config', type=str, action='append', - default=[], - help='Merge configuration file with default ' - 'configuration (allowed to be used multiple times)') +#parser.add_option('-c', '--config', type=str, action='append', +# default=[], +# help='Merge configuration file with default ' +# 'configuration (allowed to be used multiple times)') parser.add_option('-C', '--compat', action='store_true', help='Enable compatibility mode; for Python < 2.7') -args, _ = parser.parse_args() +args, cfg = parser.parse_args() # Unpickle from stdin ; currently this is the default and only way f = pickle.Unpickler(sys.stdin) conf = f.load() +print conf -for path in args.config: +for path in cfg: config = imp.load_source('', path).config - conf.update(config) + + # XXX: We cannot just use update; as it will override everything in say EV_TE + for k, v in config.iteritems(): + if k in conf: + conf[k].update(v) + else: + conf[k] = v + #conf.update(config) +print conf m = KeyMapper(conf) diff --git a/py/read.py b/py/read.py index bff8121..8ff2bec 100644 --- a/py/read.py +++ b/py/read.py @@ -14,22 +14,19 @@ parser = optparse.OptionParser(description='Read input devices. ' 'TODO') parser.add_option('-D', '--dump', action='store_false', default=True, help='Dump will marshall all the events to stdout') -parser.add_option('-i', '--input-file', action='append', - type=str, default=[], - help='Read events from this input device') parser.add_option('-C', '--compat', action='store_true', help='Enable compatibility mode; for Python < 2.7') -args, _ = parser.parse_args() +args, input_file = parser.parse_args() -if len(args.input_file) == 0: +if len(input_file) == 0: parser.print_help() exit(0) # TODO: Support multiple input files + epoll; InputDevices? -f = InputDevice(args.input_file[0]) +f = InputDevice(input_file[0]) config = parse_conf(f) m = KeyMapper(config)