[comp.os.os9] SCF Device Driver Query

iiit-sh@cybaswan.UUCP (Steve Hosgood) (05/23/89)

I wonder if any readers here are familiar with this problem:

I am trying to write a Device Driver. I obtained a skeleton driver and hacked
it about in order to save time and effort. Now I've got a driver which sets
up the device (a parallel port) correctly with the INIT routine, clears it
OK with the TERMINATE routine. The READ routine is a dummy, it just returns
an error, (and this occurs corectly).

The problem is that the WRITE routine never gets called by the file manager.
If I open the device from a program and attempt to write to it, everything
seems to work OK, correct return codes are returned. However, the driver never
gets the call. It's almost as if the file manager is buffering the data, but
I don't think it should be doing that....

This effect even happens when the driver's WRITE routine is hotwired to
return an error code. Weird huh?

I'm running Version 2.2 OS9/68K

-----------------------------------------------+------------------------------
Steve Hosgood BSc,                             | Phone (+44) 792 295213
Image Processing and Systems Engineer,         | Fax (+44) 792 295532
Institute for Industrial Information Techology,| Telex 48149
Innovation Centre, University of Wales, +------+ JANET: iiit-sh@uk.ac.swan.pyr
Swansea SA2 8PP                         | UUCP: ..!ukc!cybaswan.UUCP!iiit-sh
----------------------------------------+-------------------------------------
            My views are not necessarily those of my employers!

iiit-sh@cybaswan.UUCP (Steve Hosgood) (05/25/89)

In article <455@cybaswan.UUCP> iiit-sh@cybaswan.UUCP (that me!) writes:
>I wonder if any readers here are familiar with this problem..
>...in that the WRITE routine never gets called by the SBF file manager.
>

OK, I found the answer. I'd not set the PD_D2P field in the descriptor to
refer to the driver. This is the 'Echo Device Name' field.

I consider this to be indicative of a broken SCF manager, what do you think?
For instance, I can understand that if the manager itself was trying to write
characters that are echoes for input characters then it uses the input device's
'echo device' to write them. However, in my case I was WRITING them to the
device from a program. This is not really the same thing as ECHOING them, so
SCF shouldn't use the 'echo device' field.

Even so, when it found it couldn't write my characters, it returned status
indicating OK to me, the user. This too is broken isn't it? If it didn't
write then the 'write' call should return -1, and errno should tell me why.

Mutter mutter mutter......

This has cost me 2 weeks :-(

-----------------------------------------------+------------------------------
Steve Hosgood BSc,                             | Phone (+44) 792 295213
Image Processing and Systems Engineer,         | Fax (+44) 792 295532
Institute for Industrial Information Techology,| Telex 48149
Innovation Centre, University of Wales, +------+ JANET: iiit-sh@uk.ac.swan.pyr
Swansea SA2 8PP                         | UUCP: ..!ukc!cybaswan.UUCP!iiit-sh
----------------------------------------+-------------------------------------
            My views are not necessarily those of my employers!

koonce@brahms.berkeley.edu (tim koonce) (05/27/89)

Steve Hosgood (iiit-sh@cybaswan.UUCP) writes:
>The problem is that the WRITE routine never gets called by the file manager.
>.... It's almost as if the file manager is buffering the data, ....

If you're using C, did you remember to disable that buffering?  At least
on OS9-6809, the C standard library calls buffer output.

>Steve Hosgood BSc
					- Tim Koonce