From owner-freebsd-hackers Fri Aug 11 15:24:10 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from mass.osd.bsdi.com (mass.osd.bsdi.com [204.216.28.234]) by hub.freebsd.org (Postfix) with ESMTP id 1E7E837BCB7 for ; Fri, 11 Aug 2000 15:24:07 -0700 (PDT) (envelope-from msmith@mass.osd.bsdi.com) Received: from mass.osd.bsdi.com (localhost [127.0.0.1]) by mass.osd.bsdi.com (8.9.3/8.9.3) with ESMTP id PAA00839; Fri, 11 Aug 2000 15:35:30 -0700 (PDT) (envelope-from msmith@mass.osd.bsdi.com) Message-Id: <200008112235.PAA00839@mass.osd.bsdi.com> X-Mailer: exmh version 2.1.1 10/15/1999 To: Devin Butterfield Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: Need help with driver.... In-reply-to: Your message of "Fri, 11 Aug 2000 11:33:04 PDT." <399446E0.D4F51CCA@wireless.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Fri, 11 Aug 2000 15:35:30 -0700 From: Mike Smith Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I'm a newbie to device driver writing and I have been learning well by > reading the code of the other drivers in the system. I would ultimately > like to port a linux driver for a VoIP telephony card (Quicknet > PhoneJack) to FreeBSD, and so far I have a skeleton driver which does > successfully probe the card. It does? How? Is this a PnP card? > The problem I'm having is that I don't know how to tell whether or not > the card is attaching correctly. How can I determine this? I thought > that I would be able to make a device file in /dev if it correctly > attached but MAKEDEV responds with: > > {root@dbm /dev]# ./MAKEDEV phone > phone - no such device name MAKEDEV is a script which does not interact with the kernel in any way. You need to explicitly update MAKEDEV to know about your device. > For reference, here is my attach routine: > > static int > ixj_isa_attach (dev) /* attach device */ > device_t dev; > { > int unit = device_get_unit(dev); > struct ixj_softc *sc = device_get_softc(dev); > struct resource *res; > int rid; > int size; > > if (sc->port_used > 0) { > size = sc->port_used; > rid = sc->port_rid; Where are you initialising these fields in the softc? (I assume, in your probe, correct?) > res = bus_alloc_resource(dev, SYS_RES_IOPORT, &rid, > 0, ~0, size, RF_ACTIVE); > if (res) { > sc->port_rid = rid; > sc->port_res = res; > sc->port_used = size; > } > > } > make_dev(&ixj_cdevsw, UNIT(dev), UID_ROOT, GID_WHEEL, > 0666, "phone%d", unit); > > return (0); > } > > > What am I doing wrong? How can I tell if this is working? You should check the return values from bus_alloc_resource and make_dev, both of which you need to save in the softc so that you can detach correctly. -- ... 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] To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message