Guest OrlandoNative Posted August 1, 2005 Report Share Posted August 1, 2005 Ok, here's the question... Obviously, on some systems using regular pci slots, one can open the case, pull out a card, and look for a model #. Fine and good. However, not all systems (especially laptops) allow this option. So, just how is it that the kernel 'determines' available PCI- type devices? I'm assuming that it probes the bus, and that some sort of codes come back from the devices actually present, that then get compared against some sort of table or something... ...and that the addition/subtraction of table entries is more or less why some hardware may or may not 'show up' depending on what distribution you install - even if the distributions have a same (or very similar) kernel as it's base... So just where is this table or code? I suppose I could wade through the kernel source, but I will be the first to say that C is not my 'native language' Anybody have a pointer here? :ph34r: Quote Link to comment Share on other sites More sharing options...
devries Posted August 1, 2005 Report Share Posted August 1, 2005 Hardware recognition is not something the kernel does. It's done by separate scripts and programs. A well known program is lspci. Open a console and type: lspci -v :) Quote Link to comment Share on other sites More sharing options...
Guest OrlandoNative Posted August 1, 2005 Report Share Posted August 1, 2005 (edited) Ok, I'll buy that. But even the scripts have to be able to 'match' some sort of returned code to 'identify' what that device really is... So where is the data they 'match' against stored? In other words... ...let's say you have a card that shows as 'unknown' other than for 'type' in lspci... ...how do you 'tell' lspci what the actual card is? Obviously it's managing to 'partially' decode what it's seeing... ...since it's putting it into the proper 'type'. :ph34r: Edited August 1, 2005 by OrlandoNative Quote Link to comment Share on other sites More sharing options...
jboy Posted August 1, 2005 Report Share Posted August 1, 2005 Take a look at /usr/share/pci.ids and compare that against the output of lspci -v and lspci -vn. For example, lspci -v shows that I have an ATI Radeon 7500 video card: 01:00.0 VGA compatible controller: ATI Technologies Inc Radeon RV200 QW [Radeon7500] (prog-if 00 [VGA]) lspci -vn gives me the codes for lookup in /usr/share/pci.ids: 01:00.0 Class 0300: 1002:5157 Subsystem: 1002:103a Flags: bus master, stepping, 66Mhz, medium devsel, latency 32, IRQ 16 Memory at c0000000 (32-bit, prefetchable) I/O ports at a800 Memory at cfef0000 (32-bit, non-prefetchable) Expansion ROM at cfec0000 [disabled] Capabilities: <available only to root> Finding 1002 in the first column of /usr/share/pci.ids gives the start of an ATI Technologies Inc. section. Now searching for 5157 within the 1002 section, I find my video card: 1002 ATI Technologies Inc ... 5157 Radeon RV200 QW [Radeon 7500] You might also want to read up on the hotplug process. For example, lspci -v shows that I have various USB Controllers (USB 1.1, 2.0, etc) by a certain vendor. But when I plug in a USB flash drive, the hotplug process gets involved. See: http://linux-hotplug.sourceforge.net/ Also, see the scripts in /etc/hotplug. Quote Link to comment Share on other sites More sharing options...
pmpatrick Posted August 1, 2005 Report Share Posted August 1, 2005 I disagree; I thought that hardware recognition is something the kernel does. In fact that's it's main function - to serve as the software interface to the system hardware. The kernel loads first at boot and does the hardware detection, probes the pci bus, the ide bus, etc. Run dmesg right after you boot. That gives the recent kernel messages and you will see it's all hardware detection. As to how that's done - I assume it's part of the kernel code. All devices on the various system busses have standardized requirements for reporting what and where they are on the bus. I assume the kernel parses that info and does what's needed to use the hardware. Quote Link to comment Share on other sites More sharing options...
devries Posted August 2, 2005 Report Share Posted August 2, 2005 If that was the case why are there so many different Linux installers? All distros use the Linux kernel. If the kernel could recognize all the hardware why not use it if you want to install Linux. :) Quote Link to comment Share on other sites More sharing options...
scarecrow Posted August 2, 2005 Report Share Posted August 2, 2005 Part of the HW detection is done by the kernel itself, and part by utils like hotplug. Of course if you do know what modules are needed for your system you can preload them and disable hotplug/whatever alltogether. I'm using Arch Linux 0.7+ and running a distro-specific HW detection utility (hwd/lshwd) which seems much more consistent (and simpler) than Hotplug, although "I don't really have to use it" if I preload modules. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.