Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 28 Nov 2013 01:13:38 -0800 (PST)
From:      Nomad Esst <noname.esst@yahoo.com>
To:        "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org>
Subject:   Access to hardware informations from an user-space program
Message-ID:  <1385630018.22673.YahooMailNeo@web162701.mail.bf1.yahoo.com>

next in thread | raw e-mail | index | archive | help
Hi list
How can I do so? By hardware informations I mean which card is located on which slot, card serial number, manufacturer and ... . I know some utils do this e.g. dmesg, pciconf but I want to write something on my own.
Any suggestion is appreciated.
From owner-freebsd-drivers@FreeBSD.ORG  Sat Nov 30 04:37:36 2013
Return-Path: <owner-freebsd-drivers@FreeBSD.ORG>
Delivered-To: freebsd-drivers@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E474B21F
 for <freebsd-drivers@freebsd.org>; Sat, 30 Nov 2013 04:37:36 +0000 (UTC)
Received: from h2.funkthat.com (gate2.funkthat.com [208.87.223.18])
 (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mx1.freebsd.org (Postfix) with ESMTPS id BE632197A
 for <freebsd-drivers@freebsd.org>; Sat, 30 Nov 2013 04:37:36 +0000 (UTC)
Received: from h2.funkthat.com (localhost [127.0.0.1])
 by h2.funkthat.com (8.14.3/8.14.3) with ESMTP id rAU4bT5n057669
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO);
 Fri, 29 Nov 2013 20:37:30 -0800 (PST)
 (envelope-from jmg@h2.funkthat.com)
Received: (from jmg@localhost)
 by h2.funkthat.com (8.14.3/8.14.3/Submit) id rAU4bThV057668;
 Fri, 29 Nov 2013 20:37:29 -0800 (PST) (envelope-from jmg)
Date: Fri, 29 Nov 2013 20:37:29 -0800
From: John-Mark Gurney <jmg@funkthat.com>
To: Nomad Esst <noname.esst@yahoo.com>
Subject: Re: Access to hardware informations from an user-space program
Message-ID: <20131130043729.GA55638@funkthat.com>
Mail-Followup-To: Nomad Esst <noname.esst@yahoo.com>,
 "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org>
References: <1385630018.22673.YahooMailNeo@web162701.mail.bf1.yahoo.com>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <1385630018.22673.YahooMailNeo@web162701.mail.bf1.yahoo.com>
User-Agent: Mutt/1.4.2.3i
X-Operating-System: FreeBSD 7.2-RELEASE i386
X-PGP-Fingerprint: 54BA 873B 6515 3F10 9E88  9322 9CB1 8F74 6D3F A396
X-Files: The truth is out there
X-URL: http://resnet.uoregon.edu/~gurney_j/
X-Resume: http://resnet.uoregon.edu/~gurney_j/resume.html
X-to-the-FBI-CIA-and-NSA: HI! HOW YA DOIN? can i haz chizburger?
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.2.2
 (h2.funkthat.com [127.0.0.1]); Fri, 29 Nov 2013 20:37:30 -0800 (PST)
Cc: "freebsd-drivers@freebsd.org" <freebsd-drivers@freebsd.org>
X-BeenThere: freebsd-drivers@freebsd.org
X-Mailman-Version: 2.1.16
Precedence: list
List-Id: Writing device drivers for FreeBSD <freebsd-drivers.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/freebsd-drivers>, 
 <mailto:freebsd-drivers-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/freebsd-drivers/>;
List-Post: <mailto:freebsd-drivers@freebsd.org>
List-Help: <mailto:freebsd-drivers-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/freebsd-drivers>,
 <mailto:freebsd-drivers-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Sat, 30 Nov 2013 04:37:37 -0000

Nomad Esst wrote this message on Thu, Nov 28, 2013 at 01:13 -0800:
> Hi list
> How can I do so? By hardware informations I mean which card is located on which slot, card serial number, manufacturer and ... . I know some utils do this e.g. dmesg, pciconf but I want to write something on my own.
> Any suggestion is appreciated.

dmesg just reads the kernel buffer, but you are correct that pci conf
does read this info..  Why don't you read the source for pciconf?  If
you installed the source, it's availabe in /usr/src/usr.sbin/pciconf?

Or you can read it on the web at:
https://svnweb.freebsd.org/base/head/usr.sbin/pciconf/

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1385630018.22673.YahooMailNeo>