this diff applies on top of the previous one; it adds the hw.kbdvolume sysctl(1) entry to select how pckbd & ukbd volume keys are handled:
hw.kbdvolume=0 pass keystrokes to upper layer as we do for regular keys, thus usable by X apps as hot-keys or whatever. hw.kbdvolume=1 change the ouputs.master control of the first audio device, keystrokes are consumed by the kernel and not visible by userland. This is the default, as this is the behavior of all other (acpi, macppc, ... ) volume keys. I'm not 100% convinced this knob is is needed; some of us think it's useful, so i thow it here for completeness. Let me know if you think this is needed. To test it, rebuild your kernel, do a "make includes" in usr/src, rebuild then re-install the sysctl utility. Then: sysctl hw.kbdvolume=0 to force the pckbd and ukbd drivers to pass volume keys as regular keystrokes. And: sysctl hw.kbdvolume=1 to revert to the default behavior (ie adjust the volume). -- Alexandre --- sys/dev/wscons/wskbd.c.orig Tue Apr 29 22:54:12 2014 +++ sys/dev/wscons/wskbd.c Tue Apr 29 22:54:26 2014 @@ -299,6 +299,7 @@ void wskbd_update_layout(struct wskbd_internal *, kbd_ #if NAUDIO > 0 extern int wskbd_set_mixervolume(long, long); #endif +extern int kbdvolume; /* see sys/kern/kern_sysctl.c */ void wskbd_update_layout(struct wskbd_internal *id, kbd_t enc) @@ -706,6 +707,8 @@ wskbd_input(struct device *dev, u_int type, int value) int wskbd_volkey(struct device *dev, u_int type, int key) { + if (!kbdvolume) + return 0; switch (key) { case 160: #if NAUDIO > 0 --- sys/sys/sysctl.h.orig Tue Apr 29 22:54:12 2014 +++ sys/sys/sysctl.h Tue Apr 29 22:54:26 2014 @@ -798,7 +798,8 @@ struct kinfo_file { #define HW_USERMEM64 20 /* quad: non-kernel memory */ #define HW_NCPUFOUND 21 /* int: number of cpus found*/ #define HW_ALLOWPOWERDOWN 22 /* allow power button shutdown */ -#define HW_MAXID 23 /* number of valid hw ids */ +#define HW_KBDVOLUME 23 /* volume keys adjust volume */ +#define HW_MAXID 24 /* number of valid hw ids */ #define CTL_HW_NAMES { \ { 0, 0 }, \ @@ -824,6 +825,7 @@ struct kinfo_file { { "usermem", CTLTYPE_QUAD }, \ { "ncpufound", CTLTYPE_INT }, \ { "allowpowerdown", CTLTYPE_INT }, \ + { "kbdvolume", CTLTYPE_INT }, \ } /* --- sys/kern/kern_sysctl.c.orig Tue Apr 29 22:54:12 2014 +++ sys/kern/kern_sysctl.c Tue Apr 29 22:54:26 2014 @@ -612,6 +612,7 @@ kern_sysctl(int *name, u_int namelen, void *oldp, size */ char *hw_vendor, *hw_prod, *hw_uuid, *hw_serial, *hw_ver; int allowpowerdown = 1; +int kbdvolume = 1; int hw_sysctl(int *name, u_int namelen, void *oldp, size_t *oldlenp, void *newp, @@ -723,6 +724,11 @@ hw_sysctl(int *name, u_int namelen, void *oldp, size_t allowpowerdown)); return (sysctl_int(oldp, oldlenp, newp, newlen, &allowpowerdown)); +#ifndef SMALL_KERNEL + case HW_KBDVOLUME: + return (sysctl_int(oldp, oldlenp, newp, newlen, + &kbdvolume)); +#endif default: return (EOPNOTSUPP); }