From owner-freebsd-hackers Thu Apr 13 14:21: 7 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from alemail1.firewall.lucent.com (alemail1.lucent.com [192.11.221.161]) by hub.freebsd.org (Postfix) with ESMTP id 71DAF37B680 for ; Thu, 13 Apr 2000 14:21:02 -0700 (PDT) (envelope-from gcorcoran@lucent.com) Received: from alemail1.firewall.lucent.com (localhost [127.0.0.1]) by alemail1.firewall.lucent.com (Pro-8.9.3/8.9.3) with ESMTP id RAA10745 for ; Thu, 13 Apr 2000 17:21:00 -0400 (EDT) Received: from mhmail.mh.lucent.com (h135-3-115-8.lucent.com [135.3.115.8]) by alemail1.firewall.lucent.com (Pro-8.9.3/8.9.3) with ESMTP id RAA10733 for ; Thu, 13 Apr 2000 17:20:59 -0400 (EDT) Received: from lucent.com by mhmail.mh.lucent.com (8.8.8+Sun/EMS-1.5 sol2) id RAA14373; Thu, 13 Apr 2000 17:20:57 -0400 (EDT) Message-ID: <38F63C11.860C901B@lucent.com> Date: Thu, 13 Apr 2000 17:28:49 -0400 From: "Gary T. Corcoran" Organization: Lucent Microelectronics - Modem and Multimedia Systems X-Mailer: Mozilla 4.06 [en] (Win98; U) MIME-Version: 1.0 To: FreeBSD Hackers Subject: Setting device options Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Now that my device driver basically works (I can successfully do pings and ftp transfers through it) using default settings, I'd like to start polishing it up a bit... This is a driver for a DSL device (Lucent WildWire), and our driver has lots of options because there are many "flavors" of DSL and things that need to be set depending on who is providing DSL service to your location. The device driver currently makes our DSL device look like an Ethernet card, though I will also be adding more code to support WAN (PPP) modes (that is, of course, one of the options that I need to set before the device is initialized). So, I want to know how I can "automagically" set the device options, every time a user kldload's the device driver. To give you a little background, here's how it works on the other operating systems, and thus this is the type of thing I'm looking for in FreeBSD. In Windows, after installation the options are stored in that "wonderful" hack called the Registry. The driver, upon initialization, reads the settings (i.e. the options) from the registry, and uses those settings to initialize. In Linux, by declaring some global variables with the "MODULE_PARM" macro, this allows these variables to automatically have their value set as the module is being loaded, overriding whatever default was compiled into the module. One only has to provide settings in the /etc/conf.modules file for the options to override, and these values are picked up by the "insmod" (insert module, equivalent to kldload) command. Thus, when the module is loaded, if there were any options set, the values of the global variables are set, even before the init_module() routine gets called. In other words, once you set the options you need in conf.modules, all settings are automatically handled, you don't have to remember to run some "extra" program after loading your module but before you bring up your link with ifconfig. Is there some equivalent way of handling device driver option settings in FreeBSD? I would prefer an "automatic" way of having the device options set, similar in function to the way you can set options for your ethernet card with the ifconfig command - so that once you define, for example, your ifconfig command and put it in your rc file, you just automatically bring things up the desired way. Any suggestions? (For FreeBSD 4.x) Thanks, Gary To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message