ChipCenter Questlink
SEARCH CHIPCENTER
Search Type:
Search for:




Knowledge Centers
Product Reviews
Data Sheets
Guides & Experts
News
International
Ask Us
Circuit Cellar Online
App Notes
NetSeminars
Careers
Resources
FAQ
EE Times Network
Electronics Group Sites

Linux Drivers Weeder I/O Boards


Circuit Cellar Online
THE MAGAZINE FOR COMPUTER APPLICATIONS
Circuit Cellar Online offers articles illustrating creative solutions
and unique applications through complete projects, practical
tutorials, and useful design techniques.

LINUX DRIVES WEEDER I/O BOARDS

Applications
by Jack Dennon

Start ý Create the Device Driver ý Create the Device ý The Order of Things ý Load the Device Driver ý Call the Test Program ý Remove the Device Driver ý Sources and PDF

THE ORDER OF THINGS

To keep things orderly, there is a list of officially assigned major numbers maintained by H. Peter Anvin (who may be reached at hpa@zytor.com). My Linux system has a copy of that list stashed in the file /usr/src/linux-2.0.30/Documentation/devices.txt. You may have a more up-to-date devices.txt file in the corresponding directory on your own Linux system. Table 2 shows an excerpt from that file. Major number 120 is unused and is reserved for LOCAL/EXPERIMENTAL use, so that is the number I'll use here to create a device file directory entry. Although you would normally gather all the special device files in the directory called /dev, while testing new code it is convenient to use the current working directory.

Table 2 ýThis excerpt from devices.txt shows ranges of major device numbers that have been reserved for experimental applications.

Log in as root by using the substitute user command with no arguments (su) and type in the rootýs password when prompted. Create the device called com_dev with the command mknod com_dev c 120 0 and the devices com1 and com2 with the respective commands mknod com1 c 120 1 and mknod com2 c 120 2.

Use the exit command to exit the root shell and restore your normal user state. The command ls -l c* should, at this point, show that you have the device file entries shown below in your current directory:

crw-r--r-- 1 root root 120, 1 Aug 16 14:56 com1
crw-r--r-- 1 root root 120, 2 Aug 16 14:56 com2
crw-r--r-- 1 root root 120, 0 Aug 16 14:56 com_dev

PREVIOUS NEXT


Circuit Cellar provides up-to-date information for engineers. Visit www.circuitcellar.com for more information and additional articles.
For subscription information, call (860) 875-2199, subscribe@circuitcellar.com or subscribe online. ýCircuit Cellar, the Magazine for Computer Applications. Posted with permission.
 
Click here to get your listing up.

Copyright © 2003 ChipCenter-QuestLink
About ChipCenter-Questlink  Contact Us  Privacy Statement   Advertising Information  FAQ