Hello,kernelnewbies I am trying to develop a misc driver in 3.7.0 kernel. As a basis I copy and paste this code, *without any change*, http://virtlog.com/2008/03/25/linux-miscdevice-sample/ And build it. after insmod I have : [root@n miscDevice]\>ls -al /dev/mymisc crw------- 1 root root 10, 59 Dec 19 10:24 /dev/mymisc However, when trying to open this file I get: open: No such file or directory Any ideas why ? The program with which I try to open the device is simple, a few lines following here: int main() { int fd; fd = open("/dev/mymodule", O_RDONLY); if (fd == -1) { perror("open"); exit(1); } printf("open succeeded\n"); } Any ideas why this error ? rgs, Kevin
On Wed, Dec 19, 2012 at 10:36 AM, Kevin Wilson <wkevils@gmail.com> wrote:
Hello,kernelnewbies
I am trying to develop a misc driver in 3.7.0 kernel.
As a basis I copy and paste this code, *without any change*,
http://virtlog.com/2008/03/25/linux-miscdevice-sample/
And build it. after insmod I have : [root@n miscDevice]\>ls -al /dev/mymisc crw------- 1 root root 10, 59 Dec 19 10:24 /dev/mymisc
However, when trying to open this file I get: open: No such file or directory
Any ideas why ?
You should implement open. Check this out [1]
The program with which I try to open the device is simple, a few lines following here: int main() { int fd;
fd = open("/dev/mymodule", O_RDONLY);
Isn't this supposed to be called /dev/mymisc ?
if (fd == -1) { perror("open"); exit(1); } printf("open succeeded\n");
}
thanks, Daniel. [1] http://lxr.linux.no/#linux+v3.7.1/drivers/char/efirtc.c#L282
Hi, Thanks.
Isn't this supposed to be called /dev/mymisc ? Well, your are right ! and with /dev/mymisc it worked! sorry for the noise.
BTW, it worked also without implementing the open() method rgs K. On Wed, Dec 19, 2012 at 10:51 AM, Daniel Baluta <daniel.baluta@gmail.com> wrote:
On Wed, Dec 19, 2012 at 10:36 AM, Kevin Wilson <wkevils@gmail.com> wrote:
Hello,kernelnewbies
I am trying to develop a misc driver in 3.7.0 kernel.
As a basis I copy and paste this code, *without any change*,
http://virtlog.com/2008/03/25/linux-miscdevice-sample/
And build it. after insmod I have : [root@n miscDevice]\>ls -al /dev/mymisc crw------- 1 root root 10, 59 Dec 19 10:24 /dev/mymisc
However, when trying to open this file I get: open: No such file or directory
Any ideas why ?
You should implement open. Check this out [1]
The program with which I try to open the device is simple, a few lines following here: int main() { int fd;
fd = open("/dev/mymodule", O_RDONLY);
Isn't this supposed to be called /dev/mymisc ?
if (fd == -1) { perror("open"); exit(1); } printf("open succeeded\n");
}
thanks, Daniel.
[1] http://lxr.linux.no/#linux+v3.7.1/drivers/char/efirtc.c#L282
participants (2)
-
Daniel Baluta -
Kevin Wilson