You are not logged in.

#1 2015-10-01 17:42:20

cb951303
Member
Registered: 2007-03-17
Posts: 91

uinput doesn't work

I'm trying to create a user space input device via /dev/uinput
lsmod doesn't show uinput module loaded.
So I try sudo modprobe uinput. It says nothing. No error, no message, yet lsmod still shows there are no modules loaded.
But somehow the file /dev/uinput exists.
So I try to open it via code below and run the program with sudo to overcome any permission problems. The error I get is: error: open: No such device

I think this has something to do with uinput module not being loaded properly. Any help would be appreciated.

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

#define die(str, args...) { perror(str); exit(EXIT_FAILURE); }

int main(void)
{
	int fd = open("/dev/uinput", O_WRONLY | O_NONBLOCK);
	if(fd < 0)
		die("error: open");

	return 0;
}

Offline

#2 2015-10-03 02:00:26

pigiron
Member
From: USA
Registered: 2009-07-14
Posts: 150

Re: uinput doesn't work

Interesting kernel module. I wondered if it would still work having been dropped into the tree so long ago, but there were actually updates made to it this year.

Anyway, you posted to the "Kernel & Hardware" thread but neglected to say which kernel you're running. So I simply tried loading it into my 4.1.6-1-ARCH kernel and it seemed to load correctly:

[root@snip tmp]# modprobe uinput
[root@snip tmp]# lsmod|grep input
uinput                 20480  0
[root@snip tmp]# ls -l /dev/uinput
crw------- 1 root root 10, 223 Oct  2 19:54 /dev/uinput

Check if any error messages showed up in dmesg.

Offline

Board footer

Powered by FluxBB