Finding my /dev/hardware
Hi, I'm wondering how hardware is set up on linux. For example, there is the dev directory which contains a list of all my devices or does it? How would I set up a USB printer? Is there any way to figure out what the device is just by looking in the dev directory? What is the equivalent to a device driver in linux and where is it put? If there is anything else let me know. Thanks.
|
Which distribution of Linux are you using?
Rather than ask you a lot of questions, I'll refer you here :-> How To Ask a Question and here :-> LinuxPrinting.org |
I'm using Slackware.
|
Some good reading for a Slacker :->
The Revised Slackware Book Project Slackware Linux Basics Slackware Tips & Tricks by Jack S. Lai ##slackware FAQ Any questions you can't find answered in those links, please post back... |
Alright, I have read through most of the sources, but my question still isn't answered. Let me modify the question a bit. I want to know how a dev file comes to be. Is a dev file automatically created by linux, or does a device driver need to installed? If the dev file is automatically created what can I learn from it?
|
Alright, I have gotton a little hint on how the devices work. You do end up creating the devices using MAKEDEV or mknod. I still am unclear about a few things. How does the kernel know which PCI slot the hardware is in? What about IRC lines?
|
No need to use mknod anymore...
http://www.atnf.csiro.au/people/rgoo...ocs/devfs.html First hit on Google for devfs |
I'm trying to read through the /devfs FAQ, but there are certain words that I do not understand yet.
What is a device namespace? What is an inode? What is "real" character device? What is a block device? Also, I'm confused because Gooch starts off talking about major and minor numbers and then mentions all the requirements for specifying a SCSI device. host 6 bits (say up to 64 hosts on a really big machine) channel 4 bits (say up to 16 SCSI buses per host) id 4 bits lun 3 bits partition 6 bits TOTAL 23 bits What does this have to with major and minor numbers and how can major and minor numbers describe all these parameters? Thanks. |
Most of that is beyond me, too, but simply know that if your hardware
has a module in the kernel, and you use devfs, it's probably recognized by Slackware. I think your original question: Q: How would I set up a USB printer? A: Use CUPS...the link I provided has info for your printer if it's supported, and you simply need to open a web browser and then type: http://localhost:631/ and login as root, then follow the instructions for setting up your printer. |
Sorry, when I do not know where to look, I ask a whole bunch of questions hoping to find a hint. The printer was did not really have to do with my question. What I want to understand is hardware and GNU/Linux cooperate. I'm sure this is an extremely hard thing to explain, but I need to learn about it sometime. The USB printer was just a hypothetical question. I'm trying to figure out the flow of events. For example, say programmer needs to send a message to the internet. The order of events might be:
1. Ask the OS what device is the internet device. 2. Write to the proper devfs file. 3. devfs calls driver. 4. driver communicates with the device. Learning the flow of events might be the first step to understanding hardware in Linux. |
Well, does anyone no what the chain of events is? (Is sounds funny in that position, but the subject is actually singular, chain)
: ) |
Devfs isn't used much any more. Udev is the new standard for dynamically populating the /dev directory.
Basically, a device file is one of two types, a block device (like a hard drive, which reads or writes blocks from magnetic media) or a character device (or raw device in some usages -- these are basically like a terminal, you can read/write one byte at a time). A device file is a "magic" file that gets interpreted by the kernel directly. Basically, a driver is a piece of code ruunning in the kernel (either compiled in or insmoded) that can associate itself with a particular device major number. A program can then open/read/write the device file and the operations will be sent by the kernel I/O handler to the correct driver code. If you're interested, read Linux Device Drivers, which is online (legally) here. |
Thank you, I will take at least a week to read Linux Device Drivers because I have school this week. I will write back when I'm done.
|
All times are GMT -5. The time now is 02:01 AM. |