Lines Matching refs:kbdd

286 	register struct	kbddata *kbdd;
322 kbdd = kmem_zalloc(sizeof (struct kbddata), KM_SLEEP);
329 q->q_ptr = kbdd;
330 WR(q)->q_ptr = kbdd;
342 kmem_free(kbdd, sizeof (struct kbddata));
355 kmem_free(kbdd, sizeof (struct kbddata));
373 kbdd->kbdd_flags |= KBD_IOCWAIT; /* indicate that we're */
374 kbdd->kbdd_iocid = iocb->ioc_id; /* waiting for this response */
381 while (kbdd->kbdd_flags & KBD_IOCWAIT) {
387 if ((error = kbdd->kbdd_iocerror) != 0)
393 kbdd->kbdd_readq = q;
394 kbdd->kbdd_writeq = WR(q);
395 kbdd->kbdd_iocpending = NULL;
396 kbdd->kbdd_translatable = TR_CAN;
397 kbdd->kbdd_translate = TR_ASCII;
398 kbdd->kbdd_compat = 1;
399 kbdd->kbdd_ascii_addr = ASCII_FIRST;
400 kbdd->kbdd_top_addr = TOP_FIRST;
401 kbdd->kbdd_vkey_addr = VKEY_FIRST;
403 kbdd->kbdd_downs_entries = kbd_downs_size;
404 kbdd->kbdd_downs_bytes = kbd_downs_size * sizeof (Key_event);
405 kbdd->kbdd_downs = kmem_alloc(kbdd->kbdd_downs_bytes, KM_SLEEP);
406 kbdd->kbdd_flags = KBD_OPEN;
407 kbdd->led_state = 0;
412 kbdreset(kbdd, HARD_RESET);
420 kmem_free(kbdd, sizeof (struct kbddata));
431 register struct kbddata *kbdd = (struct kbddata *)q->q_ptr;
441 kbdd->kbdd_flags = 0;
443 if ((mp = kbdd->kbdd_replypending) != NULL) {
448 kbdd->kbdd_replypending = NULL;
453 if (kbdd->kbdd_bufcallid)
454 qunbufcall(q, kbdd->kbdd_bufcallid);
455 if (kbdd->kbdd_rptid)
456 (void) quntimeout(q, kbdd->kbdd_rptid);
457 if (kbdd->kbdd_layoutid)
458 (void) quntimeout(q, kbdd->kbdd_layoutid);
459 kmem_free(kbdd->kbdd_downs, kbdd->kbdd_downs_bytes);
460 kmem_free(kbdd, sizeof (struct kbddata));
497 struct kbddata *kbdd = kbdd_addr;
501 kbdd->kbdd_bufcallid = 0;
502 q = kbdd->kbdd_writeq;
503 if ((mp = kbdd->kbdd_iocpending) != NULL) {
504 kbdd->kbdd_iocpending = NULL; /* not pending any more */
512 register struct kbddata *kbdd = (struct kbddata *)q->q_ptr;
536 if (new_translate == kbdd->kbdd_translate)
538 kbdd->kbdd_translate = new_translate;
547 if (new_translate == kbdd->kbdd_translate)
549 kbdd->kbdd_translate = new_translate;
597 kbdd->led_state = *(uchar_t *)mp->b_cont->b_rptr;
598 kbdsetled(kbdd);
606 *(uchar_t *)datap->b_wptr = kbdd->led_state;
620 (kbdd->kbdd_translate == TR_EVENT ||
621 kbdd->kbdd_translate == TR_UNTRANS_EVENT) ?
635 *(int *)datap->b_wptr = kbdd->kbdd_translate;
652 addr_ptr = &kbdd->kbdd_ascii_addr;
656 addr_ptr = &kbdd->kbdd_top_addr;
660 addr_ptr = &kbdd->kbdd_vkey_addr;
681 addr_probe->data.current = kbdd->kbdd_ascii_addr;
685 addr_probe->data.current = kbdd->kbdd_top_addr;
689 addr_probe->data.current = kbdd->kbdd_vkey_addr;
702 if (kbdd->kbdd_translatable != *(int *)mp->b_cont->b_rptr) {
703 kbdd->kbdd_translatable = *(int *)mp->b_cont->b_rptr;
704 kbdreset(kbdd, HARD_RESET);
714 *(int *)datap->b_wptr = kbdd->kbdd_translatable;
727 kbdd->kbdd_compat = *(int *)mp->b_cont->b_rptr;
735 *(int *)datap->b_wptr = kbdd->kbdd_compat;
748 err = kbdsetkey(kbdd, (struct kiockey *)mp->b_cont->b_rptr,
762 err = kbdgetkey(kbdd, (struct kiockey *)mp->b_cont->b_rptr);
770 err = kbdskey(kbdd, (struct kiockeymap *)mp->b_cont->b_rptr,
784 err = kbdgkey(kbdd, (struct kiockeymap *)mp->b_cont->b_rptr);
808 *(int *)datap->b_wptr = kbdd->kbdd_state.k_id;
817 if ((datap = kbdd->kbdd_replypending) != NULL) {
822 kbdd->kbdd_replypending = NULL;
826 if (kbdd->kbdd_state.k_id == KB_SUN4 ||
827 kbdd->kbdd_state.k_id == KB_PC) {
839 kbdd->kbdd_replypending = mp;
841 if (kbdd->kbdd_layoutid)
842 (void) quntimeout(q, kbdd->kbdd_layoutid);
843 kbdd->kbdd_layoutid = qtimeout(q, kbdlayouttimeout,
844 kbdd, hz / 5);
935 kbdflush(kbdd);
958 if (kbdd->kbdd_iocpending != NULL)
959 freemsg(kbdd->kbdd_iocpending);
960 kbdd->kbdd_iocpending = mp;
961 if (kbdd->kbdd_bufcallid)
962 qunbufcall(q, kbdd->kbdd_bufcallid);
963 kbdd->kbdd_bufcallid = qbufcall(q, ioctlrespsize, BPRI_HI,
964 kbdreioctl, kbdd);
968 kbdflush(register struct kbddata *kbdd)
973 if ((q = kbdd->kbdd_readq) != NULL && q->q_next != NULL)
976 bzero(kbdd->kbdd_downs, kbdd->kbdd_downs_bytes);
977 kbdcancelrpt(kbdd);
984 kbduse(register struct kbddata *kbdd, unsigned keycode)
992 if ((readq = kbdd->kbdd_readq) == NULL)
994 if (!kbdd->kbdd_translatable ||
995 kbdd->kbdd_translate == TR_NONE)
998 kbdtranslate(kbdd, keycode, readq);
1058 kbdsetled(register struct kbddata *kbdd)
1060 if (kbdd->kbdd_state.k_id == KB_SUN4 ||
1061 kbdd->kbdd_state.k_id == KB_PC) {
1062 kbdcmd(kbdd->kbdd_writeq, KBD_CMD_SETLED);
1063 kbdcmd(kbdd->kbdd_writeq, kbdd->led_state);
1071 kbdreset(register struct kbddata *kbdd, uint_t hard_reset)
1075 k = &kbdd->kbdd_state;
1076 if (kbdd->kbdd_translatable) {
1081 kbdcmd(kbdd->kbdd_writeq, KBD_CMD_RESET);
1128 kbdsetkey(register struct kbddata *kbdd, struct kiockey *key, cred_t *cr)
1137 if (kbdd->kbdd_state.k_curkeyboard == NULL)
1143 kbdd->kbdd_state.k_curkeyboard->k_abort1 = key->kio_station;
1149 kbdd->kbdd_state.k_curkeyboard->k_abort2 = key->kio_station;
1153 (km = settable(kbdd, (uint_t)tablemask)) == NULL)
1198 kbdgetkey(register struct kbddata *kbdd, struct kiockey *key)
1206 if (kbdd->kbdd_state.k_curkeyboard == NULL)
1209 key->kio_station = kbdd->kbdd_state.k_curkeyboard->k_abort1;
1213 key->kio_station = kbdd->kbdd_state.k_curkeyboard->k_abort2;
1216 if ((km = settable(kbdd, (uint_t)key->kio_tablemask)) == NULL)
1242 kbdskey(register struct kbddata *kbdd, struct kiockeymap *key, cred_t *cr)
1249 if (kbdd->kbdd_state.k_curkeyboard == NULL)
1254 kbdd->kbdd_state.k_curkeyboard->k_abort1 = key->kio_station;
1260 kbdd->kbdd_state.k_curkeyboard->k_abort2 = key->kio_station;
1263 if ((km = settable(kbdd, (uint_t)key->kio_tablemask)) == NULL)
1280 kbdgkey(register struct kbddata *kbdd, struct kiockeymap *key)
1287 if (kbdd->kbdd_state.k_curkeyboard == NULL)
1290 key->kio_station = kbdd->kbdd_state.k_curkeyboard->k_abort1;
1294 key->kio_station = kbdd->kbdd_state.k_curkeyboard->k_abort2;
1297 if ((km = settable(kbdd, (uint_t)key->kio_tablemask)) == NULL)
1312 struct kbddata *kbdd = arg;
1315 kbdd->kbdd_layoutid = 0;
1321 if ((mp = kbdd->kbdd_replypending) != NULL) {
1322 kbdd->kbdd_replypending = NULL;
1325 putnext(kbdd->kbdd_readq, mp);
1335 struct kbddata *kbdd = (struct kbddata *)q->q_ptr;
1340 if (kbdd == 0) {
1375 if (!(kbdd->kbdd_flags & KBD_IOCWAIT) ||
1376 iocp->ioc_id != kbdd->kbdd_iocid) {
1380 if (kbdd->kbdd_flags & KBD_OPEN)
1385 kbdd->kbdd_flags &= ~KBD_IOCWAIT;
1386 kbdd->kbdd_iocerror = iocp->ioc_error;
1392 if (!(kbdd->kbdd_flags & KBD_OPEN)) {
1408 kbdinput(kbdd, *readp++);
1420 kbdinput(register struct kbddata *kbdd, register unsigned key)
1425 k = &kbdd->kbdd_state;
1437 kbdreset(kbdd, HARD_RESET);
1443 kbdid(kbdd, (int)key);
1455 kbdcmd(kbdd->kbdd_writeq, KBD_CMD_NOCLICK);
1458 kbdcmd(kbdd->kbdd_writeq, KBD_CMD_CLICK);
1466 kbdcmd(kbdd->kbdd_writeq, KBD_CMD_NOCLICK);
1476 kbdcmd(kbdd->kbdd_writeq,
1488 kbdsetled(kbdd);
1507 kbdreset(kbdd, HARD_RESET);
1515 kbdreset(kbdd, NO_HARD_RESET);
1541 if (kbdd->kbdd_layoutid)
1542 (void) quntimeout(kbdd->kbdd_readq,
1543 kbdd->kbdd_layoutid);
1544 if ((mp = kbdd->kbdd_replypending) != NULL) {
1545 kbdd->kbdd_replypending = NULL;
1548 putnext(kbdd->kbdd_readq, mp);
1571 kbdd->shiftkey = key;
1575 kbduse(kbdd, key);
1590 kbduse(kbdd, IDLEKEY); /* fake */
1593 kbduse(kbdd, k->k_curkeyboard->k_abort1);
1609 kbdd->shiftkey |= RELEASED;
1610 kbduse(kbdd, kbdd->shiftkey);
1611 kbduse(kbdd, IDLEKEY); /* fake */
1624 kbduse(kbdd, key);
1630 kbdid(register struct kbddata *kbdd, int id)
1635 k = &kbdd->kbdd_state;
1646 if (kbdd->kbdd_rptid)
1647 (void) quntimeout(kbdd->kbdd_readq, kbdd->kbdd_rptid);
1648 kbdd->kbdd_rptid = 0;
1673 settable(register struct kbddata *kbdd, register uint_t mask)
1677 kp = kbdd->kbdd_state.k_curkeyboard;
1698 struct kbddata *kbdd = arg;
1701 k = &kbdd->kbdd_state;
1706 kbdd->kbdd_rptid = 0;
1708 kbdkeyreleased(kbdd, KEYOF(k->k_rptkey));
1709 kbduse(kbdd, k->k_rptkey);
1711 kbdd->kbdd_rptid = qtimeout(kbdd->kbdd_readq, kbdrpt,
1712 kbdd, kbd_repeatrate);
1717 kbdcancelrpt(register struct kbddata *kbdd)
1721 k = &kbdd->kbdd_state;
1723 if (kbdd->kbdd_rptid)
1724 (void) quntimeout(kbdd->kbdd_readq, kbdd->kbdd_rptid);
1725 kbdd->kbdd_rptid = 0;
1728 ASSERT(kbdd->kbdd_rptid == 0);
1732 kbdtranslate(struct kbddata *kbdd, unsigned keycode, queue_t *q)
1746 k = &kbdd->kbdd_state;
1757 if (kbdd->kbdd_translate == TR_UNTRANS_EVENT) {
1762 kbdqueuepress(kbdd, key, &fe);
1764 kbdkeyreleased(kbdd, key);
1773 km = settable(kbdd, shiftmask);
1775 kbdcancelrpt(kbdd);
1790 km = settable(kbdd, shiftmask & ~NUMLOCKMASK);
1792 kbdcancelrpt(kbdd);
1821 kbdd->compose_key = entry;
1827 kbdd->led_state &= ~LED_COMPOSE;
1828 kbdsetled(kbdd);
1834 kbdd->led_state &= ~LED_COMPOSE;
1835 kbdsetled(kbdd);
1838 if (kbdd->compose_key <= entry) {
1840 kbdd->compose_key,
1846 kbdd->compose_key,
1850 if (kbdd->kbdd_translate ==
1853 (kbdd->kbdd_compat ?
1859 kbdd,
1862 kbdd->kbdd_translate ==
1877 != kbdd->fltaccent_entry) ||
1884 if (kbdd->kbdd_translate == TR_EVENT) {
1885 fe.id = (kbdd->kbdd_compat ?
1889 kbdqueueevent(kbdd, &fe);
1890 } else if (kbdd->kbdd_translate == TR_ASCII)
1908 kbdd->kbdd_translate == TR_EVENT)) {
1910 kbdcancelrpt(kbdd);
1911 kbdd->kbdd_rptid = qtimeout(q, kbdrpt, kbdd,
1916 kbdcancelrpt(kbdd);
1917 if ((newstate == RELEASED) && (kbdd->kbdd_translate == TR_EVENT))
1918 kbdkeyreleased(kbdd, key);
1928 switch (kbdd->kbdd_translate) {
1933 kbdkeypressed(kbdd, key, &fe, entry);
1949 kbdd->led_state &= ~LED_CAPS_LOCK;
1950 kbdsetled(kbdd);
1952 kbdd->led_state &= ~LED_NUM_LOCK;
1953 kbdsetled(kbdd);
1958 kbdd->led_state |= LED_CAPS_LOCK;
1959 kbdsetled(kbdd);
1961 kbdd->led_state |= LED_NUM_LOCK;
1962 kbdsetled(kbdd);
1973 if (kbdd->kbdd_translate == TR_EVENT && newstate == PRESSED) {
1982 kbdkeypressed(kbdd, key, &fe, fe.id);
1989 if (kbdd->kbdd_translate == TR_EVENT && newstate == PRESSED) {
1998 kbdkeypressed(kbdd, key, &fe, fe.id);
2015 kbdcancelrpt(kbdd);
2016 kbdreleaseall(kbdd);
2025 kbdd->led_state |= LED_COMPOSE;
2026 kbdsetled(kbdd);
2041 kbdd->fltaccent_entry = entry;
2049 switch (kbdd->kbdd_translate) {
2052 kbd_send_esc_event(*cp, kbdd);
2064 switch (kbdd->kbdd_translate) {
2095 kbdkeypressed(kbdd, key, &fe, fe.id);
2116 switch (kbdd->kbdd_translate) {
2137 kbdkeypressed(kbdd, key, &fe, fe.id);
2173 kbd_send_esc_event(char c, register struct kbddata *kbdd)
2186 kbdqueueevent(kbdd, &fe);
2188 kbdqueueevent(kbdd, &fe);
2211 kbdkeypressed(struct kbddata *kbdd, uchar_t key_station, Firm_event *fe,
2223 k = &kbdd->kbdd_state;
2227 km = settable(kbdd,
2245 id_addr = kbdd->kbdd_ascii_addr;
2248 id_addr = kbdd->kbdd_top_addr;
2251 id_addr = kbdd->kbdd_vkey_addr;
2257 kbdqueuepress(kbdd, key_station, fe);
2261 kbdqueuepress(struct kbddata *kbdd, uchar_t key_station, Firm_event *fe)
2273 if (kbdd->kbdd_translate == TR_EVENT ||
2274 kbdd->kbdd_translate == TR_UNTRANS_EVENT) {
2275 for (i = 0, ke = kbdd->kbdd_downs;
2276 i < kbdd->kbdd_downs_entries;
2293 ke = kbdd->kbdd_downs;
2298 kbdqueueevent(kbdd, fe);
2302 kbdkeyreleased(register struct kbddata *kbdd, uchar_t key_station)
2313 if (kbdd->kbdd_translate != TR_EVENT &&
2314 kbdd->kbdd_translate != TR_UNTRANS_EVENT)
2317 for (i = 0, ke = kbdd->kbdd_downs;
2318 i < kbdd->kbdd_downs_entries;
2324 kbdqueueevent(kbdd, &ke->event);
2336 kbdreleaseall(struct kbddata *kbdd)
2345 for (i = 0, ke = kbdd->kbdd_downs;
2346 i < kbdd->kbdd_downs_entries; i++, ke++) {
2349 kbdkeyreleased(kbdd, ke->key_station);
2403 kbdqueueevent(struct kbddata *kbdd, Firm_event *fe)
2408 if ((q = kbdd->kbdd_readq) == NULL)
2414 kbdflush(kbdd);