input_register_device()¶
Purpose¶
Registers an input device with the Linux input subsystem.
Header¶
Prototype¶
Parameters¶
dev: initialized input device.
Return Value¶
0on success.- Negative errno on failure.
Minimal Example¶
input_set_capability(input, EV_KEY, KEY_ENTER);
ret = input_register_device(input);
if (ret)
return ret;
Common Pitfalls¶
- Set device capabilities before calling this function.
- After successful registration, the input core owns the normal input device lifetime.
- With
devm_input_allocate_device(), cleanup is managed by the device core.