summaryrefslogtreecommitdiff
path: root/sys/dev/ic/pckbc.c
diff options
context:
space:
mode:
authorAlexandr Shadchin <shadchin@cvs.openbsd.org>2012-08-10 17:49:32 +0000
committerAlexandr Shadchin <shadchin@cvs.openbsd.org>2012-08-10 17:49:32 +0000
commit0cee9cb15da335548bc0f586fa041d1627c2b85b (patch)
tree0a3add3489c4db2e1d865fd1502e3cac2694a85b /sys/dev/ic/pckbc.c
parentde3317878fe731812fe3a89da7aaa2ef20d57f76 (diff)
simplify pckbc_xt_translation()
* call only for set translation on (once in /sys/dev/pckbd.c) therefore we can delete unused code. * change behavior (more standard) - return zero on success ok miod@
Diffstat (limited to 'sys/dev/ic/pckbc.c')
-rw-r--r--sys/dev/ic/pckbc.c34
1 files changed, 11 insertions, 23 deletions
diff --git a/sys/dev/ic/pckbc.c b/sys/dev/ic/pckbc.c
index 5f388e42b01..49d01d6b4b1 100644
--- a/sys/dev/ic/pckbc.c
+++ b/sys/dev/ic/pckbc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pckbc.c,v 1.29 2012/02/02 21:40:20 deraadt Exp $ */
+/* $OpenBSD: pckbc.c,v 1.30 2012/08/10 17:49:31 shadchin Exp $ */
/* $NetBSD: pckbc.c,v 1.5 2000/06/09 04:58:35 soda Exp $ */
/*
@@ -482,40 +482,28 @@ pckbc_poll_data(pckbc_tag_t self, pckbc_slot_t slot)
}
/*
- * switch scancode translation on / off
- * return nonzero on success
+ * set scancode translation on
*/
int
-pckbc_xt_translation(pckbc_tag_t self, pckbc_slot_t slot, int on)
+pckbc_xt_translation(pckbc_tag_t self)
{
struct pckbc_internal *t = self;
- int ison;
- if (ISSET(t->t_flags, PCKBC_CANT_TRANSLATE) ||
- slot != PCKBC_KBD_SLOT) {
- /* translation only for kbd slot */
- if (on)
- return (0);
- else
- return (1);
- }
+ if (ISSET(t->t_flags, PCKBC_CANT_TRANSLATE))
+ return (-1);
- ison = t->t_cmdbyte & KC8_TRANS;
- if ((on && ison) || (!on && !ison))
- return (1);
+ if (t->t_cmdbyte & KC8_TRANS)
+ return (0);
- t->t_cmdbyte ^= KC8_TRANS;
+ t->t_cmdbyte |= KC8_TRANS;
if (!pckbc_put8042cmd(t))
- return (0);
+ return (-1);
/* read back to be sure */
if (!pckbc_get8042cmd(t))
- return (0);
+ return (-1);
- ison = t->t_cmdbyte & KC8_TRANS;
- if ((on && ison) || (!on && !ison))
- return (1);
- return (0);
+ return (t->t_cmdbyte & KC8_TRANS) ? (0) : (-1);
}
static struct pckbc_portcmd {