On Fri, May 13, 2016 at 09:35:48AM -0400, Ted Unangst wrote:
> Mark Kettenis wrote:
> >
> > I personally think the wsconsctl settings should be respected by X.
>
> > But perhaps we should have a more fundamental discussion about things
> > first about how X should interact with wscons. There is a more
> > fundamental problem here where X assumes it has full control over the
> > hardware. There still is the volume key issue and there are problems
>
> Implementation issues aside, as a user, my expectation is that X is a client
> of the hardware. Therefore any "hardware" settings I have configured elsewhere
> will be respected. I don't see any difference between speaker volume and
> network interfaces. X uses my existing network configuration, so it should be
> the same for other interfaces.
I agree. FWIW, the volume keys are not a Xorg problem, it is a
keyboard driver bug (the driver uses the keys but forgets to
discard them; so they get used a second time by Xorg in a
contradictory way).
The diff below fixes it.
--- sys/dev/pckbc/pckbd.c.orig Fri Apr 15 04:01:34 2016
+++ sys/dev/pckbc/pckbd.c Fri May 13 18:08:39 2016
@@ -931,6 +931,15 @@ pckbd_input(void *vsc, int data)
#ifdef WSDISPLAY_COMPAT_RAWKBD
if (sc->rawkbd) {
+ /*
+ * Pass audio keys to wskbd_input anyway
+ */
+ if (rc != 0 && (key == 160 || key == 174 || key == 176)) {
+ wskbd_input(sc->sc_wskbddev, type, key);
+ sc->sc_rawcnt = 0;
+ return;
+ }
+
sc->sc_rawbuf[sc->sc_rawcnt++] = (char)data;
if (rc != 0 || sc->sc_rawcnt == sizeof(sc->sc_rawbuf)) {
@@ -938,12 +947,7 @@ pckbd_input(void *vsc, int data)
sc->sc_rawcnt);
sc->sc_rawcnt = 0;
}
-
- /*
- * Pass audio keys to wskbd_input anyway.
- */
- if (rc == 0 || (key != 160 && key != 174 && key != 176))
- return;
+ return;
}
#endif
if (rc != 0)
--- sys/dev/hid/hidkbd.c.orig Fri May 13 17:05:15 2016
+++ sys/dev/hid/hidkbd.c Fri May 13 18:46:54 2016
@@ -406,6 +406,18 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *
for (i = j = 0; i < nkeys; i++) {
key = ibuf[i];
+ /*
+ * Pass audio keys to wskbd_input anyway.
+ */
+ switch (key & CODEMASK) {
+ case 127:
+ case 128:
+ case 129:
+ wskbd_input(kbd->sc_wskbddev,
+ key & RELEASE ? WSCONS_EVENT_KEY_UP :
+ WSCONS_EVENT_KEY_DOWN, key & CODEMASK);
+ continue;
+ }
c = hidkbd_trtab[key & CODEMASK];
if (c == NN)
continue;
@@ -421,22 +433,6 @@ hidkbd_decode(struct hidkbd *kbd, struct hidkbd_data *
}
s = spltty();
wskbd_rawinput(kbd->sc_wskbddev, cbuf, j);
-
- /*
- * Pass audio keys to wskbd_input anyway.
- */
- for (i = 0; i < nkeys; i++) {
- key = ibuf[i];
- switch (key & CODEMASK) {
- case 127:
- case 128:
- case 129:
- wskbd_input(kbd->sc_wskbddev,
- key & RELEASE ? WSCONS_EVENT_KEY_UP :
- WSCONS_EVENT_KEY_DOWN, key & CODEMASK);
- break;
- }
- }
splx(s);
return;