NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/56738: ukbd(4): PMFE_AUDIO_VOLUME* event issue, Xorg KeyPress events ...



The following reply was made to PR kern/56738; it has been noted by GNATS.

From: Anthony Mallet <anthony.mallet%laas.fr@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: 
Subject: Re: kern/56738: ukbd(4): PMFE_AUDIO_VOLUME* event issue, Xorg KeyPress events ...
Date: Fri, 4 Mar 2022 18:44:38 +0100

 To keep it simple, I just added a defflag
 UKBD_NO_PMF_AUDIO_EVENTS. Please ignore the previous patch and
 consider just this one.
 
 . If UKBD_NO_PMF_AUDIO_EVENTS is defined, no PMF event are generated for
   audio related keys: ukbd generates normal key press events. This is
   limited to audio events, because there are no USB scancode defined
   for other kind of events (e.g. display brightness).
 
 . If not defined, previous behaviour is retained (with the
   pmf_event_inject fix that makes it actually work for me).
 
 While here, I simplified a bit the translations for 'apple_fn' and
 'gdium_fn': the F[3-5] keys are mapped to the normal USB scancode for
 audio keys. They are in turn translated to PMF event by the 'generic'
 translation table, if enabled.
 
 
 Index: sys/dev/usb/files.usb
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/files.usb,v
 retrieving revision 1.177
 diff -u -r1.177 files.usb
 --- sys/dev/usb/files.usb	29 Jun 2021 10:22:37 -0000	1.177
 +++ sys/dev/usb/files.usb	4 Mar 2022 17:39:38 -0000
 @@ -156,6 +156,7 @@
  
  # Keyboards
  defparam	UKBD_LAYOUT
 +defflag		opt_ukbd.h	UKBD_NO_PMF_AUDIO_EVENTS
  # Gdium's Fn key needs software translation
  defflag		opt_ukbd.h 	GDIUM_KEYBOARD_HACK
  device	ukbd: hid, wskbddev
 Index: sys/dev/usb/ukbd.c
 ===================================================================
 RCS file: /cvsroot/src/sys/dev/usb/ukbd.c,v
 retrieving revision 1.153
 diff -u -r1.153 ukbd.c
 --- sys/dev/usb/ukbd.c	11 Oct 2021 00:00:03 -0000	1.153
 +++ sys/dev/usb/ukbd.c	4 Mar 2022 17:39:38 -0000
 @@ -124,9 +124,9 @@
  	{ 0x38, 0x57 },	/* / -> KP + */
  	{ 0x3a, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_DOWN },
  	{ 0x3b, IS_PMF | PMFE_DISPLAY_BRIGHTNESS_UP },
 -	{ 0x3c, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
 -	{ 0x3d, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 -	{ 0x3e, IS_PMF | PMFE_AUDIO_VOLUME_UP },
 +	{ 0x3c, 0x7f }, /* F3 -> Keyboard Mute */
 +	{ 0x3d, 0x80 }, /* F4 -> Keyboard Volume Up */
 +	{ 0x3e, 0x81 }, /* F5 -> Keyboard Volume Down */
  	{ 0x3f, 0xd6 },	/* num lock */
  	{ 0x40, 0xd7 },
  	{ 0x41, IS_PMF | PMFE_KEYBOARD_BRIGHTNESS_TOGGLE },
 @@ -154,9 +154,9 @@
  	{ 58, 0 },	/* F1 -> toggle camera */
  	{ 59, 0 },	/* F2 -> toggle wireless */
  #endif
 -	{ 60, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
 -	{ 61, IS_PMF | PMFE_AUDIO_VOLUME_UP },
 -	{ 62, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 +	{ 60, 0x7f },	/* F3 -> Keyboard Mute */
 +	{ 61, 0x80 },	/* F4 -> Keyboard Volume Up */
 +	{ 62, 0x81 },	/* F5 -> Keyboard Volume Down */
  #ifdef notyet
  	{ 63, 0 },	/* F6 -> toggle ext. video */
  	{ 64, 0 },	/* F7 -> toggle mouse */
 @@ -177,9 +177,11 @@
  #endif
  
  Static const struct ukbd_keycodetrans trtab_generic[] = {
 +#ifndef UKBD_NO_PMF_AUDIO_EVENTS
  	{ 0x7f, IS_PMF | PMFE_AUDIO_VOLUME_TOGGLE },
  	{ 0x80, IS_PMF | PMFE_AUDIO_VOLUME_UP },
  	{ 0x81, IS_PMF | PMFE_AUDIO_VOLUME_DOWN },
 +#endif
  	{ 0x00, 0x00 }
  };
  
 @@ -595,7 +597,7 @@
  				if (tp->from == i) {
  					if (tp->to & IS_PMF) {
  						pmf_event_inject(
 -						    sc->sc_hdev.sc_dev,
 +						    NULL,
  						    tp->to & 0xff);
  					} else
  						setbit(ud->keys, tp->to);
 Index: share/man/man4/ukbd.4
 ===================================================================
 RCS file: /cvsroot/src/share/man/man4/ukbd.4,v
 retrieving revision 1.11
 diff -u -r1.11 ukbd.4
 --- share/man/man4/ukbd.4	30 Apr 2008 13:10:54 -0000	1.11
 +++ share/man/man4/ukbd.4	4 Mar 2022 17:39:38 -0000
 @@ -36,6 +36,8 @@
  .Sh SYNOPSIS
  .Cd "ukbd*  at uhidev? reportid ?"
  .Cd "wskbd* at ukbd? console ?"
 +.Pp
 +.Cd "options UKBD_NO_PMF_AUDIO_EVENTS"
  .Sh DESCRIPTION
  The
  .Nm
 


Home | Main Index | Thread Index | Old Index