Browse Source

Plan 9 from Bell Labs 2003-08-08

David du Colombier 20 years ago
parent
commit
2ffd7d9033

+ 11 - 10
dist/replica/plan9.db

@@ -4937,6 +4937,7 @@ sys/man/8/ndb - 664 sys sys 1055706144 9838
 sys/man/8/newuser - 664 sys sys 954305551 2343
 sys/man/8/nfsserver - 664 sys sys 1017251291 3397
 sys/man/8/pcmcia - 664 sys sys 944959679 408
+sys/man/8/pem - 664 sys sys 1060263669 1189
 sys/man/8/ping - 664 sys sys 1028233565 2789
 sys/man/8/plan9.ini - 664 sys sys 1053576234 20536
 sys/man/8/pop3 - 664 sys sys 1058012143 2444
@@ -5012,7 +5013,7 @@ sys/src/9/alphapc/mouse.c - 664 sys sys 1015012786 25
 sys/src/9/alphapc/pci.c - 664 sys sys 1039753420 7868
 sys/src/9/alphapc/random.c - 664 sys sys 1039753421 26
 sys/src/9/alphapc/screen.c - 664 sys sys 1039753422 26
-sys/src/9/alphapc/screen.h - 664 sys sys 1039794340 3547
+sys/src/9/alphapc/screen.h - 664 sys sys 1060267151 3584
 sys/src/9/alphapc/sd53c8xx.c - 664 sys sys 1015012787 51009
 sys/src/9/alphapc/sdata.c - 664 sys sys 1015012787 25
 sys/src/9/alphapc/sdscsi.c - 664 sys sys 1015012787 26
@@ -5087,7 +5088,7 @@ sys/src/9/boot/bootmkfile - 664 sys sys 1032053196 390
 sys/src/9/boot/doauthenticate.c - 664 sys sys 1015012529 2300
 sys/src/9/boot/embed.c - 664 sys sys 1039763720 1191
 sys/src/9/boot/getpasswd.c - 664 sys sys 957373373 654
-sys/src/9/boot/libboot.a8 - 664 sys sys 1056568081 54780
+sys/src/9/boot/libboot.a8 - 664 sys sys 1060267156 54780
 sys/src/9/boot/local.c - 664 sys sys 1039763718 2041
 sys/src/9/boot/mkboot - 775 sys sys 1045504382 1935
 sys/src/9/boot/nopsession.c - 664 sys sys 957373374 843
@@ -5202,7 +5203,7 @@ sys/src/9/pc/ethersink.c - 664 sys sys 1048644103 1076
 sys/src/9/pc/ethersmc.c - 664 sys sys 1015014518 15079
 sys/src/9/pc/etherwavelan.c - 664 sys sys 1026847642 3722
 sys/src/9/pc/floppy.h - 664 sys sys 1055700609 3835
-sys/src/9/pc/fns.h - 664 sys sys 1056299506 4215
+sys/src/9/pc/fns.h - 664 sys sys 1060266613 4268
 sys/src/9/pc/hcwAMC.h - 664 sys sys 1026860163 166004
 sys/src/9/pc/i8253.c - 664 sys sys 1055689890 6219
 sys/src/9/pc/i8259.c - 664 sys sys 1015014519 4423
@@ -5216,7 +5217,7 @@ sys/src/9/pc/mem.h - 664 sys sys 1018553448 4573
 sys/src/9/pc/memory.c - 664 sys sys 1032303986 12994
 sys/src/9/pc/mkfile - 664 sys sys 1056336303 3092
 sys/src/9/pc/mmu.c - 664 sys sys 1049509456 10014
-sys/src/9/pc/mouse.c - 664 sys sys 1020369766 6315
+sys/src/9/pc/mouse.c - 664 sys sys 1060266650 6625
 sys/src/9/pc/mp.c - 664 sys sys 1048644112 16928
 sys/src/9/pc/mp.h - 664 sys sys 1015014520 6575
 sys/src/9/pc/pc - 664 sys sys 1055700612 1360
@@ -5239,7 +5240,7 @@ sys/src/9/pc/random.c - 664 sys sys 1036812832 2021
 sys/src/9/pc/reboot.h - 664 sys sys 1015014522 334
 sys/src/9/pc/rebootcode.s - 664 sys sys 1015014522 988
 sys/src/9/pc/screen.c - 664 sys sys 1039753497 7266
-sys/src/9/pc/screen.h - 664 sys sys 1048644129 3760
+sys/src/9/pc/screen.h - 664 sys sys 1060267144 3797
 sys/src/9/pc/sd53c8xx.c - 664 sys sys 1055689891 52089
 sys/src/9/pc/sd53c8xx.i - 664 sys sys 1045063730 27355
 sys/src/9/pc/sd53c8xx.n - 664 sys sys 1032059019 12455
@@ -5247,7 +5248,7 @@ sys/src/9/pc/sdata.c - 664 sys sys 1056475678 50230
 sys/src/9/pc/sdmylex.c - 664 sys sys 1015014523 27750
 sys/src/9/pc/sdscsi.c - 664 sys sys 1055689892 7406
 sys/src/9/pc/trap.c - 664 sys sys 1056299507 19012
-sys/src/9/pc/uarti8250.c - 664 sys sys 1056299508 12605
+sys/src/9/pc/uarti8250.c - 664 sys sys 1060266726 12826
 sys/src/9/pc/uartpci.c - 664 sys sys 1015014524 2709
 sys/src/9/pc/usb.h - 664 sys sys 1015014524 3505
 sys/src/9/pc/usbuhci.c - 664 sys sys 1026847653 30686
@@ -5266,7 +5267,7 @@ sys/src/9/pc/vgamach64xx.c - 664 sys sys 1048644147 29112
 sys/src/9/pc/vgamga2164w.c - 664 sys sys 1015014527 5654
 sys/src/9/pc/vgamga4xx.c - 664 sys sys 1015014527 11122
 sys/src/9/pc/vganeomagic.c - 664 sys sys 1032375144 10693
-sys/src/9/pc/vganvidia.c - 664 sys sys 1055090312 6543
+sys/src/9/pc/vganvidia.c - 664 sys sys 1060269772 6545
 sys/src/9/pc/vgargb524.c - 664 sys sys 1015014527 4235
 sys/src/9/pc/vgas3.c - 664 sys sys 1055689893 12082
 sys/src/9/pc/vgasavage.c - 664 sys sys 1046203931 16194
@@ -5299,7 +5300,7 @@ sys/src/9/port/devkprof.c - 664 sys sys 1014931173 3111
 sys/src/9/port/devloopback.c - 664 sys sys 1018721201 14968
 sys/src/9/port/devmnt.c - 664 sys sys 1055688328 21594
 sys/src/9/port/devmntstats.c - 664 sys sys 1014931173 4039
-sys/src/9/port/devmouse.c - 664 sys sys 1048637374 11460
+sys/src/9/port/devmouse.c - 664 sys sys 1060266767 12196
 sys/src/9/port/devnmouse.c - 664 sys sys 1036812999 3738
 sys/src/9/port/devpipe.c - 664 sys sys 1032640439 5825
 sys/src/9/port/devpnp.c - 664 sys sys 1055688361 13021
@@ -5313,7 +5314,7 @@ sys/src/9/port/devsrv.c - 664 sys sys 1014931174 5146
 sys/src/9/port/devssl.c - 664 sys sys 1045063590 26100
 sys/src/9/port/devtinyfs.c - 664 sys sys 1015278339 15347
 sys/src/9/port/devtls.c - 664 sys sys 1055688453 43764
-sys/src/9/port/devuart.c - 664 sys sys 1055688473 11586
+sys/src/9/port/devuart.c - 664 sys sys 1060267239 11762
 sys/src/9/port/edf.c - 664 sys sys 1055688474 24743
 sys/src/9/port/edf.h - 664 sys sys 1055700516 4469
 sys/src/9/port/error.h - 664 sys sys 1055700517 2630
@@ -5342,7 +5343,7 @@ sys/src/9/port/parse.c - 664 sys sys 1014931177 2026
 sys/src/9/port/pgrp.c - 664 sys sys 1055688510 3940
 sys/src/9/port/portclock.c - 664 sys sys 1055688512 3829
 sys/src/9/port/portdat.h - 664 sys sys 1055700521 21390
-sys/src/9/port/portfns.h - 664 sys sys 1055700522 10769
+sys/src/9/port/portfns.h - 664 sys sys 1060266745 10822
 sys/src/9/port/portmkfile - 664 sys sys 1055700523 2057
 sys/src/9/port/print.c - 664 sys sys 1014931178 227
 sys/src/9/port/proc.c - 664 sys sys 1055688525 24316

+ 11 - 0
dist/replica/plan9.log

@@ -13031,3 +13031,14 @@
 1060189283 0 c 386/bin/ip/ipconfig - 775 sys sys 1060189244 128491
 1060189283 1 c sys/src/cmd/ip/ipconfig.c - 664 sys sys 1060189236 29311
 1060191081 0 c sys/man/8/ipconfig - 664 sys sys 1060189415 5050
+1060264967 0 a sys/man/8/pem - 664 sys sys 1060263669 1189
+1060266768 0 c sys/src/9/pc/fns.h - 664 sys sys 1060266613 4268
+1060266768 1 c sys/src/9/pc/mouse.c - 664 sys sys 1060266650 6625
+1060266768 2 c sys/src/9/pc/uarti8250.c - 664 sys sys 1060266726 12826
+1060266768 3 c sys/src/9/port/devmouse.c - 664 sys sys 1060266767 12196
+1060266768 4 c sys/src/9/port/portfns.h - 664 sys sys 1060266745 10822
+1060268569 0 c sys/src/9/alphapc/screen.h - 664 sys sys 1060267151 3584
+1060268569 1 c sys/src/9/boot/libboot.a8 - 664 sys sys 1060267156 54780
+1060268569 2 c sys/src/9/pc/screen.h - 664 sys sys 1060267144 3797
+1060268569 3 c sys/src/9/port/devuart.c - 664 sys sys 1060267239 11762
+1060270370 0 c sys/src/9/pc/vganvidia.c - 664 sys sys 1060269772 6545

+ 65 - 0
sys/man/8/pem

@@ -0,0 +1,65 @@
+.TH PEM 8
+.SH NAME
+pemdecode, pemencode \- encode files in Privacy Enhanced Mail (PEM) format
+.SH SYNOPSIS
+.PP
+.B auth/pemdecode
+.I section
+[
+.I file
+]
+.PP
+.B auth/pemencode
+.I section
+[
+.I file
+]
+.SH DESCRIPTION
+PEM is a textual encoding for binary data originally used by the 
+Privacy Enhanced Mail program but now commonly used for
+other applications, notably TLS.
+PEM encodes data in base 64
+(see
+.IR encode (2))
+between lines of the form:
+.IP
+.EX
+-----BEGIN SECTION-----
+-----END SECTION-----
+.EE
+.LP
+where
+.B SECTION
+may be any string describing the encoded data.
+The most common use of PEM format on Plan 9 is for encoding
+X.509 certificates; see
+.IR rsa (8).
+.PP
+.I Pemdecode
+extracts the named
+.I section
+and writes the decoded data to standard output.
+.PP
+.I Pemencode
+encodes its standard input, labels it as a
+.IR section ,
+and writes it to standard output.
+.SH EXAMPLES
+Encode and decode a simple greeting:
+.IP
+.EX
+% echo hello world |
+	auth/pemencode GREETING
+-----BEGIN GREETING-----
+aGVsbG8gd29ybGQK
+-----END GREETING-----
+% echo hello world |
+	auth/pemencode GREETING |
+	auth/pemdecode GREETING
+hello world
+% 
+.EE
+.SH SOURCE
+.B /sys/src/cmd/auth
+.SH "SEE ALSO
+.IR rsa (8)

+ 1 - 0
sys/src/9/alphapc/screen.h

@@ -11,6 +11,7 @@ extern Point mousexy(void);
 
 extern void mouseaccelerate(int);
 extern int m3mouseputc(Queue*, int);
+extern int m5mouseputc(Queue*, int);
 extern int mouseputc(Queue*, int);
 
 extern Cursorinfo cursor;

+ 1 - 0
sys/src/9/pc/fns.h

@@ -40,6 +40,7 @@ void	i8042reset(void);
 void	i8250console(void);
 void*	i8250alloc(int, int, int);
 void	i8250mouse(char*, int (*)(Queue*, int), int);
+void	i8250setmouseputc(char*, int (*)(Queue*, int));
 void	i8253enable(void);
 void	i8253init(void);
 void	i8253link(void);

+ 13 - 3
sys/src/9/pc/mouse.c

@@ -29,6 +29,7 @@ static int packetsize;
 static int resolution;
 static int accelerated;
 static int mousehwaccel;
+static char mouseport[5];
 
 enum
 {
@@ -226,6 +227,9 @@ setintellimouse(void)
 		i8042auxcmd(0xF3);	/* set sample */
 		i8042auxcmd(0x50);
 		break;
+	case Mouseserial:
+		i8250setmouseputc(mouseport, m5mouseputc);
+		break;
 	}
 }
 
@@ -292,12 +296,18 @@ mousectl(Cmdbuf *cb)
 		if(mousetype == Mouseserial)
 			error(Emouseset);
 
-		if(cb->nf > 2 && *cb->f[2] == 'M')
-			i8250mouse(cb->f[1], m3mouseputc, 0);
-		else
+		if(cb->nf > 2){
+			if(strcmp(cb->f[2], "M") == 0)
+				i8250mouse(cb->f[1], m3mouseputc, 0);
+			else if(strcmp(cb->f[2], "MI") == 0)
+				i8250mouse(cb->f[1], m5mouseputc, 0);
+			else
+				i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
+		} else
 			i8250mouse(cb->f[1], mouseputc, cb->nf == 1);
 
 		mousetype = Mouseserial;
+		strncmp(mouseport, cb->f[1], sizeof(mouseport)-1);
 		packetsize = 3;
 		break;
 	case CMhwaccel:

+ 1 - 0
sys/src/9/pc/screen.h

@@ -11,6 +11,7 @@ extern Point mousexy(void);
 
 extern void mouseaccelerate(int);
 extern int m3mouseputc(Queue*, int);
+extern int m5mouseputc(Queue*, int);
 extern int mouseputc(Queue*, int);
 
 extern Cursorinfo cursor;

+ 14 - 1
sys/src/9/pc/uarti8250.c

@@ -218,7 +218,7 @@ i8250fifo(Uart* uart, int on)
   
 		ctlr->fena = 0;
 		if(on){
-			csr8w(ctlr, Fcr, FIFO4|FIFOena);
+			csr8w(ctlr, Fcr, FIFO1|FIFOena);
 			if(!(csr8r(ctlr, Iir) & Ife))
 				ctlr->fifo = 1;
 			ctlr->fena = 1;
@@ -679,3 +679,16 @@ i8250mouse(char* which, int (*putc)(Queue*, int), int setb1200)
 		error(Ebadarg);
 	uartmouse(&i8250uart[port], putc, setb1200);
 }
+
+void
+i8250setmouseputc(char* which, int (*putc)(Queue*, int))
+{
+	char *p;
+	int port;
+
+	port = strtol(which, &p, 0);
+	if(p == which || port < 0 || port > 1)
+		error(Ebadarg);
+	uartsetmouseputc(&i8250uart[port], putc);
+
+}

+ 2 - 2
sys/src/9/pc/vganvidia.c

@@ -24,7 +24,7 @@ enum {
 	hwCurImage = Pramin + (0x00010000 - 0x0800),
 };
 
-/* Nvidia is good about backwards compatibility -- any did > 0x20 is fine */
+/* Nvidia is good about backwards compatibility -- any did >= 0x20 is fine */
 static Pcidev*
 nvidiapci(void)
 {
@@ -32,7 +32,7 @@ nvidiapci(void)
 
 	p = nil;
 	while((p = pcimatch(p, 0x10DE, 0)) != nil){
-		if(p->did > 0x20 && p->ccrb == 3)	/* video card */
+		if(p->did >= 0x20 && p->ccrb == 3)	/* video card */
 			return p;
 	}
 	return nil;

+ 36 - 0
sys/src/9/port/devmouse.c

@@ -608,6 +608,42 @@ m3mouseputc(Queue*, int c)
 	return 0;
 }
 
+/*
+ * microsoft intellimouse 3 buttons + scroll
+ * 	byte 0 -	1  L  R Y7 Y6 X7 X6
+ *	byte 1 -	0 X5 X4 X3 X2 X1 X0
+ *	byte 2 -	0 Y5 Y4 Y3 Y2 Y1 Y0
+ *	byte 3 -	0  0  M  %  %  %  %
+ *
+ *	%: 0xf => U , 0x1 => D
+ *
+ *	L: left
+ *	R: right
+ *	U: up
+ *	D: down
+ */
+int
+m5mouseputc(Queue*, int c)
+{
+	static uchar msg[3];
+	static int nb;
+	msg[nb++] = c & 0x7f;
+	if (nb == 4) {
+		schar dx,dy,newbuttons;
+		dx = msg[1] | (msg[0] & 0x3) << 6;
+		dy = msg[2] | (msg[0] & 0xc) << 4;
+		newbuttons = 
+			(msg[0] & 0x10) >> (mouseshifted ? 3 : 2)
+			| (msg[0] & 0x20) >> 5
+			| ( msg[3] == 0x10 ? 0x02 :
+			    msg[3] == 0x0f ? 0x08 :
+			    msg[3] == 0x01 ? 0x10 : 0 );
+		mousetrack(dx, dy, newbuttons, TK2MS(MACHP(0)->ticks));
+		nb = 0;
+	}
+	return 0;
+}
+
 /*
  *  Logitech 5 byte packed binary mouse format, 8 bit bytes
  *

+ 12 - 0
sys/src/9/port/devuart.c

@@ -127,6 +127,18 @@ uartmouse(Uart* p, int (*putc)(Queue*, int), int setb1200)
 	qunlock(p);
 }
 
+void
+uartsetmouseputc(Uart* p, int (*putc)(Queue*, int))
+{
+	qlock(p);
+	if(p->opens == 0 || p->special == 0){
+		qunlock(p);
+		error(Enodev);
+	}
+	p->putc = putc;
+	qunlock(p);
+}
+
 static void
 setlength(int i)
 {

+ 1 - 0
sys/src/9/port/portfns.h

@@ -341,6 +341,7 @@ int		uartctl(Uart*, char*);
 int		uartgetc(void);
 void		uartkick(void*);
 void		uartmouse(Uart*, int (*)(Queue*, int), int);
+void		uartsetmouseputc(Uart*, int (*)(Queue*, int));
 void		uartputc(int);
 void		uartputs(char*, int);
 void		uartrecv(Uart*, char);