Hack workaround XFree86 switching failure when used with /dev/sysmouse

and xdm, possibly in general.

What was happening was that the server was doing a tcsetattr(.. TCSADRAIN)
on the mouse fd after a write.  Since /dev/sysmouse had a null t_oproc,
the drain failed with EIO.  Somehow this spammed XFree86 (!@&^#%*& binary
release!!), and the driver was left in a bogus state (ie: switch_in_progress
permanently TRUE).

The simplest way out was to implement a dummy scmousestart() routine to
accept any characters from the tty system and toss them into the void.

It would probably be more correct to intercept scwrite()'s to the mouse
device, but that's executed for every single write to the screen.
Supplying a start routine to eat the characters is only executed for the
mouse port during startup/shutdown, so it should be faster.
This commit is contained in:
Peter Wemm 1996-09-10 19:14:49 +00:00
parent 80f495ec7e
commit 9545a0eaa4
3 changed files with 69 additions and 6 deletions

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.168 1996/09/08 21:31:56 sos Exp $
* $Id: syscons.c,v 1.169 1996/09/09 19:02:26 sos Exp $
*/
#include "sc.h"
@ -164,6 +164,7 @@ static int scattach(struct isa_device *dev);
static int scparam(struct tty *tp, struct termios *t);
static int scprobe(struct isa_device *dev);
static void scstart(struct tty *tp);
static void scmousestart(struct tty *tp);
static void scinit(void);
static u_int scgetc(int noblock);
static scr_stat *get_scr_stat(dev_t dev);
@ -519,7 +520,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
if (!tp)
return(ENXIO);
tp->t_oproc = (minor(dev) == SC_MOUSE) ? NULL : scstart;
tp->t_oproc = (minor(dev) == SC_MOUSE) ? scmousestart : scstart;
tp->t_param = scparam;
tp->t_dev = dev;
if (!(tp->t_state & TS_ISOPEN)) {
@ -1338,6 +1339,26 @@ scstart(struct tty *tp)
splx(s);
}
static void
scmousestart(struct tty *tp)
{
struct clist *rbp;
int s;
u_char buf[PCBURST];
s = spltty();
if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) {
tp->t_state |= TS_BUSY;
rbp = &tp->t_outq;
while (rbp->c_cc) {
q_to_b(rbp, buf, PCBURST);
}
tp->t_state &= ~TS_BUSY;
ttwwakeup(tp);
}
splx(s);
}
void
sccnprobe(struct consdev *cp)
{

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.168 1996/09/08 21:31:56 sos Exp $
* $Id: syscons.c,v 1.169 1996/09/09 19:02:26 sos Exp $
*/
#include "sc.h"
@ -164,6 +164,7 @@ static int scattach(struct isa_device *dev);
static int scparam(struct tty *tp, struct termios *t);
static int scprobe(struct isa_device *dev);
static void scstart(struct tty *tp);
static void scmousestart(struct tty *tp);
static void scinit(void);
static u_int scgetc(int noblock);
static scr_stat *get_scr_stat(dev_t dev);
@ -519,7 +520,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
if (!tp)
return(ENXIO);
tp->t_oproc = (minor(dev) == SC_MOUSE) ? NULL : scstart;
tp->t_oproc = (minor(dev) == SC_MOUSE) ? scmousestart : scstart;
tp->t_param = scparam;
tp->t_dev = dev;
if (!(tp->t_state & TS_ISOPEN)) {
@ -1338,6 +1339,26 @@ scstart(struct tty *tp)
splx(s);
}
static void
scmousestart(struct tty *tp)
{
struct clist *rbp;
int s;
u_char buf[PCBURST];
s = spltty();
if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) {
tp->t_state |= TS_BUSY;
rbp = &tp->t_outq;
while (rbp->c_cc) {
q_to_b(rbp, buf, PCBURST);
}
tp->t_state &= ~TS_BUSY;
ttwwakeup(tp);
}
splx(s);
}
void
sccnprobe(struct consdev *cp)
{

View File

@ -25,7 +25,7 @@
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* $Id: syscons.c,v 1.168 1996/09/08 21:31:56 sos Exp $
* $Id: syscons.c,v 1.169 1996/09/09 19:02:26 sos Exp $
*/
#include "sc.h"
@ -164,6 +164,7 @@ static int scattach(struct isa_device *dev);
static int scparam(struct tty *tp, struct termios *t);
static int scprobe(struct isa_device *dev);
static void scstart(struct tty *tp);
static void scmousestart(struct tty *tp);
static void scinit(void);
static u_int scgetc(int noblock);
static scr_stat *get_scr_stat(dev_t dev);
@ -519,7 +520,7 @@ scopen(dev_t dev, int flag, int mode, struct proc *p)
if (!tp)
return(ENXIO);
tp->t_oproc = (minor(dev) == SC_MOUSE) ? NULL : scstart;
tp->t_oproc = (minor(dev) == SC_MOUSE) ? scmousestart : scstart;
tp->t_param = scparam;
tp->t_dev = dev;
if (!(tp->t_state & TS_ISOPEN)) {
@ -1338,6 +1339,26 @@ scstart(struct tty *tp)
splx(s);
}
static void
scmousestart(struct tty *tp)
{
struct clist *rbp;
int s;
u_char buf[PCBURST];
s = spltty();
if (!(tp->t_state & (TS_TIMEOUT | TS_BUSY | TS_TTSTOP))) {
tp->t_state |= TS_BUSY;
rbp = &tp->t_outq;
while (rbp->c_cc) {
q_to_b(rbp, buf, PCBURST);
}
tp->t_state &= ~TS_BUSY;
ttwwakeup(tp);
}
splx(s);
}
void
sccnprobe(struct consdev *cp)
{