M boot/boot.c => boot/boot.c +3 -0
@@ 44,6 44,9 @@ boot(int argc, char *argv[])
print("%s ", argv[fd]);
print("\n");/**/
+ if(argc <= 1)
+ pflag = 1;
+
ARGBEGIN{
case 'a':
aflag = 1;
M pc/kbd.c => pc/kbd.c +0 -9
@@ 113,10 113,7 @@ KIOQ kbdq;
static int keybuttons;
static uchar ccc;
-static int mousetype;
-static int mouseport;
static int shift;
-extern int mouseshifted;
enum
{
@@ 127,11 124,6 @@ enum
Csf= (1<<2), /* system flag */
Cmouseint= (1<<1), /* mouse interrupt enable */
Ckbdint= (1<<0), /* kbd interrupt enable */
-
- /* what kind of mouse */
- Mouseother= 0,
- Mouseserial= 1,
- MousePS2= 2,
};
static void kbdintr(Ureg*);
@@ 286,7 278,6 @@ serialmouse(int port, char *type, int setspeed)
uartspecial(port, 0, &mouseq, setspeed ? 1200 : 0);
if(type && *type == 'M')
mouseq.putc = m3mouseputc;
- mouseport = port;
mousetype = Mouseserial;
}
M pc/screen.h => pc/screen.h +0 -2
@@ 29,5 29,3 @@ extern Cursorinfo cursor;
extern void mouseupdate(int);
#define hwscreenwrite(a, b)
-
-int islcd;
M port/devbit.c => port/devbit.c +12 -7
@@ 109,6 109,8 @@ Mouseinfo mouse;
Cursorinfo cursor;
Rendez lcdmouse;
int mouseshifted;
+int mousetype;
+int islcd;
Cursor arrow =
{
@@ 2047,14 2049,15 @@ mouseupdate(int dolock)
* byte 2 - 0 Y5 Y4 Y3 Y2 Y1 Y0
* byte 3 - 0 M x x x x x (optional)
*
- * shift & left button is the same as middle button (for 2 button mice)
+ * shift & right button is the same as middle button (for 2 button mice)
*/
int
m3mouseputc(IOQ *q, int c)
{
static uchar msg[3];
static int nb;
- static uchar b[] = { 0, 4, 1, 5, 0, 4, 3, 7 };
+ static int middle;
+ static uchar b[] = { 0, 4, 1, 5, 0, 2, 1, 5 };
short x;
USED(q);
@@ 2064,15 2067,15 @@ m3mouseputc(IOQ *q, int c)
if(nb==0){
if((c&0x40) == 0){
/* an extra byte gets sent for the middle button */
- mousebuttons((mouse.buttons & ~2) | ((c&0x20) ? 2 : 0));
+ middle = (c&0x20) ? 2 : 0;
+ mousebuttons((mouse.buttons & ~2) | middle);
return 0;
}
}
msg[nb] = c;
if(++nb == 3){
nb = 0;
- mouse.newbuttons = (mouse.buttons & 2)
- | b[(msg[0]>>4)&3 | (mouseshifted ? 4 : 0)];
+ mouse.newbuttons = middle | b[(msg[0]>>4)&3 | (mouseshifted ? 4 : 0)];
x = (msg[0]&0x3)<<14;
mouse.dx = (x>>8) | msg[1];
x = (msg[0]&0xc)<<12;
@@ 2085,13 2088,15 @@ m3mouseputc(IOQ *q, int c)
/*
* Logitech 5 byte packed binary mouse format, 8 bit bytes
+ *
+ * shift & right button is the same as middle button (for 2 button mice)
*/
int
mouseputc(IOQ *q, int c)
{
static short msg[5];
static int nb;
- static uchar b[] = {0, 4, 2, 6, 1, 5, 3, 7};
+ static uchar b[] = {0, 4, 2, 6, 1, 5, 3, 7, 0, 2, 2, 6, 1, 5, 3, 7};
USED(q);
if((c&0xF0) == 0x80)
@@ 2100,7 2105,7 @@ mouseputc(IOQ *q, int c)
if(c & 0x80)
msg[nb] |= ~0xFF; /* sign extend */
if(++nb == 5){
- mouse.newbuttons = b[(msg[0]&7)^7];
+ mouse.newbuttons = b[((msg[0]&7)^7) | (mouseshifted ? 2 : 0)];
mouse.dx = msg[1]+msg[3];
mouse.dy = -(msg[2]+msg[4]);
mouse.track = 1;
M port/devscc.c => port/devscc.c +9 -2
@@ 96,6 96,7 @@ struct SCC
uchar *data; /* data register in Z8530 */
int printing; /* true if printing */
ulong freq; /* clock frequency */
+ uchar mask; /* bits/char */
/* console interface */
int special; /* can't use the stream interface */
@@ 198,19 199,23 @@ sccbits(SCC *sp, int n)
switch(n){
case 5:
+ sp->mask = 0x1f;
rbits = Rx5bits;
tbits = Tx5bits;
break;
case 6:
+ sp->mask = 0x3f;
rbits = Rx6bits;
tbits = Tx6bits;
break;
case 7:
+ sp->mask = 0x7f;
rbits = Rx7bits;
tbits = Tx7bits;
break;
case 8:
default:
+ sp->mask = 0xff;
rbits = Rx8bits;
tbits = Tx8bits;
break;
@@ 298,6 303,7 @@ sccsetup0(SCC *sp, int brsource)
sccwrreg(sp, 3, 0);
sp->sticky[5] = TxEna | Tx8bits;
sccwrreg(sp, 5, 0);
+ sp->mask = 0xff;
}
void
@@ 369,7 375,7 @@ sccintr0(SCC *sp, uchar x)
cq = sp->iq;
while(*sp->ptr&RxReady){
onepointseven();
- ch = *sp->data;
+ ch = *sp->data & sp->mask;
if (ch == CTLS && sp->xonoff)
sp->blocked = 1;
else if (ch == CTLQ && sp->xonoff) {
@@ 477,7 483,8 @@ sccspecial(int port, IOQ *oq, IOQ *iq, int baud)
sp->oq = oq;
sp->iq = iq;
sccenable(sp);
- sccsetbaud(sp, baud);
+ if(baud)
+ sccsetbaud(sp, baud);
if(iq){
/*
M port/portdat.h => port/portdat.h +12 -0
@@ 774,3 774,15 @@ enum
AUTHLEN = 8,
};
+
+/*
+ * mouse types
+ */
+enum
+{
+ Mouseother= 0,
+ Mouseserial= 1,
+ MousePS2= 2,
+};
+extern int mouseshifted;
+extern int mousetype;