Hardware Reference
In-Depth Information
In addition to registering your intentions to inject these events, you need to define
some coordinate parameters. The following is an example:
struct uinput_user_dev uinp;
uinp.absmin[ABS_X] = 0;
uinp.absmax[ABS_X] = 1023;
uinp.absfuzz[ABS_X] = 0;
uinp.absflat[ABS_X] = 0;
uinp.absmin[ABS_Y] = 0;
uinp.absmax[ABS_Y] = 767;
uinp.absfuzz[ABS_Y] = 0;
uinp.absflat[ABS_Y] = 0;
These values must be established as part of your ioctl(2,UI_DEV_CREATE)
operation, which is described next.
Creating the Node
After all registrations with the uinput device driver have been completed, the final step is
to create the uinput node. This will be used by the receiving application, in order to read
injected events. This involves two programming steps:
1.
Write the struct uinput_user_dev information to the file
descriptor with write(2) .
Perform an ioctl(2,UI_DEV_CREATE) to cause the uinput
node to be created.
2.
The first step involves populating the following structures:
struct input_id {
__u16 bustype;
__u16 vendor;
__u16 product;
__u16 version;
};
struct uinput_user_dev {
char name[UINPUT_MAX_NAME_SIZE];
struct input_id id;
int ff_effects_max;
int absmax[ABS_CNT];
int absmin[ABS_CNT];
int absfuzz[ABS_CNT];
int absflat[ABS_CNT];
};
 
Search WWH ::




Custom Search