Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix remapping values bleeding from last entry, set input props same as the original device. #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions evdevremapkeys/evdevremapkeys.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ def repeat_event(event, rate, count, values, output):


def remap_event(output, event, event_remapping):
original_type = event.type
original_value = event.value
original_code = event.code
for remapping in event_remapping:
original_code = event.code
event.code = remapping['code']
event.type = remapping.get('type', None) or event.type
values = remapping.get('value', None) or [event.value]
event.type = remapping.get('type', None) or original_type
values = remapping.get('value', None) or [original_value]
repeat = remapping.get('repeat', False)
delay = remapping.get('delay', False)
if not repeat and not delay:
Expand Down Expand Up @@ -307,7 +309,7 @@ def flatmap(lst):
extended.update([remapping['code']])

caps[ecodes.EV_KEY] = list(extended)
output = UInput(caps, name=device['output_name'])
output = UInput(caps, input_props=input.input_props(), name=device['output_name'])
print('Registered: %s, %s, %s' % (input.name, input.path, input.phys), flush=True)
future = asyncio.ensure_future(
handle_events(input, output, remappings, modifier_groups))
Expand Down