Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add Nobara USB Polling Rate Patch (#964)
Co-authored-by: badlydrawnface <bdface@proton.me>
- Loading branch information
1 parent
f5f0334
commit f349a39
Showing
8 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
system_files/deck/shared/usr/bin/custom-device-pollrates.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -m | ||
|
||
# Gather device poll rate settings from /etc/custom-device-pollrates/custom-device-pollrates.conf | ||
DEVICES=$(grep -v '^\s*$\|^\s*\#' /etc/custom-device-pollrates/custom-device-pollrates.conf | paste -sd, -) | ||
|
||
# Set new polling rate for devices | ||
echo "$DEVICES" | sudo tee /sys/module/usbcore/parameters/interrupt_interval_override > /dev/null | ||
|
||
|
||
# Reload all USB devices | ||
|
||
for xhci in /sys/bus/pci/drivers/?hci_hcd ; do | ||
|
||
if ! cd $xhci ; then | ||
echo Failed to change directory to $xhci | ||
exit 1 | ||
fi | ||
|
||
echo Resetting devices from $xhci... | ||
|
||
for i in ????:??:??.? ; do | ||
echo -n "$i" > unbind | ||
echo -n "$i" > bind | ||
done | ||
sleep 1 | ||
done | ||
|
||
|
25 changes: 25 additions & 0 deletions
25
system_files/deck/shared/usr/etc/custom-device-pollrates.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Format: | ||
# vendorid:deviceid:rate | ||
# | ||
# Polling Rates: | ||
# 1=1000Hz,2=500Hz,4=250Hz,8=125Hz | ||
# | ||
# Ex (PS5 DualSense, 1000Mhz polling rate): | ||
# 054c:0ce6:1 | ||
# | ||
# One entry per line | ||
# | ||
# | ||
# To allow these devices to have custom | ||
# pollrates, uncomment the device or alternatively | ||
# add a new device configuration line, then restart | ||
# the service with: | ||
# | ||
# sudo systemctl restart custom-device-pollrates.service | ||
# -------------SONY------------- | ||
# DS4 | ||
#054c:09cc:1 | ||
# DS5 | ||
#054c:0ce6:1 | ||
# -------------SONY------------- | ||
|
1 change: 1 addition & 0 deletions
1
system_files/deck/shared/usr/lib/systemd/system-presets/99-custom-device-pollrates.preset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enable custom-device-pollrates.service |
10 changes: 10 additions & 0 deletions
10
system_files/deck/shared/usr/lib/systemd/system/custom-device-pollrates.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Set custom polling rates for specific devices | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/bash /usr/bin/custom-device-pollrates.sh | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|
29 changes: 29 additions & 0 deletions
29
system_files/desktop/shared/usr/bin/custom-device-pollrates.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#!/bin/bash | ||
set -m | ||
|
||
# Gather device poll rate settings from /etc/custom-device-pollrates/custom-device-pollrates.conf | ||
DEVICES=$(grep -v '^\s*$\|^\s*\#' /etc/custom-device-pollrates/custom-device-pollrates.conf | paste -sd, -) | ||
|
||
# Set new polling rate for devices | ||
echo "$DEVICES" | sudo tee /sys/module/usbcore/parameters/interrupt_interval_override > /dev/null | ||
|
||
|
||
# Reload all USB devices | ||
|
||
for xhci in /sys/bus/pci/drivers/?hci_hcd ; do | ||
|
||
if ! cd $xhci ; then | ||
echo Failed to change directory to $xhci | ||
exit 1 | ||
fi | ||
|
||
echo Resetting devices from $xhci... | ||
|
||
for i in ????:??:??.? ; do | ||
echo -n "$i" > unbind | ||
echo -n "$i" > bind | ||
done | ||
sleep 1 | ||
done | ||
|
||
|
25 changes: 25 additions & 0 deletions
25
system_files/desktop/shared/usr/etc/custom-device-pollrates.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Format: | ||
# vendorid:deviceid:rate | ||
# | ||
# Polling Rates: | ||
# 1=1000Hz,2=500Hz,4=250Hz,8=125Hz | ||
# | ||
# Ex (PS5 DualSense, 1000Mhz polling rate): | ||
# 054c:0ce6:1 | ||
# | ||
# One entry per line | ||
# | ||
# | ||
# To allow these devices to have custom | ||
# pollrates, uncomment the device or alternatively | ||
# add a new device configuration line, then restart | ||
# the service with: | ||
# | ||
# sudo systemctl restart custom-device-pollrates.service | ||
# -------------SONY------------- | ||
# DS4 | ||
#054c:09cc:1 | ||
# DS5 | ||
#054c:0ce6:1 | ||
# -------------SONY------------- | ||
|
1 change: 1 addition & 0 deletions
1
system_files/desktop/shared/usr/lib/systemd/system-presets/99-custom-device-pollrates.preset
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
enable custom-device-pollrates.service |
10 changes: 10 additions & 0 deletions
10
system_files/desktop/shared/usr/lib/systemd/system/custom-device-pollrates.service
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[Unit] | ||
Description=Set custom polling rates for specific devices | ||
|
||
[Service] | ||
Type=simple | ||
ExecStart=/usr/bin/bash /usr/bin/custom-device-pollrates.sh | ||
|
||
[Install] | ||
WantedBy=multi-user.target | ||
|