-
Notifications
You must be signed in to change notification settings - Fork 0
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
Linux Key / Message Handling Application #146
Comments
once written we need to add support into the IR module in raft, -> Common Remote |
Need to investigate the method more, but this is the basics, write an app that reads a config yaml and sends a message to the linux input |
Can you attach an example of config yaml input here please @Ulrond |
e.g. EV_KEY:
KEY_RESERVED: 0
KEY_ESC: 1
KEY_1: 2
KEY_2: 3
KEY_3: 4
KEY_4: 5
KEY_5: 6
KEY_6: 7
EV_REL:
...
EV_ABS:
... So that you can run but here's the bigger issue, whilst we can default to just allowing passing --key we need to be able to consider scaling and could that be built in on day 1?
therefore the code looks like this for a mouse movement struct input_event ev;
memset(&ev, 0, sizeof(ev));
ev.type = EV_REL;
ev.code = REL_X;
ev.value = 10; // Move 10 units to the right
write(fd, &ev, sizeof(ev)); and looks like htis for a EV_KEY void send_key(int fd, int code, int value) {
struct input_event ev;
memset(&ev, 0, sizeof(ev));
ev.type = EV_KEY;
ev.code = code;
ev.value = value;
write(fd, &ev, sizeof(ev)); Using the // Press the 'A' key
send_key(fd, KEY_A, 1);
// Release the 'A' key
send_key(fd, KEY_A, 0); So therefore the yaml needs to support these options, so this may work for all input types above. key_example.yaml event:
type: EV_KEY
code: KEY_ESC
value: 1 # Release and this works well.. ut_core_key_input -p linux_profile_5.28.yaml --type EV_KEY --code KEY_ESC --value 1 or ut_core_key_input -p linux_profile_5.28.yaml --i key_example.yaml |
Problem
Requirements
Write a Linux key handling app that can be built from source, but provides a
yaml
file, decodes the information and allows it to be sent to the correctioctl
The
yaml
file input can then be defined and controlled bypython_raft
Resources
https://github.com/torvalds/linux/blob/master/include/uapi/linux/input-event-codes.h
https://kernel.org/doc/html/latest/input/uinput.html#examples
Testing and Monitoring Input Events
To test key codes or monitor input events, you can use the evtest tool, which shows key events and their codes when pressed on an input device:
Install evtest if it’s not already installed:
Run evtest and select the input device to monitor:
Each key code follows a standardized format, allowing uniform interaction with input devices across Linux systems. These key codes are integral to applications and scripts interacting with the Linux input subsystem.
The text was updated successfully, but these errors were encountered: