LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-31-2005, 03:34 AM   #1
bond_7942
LQ Newbie
 
Registered: Sep 2003
Posts: 15

Rep: Reputation: 0
Question Problem in opening node created by mknod


Hi All,

I am using linux kernel 2.4.26. I created a special character file using
in dev directory as mknod /dev/test c 50 0. Command is successful n i can see the file created in /dev/test.

Then I tried to open the file using open the file as

result = open("/dev/test", I_RDWR);

but it fails i get the error as Device not found and it comes as error Number 19 i.e. ENODEV.

I can not change my kernel(version). Kindly let me know if any other thing is missing. Anybody faced the similar problem.

Waiting for reply. Thanks in advance.

Regards,

Wable
 
Old 10-31-2005, 09:22 PM   #2
jailbait
LQ Guru
 
Registered: Feb 2003
Location: Virginia, USA
Distribution: Debian 12
Posts: 8,336

Rep: Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548Reputation: 548
"I created a special character file using in dev directory as mknod /dev/test c 50 0."

50 0 must correspond to a device driver in the kernel. Did you create a kernel device driver for 50 0?

"i get the error as Device not found and it comes as error Number 19 i.e. ENODEV."

This error probably means that there is no kernel device driver which corresponds to 50 0.

"Then I tried to open the file using open the file as
result = open("/dev/test", I_RDWR);"

I think that this statement should be:
result = open("/dev/test", O_RDWR);
but that is not your problem and it should have resulted in a compile error.

------------------
Steve Stites
 
Old 10-31-2005, 10:44 PM   #3
cstrask
LQ Newbie
 
Registered: Oct 2005
Location: California
Distribution: FC3
Posts: 6

Rep: Reputation: 0
Did you write the character device driver?

If so, did you register the device with major number 50 and minor number 0?
Use the following code to register the device with a major and minor number. Note the 0 will automatically assign major number. In your case use 50. The DEVICE_NAME is a string with the name of your device. fops is a file_operations struct.
int major = register_chrdev(0, DEVICE_NAME, &fops);

If not, how do you know the device is using major number 50 and minor number 0?
 
Old 11-02-2005, 04:12 AM   #4
bond_7942
LQ Newbie
 
Registered: Sep 2003
Posts: 15

Original Poster
Rep: Reputation: 0
Hi cstrask and jailbailt,

Thanks for your reply. I opened device with o_ only sorry it was typo.

I got my problem resolved as i changed the .config setup to support appripriate devices while kernel compilation. Anyway thanks for the help.

Regards,

Wable
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem in a Parallel program for a 4 node CLUSTER nedian123 Linux - Networking 1 07-22-2004 03:05 AM
Node Boot Problem ~ No Keyboard/Harddrive/Diskdrive pjgsmith Linux - General 1 06-23-2004 02:30 PM
Problem in configuring node as Access-Point (AP) in WLAN bond_7942 Linux - Wireless Networking 1 10-06-2003 10:49 PM
Problem in configuring node as Access-Point (AP) in WLAN bond_7942 Linux - Hardware 0 09-15-2003 08:35 AM
timeout=00 and single node problem dafri Linux - Security 3 05-21-2003 08:05 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 06:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration