Lines Matching refs:upper

141 static enum kbtrans_message_response 	kbtrans_ioctl(struct kbtrans *upper,
197 progressbar_key_abort_thread(struct kbtrans *upper)
202 if (ldi_ident_from_stream(upper->kbtrans_streams_readq, &li) != 0) {
205 mutex_enter(&upper->progressbar_key_abort_lock);
206 while (upper->progressbar_key_abort_flag == 0)
207 cv_wait(&upper->progressbar_key_abort_cv,
208 &upper->progressbar_key_abort_lock);
209 if (upper->progressbar_key_abort_flag == 1) {
210 mutex_exit(&upper->progressbar_key_abort_lock);
213 mutex_exit(&upper->progressbar_key_abort_lock);
235 struct kbtrans *upper;
267 upper = kmem_zalloc(sizeof (struct kbtrans), KM_SLEEP);
269 *ret_kbd = upper;
271 upper->kbtrans_polled_buf[0] = '\0';
272 upper->kbtrans_polled_pending_chars = upper->kbtrans_polled_buf;
274 upper->kbtrans_streams_hw = hw;
275 upper->kbtrans_streams_hw_callbacks = hw_cb;
276 upper->kbtrans_streams_readq = q;
277 upper->kbtrans_streams_iocpending = NULL;
278 upper->kbtrans_streams_translatable = TR_CAN;
279 upper->kbtrans_overflow_cnt = 0;
280 upper->kbtrans_streams_translate_mode = TR_ASCII;
283 kbtrans_set_translation_callback(upper);
285 lower = &upper->kbtrans_lower;
296 lower->kbtrans_upper = upper;
320 upper->kbtrans_streams_vuid_addr.ascii = ASCII_FIRST;
321 upper->kbtrans_streams_vuid_addr.top = TOP_FIRST;
322 upper->kbtrans_streams_vuid_addr.vkey = VKEY_FIRST;
325 upper->kbtrans_streams_num_downs_entries = kbtrans_downs_size;
326 upper->kbtrans_streams_downs_bytes =
328 upper->kbtrans_streams_downs =
329 kmem_zalloc(upper->kbtrans_streams_downs_bytes, KM_SLEEP);
330 upper->kbtrans_streams_abortable = B_FALSE;
332 upper->kbtrans_streams_flags = KBTRANS_STREAMS_OPEN;
334 upper->progressbar_key_abort_flag = 0;
335 cv_init(&upper->progressbar_key_abort_cv, NULL, CV_DEFAULT, NULL);
337 mutex_init(&upper->progressbar_key_abort_lock, NULL, MUTEX_SPIN,
339 tid = thread_create(NULL, 0, progressbar_key_abort_thread, upper,
341 upper->progressbar_key_abort_t_did = tid->t_did;
343 DPRINTF(PRINT_L1, PRINT_MASK_OPEN, (upper, "kbtrans_streams_init "
354 kbtrans_streams_fini(struct kbtrans *upper)
361 upper->kbtrans_streams_flags = 0;
364 if (upper->kbtrans_streams_bufcallid) {
365 qunbufcall(upper->kbtrans_streams_readq,
366 upper->kbtrans_streams_bufcallid);
368 if (upper->kbtrans_streams_rptid) {
369 (void) quntimeout(upper->kbtrans_streams_readq,
370 upper->kbtrans_streams_rptid);
372 kmem_free(upper->kbtrans_streams_downs,
373 upper->kbtrans_streams_downs_bytes);
375 mutex_enter(&upper->progressbar_key_abort_lock);
376 if (upper->progressbar_key_abort_flag == 0) {
377 upper->progressbar_key_abort_flag = 2;
378 cv_signal(&upper->progressbar_key_abort_cv);
379 mutex_exit(&upper->progressbar_key_abort_lock);
380 thread_join(upper->progressbar_key_abort_t_did);
382 mutex_exit(&upper->progressbar_key_abort_lock);
384 cv_destroy(&upper->progressbar_key_abort_cv);
385 mutex_destroy(&upper->progressbar_key_abort_lock);
387 kmem_free(upper, sizeof (struct kbtrans));
389 DPRINTF(PRINT_L1, PRINT_MASK_CLOSE, (upper, "kbtrans_streams_fini "
399 kbtrans_streams_releaseall(struct kbtrans *upper)
407 for (i = 0, ke = upper->kbtrans_streams_downs;
408 i < upper->kbtrans_streams_num_downs_entries; i++, ke++) {
413 kbtrans_keyreleased(upper, ke->key_station);
431 kbtrans_streams_message(struct kbtrans *upper, register mblk_t *mp)
433 queue_t *q = upper->kbtrans_streams_readq;
436 DPRINTF(PRINT_L1, PRINT_MASK_ALL, (upper,
445 ret = kbtrans_ioctl(upper, mp);
465 DPRINTF(PRINT_L1, PRINT_MASK_ALL, (upper,
481 struct kbtrans *upper,
488 lower = &upper->kbtrans_lower;
492 mutex_enter(&upper->progressbar_key_abort_lock);
493 if (upper->progressbar_key_abort_flag == 0) {
494 upper->progressbar_key_abort_flag = 1;
495 cv_signal(&upper->progressbar_key_abort_cv);
497 mutex_exit(&upper->progressbar_key_abort_lock);
499 if (upper->kbtrans_streams_abortable) {
500 switch (upper->kbtrans_streams_abort_state) {
507 upper->kbtrans_streams_abort_state =
509 upper->kbtrans_streams_abort1_key = key;
512 /* Shift key needs to be sent to upper immediately */
515 upper->kbtrans_streams_abort_state =
517 upper->kbtrans_streams_new_abort1_key = key;
521 upper->kbtrans_streams_abort_state = ABORT_NORMAL;
528 upper->kbtrans_streams_callback,
529 upper->kbtrans_streams_abort1_key,
534 upper->kbtrans_streams_abort_state = ABORT_NORMAL;
539 upper->kbtrans_streams_callback,
540 upper->kbtrans_streams_new_abort1_key,
547 kbtrans_processkey(lower, upper->kbtrans_streams_callback, key, state);
559 struct kbtrans *upper,
563 upper->kbtrans_lower.kbtrans_keyboard = k;
564 upper->kbtrans_streams_id = id;
575 kbtrans_streams_has_reset(struct kbtrans *upper)
590 kbtrans_streams_enable(struct kbtrans *upper)
593 kbtrans_setled(upper);
602 kbtrans_streams_setled(struct kbtrans *upper, int led_state)
606 lower = &upper->kbtrans_lower;
628 kbtrans_streams_set_queue(struct kbtrans *upper, queue_t *q)
631 upper->kbtrans_streams_readq = q;
639 kbtrans_streams_get_queue(struct kbtrans *upper)
641 return (upper->kbtrans_streams_readq);
649 kbtrans_streams_untimeout(struct kbtrans *upper)
652 if (upper->kbtrans_streams_bufcallid) {
653 qunbufcall(upper->kbtrans_streams_readq,
654 upper->kbtrans_streams_bufcallid);
655 upper->kbtrans_streams_bufcallid = 0;
657 if (upper->kbtrans_streams_rptid) {
658 (void) quntimeout(upper->kbtrans_streams_readq,
659 upper->kbtrans_streams_rptid);
660 upper->kbtrans_streams_rptid = 0;
672 struct kbtrans *upper = (struct kbtrans *)arg;
675 upper->kbtrans_streams_bufcallid = 0;
677 if ((mp = upper->kbtrans_streams_iocpending) != NULL) {
679 upper->kbtrans_streams_iocpending = NULL;
680 (void) kbtrans_ioctl(upper, mp);
689 kbtrans_ioctl(struct kbtrans *upper, register mblk_t *mp)
703 lower = &upper->kbtrans_lower;
707 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper,
712 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "VUIDSFORMAT\n"));
720 if (new_translate == upper->kbtrans_streams_translate_mode)
722 upper->kbtrans_streams_translate_mode = new_translate;
724 kbtrans_set_translation_callback(upper);
726 kbtrans_flush(upper);
730 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCTRANS\n"));
735 if (new_translate == upper->kbtrans_streams_translate_mode)
737 upper->kbtrans_streams_translate_mode = new_translate;
738 kbtrans_set_translation_callback(upper);
740 kbtrans_flush(upper);
744 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSLED\n"));
751 kbtrans_setled(upper);
755 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGLED\n"));
770 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "VUIDGFORMAT\n"));
776 (upper->kbtrans_streams_translate_mode == TR_EVENT ||
777 upper->kbtrans_streams_translate_mode == TR_UNTRANS_EVENT) ?
787 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGTRANS\n"));
792 *(int *)datap->b_wptr = upper->kbtrans_streams_translate_mode;
801 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "VUIDSADDR\n"));
810 addr_ptr = &upper->kbtrans_streams_vuid_addr.ascii;
814 addr_ptr = &upper->kbtrans_streams_vuid_addr.top;
818 addr_ptr = &upper->kbtrans_streams_vuid_addr.vkey;
827 kbtrans_flush(upper);
832 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "VUIDGADDR\n"));
842 upper->kbtrans_streams_vuid_addr.ascii;
847 upper->kbtrans_streams_vuid_addr.top;
852 upper->kbtrans_streams_vuid_addr.vkey;
861 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCTRANSABLE\n"));
872 if (upper->kbtrans_streams_translatable != translate)
873 upper->kbtrans_streams_translatable = translate;
876 DPRINTF(PRINT_L4, PRINT_MASK_ALL, (upper,
881 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGTRANSABLE\n"));
886 *(int *)datap->b_wptr = upper->kbtrans_streams_translatable;
895 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSCOMPAT\n"));
904 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGCOMPAT\n"));
918 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSETKEY %d\n",
923 err = kbtrans_setkey(&upper->kbtrans_lower,
933 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGETKEY %d\n",
938 err = kbtrans_getkey(&upper->kbtrans_lower,
946 err = kbtrans_skey(&upper->kbtrans_lower,
959 err = kbtrans_gkey(&upper->kbtrans_lower,
964 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSDIRECT\n"));
965 kbtrans_flush(upper);
969 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSGDIRECT\n"));
983 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCTYPE\n"));
988 *(int *)datap->b_wptr = upper->kbtrans_streams_id;
1005 upper->kbtrans_streams_abortable =
1017 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGRPTDELAY\n"));
1036 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSRPTDELAY\n"));
1056 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCGRPTRATE\n"));
1075 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "KIOCSRPTRATE\n"));
1092 DPRINTF(PRINT_L0, PRINT_MASK_ALL, (upper, "unknown\n"));
1105 putnext(upper->kbtrans_streams_readq, mp);
1117 if (upper->kbtrans_streams_iocpending != NULL)
1118 freemsg(upper->kbtrans_streams_iocpending);
1119 upper->kbtrans_streams_iocpending = mp;
1120 if (upper->kbtrans_streams_bufcallid) {
1121 qunbufcall(upper->kbtrans_streams_readq,
1122 upper->kbtrans_streams_bufcallid);
1124 upper->kbtrans_streams_bufcallid =
1125 qbufcall(upper->kbtrans_streams_readq, ioctlrespsize, BPRI_HI,
1126 kbtrans_reioctl, upper);
1138 kbtrans_flush(register struct kbtrans *upper)
1143 if ((q = upper->kbtrans_streams_readq) != NULL && q->q_next != NULL)
1147 bzero(upper->kbtrans_streams_downs, upper->kbtrans_streams_downs_bytes);
1149 kbtrans_cancelrpt(upper);
1157 kbtrans_setled(struct kbtrans *upper)
1159 upper->kbtrans_streams_hw_callbacks->kbtrans_streams_setled(
1160 upper->kbtrans_streams_hw,
1161 upper->kbtrans_lower.kbtrans_led_state);
1172 struct kbtrans *upper = arg;
1173 struct kbtrans_lower *lower = &upper->kbtrans_lower;
1179 upper->kbtrans_streams_rptid = 0;
1186 kbtrans_keyreleased(upper, lower->kbtrans_repeatkey);
1189 upper->kbtrans_streams_callback,
1193 upper->kbtrans_streams_rptid =
1194 qtimeout(upper->kbtrans_streams_readq, kbtrans_rpt,
1195 (caddr_t)upper, kbtrans_repeat_rate);
1204 kbtrans_cancelrpt(struct kbtrans *upper)
1206 upper->kbtrans_lower.kbtrans_repeatkey = 0;
1208 if (upper->kbtrans_streams_rptid != 0) {
1209 (void) quntimeout(upper->kbtrans_streams_readq,
1210 upper->kbtrans_streams_rptid);
1211 upper->kbtrans_streams_rptid = 0;
1221 kbtrans_send_esc_event(char c, register struct kbtrans *upper)
1234 kbtrans_queueevent(upper, &fe);
1236 kbtrans_queueevent(upper, &fe);
1267 kbtrans_keypressed(struct kbtrans *upper, uchar_t key_station,
1272 struct kbtrans_lower *lower = &upper->kbtrans_lower;
1307 id_addr = upper->kbtrans_streams_vuid_addr.ascii;
1310 id_addr = upper->kbtrans_streams_vuid_addr.top;
1313 id_addr = upper->kbtrans_streams_vuid_addr.vkey;
1321 kbtrans_queuepress(upper, key_station, fe);
1329 kbtrans_queuepress(struct kbtrans *upper,
1342 for (i = 0, ke = upper->kbtrans_streams_downs;
1343 i < upper->kbtrans_streams_num_downs_entries; i++, ke++) {
1365 ke = upper->kbtrans_streams_downs;
1370 kbtrans_queueevent(upper, fe);
1378 kbtrans_keyreleased(register struct kbtrans *upper, uchar_t key_station)
1386 if (upper->kbtrans_streams_translate_mode != TR_EVENT &&
1387 upper->kbtrans_streams_translate_mode != TR_UNTRANS_EVENT) {
1393 for (i = 0, ke = upper->kbtrans_streams_downs;
1394 i < upper->kbtrans_streams_num_downs_entries;
1400 kbtrans_queueevent(upper, &ke->event);
1417 kbtrans_putcode(register struct kbtrans *upper, uint_t code)
1424 if (!canputnext(upper->kbtrans_streams_readq)) {
1449 (void) putnext(upper->kbtrans_streams_readq, bp);
1483 kbtrans_queueevent(struct kbtrans *upper, Firm_event *fe)
1488 if ((q = upper->kbtrans_streams_readq) == NULL)
1498 kbtrans_flush(upper);
1499 upper->kbtrans_overflow_cnt++;
1521 kbtrans_set_translation_callback(register struct kbtrans *upper)
1523 switch (upper->kbtrans_streams_translate_mode) {
1527 upper->vt_switch_keystate = VT_SWITCH_KEY_NONE;
1530 upper->kbtrans_lower.kbtrans_shiftmask &=
1532 upper->kbtrans_lower.kbtrans_togglemask &=
1535 upper->kbtrans_streams_callback = &ascii_callback;
1540 upper->kbtrans_streams_callback = &trans_event_callback;
1545 upper->kbtrans_streams_callback = &untrans_event_callback;
1558 kbtrans_untrans_keypressed_raw(struct kbtrans *upper, kbtrans_key_t key)
1573 kbtrans_queuepress(upper, key, &fe);
1583 kbtrans_untrans_keyreleased_raw(struct kbtrans *upper, kbtrans_key_t key)
1588 kbtrans_keyreleased(upper, key);
1620 kbtrans_vt_compose(struct kbtrans *upper, unsigned short keyid,
1646 (upper->vt_switch_keystate - VT_SWITCH_KEY_ALT) *
1656 kbtrans_putbuf(buf, upper->kbtrans_streams_readq);
1669 struct kbtrans *upper,
1678 struct kbtrans_lower *lower = &upper->kbtrans_lower;
1694 upper->vt_switch_keystate = VT_SWITCH_KEY_ALT;
1696 upper->vt_switch_keystate = VT_SWITCH_KEY_ALTGR;
1708 if (upper->vt_switch_keystate > VT_SWITCH_KEY_NONE) {
1718 kbtrans_vt_compose(upper, keyid, B_FALSE, buf);
1741 kbtrans_putbuf(buf, upper->kbtrans_streams_readq);
1746 if (upper->vt_switch_keystate > VT_SWITCH_KEY_NONE) {
1752 kbtrans_vt_compose(upper, keyid, B_TRUE, buf);
1768 kbtrans_putcode(upper, (uchar_t)*cp);
1780 kbtrans_putcode(upper,
1793 kbtrans_putcode(upper, entry);
1810 kbtrans_ascii_keyreleased(struct kbtrans *upper, kbtrans_key_t key)
1813 upper->vt_switch_keystate = VT_SWITCH_KEY_NONE;
1825 struct kbtrans *upper,
1829 struct kbtrans_lower *lower = &upper->kbtrans_lower;
1835 kbtrans_cancelrpt(upper);
1846 upper->kbtrans_streams_rptid = qtimeout(upper->kbtrans_streams_readq,
1847 kbtrans_rpt, (caddr_t)upper, kbtrans_repeat_delay);
1858 struct kbtrans *upper,
1865 struct kbtrans_lower *lower = &upper->kbtrans_lower;
1882 kbtrans_keypressed(upper, key, &fe, fe.id);
1895 kbtrans_keypressed(upper, key, &fe, fe.id);
1915 kbtrans_keypressed(upper, key, &fe, fe.id);
1940 kbtrans_send_esc_event(*cp, upper);
1963 kbtrans_keypressed(upper, key, &fe, fe.id);
1987 kbtrans_streams_releaseall(upper);
2005 kbtrans_queueevent(upper, &fe);
2015 kbtrans_trans_event_keyreleased(struct kbtrans *upper, kbtrans_key_t key)
2020 kbtrans_keyreleased(upper, key);
2031 struct kbtrans *upper,
2035 struct kbtrans_lower *lower = &upper->kbtrans_lower;
2050 kbtrans_cancelrpt(upper);
2061 upper->kbtrans_streams_rptid = qtimeout(upper->kbtrans_streams_readq,
2062 kbtrans_rpt, (caddr_t)upper, kbtrans_repeat_delay);