From 4ff97f4ca8e817243a7cae1dced625b48879c78f Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 13 Apr 2001 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2001-04-13 --- pc/devlpt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pc/devlpt.c b/pc/devlpt.c index 72ab3a6e62a6b4416f8a6dc528c2b4a9331b4914..817dd1f4229cde99ee6f101e9df72b068903b663 100644 --- a/pc/devlpt.c +++ b/pc/devlpt.c @@ -92,10 +92,21 @@ lptattach(char *spec) if(i < 1 || i > NDEV) error(Ebadarg); if(lptallocd[i-1] == 0){ + int ecr; sprint(name, "lpt%d", i-1); if(ioalloc(lptbase[i-1], 3, 0, name) < 0) error("lpt port space in use"); lptallocd[i-1] = 1; + // Detect ECP - if found, put into PS/2 mode to suit style of driver + ecr = lptbase[i-1] + 0x402; + if ((inb(ecr) & 3) == 1) { + outb(ecr, 0x34); + if (inb(ecr) == 0x35) { + outb(ecr, (inb(ecr) & 0x1f) | (1 << 5)); + if(ioalloc(ecr, 1, 0, name) < 0) + error("lpt ecr port space in use"); + } + } } c = devattach('L', spec); c->dev = i-1;