* [PATCH] Bluetooth: btusb: add sysfs attribute to control USB alt setting
@ 2024-12-12 17:35 Ying Hsu
2024-12-12 17:58 ` bluez.test.bot
2024-12-12 18:02 ` [PATCH] " Luiz Augusto von Dentz
0 siblings, 2 replies; 3+ messages in thread
From: Ying Hsu @ 2024-12-12 17:35 UTC (permalink / raw)
To: linux-bluetooth, luiz.dentz; +Cc: chromeos-bluetooth-upstreaming, Ying Hsu
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.
BUG=b:382526205
TEST=read and write /sys/class/bluetooth/hci0/isoc_alt
Series-to: linux-bluetooth@vger.kernel.org
Series-to: luiz.dentz@gmail.com
Series-cc: chromeos-bluetooth-upstreaming@chromium.org
Commit-notes:
This commit has been tested on a chromebook with AX211.
END
Change-Id: Ifc708cc471a8834b344c26fce1ce2fe3e5992cad
Signed-off-by: Ying Hsu <yinghsu@chromium.org>
---
drivers/bluetooth/btusb.c | 32 ++++++++++++++++++++++++++++++++
1 file changed, 32 insertions(+)
diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
index 279fe6c115fa..e8446f3e026e 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)
{
@@ -4032,6 +4058,10 @@ static int btusb_probe(struct usb_interface *intf,
debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, data,
&force_poll_sync_fops);
+ err = device_create_file(&intf->dev, &dev_attr_isoc_alt);
+ if (err)
+ goto out_free_dev;
+
return 0;
out_free_dev:
@@ -4052,6 +4082,8 @@ static void btusb_disconnect(struct usb_interface *intf)
return;
hdev = data->hdev;
+ device_remove_file(&intf->dev, &dev_attr_isoc_alt);
+
usb_set_intfdata(data->intf, NULL);
if (data->isoc)
--
2.47.0.338.g60cca15819-goog
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-12 17:35 [PATCH] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
@ 2024-12-12 17:58 ` bluez.test.bot
2024-12-12 18:02 ` [PATCH] " Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2024-12-12 17:58 UTC (permalink / raw)
To: linux-bluetooth, yinghsu
[-- Attachment #1: Type: text/plain, Size: 1680 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=917321
---Test result---
Test Summary:
CheckPatch PENDING 0.40 seconds
GitLint PENDING 0.25 seconds
SubjectPrefix PASS 0.07 seconds
BuildKernel PASS 24.76 seconds
CheckAllWarning PASS 27.05 seconds
CheckSparse PASS 30.79 seconds
BuildKernel32 PASS 24.46 seconds
TestRunnerSetup PASS 434.06 seconds
TestRunner_l2cap-tester PASS 20.47 seconds
TestRunner_iso-tester PASS 31.71 seconds
TestRunner_bnep-tester PASS 4.88 seconds
TestRunner_mgmt-tester PASS 121.82 seconds
TestRunner_rfcomm-tester PASS 7.60 seconds
TestRunner_sco-tester PASS 9.38 seconds
TestRunner_ioctl-tester PASS 8.27 seconds
TestRunner_mesh-tester PASS 6.07 seconds
TestRunner_smp-tester PASS 7.03 seconds
TestRunner_userchan-tester PASS 5.06 seconds
IncrementalBuild PENDING 0.68 seconds
Details
##############################
Test: CheckPatch - PENDING
Desc: Run checkpatch.pl script
Output:
##############################
Test: GitLint - PENDING
Desc: Run gitlint
Output:
##############################
Test: IncrementalBuild - PENDING
Desc: Incremental build with the patches in the series
Output:
---
Regards,
Linux Bluetooth
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Bluetooth: btusb: add sysfs attribute to control USB alt setting
2024-12-12 17:35 [PATCH] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
2024-12-12 17:58 ` bluez.test.bot
@ 2024-12-12 18:02 ` Luiz Augusto von Dentz
1 sibling, 0 replies; 3+ messages in thread
From: Luiz Augusto von Dentz @ 2024-12-12 18:02 UTC (permalink / raw)
To: Ying Hsu; +Cc: linux-bluetooth, chromeos-bluetooth-upstreaming
Hi Ying,
On Thu, Dec 12, 2024 at 12:35 PM Ying Hsu <yinghsu@chromium.org> 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.
>
> BUG=b:382526205
> TEST=read and write /sys/class/bluetooth/hci0/isoc_alt
>
> Series-to: linux-bluetooth@vger.kernel.org
> Series-to: luiz.dentz@gmail.com
> Series-cc: chromeos-bluetooth-upstreaming@chromium.org
>
> Commit-notes:
> This commit has been tested on a chromebook with AX211.
> END
>
> Change-Id: Ifc708cc471a8834b344c26fce1ce2fe3e5992cad
Ok, what is up with these artifacts? I don't think we use those upstream.
> Signed-off-by: Ying Hsu <yinghsu@chromium.org>
> ---
> drivers/bluetooth/btusb.c | 32 ++++++++++++++++++++++++++++++++
> 1 file changed, 32 insertions(+)
>
> diff --git a/drivers/bluetooth/btusb.c b/drivers/bluetooth/btusb.c
> index 279fe6c115fa..e8446f3e026e 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)
> {
> @@ -4032,6 +4058,10 @@ static int btusb_probe(struct usb_interface *intf,
> debugfs_create_file("force_poll_sync", 0644, hdev->debugfs, data,
> &force_poll_sync_fops);
>
> + err = device_create_file(&intf->dev, &dev_attr_isoc_alt);
> + if (err)
> + goto out_free_dev;
This should probably be behind a check for data->isoc, otherwise it
won't be useful to export into sysfs if there isn't any interface to
begin with or that has been marked as broken (e.g. BTUSB_BROKEN_ISOC).
> return 0;
>
> out_free_dev:
> @@ -4052,6 +4082,8 @@ static void btusb_disconnect(struct usb_interface *intf)
> return;
>
> hdev = data->hdev;
> + device_remove_file(&intf->dev, &dev_attr_isoc_alt);
Ditto, make it conditional to data->isoc.
> usb_set_intfdata(data->intf, NULL);
>
> if (data->isoc)
> --
> 2.47.0.338.g60cca15819-goog
>
--
Luiz Augusto von Dentz
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-12-12 18:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-12 17:35 [PATCH] Bluetooth: btusb: add sysfs attribute to control USB alt setting Ying Hsu
2024-12-12 17:58 ` bluez.test.bot
2024-12-12 18:02 ` [PATCH] " Luiz Augusto von Dentz
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.