Lines Matching refs:ms

115 	struct ms_softc *ms;  in msopen()  local
117 ms = device_lookup_private(&ms_cd, minor(dev)); in msopen()
118 if (ms == NULL) in msopen()
122 if (ms->ms_events.ev_io) in msopen()
125 if (ms->ms_deviopen) { in msopen()
127 err = (*ms->ms_deviopen)(ms->ms_dev, flags); in msopen()
131 ms->ms_events.ev_io = l->l_proc; in msopen()
132 ev_init(&ms->ms_events); /* may cause sleep */ in msopen()
134 ms->ms_ready = 1; /* start accepting events */ in msopen()
141 struct ms_softc *ms; in msclose() local
143 ms = device_lookup_private(&ms_cd, minor(dev)); in msclose()
144 ms->ms_ready = 0; /* stop accepting events */ in msclose()
145 ev_fini(&ms->ms_events); in msclose()
147 ms->ms_events.ev_io = NULL; in msclose()
148 if (ms->ms_deviclose) { in msclose()
150 err = (*ms->ms_deviclose)(ms->ms_dev, flags); in msclose()
160 struct ms_softc *ms; in msread() local
162 ms = device_lookup_private(&ms_cd, minor(dev)); in msread()
163 return ev_read(&ms->ms_events, uio, flags); in msread()
169 struct ms_softc *ms; in msioctl() local
171 ms = device_lookup_private(&ms_cd, minor(dev)); in msioctl()
179 ms->ms_events.ev_async = *(int *)data != 0; in msioctl()
183 if (-*(int *)data != ms->ms_events.ev_io->p_pgid in msioctl()
184 && *(int *)data != ms->ms_events.ev_io->p_pid) in msioctl()
189 if (*(int *)data != ms->ms_events.ev_io->p_pgid) in msioctl()
209 struct ms_softc *ms; in mspoll() local
211 ms = device_lookup_private(&ms_cd, minor(dev)); in mspoll()
212 return ev_poll(&ms->ms_events, events, l); in mspoll()
218 struct ms_softc *ms; in mskqfilter() local
220 ms = device_lookup_private(&ms_cd, minor(dev)); in mskqfilter()
221 return ev_kqfilter(&ms->ms_events, kn); in mskqfilter()
232 ms_input(struct ms_softc *ms, int c) in ms_input() argument
243 if (ms->ms_ready == 0) in ms_input()
246 ms->ms_byteno = -1; in ms_input()
251 ms->ms_byteno = 1; /* short form (3 bytes) */ in ms_input()
253 ms->ms_byteno = 0; /* long form (5 bytes) */ in ms_input()
262 switch (ms->ms_byteno) { in ms_input()
269 ms->ms_byteno = 2; in ms_input()
270 ms->ms_mb = (~c) & 0x7; in ms_input()
275 ms->ms_byteno = 4; in ms_input()
276 ms->ms_mb = (~c) & 0x7; in ms_input()
281 ms->ms_byteno = 3; in ms_input()
282 ms->ms_dx += (char)c; in ms_input()
287 ms->ms_byteno = 4; in ms_input()
288 ms->ms_dy += (char)c; in ms_input()
293 ms->ms_byteno = 5; in ms_input()
294 ms->ms_dx += (char)c; in ms_input()
299 ms->ms_byteno = -1; /* wait for button-byte again */ in ms_input()
300 ms->ms_dy += (char)c; in ms_input()
309 if (ms->ms_wsmousedev != NULL && ms->ms_ready == 2) { in ms_input()
310 mb = ((ms->ms_mb & 4) >> 2) | in ms_input()
311 (ms->ms_mb & 2) | in ms_input()
312 ((ms->ms_mb & 1) << 2); in ms_input()
313 wsmouse_input(ms->ms_wsmousedev, in ms_input()
315 ms->ms_dx, ms->ms_dy, 0, 0, in ms_input()
317 ms->ms_dx = 0; in ms_input()
318 ms->ms_dy = 0; in ms_input()
330 get = ms->ms_events.ev_get; in ms_input()
331 put = ms->ms_events.ev_put; in ms_input()
332 fe = &ms->ms_events.ev_q[put]; in ms_input()
345 fe = &ms->ms_events.ev_q[0]; \ in ms_input()
349 mb = ms->ms_mb; in ms_input()
350 ub = ms->ms_ub; in ms_input()
364 if (ms->ms_dx) { in ms_input()
367 fe->value = ms->ms_dx; in ms_input()
370 ms->ms_dx = 0; in ms_input()
372 if (ms->ms_dy) { in ms_input()
375 fe->value = ms->ms_dy; in ms_input()
378 ms->ms_dy = 0; in ms_input()
382 ms->ms_ub = ub; in ms_input()
383 ms->ms_events.ev_put = put; in ms_input()
384 EV_WAKEUP(&ms->ms_events); in ms_input()