Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 538428 - x11-drivers/nvidia-drivers with thinkpad_acpi hotkeys - ?
Summary: x11-drivers/nvidia-drivers with thinkpad_acpi hotkeys - ?
Status: RESOLVED WONTFIX
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Library (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Jeroen Roovers (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-02-01 12:19 UTC by haarp
Modified: 2015-02-01 12:37 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
Patch to prevent nvidia from modifying the hotkey file (thinkpad-hotkeys.patch,5.39 KB, patch)
2015-02-01 12:19 UTC, haarp
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description haarp 2015-02-01 12:19:04 UTC
Created attachment 395304 [details, diff]
Patch to prevent nvidia from modifying the hotkey file

The binary blob nvidia drivers mess with Thinkpad hotkeys, if the thinkpad_acpi module is loaded. There is absolutely no good reason this should happen. I can only imagine that they were tryng to mess with brightness hotkeys in some way or another, but they have no useful effect whatsoever on modern systems. They're simply writing a hardcoded bitmask (not even read-modify-write), with no regard for what the user might prefer, no regard for actually fixing bugs in thinkpad_acpi (should there even be any), and most importantly, no regard for bounds (A driver should not mess with an unrelated kernel module!)

They do this by writing the /proc/acpi/ibm/hotkey file. More info: http://forums.fedoraforum.org/showthread.php?t=277541

Since Nvidia doesn't seem to care and offers no sources, I've modified the driver binary. I have created a patch with that modification. It causes the driver to write an invalid value to /proc/acpi/ibm/hotkey, which gets rejected, thus preserving the hotkeys.

The "patch" is the common unified diff format, even though it applies to a binary file. It seems to apply to all recent driver versions flawlessly, but should that ever change, the following could also be used:

sed -i -e 's/0xffbf/      /' nvidia_drv.so
Comment 1 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-01 12:23:32 UTC
Comment on attachment 395304 [details, diff]
Patch to prevent nvidia from modifying the hotkey file

Please mind your language.
Comment 2 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-01 12:27:08 UTC
For the 346.35 driver[1]:

 * Fixed a bug that caused the ACPI hotkey mask to be set incorrectly on some laptops even when the EnableACPIHotkeys option is disabled.
 * Disabled the EnableACPIHotkeys option by default.  This option is now considered deprecated and will be removed in a future driver release. On modern Linux systems, display change hotkey events are delivered to the desktop environment as key press events, and the desktop environment handles the display change by issuing requests through the X Resize and Rotate extension (RandR).


[1] http://www.nvidia.com/download/driverResults.aspx/81252/en-us
Comment 3 Jeroen Roovers (RETIRED) gentoo-dev 2015-02-01 12:32:11 UTC
Additionally, it appears you can disable this quite easily[1]:


   Option "EnableACPIHotkeys" "boolean"

           When this option is enabled, the NVIDIA Linux X driver will detect
           mobile display change hotkey events through ACPI. When disabled,
           the Linux kernel usually translates these ACPI events into
           keyboard events that can be handled by a desktop environment.

           Note that X servers prior to X.Org xserver-1.2.0 (see "How do I
           interpret X server version numbers?") have a bug that cause the X
           server to crash when the X server receives an ACPI hotkey event
           (freedesktop.org bug 8776).

           When running on a mobile system, search for "ACPI display change
           hotkey events" in your X log to see the NVIDIA X driver's
           decision.

           This option is deprecated.

           Default: disabled



[1] </usr/share/doc/nvidia-drivers-346.35/html/xconfigoptions.html> Earlier versions support
    this option as well.
Comment 4 haarp 2015-02-01 12:37:06 UTC
Sorry about the swear word, I did not think the filename would show up here.

from comment #3)
> Additionally, it appears you can disable this quite easily[1]:
> 
> 
>    Option "EnableACPIHotkeys" "boolean"
> 
>            When this option is enabled, the NVIDIA Linux X driver will detect
>            mobile display change hotkey events through ACPI. When disabled,
>            the Linux kernel usually translates these ACPI events into
>            keyboard events that can be handled by a desktop environment.
> 
>            Note that X servers prior to X.Org xserver-1.2.0 (see "How do I
>            interpret X server version numbers?") have a bug that cause the X
>            server to crash when the X server receives an ACPI hotkey event
>            (freedesktop.org bug 8776).
> 
>            When running on a mobile system, search for "ACPI display change
>            hotkey events" in your X log to see the NVIDIA X driver's
>            decision.
> 
>            This option is deprecated.
> 
>            Default: disabled
> 
> 
> 
> [1] </usr/share/doc/nvidia-drivers-346.35/html/xconfigoptions.html> Earlier
> versions support
>     this option as well.

That does not work, see http://forums.fedoraforum.org/showthread.php?t=277541:

> I tried using the Xorg options
> "ConnectToAcpid" "False"
> "EnableACPIHotkeys" "False"
> but those still let the nvidia module change the hotkey.


(In reply to Jeroen Roovers from comment #2)
> For the 346.35 driver[1]:
> 
>  * Fixed a bug that caused the ACPI hotkey mask to be set incorrectly on
> some laptops even when the EnableACPIHotkeys option is disabled.
>  * Disabled the EnableACPIHotkeys option by default.  This option is now
> considered deprecated and will be removed in a future driver release. On
> modern Linux systems, display change hotkey events are delivered to the
> desktop environment as key press events, and the desktop environment handles
> the display change by issuing requests through the X Resize and Rotate
> extension (RandR).
> 
> 
> [1] http://www.nvidia.com/download/driverResults.aspx/81252/en-us

Interesting, Nvidia actually fixed a bug for once? I've been running that patch for over a year now, must've missed that. Thanks, and sorry for bothering! :)