Linux API/linux

kernel input_event()

구차니 2025. 12. 23. 10:52

먼가 uinput 에서 사용하던 함수 같은 느낌의 코드가 보여서 찾아보는 중

input_event(input, EV_ABS, ABS_MT_POSITION_X, *slot->x);
input_event(input, EV_ABS, ABS_MT_POSITION_Y, *slot->y);
input_event(input, EV_ABS, ABS_MT_TOOL_X, *slot->cx);
input_event(input, EV_ABS, ABS_MT_TOOL_Y, *slot->cy);
input_event(input, EV_ABS, ABS_MT_DISTANCE, !*slot->tip_state);
input_event(input, EV_ABS, ABS_MT_ORIENTATION, orientation);
input_event(input, EV_ABS, ABS_MT_PRESSURE, *slot->p);
input_event(input, EV_ABS, ABS_MT_TOUCH_MAJOR, major);
input_event(input, EV_ABS, ABS_MT_TOUCH_MINOR, minor);

 

void input_event(struct input_dev * dev, unsigned int type, unsigned int code, int value)
report new input event

Parameters

struct input_dev * devdevice that generated the eventunsigned int typetype of the eventunsigned int codeevent codeint valuevalue of the event

Description
This function should be used by drivers implementing various input devices to report input events. See also input_inject_event().

NOTE

input_event() may be safely used right after input device was allocated with input_allocate_device(), even before it is registered with input_register_device(), but the event will not reach any of the input handlers. Such early invocation of input_event() may be used to ‘seed’ initial state of a switch or initial position of absolute axis, etc.

[링크 : https://www.kernel.org/doc/html/v4.14/driver-api/input.html#c.input_event]