update: remove btusb kernel patches

This commit is contained in:
Leonardo Eugênio 2023-01-11 21:49:02 -03:00
parent d73090a192
commit 71b785191a
7 changed files with 51 additions and 262 deletions

View File

@ -5,11 +5,11 @@
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1665870395,
"narHash": "sha256-Tsbqb27LDNxOoPLh0gw2hIb6L/6Ow/6lIBvqcHzEKBI=",
"lastModified": 1673301561,
"narHash": "sha256-gRUWHbBAtMuPDJQXotoI8u6+3DGBIUZHkyQWpIv7WpM=",
"owner": "ryantm",
"repo": "agenix",
"rev": "a630400067c6d03c9b3e0455347dc8559db14288",
"rev": "42d371d861a227149dc9a7e03350c9ab8b8ddd68",
"type": "github"
},
"original": {
@ -116,11 +116,11 @@
"utils": "utils"
},
"locked": {
"lastModified": 1670253003,
"narHash": "sha256-/tJIy4+FbsQyslq1ipyicZ2psOEd8dvl4OJ9lfisjd0=",
"lastModified": 1672244468,
"narHash": "sha256-xaZb8AZqoXRCSqPusCk4ouf+fUNP8UJdafmMTF1Ltlw=",
"owner": "nix-community",
"repo": "home-manager",
"rev": "0e8125916b420e41bf0d23a0aa33fadd0328beb3",
"rev": "89a8ba0b5b43b3350ff2e3ef37b66736b2ef8706",
"type": "github"
},
"original": {
@ -140,11 +140,11 @@
"xdph": "xdph"
},
"locked": {
"lastModified": 1670611904,
"narHash": "sha256-gB17b2temQ3QS12bWMXpAdKmLUtCFVvB9T7VyVcr0JU=",
"lastModified": 1673460918,
"narHash": "sha256-vL9AhYPCMP1/8va2pdmLn0vmCdsxbgYSSQHm4kaQjHs=",
"owner": "hyprwm",
"repo": "Hyprland",
"rev": "bf78dcecf092fc10df75ce869306ddabf8ecd640",
"rev": "11afb660102198abb1e74fffdffd00f8c1a11cd9",
"type": "github"
},
"original": {
@ -154,29 +154,18 @@
}
},
"hyprland-protocols": {
"flake": false,
"locked": {
"lastModified": 1670258048,
"narHash": "sha256-Lm2sXnDVZNE+taHqsqVibvPmSdu65VHvXI507KVX4lg=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "0dcff94fc10df2bbb66d3e1b5a1d6cfd3ada5515",
"type": "github"
"inputs": {
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"type": "github"
}
},
"hyprland-protocols_2": {
"flake": false,
"locked": {
"lastModified": 1670185345,
"narHash": "sha256-hxWGqlPecqEsE6nOHDV29KFBKePbY2Ipeac6lrChMKY=",
"lastModified": 1671839510,
"narHash": "sha256-+PY1qqJfmZzzROgcIY4I7AkCwpnC+qBIYk2eFoA9RWc=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "4623a404c091e64743ba310199bb380ec52f1936",
"rev": "b8f55e02a328c47ed373133c52483bbfa20a1b75",
"type": "github"
},
"original": {
@ -210,11 +199,11 @@
"rust-overlay": "rust-overlay"
},
"locked": {
"lastModified": 1670452176,
"narHash": "sha256-jtNinXtCUJ+6Zu55HxrGN1zCLCH5qd4GoK2m1RgUW+Q=",
"lastModified": 1672668722,
"narHash": "sha256-i1MidLitMVa4k9UFbzdVoRyKy8y2NmYxVcVZdrdMEjw=",
"owner": "oxalica",
"repo": "nil",
"rev": "661af99ab69eef0cfc32f77ddbf74f252dba97d5",
"rev": "0eff7fc333e3c0c064a6339834b44feae00fe64a",
"type": "github"
},
"original": {
@ -241,11 +230,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1670507980,
"narHash": "sha256-riNZa0xzM1it3pzxciwALeMs+0CsBMWIW2FqulzK8vM=",
"lastModified": 1673315479,
"narHash": "sha256-GNCFRtDHjTygXGJp/H+f2XQPMGxpYSmNiibIqYzihtM=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "2787fc7d1e51404678614bf0fe92fc296746eec0",
"rev": "c07552f6f7d4eead7806645ec03f7f1eb71ba6bd",
"type": "github"
},
"original": {
@ -256,11 +245,11 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1670543317,
"narHash": "sha256-4mMR56rtxKr+Gwz399jFr4i76SQZxsLWxxyfQlPXRm0=",
"lastModified": 1673345971,
"narHash": "sha256-4DfFcKLRfVUTyuGrGNNmw37IeIZSoku9tgTVmu/iD98=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "7a6a010c3a1d00f8470a5ca888f2f927f1860a19",
"rev": "54644f409ab471e87014bb305eac8c50190bcf48",
"type": "github"
},
"original": {
@ -271,11 +260,11 @@
},
"nur": {
"locked": {
"lastModified": 1670646657,
"narHash": "sha256-T5DjvmZ4jvUedK9e9NADrYIe85fxIMTwj2QHTdJxxXQ=",
"lastModified": 1673466346,
"narHash": "sha256-xQmR3V5l5hwHSWIOmWxqBUttmcgsUD7Da8sEpngW7/w=",
"owner": "nix-community",
"repo": "NUR",
"rev": "6b370298b8e08bcc7a7a490d54517bd699708cd8",
"rev": "1ee2886609567a210debe8b53520b12b9d7541f8",
"type": "github"
},
"original": {
@ -303,11 +292,11 @@
"ranger-icons": {
"flake": false,
"locked": {
"lastModified": 1653224349,
"narHash": "sha256-YT7YFiTA2XtIoVzaVjUWMu6j4Nwo4iGzvOtjjWva/80=",
"lastModified": 1673142324,
"narHash": "sha256-97u8yNyfN9vbv4JAvqgFekno3dUyYu265TvpU3ZZqg4=",
"owner": "alexanderjeurissen",
"repo": "ranger_devicons",
"rev": "49fe4753c89615a32f14b2f4c78bbd02ee76be3c",
"rev": "5bb1c32f649055c2d9143c8371c2bf06d5e574f7",
"type": "github"
},
"original": {
@ -382,11 +371,11 @@
]
},
"locked": {
"lastModified": 1669775522,
"narHash": "sha256-6xxGArBqssX38DdHpDoPcPvB/e79uXyQBwpBcaO/BwY=",
"lastModified": 1672280602,
"narHash": "sha256-aBO2MgTv8Pj24j+q0BKFHV5XmAuAn6+iw7AVNW4wUxc=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "3158e47f6b85a288d12948aeb9a048e0ed4434d6",
"rev": "ede977678e5d0164316998487e686d0790744cd7",
"type": "github"
},
"original": {
@ -428,11 +417,11 @@
},
"webcord": {
"locked": {
"lastModified": 1670198705,
"narHash": "sha256-cf+JUnVqSSq3H6dhti927gKwkFvWjEV7aKdi+rSNpRs=",
"lastModified": 1672958964,
"narHash": "sha256-3SB6mTMTiek1B1zie7oD3DWJWVqKDaB5znQ+Nz6jz/Y=",
"owner": "huantianad",
"repo": "nixpkgs",
"rev": "cf38762a26b34f91de025755aea4d72f99b89266",
"rev": "1d1ed8fbb244fe3d242ebd3d2ad4e647235719eb",
"type": "github"
},
"original": {
@ -449,11 +438,11 @@
]
},
"locked": {
"lastModified": 1670449081,
"narHash": "sha256-9giL4NKm2NaLN9IPfmasADQ8UA8qGkArnhuyCpdGLIU=",
"lastModified": 1672212978,
"narHash": "sha256-6O6QGMjQG5iyHmnR0pMb9aITT7759M26xguQnxC4vdc=",
"owner": "wegank",
"repo": "nur-packages",
"rev": "892b4157422d8199f04e3870a187d759fee8f5b1",
"rev": "ca4050e03a2b47ecbf8a2860449f0b603ab91c21",
"type": "github"
},
"original": {
@ -466,11 +455,11 @@
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1669925104,
"narHash": "sha256-xMHfW+/G9MieN/5tXHUA5/ztE8dkE093cNFTEUgcwxI=",
"lastModified": 1671183014,
"narHash": "sha256-oMWT5Zbe/3HFINAk38jNVxiZ4PCYvPJj2Jo4iiyBtm0=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "c8eb24d30e18c165728b8788a10716611c3b633d",
"rev": "dc7cc98cf21a8dc19ab8895505500e3700646af0",
"type": "gitlab"
},
"original": {
@ -482,18 +471,21 @@
},
"xdph": {
"inputs": {
"hyprland-protocols": "hyprland-protocols_2",
"hyprland-protocols": [
"hyprland",
"hyprland-protocols"
],
"nixpkgs": [
"hyprland",
"nixpkgs"
]
},
"locked": {
"lastModified": 1670593043,
"narHash": "sha256-tsDs6FB+7PlBOt46dMQFBMH5yPY/fduf4cYbQYhauhA=",
"lastModified": 1673116118,
"narHash": "sha256-eR0yDSkR2XYMesfdRWJs25kAdXET2mbNNHu5t+KUcKA=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "5f7eecff553d82f21e049d79d8fb3f1f46568da0",
"rev": "d479c846531fd0e1d2357c9588b8310a2b859ef2",
"type": "github"
},
"original": {

View File

@ -93,7 +93,6 @@
./hosts/monolith.nix
./system/gitlab-runner.nix
# ./system/nix-serve.nix
./system/btusb-kernel-patches.nix
./system/amdgpu-kernel-patches.nix
] ++ common_modules;
};

View File

@ -1,68 +0,0 @@
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 3b269060e91f..1360b2163ec5 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2174,6 +2174,7 @@ static int btusb_setup_csr(struct hci_dev *hdev)
* without these the controller will lock up.
*/
set_bit(HCI_QUIRK_BROKEN_STORED_LINK_KEY, &hdev->quirks);
+ set_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks);
set_bit(HCI_QUIRK_BROKEN_FILTER_CLEAR_ALL, &hdev->quirks);
set_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks);
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index e004ba04a9ae..0fe789f6a653 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -228,6 +228,17 @@ enum {
*/
HCI_QUIRK_VALID_LE_STATES,
+ /* When this quirk is set, then erroneous data reporting
+ * is ignored. This is mainly due to the fact that the HCI
+ * Read Default Erroneous Data Reporting command is advertised,
+ * but not supported; these controllers often reply with unknown
+ * command and tend to lock up randomly. Needing a hard reset.
+ *
+ * This quirk can be set before hci_register_dev is called or
+ * during the hdev->setup vendor callback.
+ */
+ HCI_QUIRK_BROKEN_ERR_DATA_REPORTING,
+
/*
* When this quirk is set, then the hci_suspend_notifier is not
* registered. This is intended for devices which drop completely
diff --git a/net/bluetooth/hci_sync.c b/net/bluetooth/hci_sync.c
index bd9eb713b26b..0a7abc817f10 100644
--- a/net/bluetooth/hci_sync.c
+++ b/net/bluetooth/hci_sync.c
@@ -3798,7 +3798,8 @@ static int hci_read_page_scan_activity_sync(struct hci_dev *hdev)
static int hci_read_def_err_data_reporting_sync(struct hci_dev *hdev)
{
if (!(hdev->commands[18] & 0x04) ||
- !(hdev->features[0][6] & LMP_ERR_DATA_REPORTING))
+ !(hdev->features[0][6] & LMP_ERR_DATA_REPORTING) ||
+ test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks))
return 0;
return __hci_cmd_sync_status(hdev, HCI_OP_READ_DEF_ERR_DATA_REPORTING,
@@ -4316,7 +4317,8 @@ static int hci_set_err_data_report_sync(struct hci_dev *hdev)
bool enabled = hci_dev_test_flag(hdev, HCI_WIDEBAND_SPEECH_ENABLED);
if (!(hdev->commands[18] & 0x08) ||
- !(hdev->features[0][6] & LMP_ERR_DATA_REPORTING))
+ !(hdev->features[0][6] & LMP_ERR_DATA_REPORTING) ||
+ test_bit(HCI_QUIRK_BROKEN_ERR_DATA_REPORTING, &hdev->quirks))
return 0;
if (enabled == hdev->err_data_reporting)
@@ -4475,6 +4477,9 @@ static const struct {
HCI_QUIRK_BROKEN(STORED_LINK_KEY,
"HCI Delete Stored Link Key command is advertised, "
"but not supported."),
+ HCI_QUIRK_BROKEN(ERR_DATA_REPORTING,
+ "HCI Read Default Erroneous Data Reporting command is "
+ "advertised, but not supported."),
HCI_QUIRK_BROKEN(READ_TRANSMIT_POWER,
"HCI Read Transmit Power Level command is advertised, "
"but not supported."),

View File

@ -1,16 +0,0 @@
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 1360b2163ec5..8f34bf195bae 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -2112,6 +2112,11 @@ static int btusb_setup_csr(struct hci_dev *hdev)
rp = (struct hci_rp_read_local_version *)skb->data;
+ bt_dev_info(hdev, "CSR: Setting up dongle with HCI ver=%u rev=%04x; LMP ver=%u subver=%04x; manufacturer=%u",
+ le16_to_cpu(rp->hci_ver), le16_to_cpu(rp->hci_rev),
+ le16_to_cpu(rp->lmp_ver), le16_to_cpu(rp->lmp_subver),
+ le16_to_cpu(rp->manufacturer));
+
/* Detect a wide host of Chinese controllers that aren't CSR.
*
* Known fake bcdDevices: 0x0100, 0x0134, 0x1915, 0x2520, 0x7558, 0x8891

View File

@ -1,67 +0,0 @@
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 8f34bf195bae..d31d4f925463 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -34,6 +34,7 @@ static bool force_scofix;
static bool enable_autosuspend = IS_ENABLED(CONFIG_BT_HCIBTUSB_AUTOSUSPEND);
static bool enable_poll_sync = IS_ENABLED(CONFIG_BT_HCIBTUSB_POLL_SYNC);
static bool reset = true;
+static bool disable_fake_csr_forcesuspend_hack;
static struct usb_driver btusb_driver;
@@ -2171,7 +2172,7 @@ static int btusb_setup_csr(struct hci_dev *hdev)
is_fake = true;
if (is_fake) {
- bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; adding workarounds and force-suspending once...");
+ bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; adding workarounds...");
/* Generally these clones have big discrepancies between
* advertised features and what's actually supported.
@@ -2215,21 +2216,24 @@ static int btusb_setup_csr(struct hci_dev *hdev)
* apply this initialization quirk to every controller that gets here,
* it should be harmless. The alternative is to not work at all.
*/
- pm_runtime_allow(&data->udev->dev);
+ if (!disable_fake_csr_forcesuspend_hack) {
+ bt_dev_warn(hdev, "CSR: Unbranded CSR clone detected; force-suspending once...");
+ pm_runtime_allow(&data->udev->dev);
- ret = pm_runtime_suspend(&data->udev->dev);
- if (ret >= 0)
- msleep(200);
- else
- bt_dev_warn(hdev, "CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround");
+ ret = pm_runtime_suspend(&data->udev->dev);
+ if (ret >= 0)
+ msleep(200);
+ else
+ bt_dev_warn(hdev, "CSR: Couldn't suspend the device for our Barrot 8041a02 receive-issue workaround");
- pm_runtime_forbid(&data->udev->dev);
+ pm_runtime_forbid(&data->udev->dev);
- device_set_wakeup_capable(&data->udev->dev, false);
+ device_set_wakeup_capable(&data->udev->dev, false);
- /* Re-enable autosuspend if this was requested */
- if (enable_autosuspend)
- usb_enable_autosuspend(data->udev);
+ /* Re-enable autosuspend if this was requested */
+ if (enable_autosuspend)
+ usb_enable_autosuspend(data->udev);
+ }
}
kfree_skb(skb);
@@ -4312,6 +4316,9 @@ MODULE_PARM_DESC(enable_autosuspend, "Enable USB autosuspend by default");
module_param(reset, bool, 0644);
MODULE_PARM_DESC(reset, "Send HCI reset command on initialization");
+module_param(disable_fake_csr_forcesuspend_hack, bool, 0644);
+MODULE_PARM_DESC(disable_fake_csr_forcesuspend_hack, "Don't indiscriminately force-suspend Chinese-cloned CSR dongles trying to unfreeze them");
+
MODULE_AUTHOR("Marcel Holtmann <marcel@holtmann.org>");
MODULE_DESCRIPTION("Generic Bluetooth USB driver ver " VERSION);
MODULE_VERSION(VERSION);

View File

@ -1,27 +0,0 @@
diff --git a/net/bluetooth/hci_core.c b/net/bluetooth/hci_core.c
index 6ae5aa5..3c5e80f 100644
--- a/net/bluetooth/hci_core.c
+++ b/net/bluetooth/hci_core.c
@@ -2757,7 +2757,8 @@ int hci_register_suspend_notifier(struct hci_dev *hdev)
{
int ret = 0;
- if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) {
+ if (!hdev->suspend_notifier.notifier_call &&
+ !test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks)) {
hdev->suspend_notifier.notifier_call = hci_suspend_notifier;
ret = register_pm_notifier(&hdev->suspend_notifier);
}
@@ -2769,8 +2770,11 @@ int hci_unregister_suspend_notifier(struct hci_dev *hdev)
{
int ret = 0;
- if (!test_bit(HCI_QUIRK_NO_SUSPEND_NOTIFIER, &hdev->quirks))
+ if (hdev->suspend_notifier.notifier_call) {
ret = unregister_pm_notifier(&hdev->suspend_notifier);
+ if (!ret)
+ hdev->suspend_notifier.notifier_call = NULL;
+ }
return ret;
}

View File

@ -1,24 +0,0 @@
{ config, pkgs, lib, inputs, ... }: {
boot.kernelPackages = lib.mkDefault pkgs.linuxPackages_latest;
boot.kernelPatches = [
{
name = "bt-usb-fixes-1";
patch =
../patches/kernel/1-3-Bluetooth-btusb-Fix-Chinese-CSR-dongles-again-by-re-adding-ERR_DATA_REPORTING-quirk.diff;
}
{
name = "bt-usb-fixes-2";
patch =
../patches/kernel/2-3-Bluetooth-btusb-Add-a-setup-message-for-CSR-dongles-showing-the-Read-Local-Information-values.diff;
}
{
name = "bt-usb-fixes-3";
patch =
../patches/kernel/3-3-Bluetooth-btusb-Add-a-parameter-to-let-users-disable-the-fake-CSR-force-suspend-hack.diff;
}
{
name = "bt-usb-fixes-4";
patch = ../patches/kernel/fix-btusb-crash.diff;
}
];
}