From owner-freebsd-hackers Fri Dec 22 00:23:17 1995 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.3/8.7.3) id AAA12927 for hackers-outgoing; Fri, 22 Dec 1995 00:23:17 -0800 (PST) Received: from hq.icb.chel.su (icb-rich-gw.icb.chel.su [193.125.10.34]) by freefall.freebsd.org (8.7.3/8.7.3) with SMTP id AAA12869 for ; Fri, 22 Dec 1995 00:21:49 -0800 (PST) Received: from localhost (babkin@localhost) by hq.icb.chel.su (8.6.5/8.6.5) id NAA15789; Fri, 22 Dec 1995 13:06:26 +0500 From: "Serge A. Babkin" Message-Id: <199512220806.NAA15789@hq.icb.chel.su> Subject: Digiboard patch To: bde@zeta.org.au Date: Fri, 22 Dec 1995 13:06:26 +0500 (GMT+0500) Cc: erich@jake.lodgenet.com, ptitz@base.dux.ru, alexis@ww.net, hackers@freebsd.org X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-hackers@freebsd.org Precedence: bulk Hi! I have made a patch for Digiboard. It does: 1. Fixes the bug with erroneous resending of the output buffer 2. Fixes the problem with panics when some verisons of Digiboard report events on nonexisting ports 3. Fixes the bug with registering the device for lsdev I have created this patch on a slightly old version of driver but it applies very well to -current (I tested): -------------------------- cut here---------------------------------------- *** 1.44 1995/12/22 07:26:52 --- dgb.c 1995/12/22 07:42:08 *************** *** 434,440 **** &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, ! "DigiBoard multiport card" } }; static void --- 434,441 ---- &kdc_isa0, /* parent */ 0, /* parentdata */ DC_UNCONFIGURED, ! "DigiBoard multiport card", ! DC_CLS_SERIAL, } }; static void *************** *** 450,456 **** kdc_dgb[unit].kdc_isa = id; /* now we assume that multiport is always 'open' for simplicity */ ! kdc_dgb[unit].kdc_state = DC_BUSY; dev_attach(&kdc_dgb[unit]); } --- 451,457 ---- kdc_dgb[unit].kdc_isa = id; /* now we assume that multiport is always 'open' for simplicity */ ! kdc_dgb[unit].kdc_state = DC_UNKNOWN; dev_attach(&kdc_dgb[unit]); } *************** *** 872,877 **** --- 873,880 ---- hidewin(sc); + dgbregisterdev(dev); + /* register the polling function */ timeout(dgbpoll, (void *)unit, hz/25); *************** *** 1217,1229 **** lstat=eventbuf[3]; port=&sc->ports[pnum]; - bc=port->brdchan; tp=&sc->ttys[pnum]; if(pnum>=sc->numports || port->status==DISABLED) { printf("dgb%d: port %d: got event on nonexisting port\n",unit,pnum); } else if(port->used || port->wopeners>0 ) { if( !(event & ALL_IND) ) printf("dgb%d: port%d: ? event 0x%x mstat 0x%x lstat 0x%x\n", unit, pnum, event, mstat, lstat); --- 1220,1233 ---- lstat=eventbuf[3]; port=&sc->ports[pnum]; tp=&sc->ttys[pnum]; if(pnum>=sc->numports || port->status==DISABLED) { printf("dgb%d: port %d: got event on nonexisting port\n",unit,pnum); } else if(port->used || port->wopeners>0 ) { + bc=port->brdchan; + if( !(event & ALL_IND) ) printf("dgb%d: port%d: ? event 0x%x mstat 0x%x lstat 0x%x\n", unit, pnum, event, mstat, lstat); *************** *** 1375,1388 **** #endif end_of_buffer: } } else { DPRINT4("dgb%d: port %d: got event 0x%x on closed port\n", unit,pnum,event); bc->rout=bc->rin; bc->idata=bc->iempty=bc->ilow=0; } - - bc->idata=1; tail= (tail+4) & (FEP_IMAX-FEP_ISTART-4); } --- 1379,1393 ---- #endif end_of_buffer: } + bc->idata=1; + } else { + bc=port->brdchan; DPRINT4("dgb%d: port %d: got event 0x%x on closed port\n", unit,pnum,event); bc->rout=bc->rin; bc->idata=bc->iempty=bc->ilow=0; } tail= (tail+4) & (FEP_IMAX-FEP_ISTART-4); } *************** *** 1928,1933 **** --- 1933,1940 ---- ocount=q_to_b(&tp->t_outq, port->txptr+head, size); head+=ocount; + if(head>=port->txbufsize) + head-=port->txbufsize; setwin(sc,0); bc->tin=head;