Skip to content

Commit 0f8a001

Browse files
Hsin-chen ChuangVudentz
authored andcommitted
Bluetooth: Allow reset via sysfs
Allow sysfs to trigger hdev reset. This is required to recover devices that are not responsive from userspace. Signed-off-by: Hsin-chen Chuang <[email protected]> Signed-off-by: Luiz Augusto von Dentz <[email protected]>
1 parent f07d478 commit 0f8a001

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

net/bluetooth/hci_sysfs.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,28 @@ static void bt_host_release(struct device *dev)
9090
module_put(THIS_MODULE);
9191
}
9292

93+
static ssize_t reset_store(struct device *dev, struct device_attribute *attr,
94+
const char *buf, size_t count)
95+
{
96+
struct hci_dev *hdev = to_hci_dev(dev);
97+
98+
if (hdev->reset)
99+
hdev->reset(hdev);
100+
101+
return count;
102+
}
103+
static DEVICE_ATTR_WO(reset);
104+
105+
static struct attribute *bt_host_attrs[] = {
106+
&dev_attr_reset.attr,
107+
NULL,
108+
};
109+
ATTRIBUTE_GROUPS(bt_host);
110+
93111
static const struct device_type bt_host = {
94112
.name = "host",
95113
.release = bt_host_release,
114+
.groups = bt_host_groups,
96115
};
97116

98117
void hci_init_sysfs(struct hci_dev *hdev)

0 commit comments

Comments
 (0)