Skip to content

Instantly share code, notes, and snippets.

@SavageCore
Forked from cdleveille/Install⁄Update Xone
Last active May 2, 2024 23:18
Show Gist options
  • Star 60 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save SavageCore/263a3413532bc181c9bb215c8fe6c30d to your computer and use it in GitHub Desktop.
Save SavageCore/263a3413532bc181c9bb215c8fe6c30d to your computer and use it in GitHub Desktop.
Install or update xone driver for Steam Deck (desktop shortcut and bash script)

Enjoying this script? Consider buying me a beer/coffee!

ko-fi

First time setting up your Deck? You may enjoy my setup guide. It'll get you started on Emulation.

Improvements

Main changes at initial release versus cdleveille's original script:

  • Added zenity for a basic "GUI"
  • Added sudo check
  • Added various checks to prevent the script from redoing things that are already done
  • Ensure the module is loaded after install and on boot
  • Return steamos-readonly to its previous state after install

Installation

  1. Switch to Desktop mode
  2. Launch Konsole
  3. Run wget -O /tmp/bootstrap.sh https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/8cfbc292c4b55612a2ebea3227911a3c3a6ae214/bootstrap.sh && sh /tmp/bootstrap.sh

⚠ If you have problems during install please read the Notices below for a potential fix.

Pairing

You can enable and disable pairing mode from the included Desktop shortcuts, saving you from getting up and pressing that button!

After installation you may need to restart your Deck to get things working. Failing that try shutting down and waiting a minute before starting up again. Using the Desktop shortcut or command to enable pairing can also get things working.

echo 0 | sudo tee /sys/bus/usb/drivers/xone-dongle/*/pairing

Updating

  1. Switch to Desktop mode
  2. Click the Install/Update Xone icon on your desktop

Troubleshooting

  1. Switch to Desktop mode
  2. Click the Install/Update Xone (DEBUG) icon on your desktop
  3. Post a comment below with your issue and link to a gist/paste of the output or pop by Discord and leave a message in #xone-install-script

Changelog

0.8.0

  • Add shortcuts to the Desktop to enable / disable pairing mode on the adapter

0.7.13

  • Ensure local repo is "clean" so that git pull can correctly update.

0.7.12

  • When running as debug, force the drivers to reinstall
  • Debug output is less verbose. No need to see all the pacman keys.

0.7.11

  • Ensure old kernel headers are removed when the user has upgraded to 3.5. Found at Reddit, potential fix for some.

0.7.10

  • Fix driver reinstallation in non debug mode
  • Better linux header install/update handling

0.7.9

  • Reinstate checks to prevent driver reinstallation
  • Add a function to handle the base-devel package group installation - you should no longer see errors

0.7.8

  • Revert "steamos-readonly should always be disabled". This results in an already read write error needlessly.

0.7.7

  • Fix driver update checks
  • Fix modprobe check which resulted in script exiting when install did infact happen

0.7.6

  • Test version, didn't fix anything

0.7.5

  • steamos-readonly should always be disabled
  • Exit script if either driver module failed to install

0.7.4

  • Fix required packages installation. There may not have been an issue or it was debug mode only or I'm going mad.

0.7.3

  • Fix --populate commands not running

0.7.2

  • Fix installs on latest SteamOS (3.5.1)

0.7.1

  • Fix broken package installs/updates

0.7.0

Improve update process:

  • Only install required packages if they are not already installed
  • Update required packages if needed
  • Add xone installation function, skips if already installed

0.6.0

  • If the user has no sudo password, prompt for one and set it. This script should now work on first boot of a Deck without any previous steps taken.

0.5.2

  • Fix kernel installation - forgot to answer yes to the prompt...

0.5.1

  • Remove kernel headers installation from required packages as we now handle that in a dedicated step

0.5.0

  • Added support for SteamOS 3.5 - should now work on all SteamOS versions out of the box

0.4.0

  • Added xpad-noone to restore Xbox and Xbox 360 controller support. Now working with GP2040-CE devices!

0.3.0

  • Added --debug argument to show the output of every command, an additional desktop shortcut is also created for this

0.2.1

  • Implement basic semver comparison

0.2.0

  • Added auto update check

0.1.0

  • Initial release
#!/bin/bash
# Download the latest version of the script from the Gist
echo -e "\e[1mDownloading the latest version of the script...\e[0m"
echo ""
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/xone_install_or_update.sh?cachebust=dd?$(date +%s)" >~/xone_install_or_update.sh || {
echo "Failed to download xone_install_or_update.sh. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/xone.desktop?cachebust=dd?$(date +%s)" >~/Desktop/xone.desktop || {
echo "Failed to download xone.desktop. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/xone_debug.desktop?cachebust=dd?$(date +%s)" >~/Desktop/xone_debug.desktop || {
echo "Failed to download xone_debug.desktop. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/enable-pairing.desktop?cachebust=dd?$(date +%s)" >~/Desktop/enable-pairing.desktop || {
echo "Failed to download enable-pairing.desktop. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/disable-pairing.desktop?cachebust=dd?$(date +%s)" >~/Desktop/disable-pairing.desktop || {
echo "Failed to download disable-pairing.desktop. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
# Run the script
echo -e "\e[1mRunning the script...\e[0m"
echo ""
clear
chmod +x ~/xone_install_or_update.sh
exec bash ~/xone_install_or_update.sh
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=echo 0 | sudo tee /sys/bus/usb/drivers/xone-dongle/*/pairing
GenericName[en_US]=
GenericName=
Icon=preferences-desktop-gaming
MimeType=
Name[en_US]=Disable Pairing Mode
Name=Disable Pairing Mode
Path=
StartupNotify=false
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=echo 1 | sudo tee /sys/bus/usb/drivers/xone-dongle/*/pairing
GenericName[en_US]=
GenericName=
Icon=preferences-desktop-gaming
MimeType=
Name[en_US]=Enable Pairing Mode
Name=Enable Pairing Mode
Path=
StartupNotify=false
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=bash $HOME/xone_install_or_update.sh
GenericName[en_US]=
GenericName=
Icon=preferences-desktop-gaming
MimeType=
Name[en_US]=Install⁄Update Xone
Name=Install⁄Update Xone
Path=
StartupNotify=false
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
[Desktop Entry]
Comment[en_US]=
Comment=
Exec=bash $HOME/xone_install_or_update.sh --debug
GenericName[en_US]=
GenericName=
Icon=preferences-desktop-gaming
MimeType=
Name[en_US]=Install⁄Update Xone (DEBUG)
Name=Install⁄Update Xone (DEBUG)
Path=
StartupNotify=false
Terminal=true
TerminalOptions=
Type=Application
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
#!/bin/bash
# xone install or update script for SteamOS
# by cdleveille
# updated by SavageCore
#
# https://gist.github.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d
# Script version 0.8.0
# Set xone local repo location
XONE_LOCAL_REPO="/home/deck/repos/xone"
XPAD_NOONE_LOCAL_REPO="/home/deck/repos/xpad-noone"
# Set xone remote repo location
# dlundqvist is maintaining a fork that contains PRs that have not been merged into the main repo
# main repo: https://github.com/medusalix/xone
XONE_REMOTE_REPO="https://github.com/dlundqvist/xone"
XPAD_NOONE_REMOTE_REPO="https://github.com/medusalix/xpad-noone"
XPAD_NOONE_VERSION="1.0"
# DO NOT EDIT BELOW THIS LINE
KEEP_READ_ONLY="false"
REDIRECT=">/dev/null 2>&1"
DEBUG="false"
CURRENT_USER=$(whoami)
REQUIRED_PACKAGES=("curl" "wget" "git" "gcc" "cabextract" "dkms" "libisl" "libmpc")
# If --debug is passed as an argument, enable debug mode
if [[ "$1" == "--debug" ]]; then
REDIRECT=""
DEBUG="true"
fi
# compare_semver: Compare two Semantic Versioning (SemVer) strings.
# Usage: compare_semver <version1> <version2>
compare_semver() {
# Split version strings into major, minor, and patch segments.
ver1_major=$(echo "$1" | cut -d '.' -f 1)
ver1_minor=$(echo "$1" | cut -d '.' -f 2)
ver1_patch=$(echo "$1" | cut -d '.' -f 3)
ver2_major=$(echo "$2" | cut -d '.' -f 1)
ver2_minor=$(echo "$2" | cut -d '.' -f 2)
ver2_patch=$(echo "$2" | cut -d '.' -f 3)
# Compare major versions.
if [ "$ver1_major" -gt "$ver2_major" ]; then
echo "1"
return
elif [ "$ver1_major" -lt "$ver2_major" ]; then
echo "-1"
return
fi
# Compare minor versions.
if [ "$ver1_minor" -gt "$ver2_minor" ]; then
echo "1"
return
elif [ "$ver1_minor" -lt "$ver2_minor" ]; then
echo "-1"
return
fi
# Compare patch versions.
if [ "$ver1_patch" -gt "$ver2_patch" ]; then
echo "1"
return
elif [ "$ver1_patch" -lt "$ver2_patch" ]; then
echo "-1"
return
fi
# Versions are equal.
echo "0"
}
install_xone() {
if [ -n "$(dkms status xone)" ]; then
if [[ $DEBUG == "true" ]]; then
echo ""
echo "xone is already installed"
fi
return
fi
cd $XONE_LOCAL_REPO || {
echo "Failed to cd into xone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
echo -e "\e[1mInstalling xone...\e[0m"
echo ""
# Run the xone install and get-firmware scripts
eval sudo ./install.sh --release "$REDIRECT"
echo -e "\e[1mGetting xone firmware...\e[0m"
echo ""
eval sudo xone-get-firmware.sh --skip-disclaimer "$REDIRECT"
}
uninstall_xone() {
cd $XONE_LOCAL_REPO || {
echo "Failed to cd into xone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
# Run the xone uninstall script
eval sudo ./uninstall.sh "$REDIRECT"
}
install_xpad_noone() {
if [ -n "$(dkms status xpad-noone)" ]; then
if [[ $DEBUG == "true" ]]; then
echo "xpad-noone is already installed"
fi
return
fi
echo -e "\e[1mInstalling xpad-noone...\e[0m"
echo ""
eval sudo modprobe -r xpad "$REDIRECT"
eval sudo cp -r "$XPAD_NOONE_LOCAL_REPO" /usr/src/xpad-noone-$XPAD_NOONE_VERSION "$REDIRECT"
eval sudo dkms install -m xpad-noone -v $XPAD_NOONE_VERSION "$REDIRECT"
}
uninstall_xpad_noone() {
modules=$(lsmod | grep '^xpad_noone' | cut -d ' ' -f 1 | tr '\n' ' ')
version=$XPAD_NOONE_VERSION
if [ -n "$modules" ]; then
# shellcheck disable=SC2086
eval sudo modprobe -r -a $modules "$REDIRECT"
fi
if [ -n "$version" ]; then
eval sudo dkms remove -m xpad-noone -v "$version" --all "$REDIRECT"
sudo rm -rf "/usr/src/xpad-noone-$version"
else
echo 'Driver is not installed!'
fi
}
# Returns the SteamOS version
detect_os_version() {
version=$(cat /etc/*-release | grep VERSION_ID)
if [[ $version == *"3.5"* ]]; then
echo "3.5"
else
echo "3.4"
fi
}
# Install linux headers (if not already installed)
install_linux_headers() {
echo -e "\e[1mChecking for linux headers...\e[0m"
echo ""
version=$(detect_os_version)
kernel_headers="linux-neptune-headers"
# If SteamOS 3.5, use the new kernel headers package
if [[ $version == "3.5" ]]; then
kernel_headers="linux-neptune-61-headers"
# Ensure the SteamOS 3.4 kernel package (5.13) is uninstalled if installed
if pacman -Qs "linux-neptune-headers" >/dev/null; then
if [[ $DEBUG == "true" ]]; then
echo "Found old 3.4 kernel package - removing"
fi
sudo pacman -R linux-neptune-headers --noconfirm >/dev/null
fi
fi
if [[ $DEBUG == "true" ]]; then
echo "SteamOS $version detected using $kernel_headers package" "$REDIRECT"
fi
# Are the kernel headers already installed and up-to-date?
if pacman -Qs "$kernel_headers" >/dev/null && ! pacman -Qu "$kernel_headers" >/dev/null; then
if [[ $DEBUG == "true" ]]; then
echo "Headers are already installed and up to date"
fi
return
fi
# If the headers are not installed or need updating, install them
echo -e "\e[1mInstalling required kernel headers, this may take a while...\e[0m"
echo ""
eval sudo pacman -Sy "$kernel_headers" --noconfirm >/dev/null
}
install_base_devel() {
# Get list of base-devel packages
base_devel_packages=$(pacman -Sg base-devel | cut -d ' ' -f 2)
# Check if any of the base-devel packages are missing or need updating
for package in $base_devel_packages; do
if pacman -Qs "$package" >/dev/null; then
if pacman -Qu "$package" >/dev/null; then
packages_to_update+=("$package")
fi
else
packages_to_install+=("$package")
fi
done
}
install_pairing_shortcuts() {
# If the pairing shortcuts are already installed (on desktop), exit
if [ -f ~/Desktop/enable-pairing.desktop ] && [ -f ~/Desktop/disable-pairing.desktop ]; then
if [[ $DEBUG == "true" ]]; then
echo "Pairing shortcuts already installed"
fi
return
fi
# Download the pairing shortcuts
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/e98d6af5cba9ab4085b9e7f0c26cfd0b7c807c7d/enable-pairing.desktop?$(date +%s)" >~/Desktop/enable-pairing.desktop || {
echo "Failed to download enable-pairing.desktop."
}
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/e98d6af5cba9ab4085b9e7f0c26cfd0b7c807c7d/disable-pairing.desktop?$(date +%s)" >~/Desktop/disable-pairing.desktop || {
echo "Failed to download disable-pairing.desktop."
}
}
echo -e "\e[1mxone install script by SavageCore\e[0m"
echo -e "\e[1mhttps://gist.github.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d\e[0m"
echo "─────────────────────────────"
echo ""
echo "This script will install the xone and xpad-noone drivers for the Xbox wireless dongle and controller"
echo ""
# Check if script is up to date
CURRENT_VERSION=$(sed -n 's/^# Script version //p' "$0")
REQUIRED_VERSION=$(curl -s "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/xone_install_or_update.sh?$(date +%s)" | sed -n 's/^# Script version //p')
VERSION_DIFF=$(compare_semver "$CURRENT_VERSION" "$REQUIRED_VERSION")
# if [[ "$CURRENT_VERSION" != "$REQUIRED_VERSION" ]]; then
if [[ $VERSION_DIFF == -1 ]]; then
echo -e "\e[1mYou have an outdated version of the script. Updating...\e[0m"
echo ""
# Download the latest version of the script from the Gist
curl -sSf "https://gist.githubusercontent.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d/raw/xone_install_or_update.sh?cachebust=dd?$(date +%s)" >/tmp/xone_install_or_update.sh || {
echo "Failed to download the latest version of the script. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
# Preserve the current working directory and arguments
PWD=$(pwd)
ARGS="$@"
# Replace the current script with the new version
mv /tmp/xone_install_or_update.sh "$0"
read -n 1 -s -r -p "Press any key to relaunch the script..."
clear
# Re-run the script with the same environment variables and arguments
cd "$PWD" || {
echo "Failed to change directory. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
exec bash "$0" "$ARGS"
fi
# Does the user have a sudo password set?
# If not, prompt them to set one
if [ "$(passwd -S "$CURRENT_USER" | cut -d" " -f2)" != "P" ]; then
echo -e "\e[1mA sudo password is required, please enter one now to create it\e[0m"
PASSWORD=$(zenity --password --title="Password")
CONFIRM_PASSWORD=$(zenity --password --title="Confirm password")
# If the passwords don't match, exit
if [ "$PASSWORD" != "$CONFIRM_PASSWORD" ]; then
zenity --error --text="Passwords do not match\n\nExiting..." --title="Error"
exit 1
fi
{
echo -e "$PASSWORD\n$PASSWORD" | passwd
# Elevate with sudo
echo -e "$PASSWORD" | sudo -S echo "" "$REDIRECT"
} &>/dev/null
fi
# Check if the user has sudo privileges
# If not, prompt the user for a password
if ! sudo -n true 2>/dev/null; then
if ! zenity --password --title="Sudo password" | eval sudo -S echo "" "$REDIRECT"; then
zenity --error --text="Sorry, you need to have sudo privileges to run this script." --title="Error"
exit 1
fi
fi
# Rename fakeroot.conf to avoid error
if [ -f /etc/ld.so.conf.d/fakeroot.conf ]; then
sudo mv /etc/ld.so.conf.d/fakeroot.conf /etc/ld.so.conf.d/fakeroot.conf.bck
fi
# If output of `sudo steamos-readonly status` is "enabled", disable it
if [ "$(sudo steamos-readonly status)" == "enabled" ]; then
sudo steamos-readonly disable
KEEP_READ_ONLY="true"
fi
# If pacman-key is not initialised, initialise it
if ! eval pacman-key --list-keys >/dev/null 2>&1; then
echo -e "\e[1mInitialising pacman...\e[0m"
echo ""
sudo pacman-key --init
fi
echo "Refreshing pacman keys..."
# Always populate archlinux and holo keys, quick enough to do every time
# TODO: Only populate if not already populated
sudo pacman-key --populate archlinux holo >/dev/null 2>&1
# Install linux headers (if not already installed)
install_linux_headers
packages_to_install=()
packages_to_update=()
# Check if the required packages are installed and if they have updates
for package in "${REQUIRED_PACKAGES[@]}"; do
if pacman -Qs "$package" >/dev/null; then
if pacman -Qu "$package" >/dev/null; then
packages_to_update+=("$package")
fi
else
packages_to_install+=("$package")
fi
done
# Special case for base-devel, as it is a group, not a package
install_base_devel
# Are there any packages to install?
if [ ! ${#packages_to_install[@]} -eq 0 ]; then
# Install the packages
echo -e "\e[1mInstalling required packages, this may take a while...\e[0m"
echo ""
if [[ $DEBUG == "true" ]]; then
echo "Packages to install: ${packages_to_install[*]}"
fi
# Install the packages
for package in "${packages_to_install[@]}"; do
if [[ $DEBUG == "true" ]]; then
echo "Installing $package" "$REDIRECT"
fi
sudo pacman -S "$package" --noconfirm >/dev/null
done
fi
# Are there any packages to update?
if [ ! ${#packages_to_update[@]} -eq 0 ]; then
# Update the packages
echo -e "\e[1mUpdating required packages, this may take a while...\e[0m"
echo ""
if [[ $DEBUG == "true" ]]; then
echo "Packages to update: ${packages_to_update[*]}"
fi
# Update the packages
for package in "${packages_to_update[@]}"; do
if [[ $DEBUG == "true" ]]; then
echo "Updating $package" "$REDIRECT"
fi
sudo pacman -S "$package" --noconfirm >/dev/null
done
fi
if [ ${#packages_to_install[@]} -eq 0 ] && [ ${#packages_to_update[@]} -eq 0 ]; then
echo -e "\e[1mRequired packages installed and up to date\e[0m"
echo ""
fi
XONE_HAS_UPDATED=false
XPAD_HAS_UPDATED=false
# Does the xone local repo folder already exist?
if [ -d "$XONE_LOCAL_REPO" ]; then
# ...if yes, run the uninstall script, and pull down any new updates from the remote repo
echo -e "\e[1mChecking for xone updates...\e[0m"
echo ""
cd $XONE_LOCAL_REPO || {
echo "Failed to cd into xone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
# Ensure the repo is in a clean state for git pull
eval git reset --hard "$REDIRECT"
# Check for updates with git pull, and if there are updates, uninstall
git_output=$(eval git pull)
if [[ $git_output != *"Already up to date."* ]]; then
uninstall_xone
XPAD_HAS_UPDATED=true
else
echo "No updates available"
fi
else
# ...if not, clone the repo
echo -e "\e[1mCloning xone repo...\e[0m"
echo ""
eval git clone $XONE_REMOTE_REPO $XONE_LOCAL_REPO "$REDIRECT"
cd $XONE_LOCAL_REPO || {
echo "Failed to clone xone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
fi
# Does the xpad-noone local repo folder already exist?
if [ -d "$XPAD_NOONE_LOCAL_REPO" ]; then
# ...if yes, run the uninstall script, and pull down any new updates from the remote repo
echo -e "\e[1mChecking for xpad-noone updates...\e[0m"
echo ""
cd $XPAD_NOONE_LOCAL_REPO || {
echo "Failed to cd into xpad-noone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
# Ensure the repo is in a clean state for git pull
eval git reset --hard "$REDIRECT"
# Check for updates with git pull, and if there are updates, uninstall
git_output=$(eval git pull)
if [[ $git_output != *"Already up to date."* ]]; then
uninstall_xpad_noone
XPAD_HAS_UPDATED=true
else
echo "No updates available"
fi
else
# ...if not, clone the repo
echo -e "\e[1mCloning xpad-noone repo...\e[0m"
echo ""
eval git clone $XPAD_NOONE_REMOTE_REPO $XPAD_NOONE_LOCAL_REPO "$REDIRECT"
cd $XPAD_NOONE_LOCAL_REPO || {
echo "Failed to clone xpad-noone repo. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
}
fi
# If debug, remove xone and xpad-noone to force a reinstall
if [[ $DEBUG == "true" ]]; then
echo ""
echo "Removing xone and xpad-noone to force a reinstall"
echo ""
if [ $XONE_HAS_UPDATED = "false" ]; then
uninstall_xone
fi
if [ $XPAD_HAS_UPDATED = "false" ]; then
uninstall_xpad_noone
fi
fi
# Run the xone install function
install_xone
# Run the xpad-noone install function
install_xpad_noone
# Using lsmod check if xone_dongle is loaded, if not, load it
if ! lsmod | grep -q xone_dongle; then
load_cmd="sudo modprobe -q xone_dongle"
if [[ $DEBUG == "true" ]]; then
load_cmd="sudo modprobe xone_dongle"
fi
# Load the xone dongle module, if it exists
if ! $load_cmd; then
echo "Failed to load xone_dongle module. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
fi
sudo touch /etc/modules-load.d/xone-dongle.conf
echo "xone-dongle" | sudo tee /etc/modules-load.d/xone-dongle.conf >/dev/null 2>&1
fi
# Using lsmod check if xpad_noone is loaded, if not, load it
if ! lsmod | grep -q xpad_noone; then
load_cmd="sudo modprobe -q xpad-noone"
if [[ $DEBUG == "true" ]]; then
load_cmd="sudo modprobe xpad-noone"
fi
# Load the xpad-noone module, if it exists
if ! $load_cmd; then
echo "Failed to load xpad-noone module. Aborting..."
read -n 1 -s -r -p "Press any key to exit"
exit 1
fi
sudo touch /etc/modules-load.d/xpad-noone.conf
echo "xpad-noone" | sudo tee /etc/modules-load.d/xpad-noone.conf >/dev/null 2>&1
fi
# Re enable steamos-readonly if it was enabled before
if [ $KEEP_READ_ONLY = "true" ]; then
sudo steamos-readonly enable
fi
install_pairing_shortcuts
zenity --info \
--text="Done. You may now plug in your controller/adapter."
# If debug wait for user input before exiting
if [ $DEBUG = "true" ]; then
read -n 1 -s -r -p "Press any key to exit"
fi

Notices

If you experience an error similar to this where the kernel headers are mismatched then follow the instructions below

Installing xone v0.3-19-gcc63d27...
Sign command: /usr/lib/modules/6.1.52-valve3-1-neptune-61/build/scripts/sign-file
Binary /usr/lib/modules/6.1.52-valve3-1-neptune-61/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/xone/v0.3-19-gcc63d27/source -> /usr/src/xone-v0.3-19-gcc63d27
Error! Your kernel headers for kernel 6.1.52-valve3-1-neptune-61 cannot be found at /usr/lib/modules/6.1.52-valve3-1-neptune-61/build or /usr/lib/modules/6.1.52-valve3-1-neptune-61/source.
Please install the linux-headers-6.1.52-valve3-1-neptune-61 package or use the --kernelsourcedir option to tell DKMS where it's located.
  1. Ensure readonly is off sudo steamos-readonly disable
  2. Run sudo pacman -S linux-neptune-61 which should upgrade this package.
  3. Reboot to load the new kernel
  4. Re-run script as debug
  5. Enjoy!

Some users have reported that rebooting a couple of times is needed. Just keep trying the steps until the script is happy. We're trying to force an upgrade to the correct non-mismatched kernel headers.

@cdleveille
Copy link

Working for me as well on 3.5.5 in the Stable channel - no additional configuration needed before running in my case. Thanks again @SavageCore for taking the script and making it awesome (and also for all the troubleshooting I’ve noticed has been done recently)!

@SavageCore
Copy link
Author

Thanks all, it's nice to have some reports of it working. I do wonder if it's just me with a seamless experience! 😁I guess we're the silent majority.

@flavapitch woo🎉

@genna87
Copy link

genna87 commented Nov 22, 2023

Awesome tool. Thanks for adding the pairing launchers as requested!

Just some nitpicking.. would be possible to use different icons for every launcher?

@smy20011
Copy link

holo

Thank you for the holo trick! Save me 1 hrs

@SavageCore
Copy link
Author

Just some nitpicking.. would be possible to use different icons for every launcher?

Yes, I need to find a list of the possibilities and test some out. Good idea.

@Termiations
Copy link

Hi, new to this (running GitHub code from Steam Deck Konsole) so sorry for potential stupid questions, but should this work for SteamOS stable 3.5.7?

When trying to install I receive an error message: "Failed to load xone_dongle module. Aborting...".
And after that, when running the 'Install/Update Xone (DEBUG)' executable (by double-clicking the installed desktop icon) I receive a message under 'Installing xone v0.3-21-gc654623...' that the kernel headers cannot be found.

Am I doing something wrong?
Thanks in advance.

@SavageCore
Copy link
Author

@Termiations What does sudo pacman -Ss linux-neptune output in Konsole?

@Termiations
Copy link

Termiations commented Dec 6, 2023

@SavageCore Thanks for picking up so fast.

My device's Konsole output on running sudo pacman -Ss linux-neptune is:

jupiter-3.5/linux-neptune 5.13.0.valve37-1
The Linux kernel and modules, including the futex-wait-multiple patchset for testing with Proton fsync
jupiter-3.5/linux-neptune-61 6.1.52.valve10-1 [installed: 6.1.52.valve9-1]
The Linux kernel and modules
jupiter-3.5/linux-neptune-61-headers 6.1.52.valve10-1 [installed]
Headers and scripts for building modules for the Linux kernel
jupiter-3.5/linux-neptune-headers 5.13.0.valve37-1
Headers and scripts for building modules for the Linux kernel
jupiter-3.5/linux-neptune-rtw-debug 5.13.0.valve38.rtwdbg.6-1
The Linux kernel and modules, including the futex-wait-multiple patchset for testing with Proton fsync
jupiter-3.5/linux-neptune-rtw-debug-headers 5.13.0.valve38.rtwdbg.6-1
Headers and scripts for building modules for the Linux kernel

Furthermore I can confirm that my issue (with SteamOS stable 3.5.7) was with the official Valve dock.

Could it be that I am doing something wrong in the order of steps?
And/or should the Microsoft Wireless Adapter already be paired with the Microsoft Xbox (One) Wireless Controller, before (so, on another device) trying to get it to work on the Steam Deck?
Or is it 'just' an issue with the newer SteamOS version mixing things up?

Also maybe good to now that the only other 'tweak' I am running on my Steam Deck is the 'CryoByte33' Steam Deck Utilities application.
Could it be that this gets mixed up with the Xone application?

@WaferMouse
Copy link

WaferMouse commented Dec 7, 2023

Looks as though DKMS(? maybe something else but DKMS is the command that causes me an error) is looking for linux-headers-6.1.52-valve9-1-neptune-61 but linux-neptune-61-headers is at 6.1.52.valve10-1, so the version is mismatching.

At least, that seems to be what happens when I try to patch my xpad driver. Sure wish Valve would just downstream the patch I wrote.

Not sure what the fix is, but figured I'd post my findings.

@WaferMouse
Copy link

Update: Okay I don't know what I did but I restarted my deck, re-ran sudo pacman -Ss linux-neptune and noticed that the headers and kernel are matching now, so I'm not sure what fixed it but I'm past the version mismatch now. Good luck!

@SavageCore
Copy link
Author

Update: Okay I don't know what I did but I restarted my deck, re-ran sudo pacman -Ss linux-neptune and noticed that the headers and kernel are matching now, so I'm not sure what fixed it but I'm past the version mismatch now. Good luck!

Oh, could be. Thanks. @Termiations please report back!

@Teemuis
Copy link

Teemuis commented Dec 8, 2023

I have exactly the same problem as @Termiations .. shut it off yesterday to try again today and was hopeful to see that @WaferMouse got it to work wih reboot but still no luck :(

@ChuckFromage
Copy link

Exactly the same issue as @Termiations and @Teemuis, same configuration.

Output from debug installer:

xone install script by SavageCore
https://gist.github.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d

─────────────────────────────

This script will install the xone and xpad-noone drivers for the Xbox wireless dongle and controller

[sudo] password for deck:
Refreshing pacman keys...
Checking for linux headers...

SteamOS 3.5 detected using linux-neptune-61-headers package
Headers are already installed and up to date
Required packages installed and up to date

Checking for xone updates...

HEAD is now at c654623 Merge pull request #5 from SavageCore/fix/compilation
No updates available
Checking for xpad-noone updates...

HEAD is now at d02737f Pull changes from upstream
No updates available

Removing xone and xpad-noone to force a reinstall

Uninstalling xone v0.3-21-gc654623...
Deleting module xone-v0.3-21-gc654623 completely from the DKMS tree.
Deleting module xpad-noone-1.0 completely from the DKMS tree.
Installing xone...

Installing xone v0.3-21-gc654623...
Sign command: /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file
Binary /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/xone/v0.3-21-gc654623/source -> /usr/src/xone-v0.3-21-gc654623
Error! Your kernel headers for kernel 6.1.52-valve9-1-neptune-61 cannot be found at /usr/lib/modules/6.1.52-valve9-1-neptune-61/build or /usr/lib/modules/6.1.52-valve9-1-neptune-61/source.
Please install the linux-headers-6.1.52-valve9-1-neptune-61 package or use the --kernelsourcedir option to tell DKMS where it's located.
Getting xone firmware...

sudo: xone-get-firmware.sh: command not found
Installing xpad-noone...

Sign command: /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file
Binary /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/xpad-noone/1.0/source -> /usr/src/xpad-noone-1.0
Error! Your kernel headers for kernel 6.1.52-valve9-1-neptune-61 cannot be found at /usr/lib/modules/6.1.52-valve9-1-neptune-61/build or /usr/lib/modules/6.1.52-valve9-1-neptune-61/source.
Please install the linux-headers-6.1.52-valve9-1-neptune-61 package or use the --kernelsourcedir option to tell DKMS where it's located.
modprobe: FATAL: Module xone_dongle not found in directory /lib/modules/6.1.52-valve9-1-neptune-61
Failed to load xone_dongle module. Aborting...

Thanks so much for your help - this is very frustrating.

@izzletodasmizzle
Copy link

@ChuckFromage having the exact same issue as you with the 6.1.52 headers mismatch... Thanks for bringing this up, I'll be interested in seeing of any possible solutions.

@izzletodasmizzle
Copy link

izzletodasmizzle commented Dec 11, 2023

@ChuckFromage having the exact same issue as you with the 6.1.52 headers mismatch... Thanks for bringing this up, I'll be interested in seeing of any possible solutions.

Actually ended up fixing it right after I posted back to you by rerunning sudo pacman -S linux-neptune-61

@ChuckFromage
Copy link

@izzletodasmizzle's addition (sudo pacman -S linux-neptune-61) plus a couple of reboots did the trick. Thank you!

@SavageCore
Copy link
Author

Thanks, I'll add the Notices highlighting this to the top again.

@Termiations
Copy link

Termiations commented Dec 12, 2023

Update: Okay I don't know what I did but I restarted my deck, re-ran sudo pacman -Ss linux-neptune and noticed that the headers and kernel are matching now, so I'm not sure what fixed it but I'm past the version mismatch now. Good luck!

Oh, could be. Thanks. @Termiations please report back!

For me still the same issue as I reported last week. Even after quite some restarts of my device.
Also with running the things as noted under Notices.
@ChuckFromage How many restarts did you perform? And how much time between shutdown and reboot?

@ChuckFromage
Copy link

@Termiations I think I went through all the basic steps above to get it to accept the install script (e.g. checking pacman-key --init, etc.), then I rebooted and tried running the script again. It didn't work, but I rebooted, then used @izzletodasmizzle's suggestion (sudo pacman -S linux-neptune-61), confirmed updated headers, rebooted again and tried the DEBUG script from the icon on the desktop. That finally worked and gave me the confirmation message at the end of the script, but the light would not go on on the adapter and it still wasn't working, so I rebooted one more time, and after that the light and button on the adapter were working properly and it would connect to the controller.

So 4 reboots total. I wasn't paying attention to powering off for a certain period of time - a reboot is a reboot, is it not? Anyway, hope it works for you.

@SavageCore
Copy link
Author

I just had this after an update of the Preview channel. The debug run failed then ran sudo pacman -S linux-neptune-61 and confirmed the upgrade, with some errors, I ignored those and rebooted. Ran the debug script, is working.

Wish I knew... the script installs the header with the very same sudo pacman -S linux-neptune-61

Anyway, do the dance and you should be good. Let me know if not everyone!

@Acvice
Copy link

Acvice commented Dec 25, 2023

Came here to report that I too was receiving the mismatched headers error on 3.5.7. Running sudo pacman -S linux-neptune-61, performing a shutdown, then running the debug script resulted in a successful install. Thanks for your work on this!

@Xarishark
Copy link

Any way this will work on the Main update channel? do I need different headers and to provide the header dir to the script ?

@Acvice
Copy link

Acvice commented Dec 25, 2023

Any way this will work on the Main update channel? do I need different headers and to provide the header dir to the script ?

This does work on the main update channel. The script won't need updated until SteamOS 3.6. Is it not working for you?

@ConvexTlc97
Copy link

xone install script by SavageCore
https://gist.github.com/SavageCore/263a3413532bc181c9bb215c8fe6c30d
─────────────────────────────

This script will install the xone and xpad-noone drivers for the Xbox wireless dongle and controller

[sudo] password for deck:
Refreshing pacman keys...
Checking for linux headers...

SteamOS 3.5 detected using linux-neptune-61-headers package
Headers are already installed and up to date
Required packages installed and up to date

Checking for xone updates...

HEAD is now at bbf0dcc Fix build on kernel 6.3
No updates available
Checking for xpad-noone updates...

HEAD is now at d02737f Pull changes from upstream
No updates available

Removing xone and xpad-noone to force a reinstall

Uninstalling xone v0.3-2-gbbf0dcc...
Deleting module xone-v0.3-2-gbbf0dcc completely from the DKMS tree.
Deleting module xpad-noone-1.0 completely from the DKMS tree.
Installing xone...

Installing xone v0.3-2-gbbf0dcc...
Sign command: /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file
Binary /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/xone/v0.3-2-gbbf0dcc/source -> /usr/src/xone-v0.3-2-gbbf0dcc
Error! Your kernel headers for kernel 6.1.52-valve9-1-neptune-61 cannot be found at /usr/lib/modules/6.1.52-valve9-1-neptune-61/build or /usr/lib/modules/6.1.52-valve9-1-neptune-61/source.
Please install the linux-headers-6.1.52-valve9-1-neptune-61 package or use the --kernelsourcedir option to tell DKMS where it's located.
Getting xone firmware...

sudo: xone-get-firmware.sh: command not found
Installing xpad-noone...

Sign command: /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file
Binary /usr/lib/modules/6.1.52-valve9-1-neptune-61/build/scripts/sign-file not found, modules won't be signed
Creating symlink /var/lib/dkms/xpad-noone/1.0/source -> /usr/src/xpad-noone-1.0
Error! Your kernel headers for kernel 6.1.52-valve9-1-neptune-61 cannot be found at /usr/lib/modules/6.1.52-valve9-1-neptune-61/build or /usr/lib/modules/6.1.52-valve9-1-neptune-61/source.
Please install the linux-headers-6.1.52-valve9-1-neptune-61 package or use the --kernelsourcedir option to tell DKMS where it's located.
modprobe: FATAL: Module xone_dongle not found in directory /lib/modules/6.1.52-valve9-1-neptune-61
Failed to load xone_dongle module. Aborting...
Press any key to exit

Getting this issue on 3.5.7. not sure whats going on with it.

@Acvice
Copy link

Acvice commented Dec 29, 2023

Read the past few comments my dude.

@Idontknowman123
Copy link

No idea why this happens:

Failed to load xone_dongle module. Aborting...
Press any key to exit(1)(deck@steamdeck ~)$ sudo pacman -S linux-neptune-61
resolving dependencies...
looking for conflicting packages...

Packages (1) linux-neptune-61-6.1.52.valve14-1

Total Download Size: 114.89 MiB
Total Installed Size: 114.49 MiB
Net Upgrade Size: 0.00 MiB

:: Proceed with installation? [Y/n] y
:: Retrieving packages...
linux-neptune-61-6.1.52.valve14-1-x86_64 114.9 MiB 44.5 MiB/s 00:03 [###########################################] 100%
(1/1) checking keys in keyring [###########################################] 100%
(1/1) checking package integrity [###########################################] 100%
error: linux-neptune-61: signature from "GitLab CI Package Builder ci-package-builder-1@steamos.cloud" is unknown trust
:: File /var/cache/pacman/pkg/linux-neptune-61-6.1.52.valve14-1-x86_64.pkg.tar.zst is corrupted (invalid or corrupted package (PGP signature)).
Do you want to delete it? [Y/n]

@Danyaga
Copy link

Danyaga commented Jan 31, 2024

Hello everyone! Same issue here. Following...

@cosaga
Copy link

cosaga commented Jan 31, 2024

I too get the Failed to load xone_dongle module. Aborting... message
Sad days

@deello
Copy link

deello commented Feb 21, 2024

It seems that pacman can no longer reach the update for linux-neptune-61. Download from elsewhere and run the script again.

@RACEDRONES
Copy link

I am having issues even after the update for linux-neptune-61.
Ill try to run the script again after a reboot to see if it works this time.
If not Im going to the Discord server for some help .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment