From owner-freebsd-hackers Tue Oct 3 4:40:16 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.osd.bsdi.com (adsl-63-202-176-106.dsl.snfc21.pacbell.net [63.202.176.106]) by hub.freebsd.org (Postfix) with ESMTP id 64D9937B503 for ; Tue, 3 Oct 2000 04:40:14 -0700 (PDT) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.11.0/8.9.3) with ESMTP id e93Bfph06288; Tue, 3 Oct 2000 04:41:52 -0700 (PDT) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200010031141.e93Bfph06288@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Willem van Engen Cc: freebsd-hackers@freebsd.org Subject: Re: FreeBSD 4.x kld device driver In-reply-to: Your message of "Tue, 03 Oct 2000 13:00:51 +0200." <39D9BC63.7C7EDD43@stack.nl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 03 Oct 2000 04:41:51 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Have a look at the simple device driver I wrote for the Linksys Gigadrive's front panel LEDs, etc. http://people.freebsd.org/~msmith/gigadrive This approach should suit you well. I would use a single device node and a small set of ioctls for your control interface, as this will keep things simple. You could also use a couple of sysctl nodes (this would make it possible to talk to it without needing a device node). Let me know if you want more comments on your code... > I'm writing a device driver for FreeBSD 3.x and 4.x for the application > panel of the fujitsu lifebook c4110 notebook (a led, lcd and some > buttons). It took me some time to get a working driver (compiles on both > 3.x and 4.x), but it's not really clean code. I'd like to rewrite it, > but I can't find how to do it properly (the kernel sources don't help me > enough). How do I use uimove, DECLARE_MODULE, etc properly? How do I use > more than one device in one module? > Currently I use outb and inb to access the hardware resources. Should > newbus be used in FreeBSD 4.x? > > Another question is the architecure of the device driver. How exactly > should the interface to the device be? Currently, I'm thinking of three > devices to control the three different parts /dev/led (led), /dev/lcd > (lcd) and /dev/abtn (buttons). Ascii numbers should be written to/read > from the character devices. Is this the way to do it, or should system > calls be used (harder to use in shell scripts) or binary values? > > Thanks in advance. > > Willem van Engen > > See the application panel project at http://willem.n3.net/fujitsu/ > > > To Unsubscribe: send mail to majordomo@FreeBSD.org > with "unsubscribe freebsd-hackers" in the body of the message > -- ... every activity meets with opposition, everyone who acts has his rivals and unfortunately opponents also. But not because people want to be opponents, rather because the tasks and relationships force people to take different points of view. [Dr. Fritz Todt] V I C T O R Y N O T V E N G E A N C E To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message