Date: Wed, 24 Aug 2005 20:28:28 -0600 (MDT) From: "M. Warner Losh" <imp@bsdimp.com> To: fierykylin@gmail.com Cc: freebsd-hackers@freebsd.org Subject: Re: Enumerating devices and hardware conf from userland Message-ID: <20050824.202828.133432144.imp@bsdimp.com> In-Reply-To: <87ab37ab05082405065fb8252@mail.gmail.com> References: <87ab37ab05082405065fb8252@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
In message: <87ab37ab05082405065fb8252@mail.gmail.com> kylin <fierykylin@gmail.com> writes: : >I'm developping a tool running in userland (root) (a command line : >tools) for enumerating all devices present on the machine : : : >This tool must scan all hardware buses : pci, but usb, firewire, ide, : >etc.... and retreive devices states : configure, not configured, handle : >by a driver, not handle by a driver, witch modules is the driver. : >And I want to have all devices present inside a machine. : : : >In some recent Kernel, there is a way from userland, to take a handle : >from the root hardware tree, enumeratiing first buses, and under buses, : >witch device are connect to those buses. This is is what I am looking : >for. : do u just need the read function on the sysctl or do something from : the deep end into kernel ? : does http://www.magnicomp.com/cgi-bin/mcdownload.cgi really help? You can use devinfo to get 99% of the information that you are looking for. This is available in 4.x and newer. In 5.x and newer it also provides information about each device's location and its bus specific plug and play data as well. You can determine which driver is attached to each child in the device tree, or if no device is attached. While you can't directly map the device name to a module name, you can get close with some simple hueristics. There are man pages for the program, and the underlying library. Warner
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20050824.202828.133432144.imp>