Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 31 Oct 1996 11:16:56 -0600
From:      "Eric L. Hernes" <erich@lodgenet.com>
To:        "Allen W. Gambert" <gambert@cftnet.com>
Cc:        hackers@FreeBSD.ORG
Subject:   Re: problems with device driver 
Message-ID:  <199610311717.LAA06956@jake.lodgenet.com>
In-Reply-To: Your message of "Thu, 31 Oct 1996 10:45:45 EST." <Pine.SUN.3.91.961031102600.16037D-100000@renoir.cftnet.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
"Allen W. Gambert" writes:

>I've checked the majors.i386 file and decided to use major device number 
>77, the last free entry in that file.  After creating the device nodes I 
>use kermit to try to open the device.  I keep getting 'Sorry, can't open 
>connection: /dev/mb0: Device not configured'.  I believe this is caused 
>by the open routine returning 'ENXIO'.  The problem is the kernel is not 
>calling my open routine but instead some other open routine.  I know its 
>not calling my open routine because its not printing out the printf's 
>i've placed at the beginning of 'mbopen'.

2.1* or -current.
Under 2.1* you've got to edit sys/i386/i386/conf.c
and add an entry to the cdev switch, in the 77th slot if that's your
major number.

Under -current, you've got to add the cdevsw[] entry to your driver
and call cdevsw_add() somewhere in your probe or attach, probably
attach.

you can test basic open/close/read/write/ioctl straight from the shell
by:

open:
$ exec 9>/dev/mydev
close:
$ exec 9>&-
read: (and open/close)
$ cat /dev/mydev
write: (and open/close)
$ cat somefile >/dev/mydev
ioctl:
$ stty </dev/mydev

>
>My question is what can I do to determine why my open routine is not 
>being called but instead some other open routine is being called?  I must be 
>over looking something, but I just cant seem to figure out what.  If 
>someone can point me in the right direction I would greatly appreciate it.
>

install the devsw entries.

>Also.  I was hoping to make this device driver an lkm instead of hard 
>coding it into the kernel.  The only problem is I cant seem to find any 
>documentation on lkm other than the man pages.  Does anyone know where I 
>might be able to find some documentation on lkm?
>

have a look-see at http://www.freebsd.org/~erich/ddwg.html (or thereabouts),
its sparse and a little (lot) out of date, but it should get you going.

>Thanks for you help.
>
>Allen
>

g'luck,
eric.

-- 
erich@lodgenet.com
http://rrnet.com/~erich erich@rrnet.com






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