Error while opennig device file
Garcia Jérémie
GARCIAJ at 3il.fr
Thu Jun 16 03:47:56 EST 2005
I'm sorry but this is a "copy to mail" error.
Here is the right code:
ret_val = system("mknod -m 777 /dev/test1 c 122 1");
ret_val = system("mknod -m 777 /dev/test2 c 122 2");
file_desc1 = open("/dev/test1", O_RDWR);
file_desc2 = open("/dev/test2", O_RDWR);
Sorry again but I would have liked that it was so easy...lol
-------- Message d'origine--------
De: Eugene Surovegin [mailto:ebs at ebshome.net]
Date: mer. 15/06/2005 19:26
À: Garcia Jérémie
Cc: linuxppc-dev at ozlabs.org
Objet : Re: Error while opennig device file
On Wed, Jun 15, 2005 at 06:19:43PM +0200, Garcia J?r?mie wrote:
> Hi everybody,
> I'd like to have your opinion on such a stupid question. Indeed, it must be very easy to see but
> I can't find out what goes on.
> I'm writing a device driver. In the init_module(), I register it with TEST_DEV_MAJOR = 122
>
> ret_val = register_chrdev(TEST_DEV_MAJOR, TEST_DEV_PROC_NAME, &lcd_fops);
>
> In the user space, I have a programm that creates two device files using the same major number but with
> different minor numbers:
>
> ret_val = system("mknod -m 777 /dev/Test1 c 122 1");
> ret_val = system("mknod -m 777 /dev/Test1 c 122 2");
^
> Then I try to open both files :
> file_desc1 = open("/dev/test1", O_RDWR);
> file_desc2 = open("/dev/test2", O_RDWR);
You must be kidding.
You create /dev/Test1 twice, and then open /dev/test1 and /dev/test2.
First of all, Linux fs are case sensitive, second, you don't create
test2 (even with wrong case).
--
Eugene
More information about the Linuxppc-dev
mailing list