Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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?
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.