왼쪽은 golang의 touchscreen uinput 기능을 이용한 것, 오른쪽은 uinput 예제에서 설정한 것인데
UI_DEV_SETUP 대신 write로 쓰는게 좀.. 특이하다.
그리고 write로 장치 이름을 쓰고 1116 바이트가 써졌다라..
ioctl(3, UI_SET_EVBIT, 0x1) = 0 ioctl(3, UI_SET_KEYBIT, 0x110) = 0 ioctl(3, UI_SET_KEYBIT, 0x111) = 0 ioctl(3, UI_SET_KEYBIT, 0x14a) = 0
ioctl(3, UI_SET_EVBIT, 0x3) = 0 ioctl(3, UI_SET_ABSBIT, 0) = 0 ioctl(3, UI_SET_ABSBIT, 0x1) = 0
write(3, "testpad\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 1116) = 1116 ioctl(3, UI_DEV_CREATE, 0) = 0 |
ioctl(3, UI_SET_EVBIT, 0x1) = 0 ioctl(3, UI_SET_KEYBIT, 0x110) = 0 ioctl(3, UI_SET_KEYBIT, 0x111) = 0 ioctl(3, UI_SET_KEYBIT, 0x14a) = 0
ioctl(3, UI_SET_EVBIT, 0x3) = 0 ioctl(3, UI_SET_ABSBIT, 0) = 0 ioctl(3, UI_SET_ABSBIT, 0x1) = 0
ioctl(3, UI_DEV_SETUP, 0x7ffc48a87ef0) = 0 ioctl(3, UI_DEV_CREATE, 0) = 0 |
struct uinput_user_dev uinp;
// create input device in input subsystem retcode = write(ufile, &uinp, sizeof(uinp)); printf("First write returned %d.\n", retcode);
First write returned 1116. |
[링크 : https://hybridego.net/1823]
sturct uinput_setup 은 92 바이트 길이
#define UINPUT_MAX_NAME_SIZE 80 struct uinput_setup { struct input_id id; char name[UINPUT_MAX_NAME_SIZE]; __u32 ff_effects_max; }; |
[링크 : https://elixir.bootlin.com/linux/v4.7/source/include/uapi/linux/uinput.h#L66]
struct uinput_user_dev도 그리 길어 보이진 않는데..
#define UINPUT_MAX_NAME_SIZE 80 struct uinput_user_dev { char name[UINPUT_MAX_NAME_SIZE]; struct input_id id; __u32 ff_effects_max; __s32 absmax[ABS_CNT]; __s32 absmin[ABS_CNT]; __s32 absfuzz[ABS_CNT]; __s32 absflat[ABS_CNT]; }; |
[링크 : https://elixir.bootlin.com/linux/v4.0/source/include/uapi/linux/uinput.h#L148]
64개까지 등록 가능하도록 되어있는건가?
#define ABS_MAX 0x3f #define ABS_CNT (ABS_MAX+1) |
[링크 : https://github.com/spotify/linux/blob/master/include/linux/input.h]
+
uinput old interface 로 분류된 구조체인듯..
Programs supportinf older versions of uinput interface need to fill a uinput_user_dev structure and write it to the uinput file descriptor to configure the new uinput device |
[링크 : https://www.kernel.org/doc/html/v4.12/input/uinput.html]