Comment 41 for bug 271706

Revision history for this message
jetdog (slicksterdave) wrote : Re: Volume control wheel on laptop is sticking in ubuntu

@ktemkin:

Okay, got something you might enjoy besides more confusion:

Just writing
+ if(ev->code == KEY_VOLUMEDOWN || ev->code == KEY_VOLUMEUP)
+ return;

Unfortunately seems to result in no keyevents for the volume up/down buttons at all (R4000) , as indicated by xev.

I think you original modification was more correct with this:

 if(ev->code == KEY_VOLUMEDOWN || ev->code == KEY_VOLUMEUP)
    {
 //post a keydown and then a keyup, as media keys have no automatic key-up
 xf86PostKeyboardEvent(pInfo->dev, code, 1);
 xf86PostKeyboardEvent(pInfo->dev, code, 0);
 return;
    }

Also, I suggest a slightly improved version of this, because this modification will apply for all xf86-input-evdev generated events (so for people whom have two keyboards with volume buttons, one working, one quirky, we would be throwing volume "up then down" events (as per above), for keyboards that successfully have the "volume key release" event correctly implemented. To fix such, I suggest the following:

+ if (ev->code == KEY_VOLUMEDOWN || ev->code == KEY_VOLUMEUP) {
+ if (value) {
+ xf86PostKeyboardEvent(pInfo->dev, code, 1);
+ xf86PostKeyboardEvent(pInfo->dev, code, 0);
+ }
+ return;
+ }
+

^ ^ if my understanding of "value" is correct, one that evaluates to true should mean a "keydown" event -- this way, a working keyboard that correctly implements "volume key release" will not generate an extra "up then down" when we release a volume key on a working keyboard (and yes, some of us use 2, if not 3 keyboards xD)

Keep in mind that although this DOES stop the auto-repeat symptoms for our events within the xf86-input-evdev driver (as you said earlier). I'm not convinced that this is the source of the problem, and would thus classify this as a "hack-fix" to relieve symptoms. (see my next comment)