Recognizing input - Left Ctrl, Right Ctrl

Announcements, questions
MATORAX
Posts: 3
Joined: 01 Mar 2019, 22:42

Recognizing input - Left Ctrl, Right Ctrl

Post by MATORAX » 01 Mar 2019, 22:56

I have a problem with recognizing keys on my keyboard in LuaMacros. Both left control and right control appear as one key (identical key number). Same thing goes with left and right alt. Is there a way to recognize these keys as different buttons? I can see in logs that those keys have different "extended" flag. How can I test a button in case of a value in that flag?

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by admin » 02 Mar 2019, 22:09

Now you can't.
But I can add the extended flag as 4th parameter of trigger callback.
In near future or feel free to create issue in https://github.com/me2d13/luamacros/issues for tracking
Petr Medek
LUAmacros author

MATORAX
Posts: 3
Joined: 01 Mar 2019, 22:42

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by MATORAX » 03 Mar 2019, 10:10

I've created an issue on GitHub as suggested. Thank you for quick response.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by admin » 04 Mar 2019, 22:00

Version 0.1.1.98 released with support of this parameter.
With code like

Code: Select all

lmc_assign_keyboard('KBD2')

log_handler = function(button, direction, ts, flags)
  print('Callback for device: button ' .. button .. ', direction '..direction..', ts '..ts..', flags '..flags)
end

lmc_set_handler('KBD2', log_handler)
You get for left ctrl (press and release):
Callback for device: button 17, direction 1, ts 8166000, flags 0
Callback for device: button 17, direction 0, ts 8166125, flags 1

And for right ctrl (press and release):
Callback for device: button 17, direction 1, ts 8295125, flags 2
Callback for device: button 17, direction 0, ts 8295203, flags 3

Download link is still the same.
Petr Medek
LUAmacros author

MATORAX
Posts: 3
Joined: 01 Mar 2019, 22:42

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by MATORAX » 05 Mar 2019, 11:11

Everything works - thank you for adding this feature :)

peewee
Posts: 10
Joined: 30 Mar 2019, 13:43

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by peewee » 15 Apr 2019, 21:45

Could flags also be added to left and right Shift keys, pretty please? :)

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by admin » 16 Apr 2019, 08:27

Flags are parameter of callback function, they are not bound to specific key.
Did you try?
Petr Medek
LUAmacros author

peewee
Posts: 10
Joined: 30 Mar 2019, 13:43

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by peewee » 16 Apr 2019, 09:22

Yes, both Shift keys report Button 16, and flags 0 and 1.

admin
Site Admin
Posts: 735
Joined: 01 Nov 2010, 13:00
Location: Prague, Czech republic
Contact:

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by admin » 17 Apr 2019, 08:38

I see, will check after Easter
Petr Medek
LUAmacros author

peewee
Posts: 10
Joined: 30 Mar 2019, 13:43

Re: Recognizing input - Left Ctrl, Right Ctrl

Post by peewee » 17 Apr 2019, 11:41

You are the man, than yiu so much!

I'm using this together with X-Keypad and it's looking great!

Post Reply