Solved

creating device nodes.

Posted on 2003-11-07
5
191 Views
Last Modified: 2012-05-04
Hi,

I have a simple device driver which registers a dynamic major number. I would like my install rule in the Makefile to create the device nodes automatically by looking into /proc/devices.

I had referred some text on the net and came up with the below commands for my "install" rule in Makefile.

Makefile
=====

TARGET=abc.o
MODULE="abc-char"
.
.


install:
  @insmod $(TARGET)
  @major=`cat /proc/devices | grep $(MODULE) | awk '{print $$1}'`
  @echo $$major

at this point (echo) i dont get the major number of the device, i get a blank. But if I execute the "cat /proc/devices..." as a command i do get the correct major number of the device.

creating device nodes is easy if i can get the major number from /proc/devices.

Can anyone please help me figure out the mistake i am doing or give some other way of doing the same.

cheers!
-Jinu

 



0
Comment
Question by:jinumjoy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 45

Expert Comment

by:sunnycoder
ID: 9700844
>@major=`cat /proc/devices | grep $(MODULE) | awk '{print $$1}'`
should perhaps be
@major=`cat /proc/devices | grep $(MODULE) | awk '{print $1}'`
0
 

Author Comment

by:jinumjoy
ID: 9709225
no sunnycoder $1 will not work.

$$1 is correct, but @major is not getting updated. I dont know what the problem is.

-Jinu
0
 
LVL 45

Accepted Solution

by:
sunnycoder earned 100 total points
ID: 9722171
cat /proc/devices | grep $(MODULE) | awk '{print $$1}'
run this with some dummy values and check the ouput ... if the output is what you desire, then check for spaces on either side of =
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The purpose of this article is to fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…

622 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question