Project:

Linux Quirks

  • Fixing nvidia backlight in 2015: on Linux 3.13

    22 September 2015Post 1 of 5 in Linux Quirks

    I’m running Linux Mint 17.1 with Linux 3.13.0. I recently upgraded my nvidia driver to nvidia-346, and my backlight control broke (again!). We’ve been on the backlight merry-go-round for far too long.

    Anyway, here’s a fix that might help. There’s a new kernel flag you can add to your grub file called video.use_native_backlight.

    Let’s get started: open your grub config file at

    /etc/default/grub

    And append the video.use_native_backlight parameter to your boot options:

    GRUB_CMDLINE_LINUX_DEFAULT="quiet splash video.use_native_backlight=1"

    Now update your grub installation by running update-grub as superuser.

    My boot parameters used to include the classic acpi_backlight=vendor, but it looks like the nvidia-346 driver doesn’t handle that option as the older drivers did. Hopefully this will help you! (For reference, I’m on a ThinkPad T420)

    Thanks to https://jamielinux.com/blog/cannot-adjust-screen-brightness-on-fedora/ for the tip. I’m mainly reposting this so it will include the words “Linux Mint” and “T420” for wayward backlight-deprived souls.

  • Fixing nvidia Backlight in 2016: Linux 4.4 with nvidia-361

    15 August 2016Post 2 of 5 in Linux Quirks

    It seems we have reached a new epoch in the Linux backlight stuggle: today, I upgraded my T420 to Linux Mint 18, and the backlight again stopped working (as expected). I did the usual, which is to add "video.use_native_backlight=1" to my GRUB boot options.

    To my dismay, the backlight controls still didn’t work. After trying various drivers, all of the possible ACPI kernel command-line options, and various commands to set the backlight brightness directly from the terminal, it occurred to me that nvidia has been working on Linux support for Optimus, and their new drivers include that support.

    As a last resort, I re-enabled Optimus in my T420 BIOS settings, and removed all of my modifications to the stock Linux Mint 18 grub file. To my great surprise and immense relief, the system Just Works. I’m happy to say that it goes to sleep, wakes up, and adjusts backlight brightness with no issues.

    At last, after a solid five years of workarounds, my T420 shines as brightly as I want it to shine. Thanks to nvidia for all the vast improvements to their Linux driver, and to all the members of the Linux community who researched and shared their ideas for fixing backlight problems.

  • Thoughts on the Dell Precision m5510

    1 January 2017Post 3 of 5 in Linux Quirks

    I just upgraded my Thinkpad T420 to a new Dell Precision m5510, the 15-inch Developer Edition laptop. In one word, it’s awesome. It ships with Ubuntu installed by default and Dell has done great work getting the support for this hardware into the mainline Linux kernel.

    I got the 5510 with the following options:

    • Core i5-6300HQ @ 2.3 GHz
    • 16 GB RAM
    • 1920x1080 matte display
    • 1TB NVMe M.2 SSD
    • 84 Wh battery

    Originally, I was aiming to migrate my 2.5” SSD from the T420 to the 5510, but I noticed that I could omit the 2.5” drive and fill the drive bay with a larger battery. Battery life is one of my top priorities, so I opted for the 84 Wh battery (up from 54 Wh) and bought the NVMe SSD. The NVMe SSD is super fast!

    Of course, I can’t just start using the laptop without making some tweaks :) Here’s what I did to get the software all set up.

    1. Install Linux Mint

    The system ships with Ubuntu, but I prefer Linux Mint, so my first step was to install Mint. I’m running Mint 18.1 with Cinnamon, kernel 4.4.0-57-generic.

    2. Set up graphics

    The 5510 comes with an Nivida Quadro M1000M connected to the CPU with Optimus. The T420 also shipped with Optimus. Fortunately, configuring the graphics is way easier than it used to be!

    This step was super easy: I opened the driver manager and installed nvidia-367. The manager also installs nvidia-prime. After a reboot, Optimus is working flawlessly. I can toggle between nvidia and intel GPUs and the graphics are stable and the backlight works. Excellent!

    I see a little bit of tearing when I scroll, for example in web browsers. I’ve had tearing before, and I’m not yet sure what causes it here, but it’s minor and fixing it isn’t my top priority right now.

    3. Adjust the touchpad

    At this point, things are working great. So far, this is the easiest Linux setup I’ve had. However, this laptop has a larger touchpad than does the T420, large enough that my hands touch it while I type.

    The Dell developers brought us the designware i2c driver for this touchpad, so it’s working better than it did when the 5510 first came out as the developer edition machine. It looks like the driver handles palm rejection, because adjusting palm rejection settings in synclient does not affect the touchpad, and evtest does not see palm touch events at all, which suggests that the driver filters out palm touches.

    However, palm rejection alone isn’t quite enough to keep out spurious touch events: when I type, my thumbs hit the top of the touchpad when I press the spacebar, and the base of my right thumb rests on the right edge of the trackpad. To filter out these touches, I disabled touch-to-click, and added a dead zone to the top and right margins of the touchpad using synclient, the Synaptics touchpad driver configuration client.

    Disable touch-to-click

    First, I simply disabled touch-to-click. The trackpad had a physical button under it, and using this button alone to register clicks is already less prone to noise than using touches to click as well.

    Add dead zones

    The synaptics touchpad driver offers some customization options for the trackpad.

    Disable psmouse

    The psmouse kernel module interferes with the synaptics driver. I blacklisted it by adding the following line to /etc/modprobe.d/blacklist.conf:

    blacklist psmouse

    Then I ran update-initramfs -u to update the kernel image.

    Configure the synaptics options

    The parameters of interest are AreaRightEdge, which controls the dead zone on the right side, and AreaTopEdge, which controls the dead zone at the top. Note that the trackpad is still active in these “dead zones,” but it will ignore touches that start there. It only responds to touches that start out of the dead zone and cross into it.

    To experiment with different options, run synclient and pass in one of these at a time, like so:

    synclient AreaTopEdge=150

    You can monitor what coordinates your trackpad is seeing with evtest, which dumps the raw input events. You’ll need the input device number of your trackpad to use evtest. Run xinput to get a list of input devices with their IDs:

    xinput
    ⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
    ⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
    ⎜   ↳ DLL06E5:01 06CB:7A13 Touchpad           	id=12	[slave  pointer  (2)]
    ⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]
    ↳ Power Button                            	id=6	[slave  keyboard (3)]
    ↳ Video Bus                               	id=7	[slave  keyboard (3)]
    ↳ Video Bus                               	id=8	[slave  keyboard (3)]
    ↳ Power Button                            	id=9	[slave  keyboard (3)]
    ↳ Sleep Button                            	id=10	[slave  keyboard (3)]
    ↳ Integrated_Webcam_HD                    	id=11	[slave  keyboard (3)]
    ↳ Intel HID events                        	id=13	[slave  keyboard (3)]
    ↳ AT Translated Set 2 keyboard            	id=14	[slave  keyboard (3)]
    ↳ Dell WMI hotkeys

    My dell touchpad is the DLL06E5:01, which is at /dev/input/event15. Run evtest on it to see the raw events:

    sudo evtest /dev/input/event15

    These raw events will give you an idea of the coordinates on the trackpad. Once I found synclient parameters that I like, I had to make the changes persist. I created a .xprofile file in my home directory with the following synclient commands:

    synclient AreaRightEdge=1000
    synclient AreaTopEdge=150

    There are lots of other synclient options to play with, but these two changes make typing way better. Now I don’t get any trackpad interference while I type!

    I noticed that there may be a way to get more gesture support on the trackpad, but I haven’t tried it yet.

    4. Disable Bluetooth LE to pair with Bose QC 35

    I was to use my new laptop with Bose QuietComfort 35 headphones, which use Bluetooth LE (low energy) to pair with the host. Unfortunately, it looks like Linux’s BlueZ doesn’t support that pairing strategy yet, so in order to pair the QC 35s, I had to disable the BLE mode for my laptop’s Bluetooth adapter.

    In /etc/bluetooth/main.conf, I changed

    # ControllerMode = dual

    to

    ControllerMode = bredr

    Then I restarted bluetooth with sudo service bluetooth restart.

    Thanks to Victor over on AskUbuntu for these steps.

    5. Fix the tearing

    It took me some time to get around to working on the tearing issue. I usually use the Intel graphics card, and Firefox was tearing badly on scroll and when playing video. I discovered an issue on GitHub relevant to my setup and tried what they recommend, which is to remove the xserver-xorg-video-intel package. Now the tearing is gone. There’s another possible fix specific to Firefox, but as far as I’m concerned removing a package to fix an issue is preferable unless I see stability or power-consumption side effects.

    Stability

    The new laptop is stable so far, except for a crash I experienced yesterday. The laptop froze and dmesg revealed that NVMe, the storage controller, had an error. The system failed into read-only mode and I restarted it (luckily, I have a photo of the logs, because the drive became read-only).

    I wanted to check the S.M.A.R.T. attributes for the drive, but NVMe support for disk-monitoring tools is relatively new in Linux, so I had to build smartctl from source, using the configuration option --with-nvme-devicescan. The output showed everything okay:

    sudo smartctl -x -d nvme /dev/nvme0
    
    smartctl 6.5 2016-05-07 r4318 [x86_64-linux-4.4.0-57-generic] (local build)
    Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org
    
    === START OF INFORMATION SECTION ===
    Model Number:                       THNSN51T02DUK NVMe TOSHIBA 1024GB
    Serial Number:                      966S10FGT1BT
    Firmware Version:                   5KDA4101
    PCI Vendor/Subsystem ID:            0x1179
    IEEE OUI Identifier:                0x00080d
    Controller ID:                      0
    Number of Namespaces:               1
    Namespace 1 Size/Capacity:          1,024,209,543,168 [1.02 TB]
    Namespace 1 Formatted LBA Size:     512
    Local Time is:                      Sun Jan  1 17:46:20 2017 EST
    Firmware Updates (0x02):            1 Slot
    Optional Admin Commands (0x0017):   Security Format Frmw_DL *Other*
    Optional NVM Commands (0x001e):     Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat
    Warning  Comp. Temp. Threshold:     78 Celsius
    Critical Comp. Temp. Threshold:     82 Celsius
    
    Supported Power States
    St Op     Max   Active     Idle   RL RT WL WT  Ent_Lat  Ex_Lat
    0 +     6.00W       -        -    0  0  0  0        0       0
    1 +     2.40W       -        -    1  1  1  1        0       0
    2 +     1.90W       -        -    2  2  2  2        0       0
    3 -   0.0120W       -        -    3  3  3  3     5000   25000
    4 -   0.0060W       -        -    4  4  4  4   100000   80000
    
    Supported LBA Sizes (NSID 0x1)
    Id Fmt  Data  Metadt  Rel_Perf
    0 +     512       0         2
    1 -    4096       0         1
    
    === START OF SMART DATA SECTION ===
    SMART overall-health self-assessment test result: PASSED
    
    SMART/Health Information (NVMe Log 0x02, NSID 0xffffffff)
    Critical Warning:                   0x00
    Temperature:                        36 Celsius
    Available Spare:                    100%
    Available Spare Threshold:          50%
    Percentage Used:                    0%
    Data Units Read:                    172,363 [88.2 GB]
    Data Units Written:                 579,378 [296 GB]
    Host Read Commands:                 3,566,794
    Host Write Commands:                10,514,861
    Controller Busy Time:               16
    Power Cycles:                       60
    Power On Hours:                     38
    Unsafe Shutdowns:                   19
    Media and Data Integrity Errors:    0
    Error Information Log Entries:      0
    Warning  Comp. Temperature Time:    0
    Critical Comp. Temperature Time:    0
    Temperature Sensor 1:               36 Celsius
    
    Error Information (NVMe Log 0x01, max 128 entries)
    No Errors Logged

    We’ll see how the drive holds up; hopefully this error was a minor software issue and not a hardware fault.

    Update 5 Jan 2017

    The NVMe crash returned once a day for a total of three crashes. I contacted Dell support and they were incredibly responsive. The technician came to my house the next day and replaced the SSD and motherboard on my laptop. So far, so good. Ideally, there would be no problem to begin with, but the service has been a great experience.

    Dell Precision 5510 repair

    Dell Precision 5510 internals

    The new SSD is a made by Lite-on instead of Toshiba. The motherboard is indistinguishable from the old one, and it comes with a new CPU and GPU.

  • ACTUALLY WORKING LINUX TOUCHPAD

    29 July 2020Post 4 of 5 in Linux Quirks

    Remember my post about the Dell Precision 5510? I dwelled quite a while on how to adjust the touchpad to something even slightly workable, to defend against stray taps. My “solution” was to add a deadzone to the top and right of the pad so touches starting there wouldn’t register as mouse movement.

    That solution was always a hack, and I finally decided to pursue a real fix again. I am delighted, thrilled, positively floored to report that good touchpad support is here for Linux in the form of libinput drivers.

    I just upgraded to Linux Mint 20, and noticed that my touchpad was behaving weirdly again. After a deep dive into the touchpad forum rabbit hole, here’s what I learned:

    • My laptop is using libinput for mouse support
    • libinput should support good palm rejection

    But, there’s a twist! Check out the Linux Mint 20 release notes, specifically the “Touchpad drivers” section:

    The default touchpad driver in this edition is “libinput” (provided by the xserver-xorg-input-libinput package). […] When both drivers are installed, “synaptics” takes priority.

    Searching my selected packages for “synaptics,” I found that somehow I had xserver-xorg-input-synaptics installed! Removing this package and logging in again is all it took to get amazing, MacBook-level touchpad support.

    synaptics package

    So, here it is: if you’re running a new Ubuntu-flavored distro, make sure you know which input driver you’re using!

  • Fixing Thunderbolt USB Dock for Dell Precision 5510

    30 November 2023Post 5 of 5 in Linux Quirks

    I bought a Thunderbolt dock, the Dell WD22TB4. As the name hints, this dock came out in 2022 and sports Thunderbolt 4, while my Precision 5510 laptop from 2017 has Thunderbolt 3. Fortunately, like USB, Thunderbolt is backwards-compatible, so this dock should work with my laptop. I used the same dock with a work laptop, a five-generations-newer Precision 5560 also running Linux, and it worked great, delivering smooth 4K60 video and USB ports.

    Unfortunately, while my Precision 5510 could charge from the dock and pass video through it, it couldn’t use the USB ports. This incompatibility was just minor enough for me to keep using the new dock with its better video bitrate even while having to plug USB devices into the laptop directly again, a step backwards in convience compared to the previous USB-C dock with its worse video framerate. Thus began a months-long albeit intermittent search for the problem, and I am happy to report I found the solution!

    TLDR: The Precision 5510’s Thunderbolt firmware is buggy, and updating it fixes the USB port issues on Linux. I found the latest firmware on LVFS, installed it with fwupdmgr, and now the USB ports on my dock work great! Here are the steps to do the same:

    1. Identify the version of Thunderbolt controller firmware on your Precision 5510:

        > fwupdmgr get-devices
      
        Precision 5510
        │
        └─Thunderbolt host controller:
              Device ID:          cfad6899e91b587ba93beb78d57bae8001bd305b
              Summary:            Unmatched performance for high-speed I/O
              Current version:    12.00
              Vendor:             Dell (THUNDERBOLT:0x00D4, TBT:0x00D4)
              Update State:       Success
              GUIDs:              febe4287-5bce-5310-a1d4-32ed973cd977
                                  351e2f41-8007-59d6-8dc8-1a00a83e8ea5
                                  17c9727e-0343-5eb3-bd40-c54b1ed85e27
                                  4b0fa34e-5dd2-5ee0-9112-94e951a74823
              Device Flags:       • Internal device
                                  • Updatable
                                  • System requires external power source
                                  • Device stages updates
                                  • Signed Payload

      That Thunderbolt host controller is the part responsible for handling Thunderbolt peripheral connections. Notice that it’s version 12.00? The current version is actually supposed to be 16!

    2. Download the firmware from LVFS. Dell distributes their official firmware images for Linux through LVFS. At the time of writing, this was the latest version. It has a filename like 8FDJ2_NVM16.00.cab.

    3. Install the firmware with fwupdmgr:

      > fwupdmgr install 8FDJ2_NVM16.00.cab

      fwupdmgr will automatically unpack this CAB file, find the appropriate device to apply it to, install it, and restart the Thunderbolt controller.


    That’s it! After months of searching for a problem in the Linux kernel, looking through the Arch forums, StackOverflow, UbuntuForums, and AskUbuntu, it turns out that Linux wasn’t the issue at all.

    This laptop came out early in the Thunderbolt 3 days, when Linux support for Thunderbolt was just getting started and even support on Windows was hit or miss. Since then, Thunderbolt drivers on Linux have come a long way, and the experience is generally excellent for simple things like a USB dock.

    Thunderbolt is such a complex interface that it feels like we are in a new era of hardware-software abstraction leaks, where it’s harder than ever to trust drivers for formerly-basic peripherals. Because Thunderbolt exposes a whole PCI bus to the outside world, there are tons of new edge cases, many of which seem to happen in the firmware. The mere capability to update the firmware in the Thunderbolt controller feels like a hint that there will be issues, a concession to not getting it just right the first time around.

    In contrast to something like USB, where the controller chip either does its job or you toss it out and find a new one, Thunderbolt controllers offer some sliding scale of capability and compatibility that requires much deeper analysis, with debugging tools that I don’t have, and updating the firmware can change those capabilities.

    Hopefully, as support for Thunderbolt matures and the edge cases are better understood, using Thunderbolt will be entirely mundane. Maybe on newever hardware like the Precision 5560 I used, we’re already in that future. In the meantime, getting Thunderbolt working on this old laptop was an excercise in archaeology, because the firmware of the Thunderbolt controller lies outside the reach of kernel patches and doesn’t benefit from the regular updates to the rest of my OS.