* [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
@ 2024-12-13 4:04 Ying Hsu
2024-12-13 4:35 ` [v2] " bluez.test.bot
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Ying Hsu @ 2024-12-13 4:04 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz
Cc: chromeos-bluetooth-upstreaming, Ying Hsu, Marcel Holtmann,
linux-kernel
When a Bluetooth raw socket is open, the HCI event related to SCO
connection changes are not dispatched to the hci_event module, and
the underlying Bluetooth controller's USB Interface 1 will not be
updated accordingly.
This patch adds `isoc_alt` sysfs attribute, allowing user space
to update the alternate setting of the USB interface alternate
setting as needed.
Signed-off-by: Ying Hsu <yinghsu@chromium.org>
---
This commit has been tested on a chromebook with AX211.
Changes in v2:
- Add check for the existence of a valid USB interface 1.
drivers/bluetooth/btusb.c | 34 +++++++++++++++++++++++++++++++++-
1 file changed, 33 insertions(+), 1 deletion(-)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 279fe6c115fa..7d7cfcd07aef 100644
--- a/drivers/bluetooth/btusb.c
+++ b/drivers/bluetooth/btusb.c
@@ -3645,6 +3645,32 @@ static const struct file_operations force_poll_sync_fops = {
.llseek = default_llseek,
};
+static ssize_t isoc_alt_show(struct device *dev,
+ struct device_attribute *attr,
+ char *buf)
+{
+ struct btusb_data *data = dev_get_drvdata(dev);
+
+ return sysfs_emit(buf, "%d\n", data->isoc_altsetting);
+}
+
+static ssize_t isoc_alt_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct btusb_data *data = dev_get_drvdata(dev);
+ int alt;
+ int ret;
+
+ if (kstrtoint(buf, 10, &alt))
+ return -EINVAL;
+
+ ret = btusb_switch_alt_setting(data->hdev, alt);
+ return ret < 0 ? ret : count;
+}
+
+static DEVICE_ATTR_RW(isoc_alt);
+
static int btusb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
@@ -4008,6 +4034,10 @@ static int btusb_probe(struct usb_interface *intf,
data->isoc, data);
if (err < 0)
goto out_free_dev;
+
+ err = device_create_file(&intf->dev, &dev_attr_isoc_alt);
+ if (err)
+ goto out_free_dev;
}
if (IS_ENABLED(CONFIG_BT_HCIBTUSB_BCM) && data->diag) {
@@ -4054,8 +4084,10 @@ static void btusb_disconnect(struct usb_interface *intf)
hdev = data->hdev;
usb_set_intfdata(data->intf, NULL);
- if (data->isoc)
+ if (data->isoc) {
+ device_remove_file(&intf->dev, &dev_attr_isoc_alt);
usb_set_intfdata(data->isoc, NULL);
+ }
if (data->diag)
usb_set_intfdata(data->diag, NULL);
--
2.47.1.613.gc27f4b7a9f-goog
^ permalink raw reply related [flat|nested] 6+ messages in thread
* RE: [v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-13 4:04 [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
@ 2024-12-13 4:35 ` bluez.test.bot
2024-12-18 1:30 ` Ying Hsu
2025-01-06 18:10 ` [PATCH v2] " patchwork-bot+bluetooth
2025-01-08 12:35 ` Greg KH
2 siblings, 1 reply; 6+ messages in thread
From: bluez.test.bot @ 2024-12-13 4:35 UTC (permalink / raw)
To: linux-bluetooth, yinghsu
[-- Attachment #1: Type: text/plain, Size: 2028 bytes --]
This is automated email and please do not reply to this email!
Dear submitter,
Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=917446
---Test result---
Test Summary:
CheckPatch PENDING 0.24 seconds
GitLint PENDING 0.24 seconds
SubjectPrefix PASS 0.09 seconds
BuildKernel PASS 24.52 seconds
CheckAllWarning PASS 28.65 seconds
CheckSparse PASS 30.25 seconds
BuildKernel32 PASS 24.18 seconds
TestRunnerSetup PASS 430.44 seconds
TestRunner_l2cap-tester PASS 20.19 seconds
TestRunner_iso-tester PASS 29.42 seconds
TestRunner_bnep-tester PASS 4.76 seconds
TestRunner_mgmt-tester FAIL 119.16 seconds
TestRunner_rfcomm-tester PASS 7.52 seconds
TestRunner_sco-tester PASS 9.32 seconds
TestRunner_ioctl-tester PASS 8.02 seconds
TestRunner_mesh-tester PASS 5.86 seconds
TestRunner_smp-tester PASS 6.91 seconds
TestRunner_userchan-tester PASS 5.02 seconds
IncrementalBuild PENDING 0.61 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: TestRunner_mgmt-tester - FAIL
Desc: Run mgmt-tester with test-runner
Output:
Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4
Failed Test Cases
LL Privacy - Start Discovery 2 (Disable RL) Failed 0.190 seconds
LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.153 seconds
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-13 4:35 ` [v2] " bluez.test.bot
@ 2024-12-18 1:30 ` Ying Hsu
2024-12-27 4:40 ` Ying Hsu
0 siblings, 1 reply; 6+ messages in thread
From: Ying Hsu @ 2024-12-18 1:30 UTC (permalink / raw)
To: linux-bluetooth
Hi Luiz,
I've addressed the feedback in v1 and passed the series through our internal CI.
For two LLPrivacy test failures in the `mgmt-tester, I'm wondering if
these failures might be unrelated to this patch.
Could you please take a look at the updated patch set when you have a chance?
Best regards,
Ying
On Fri, Dec 13, 2024 at 12:35 PM <bluez.test.bot@gmail.com> wrote:
>
> This is automated email and please do not reply to this email!
>
> Dear submitter,
>
> Thank you for submitting the patches to the linux bluetooth mailing list.
> This is a CI test results with your patch series:
> PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=917446
>
> ---Test result---
>
> Test Summary:
> CheckPatch PENDING 0.24 seconds
> GitLint PENDING 0.24 seconds
> SubjectPrefix PASS 0.09 seconds
> BuildKernel PASS 24.52 seconds
> CheckAllWarning PASS 28.65 seconds
> CheckSparse PASS 30.25 seconds
> BuildKernel32 PASS 24.18 seconds
> TestRunnerSetup PASS 430.44 seconds
> TestRunner_l2cap-tester PASS 20.19 seconds
> TestRunner_iso-tester PASS 29.42 seconds
> TestRunner_bnep-tester PASS 4.76 seconds
> TestRunner_mgmt-tester FAIL 119.16 seconds
> TestRunner_rfcomm-tester PASS 7.52 seconds
> TestRunner_sco-tester PASS 9.32 seconds
> TestRunner_ioctl-tester PASS 8.02 seconds
> TestRunner_mesh-tester PASS 5.86 seconds
> TestRunner_smp-tester PASS 6.91 seconds
> TestRunner_userchan-tester PASS 5.02 seconds
> IncrementalBuild PENDING 0.61 seconds
>
> Details
> ##############################
> Test: CheckPatch - PENDING
> Desc: Run checkpatch.pl script
> Output:
>
> ##############################
> Test: GitLint - PENDING
> Desc: Run gitlint
> Output:
>
> ##############################
> Test: TestRunner_mgmt-tester - FAIL
> Desc: Run mgmt-tester with test-runner
> Output:
> Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4
>
> Failed Test Cases
> LL Privacy - Start Discovery 2 (Disable RL) Failed 0.190 seconds
> LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.153 seconds
> ##############################
> Test: IncrementalBuild - PENDING
> Desc: Incremental build with the patches in the series
> Output:
>
>
>
> ---
> Regards,
> Linux Bluetooth
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-18 1:30 ` Ying Hsu
@ 2024-12-27 4:40 ` Ying Hsu
0 siblings, 0 replies; 6+ messages in thread
From: Ying Hsu @ 2024-12-27 4:40 UTC (permalink / raw)
To: linux-bluetooth, Luiz Augusto von Dentz,
chromeos-bluetooth-upstreaming, chharry@chromium.org,
Zhengping Jiang
Looping in chharry@ who will be taking over this patch. Thank you for
the review, Luiz.
On Wed, Dec 18, 2024 at 9:30 AM Ying Hsu <yinghsu@chromium.org> wrote:
>
> Hi Luiz,
>
> I've addressed the feedback in v1 and passed the series through our internal CI.
> For two LLPrivacy test failures in the `mgmt-tester, I'm wondering if
> these failures might be unrelated to this patch.
> Could you please take a look at the updated patch set when you have a chance?
>
> Best regards,
> Ying
>
> On Fri, Dec 13, 2024 at 12:35 PM <bluez.test.bot@gmail.com> wrote:
> >
> > This is automated email and please do not reply to this email!
> >
> > Dear submitter,
> >
> > Thank you for submitting the patches to the linux bluetooth mailing list.
> > This is a CI test results with your patch series:
> > PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=917446
> >
> > ---Test result---
> >
> > Test Summary:
> > CheckPatch PENDING 0.24 seconds
> > GitLint PENDING 0.24 seconds
> > SubjectPrefix PASS 0.09 seconds
> > BuildKernel PASS 24.52 seconds
> > CheckAllWarning PASS 28.65 seconds
> > CheckSparse PASS 30.25 seconds
> > BuildKernel32 PASS 24.18 seconds
> > TestRunnerSetup PASS 430.44 seconds
> > TestRunner_l2cap-tester PASS 20.19 seconds
> > TestRunner_iso-tester PASS 29.42 seconds
> > TestRunner_bnep-tester PASS 4.76 seconds
> > TestRunner_mgmt-tester FAIL 119.16 seconds
> > TestRunner_rfcomm-tester PASS 7.52 seconds
> > TestRunner_sco-tester PASS 9.32 seconds
> > TestRunner_ioctl-tester PASS 8.02 seconds
> > TestRunner_mesh-tester PASS 5.86 seconds
> > TestRunner_smp-tester PASS 6.91 seconds
> > TestRunner_userchan-tester PASS 5.02 seconds
> > IncrementalBuild PENDING 0.61 seconds
> >
> > Details
> > ##############################
> > Test: CheckPatch - PENDING
> > Desc: Run checkpatch.pl script
> > Output:
> >
> > ##############################
> > Test: GitLint - PENDING
> > Desc: Run gitlint
> > Output:
> >
> > ##############################
> > Test: TestRunner_mgmt-tester - FAIL
> > Desc: Run mgmt-tester with test-runner
> > Output:
> > Total: 490, Passed: 484 (98.8%), Failed: 2, Not Run: 4
> >
> > Failed Test Cases
> > LL Privacy - Start Discovery 2 (Disable RL) Failed 0.190 seconds
> > LL Privacy - Set Device Flag 1 (Device Privacy) Failed 0.153 seconds
> > ##############################
> > Test: IncrementalBuild - PENDING
> > Desc: Incremental build with the patches in the series
> > Output:
> >
> >
> >
> > ---
> > Regards,
> > Linux Bluetooth
> >
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-13 4:04 [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
2024-12-13 4:35 ` [v2] " bluez.test.bot
@ 2025-01-06 18:10 ` patchwork-bot+bluetooth
2025-01-08 12:35 ` Greg KH
2 siblings, 0 replies; 6+ messages in thread
From: patchwork-bot+bluetooth @ 2025-01-06 18:10 UTC (permalink / raw)
To: Ying Hsu
Cc: linux-bluetooth, luiz.dentz, chromeos-bluetooth-upstreaming,
marcel, linux-kernel
Hello:
This patch was applied to bluetooth/bluetooth-next.git (master)
by Luiz Augusto von Dentz <luiz.von.dentz@intel.com>:
On Fri, 13 Dec 2024 12:04:22 +0800 you wrote:
> When a Bluetooth raw socket is open, the HCI event related to SCO
> connection changes are not dispatched to the hci_event module, and
> the underlying Bluetooth controller's USB Interface 1 will not be
> updated accordingly.
>
> This patch adds `isoc_alt` sysfs attribute, allowing user space
> to update the alternate setting of the USB interface alternate
> setting as needed.
>
> [...]
Here is the summary with links:
- [v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
https://git.kernel.org/bluetooth/bluetooth-next/c/e85c08c0aada
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-13 4:04 [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
2024-12-13 4:35 ` [v2] " bluez.test.bot
2025-01-06 18:10 ` [PATCH v2] " patchwork-bot+bluetooth
@ 2025-01-08 12:35 ` Greg KH
2 siblings, 0 replies; 6+ messages in thread
From: Greg KH @ 2025-01-08 12:35 UTC (permalink / raw)
To: Ying Hsu
Cc: linux-bluetooth, luiz.dentz, chromeos-bluetooth-upstreaming,
Marcel Holtmann, linux-kernel
On Fri, Dec 13, 2024 at 12:04:22PM +0800, Ying Hsu wrote:
> When a Bluetooth raw socket is open, the HCI event related to SCO
> connection changes are not dispatched to the hci_event module, and
> the underlying Bluetooth controller's USB Interface 1 will not be
> updated accordingly.
>
> This patch adds `isoc_alt` sysfs attribute, allowing user space
> to update the alternate setting of the USB interface alternate
> setting as needed.
>
> Signed-off-by: Ying Hsu <yinghsu@chromium.org>
> ---
> This commit has been tested on a chromebook with AX211.
>
> Changes in v2:
> - Add check for the existence of a valid USB interface 1.
You forgot a Documentation/ABI/ entry.
Also, the code isn't quite right:
> @@ -4008,6 +4034,10 @@ static int btusb_probe(struct usb_interface *intf,
> data->isoc, data);
> if (err < 0)
> goto out_free_dev;
> +
> + err = device_create_file(&intf->dev, &dev_attr_isoc_alt);
> + if (err)
> + goto out_free_dev;
You just raced with userspace and lost. Please properly use a device
group instead. That makes for smaller code, and it works properly.
thanks,
greg k-h
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2025-01-08 12:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-13 4:04 [PATCH v2] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
2024-12-13 4:35 ` [v2] " bluez.test.bot
2024-12-18 1:30 ` Ying Hsu
2024-12-27 4:40 ` Ying Hsu
2025-01-06 18:10 ` [PATCH v2] " patchwork-bot+bluetooth
2025-01-08 12:35 ` Greg KH
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox