#110 (Toumas) - I no longer experience this problem when running 20.10
with the latest kernel and the latest Dell firmware update (fwupdmgr
works reasonably well, but you can also just download the firmware file
from Dell, put it on a USB dok and the preboot screen lets you apply it
directly - no MS-Windows needed).

That being said, when I had the most serious problems, the small script
attached below would take care of things semi-automatically or
automatically (follow step 4 in the header doc for completely automated
recovery - when the dock crashes, wait a few seconds and it'll auto
recover).


#!/bin/bash

### Installation Instructions:
# 1. Install file into `/usr/local/bin/reset-tb`
#
# 2. Optional: allow password less sudo by creating a file 
`/etc/sudoers.d/allow-reset-tb` with the following content:
# ----8<-----
# <your username> ALL = NOPASSWD: /usr/local/bin/reset-tb
# ----8<-----
# 
# 3. Optional: allow easy access from the menu by creating a file 
`$HOME/.local/share/applications/Reset Thunderbolt.desktop` with the following 
content:
# ----8<-----
# [Desktop Entry]
# Exec=bash -c 'sudo -S /usr/local/bin/reset-tb'
# Icon=amarok_playlist_refresh
# Name=Reset Thunderbolt
# NoDisplay=false
# StartupNotify=false
# ----8<-----
#
# 4. Optional: run a service to automatically trigger the reset and send you an 
email when "unknown event type 15" error is detected, by setting your email
# in this file below, then creating a file 
`/etc/systemd/system/auto-reset-tb.service` with the following content:
# ----8<-----
# [Unit]
# Description=Automatically reset XHCI USB bus when detecting a Thunderbolt 
dock error
# [Service]
# ExecStart=/usr/local/bin/reset-tb -l
# [Install]
# WantedBy=multi-user.target
# ----8<-----
# Then run:
# ```
# sudo systemctl daemon-reload
# sudo systemctl enable auto-reset-tb
# sudo systemctl start auto-reset-tb
# ```

EMAIL=o...@geek.co.il
SUBJECT="Detected Thunderbolt error in your system"
MESSAGE="
Check the logs, please.
"

function do_reset() {
        tbtid="$(ls /sys/bus/pci/drivers/xhci_hcd/ | grep '[0-9]' | tail -n1)"
        echo "Resetting thunderbolt bus">&2
        for id in $tbtid; do
                echo -n $id > /sys/bus/pci/drivers/xhci_hcd/unbind
        done
        sleep 1
        for id in $tbtid; do
                echo -n $id > /sys/bus/pci/drivers/xhci_hcd/bind
        done
        echo "Done resetting thunderbolt bus" >&2
}

function listen_for_reset() {
        dmesg -w | while read line; do
                [[ "$line" =~ "xHCI host controller not responding, assume 
dead" ]] || continue
                (
                        sleep 15 # let the busses settle
                        do_reset
                        sleep 90 # don't reset too much
                )&
                mail -s "$SUBJECT" $EMAIL <<< "$MESSAGE Date: $(date -R)"
        done
}

[ "$1" == "-l" ] && listen_for_reset || do_reset

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1766076

Title:
  USB over thunderbolt turns off every once in a while

To manage notifications about this bug go to:
https://bugs.launchpad.net/dell-sputnik/+bug/1766076/+subscriptions

-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to