Thread (3 messages) flat view 3 messages, 3 authors, 2005-06-15

RE : Error while opennig device file

From: Garcia Jérémie <hidden>
Date: 2005-06-15 17:50:56

I'm sorry but this is a "copy to mail" error. =20
Here is the right code:

ret_val =3D system("mknod -m 777 /dev/test1 c 122 1");
ret_val =3D system("mknod -m 777 /dev/test2 c 122 2");

file_desc1 =3D open("/dev/test1", O_RDWR);
file_desc2 =3D 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@ebshome.net]
Date: mer. 15/06/2005 19:26
=C0: Garcia J=E9r=E9mie
Cc: linuxppc-dev@ozlabs.org
Objet : Re: Error while opennig device file
=20
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 =3D 122=20
=20
ret_val =3D register_chrdev(TEST_DEV_MAJOR, TEST_DEV_PROC_NAME, =
&lcd_fops);
=20
In the user space, I have a programm that creates two device files =
using the same major number but with=20
different minor numbers:
=20
ret_val =3D system("mknod -m 777 /dev/Test1 c 122 1");
ret_val =3D system("mknod -m 777 /dev/Test1 c 122 2");
                                          ^=20
Then I try to open both files :
file_desc1 =3D open("/dev/test1", O_RDWR);
file_desc2 =3D 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=20
test2 (even with wrong case).

--=20
Eugene
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help