Skip to content

Commit

Permalink
Allow for device names. Breaks compatibility.
Browse files Browse the repository at this point in the history
I will think about a stable ABI when the software actually gets used more often.
;-)

Right now, just make sure you sync all the machines to the latest version.
  • Loading branch information
MerlijnWajer committed Feb 3, 2014
1 parent cd29dba commit d0e184d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
10 changes: 7 additions & 3 deletions input-create
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ctypes, sys
import uinputmapper
import uinputmapper.linux_uinput
from uinputmapper.cinput import *
from uinputmapper.mapper import KeyMapper, parse_conf, pretty_conf_print, \
from uinputmapper.mapper import KeyMapper, pretty_conf_print, \
get_exported_device_count
from uinputmapper.linux_input import timeval, input_event

Expand Down Expand Up @@ -39,13 +39,16 @@ nifd = in_f.load()
# Read configuration
conf = in_f.load()

# Read names
names = in_f.load()

if args.verbose:
pretty_conf_print(conf)

# Allow configurations to change our current configuration
for path in cfg:
config_merge = imp.load_source('', path).config_merge
config_merge(conf)
config_merge(conf, names)

if args.verbose:
pretty_conf_print(conf)
Expand All @@ -58,9 +61,10 @@ nofd = get_exported_device_count(conf)
# Create and expose uinput devices
ofs = []
for f in xrange(nofd):
name = names[f]
d = UInputDevice()
m.expose(d, f)
d.setup('Example input device')
d.setup('UInputMapper: %s' % name)
ofs.append(d)

# Map events
Expand Down
3 changes: 3 additions & 0 deletions input-read
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ fs += fsg

# Create configuration
config = {}
names = {}
for idx, f in enumerate(fs):
c = parse_conf(f, idx)
names[idx] = f.get_name()

config.update(c)

Expand Down Expand Up @@ -82,6 +84,7 @@ else:
p.dump(len(fs))

p.dump(config)
p.dump(names)

sys.stdout.flush()

Expand Down

0 comments on commit d0e184d

Please sign in to comment.