Skip to content

Commit

Permalink
xpadneo, installer: Get rid of ERTM work-around by requiring kernel 5.12
Browse files Browse the repository at this point in the history
Link: atar-axis#198
Signed-off-by: Kai Krakow <[email protected]>
  • Loading branch information
kakra committed Dec 23, 2024
1 parent 082770b commit 352cce2
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 23 deletions.
2 changes: 1 addition & 1 deletion hid-xpadneo/dkms.conf.in
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ DEST_MODULE_LOCATION[0]="/kernel/drivers/hid"
MAKE[0]="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' VERSION='${PACKAGE_VERSION}' modules"
CLEAN="make -C '${kernel_source_dir}' M='${dkms_tree}/${PACKAGE_NAME}/${PACKAGE_VERSION}/build/src' clean"

BUILD_EXCLUSIVE_KERNEL_MIN="4.18.0"
BUILD_EXCLUSIVE_KERNEL_MIN="5.12.0"
BUILD_EXCLUSIVE_CONFIG="CONFIG_HID CONFIG_INPUT_FF_MEMLESS CONFIG_POWER_SUPPLY"

AUTOINSTALL="yes"
Expand Down
22 changes: 2 additions & 20 deletions hid-xpadneo/dkms.post_install
Original file line number Diff line number Diff line change
@@ -1,26 +1,8 @@
#!/bin/sh

#TODO Remove ERTM after kernel patch is deployed in the wild
# DKMS now defaults to kernel 5.12 minimum, remove ERTM override
ERTM_OVERRIDE="/etc/modprobe.d/99-xpadneo-bluetooth.conf"
DISABLE_ERTM="/sys/module/bluetooth/parameters/disable_ertm"

if [ "$(uname -r | awk -F. '{ printf "%03d%03d",$1,$2 }')" -ge 005012 ]; then
echo "Not disabling ERTM, kernel version doesn't require it..."
elif [ "$(readlink "${ERTM_OVERRIDE}" 2>/dev/null)" = "/dev/null" ]; then
echo "Not disabling ERTM, local override in place..."
elif [ -L "${ERTM_OVERRIDE}" ]; then
echo >&2 "WARNING: '${ERTM_OVERRIDE}' is an arbitrary symlink, this is not supported."
echo >&2 "Skipping ERTM fixup, you're expected to manage the options on your own..."
else
echo "Disabling ERTM permanently (requires reboot)..."
echo "options bluetooth disable_ertm=y" >"${ERTM_OVERRIDE}"
echo "HINT: If you want to prevent this in the future, run 'ln -snf /dev/null ${ERTM_OVERRIDE}'."

if [ -w "${DISABLE_ERTM}" ]; then
echo "Disabling ERTM instantly..."
echo "Y" >"${DISABLE_ERTM}"
fi
fi
[ -L "${ERTM_OVERRIDE}" ] || { echo "Forcing removal of ERTM override..."; rm -f "${ERTM_OVERRIDE}"; }

echo "Installing modalias database..."
install -D -m 0644 -t /etc/modprobe.d etc-modprobe.d/xpadneo.conf
Expand Down
3 changes: 1 addition & 2 deletions hid-xpadneo/dkms.post_remove
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#!/bin/sh

#TODO Remove ERTM after kernel patch is deployed in the wild
# DKMS now defaults to kernel 5.12 minimum, remove ERTM override
ERTM_OVERRIDE="/etc/modprobe.d/99-xpadneo-bluetooth.conf"

[ -L "${ERTM_OVERRIDE}" ] || { echo "Uninstalling ERTM override..."; rm -f "${ERTM_OVERRIDE}"; }

echo "Uninstalling modalias database..."
Expand Down
6 changes: 6 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,12 @@ if [[ ! -d /sys/devices/virtual/misc/uhid ]]; then

fi

if [ "$(uname -r | awk -F. '{ printf "%03d%03d",$1,$2 }')" -ge 005012 ]; then

>&2 echo "WARNING: kernel 5.12 or lower will not be supported due to known ERTM issues"

fi

echo "* deploying DKMS package"
make "${MAKE_OPTS[@]}" VERSION="${VERSION}" install || maybe_already_installed

Expand Down

0 comments on commit 352cce2

Please sign in to comment.