HID: Make report_descriptor available for all devices
Currently the sysfs report_descriptor attribute is only available if the device is claimed. We have the descriptor before we even create the device node, so just instantiate report_descriptor statically. Signed-off-by: Andy Lutomirski <luto@kernel.org> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
committed by
Jiri Kosina
parent
319645cac2
commit
54f32fd5df
@@ -1691,11 +1691,6 @@ int hid_connect(struct hid_device *hdev, unsigned int connect_mask)
|
|||||||
hid_warn(hdev,
|
hid_warn(hdev,
|
||||||
"can't create sysfs country code attribute err: %d\n", ret);
|
"can't create sysfs country code attribute err: %d\n", ret);
|
||||||
|
|
||||||
ret = device_create_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
|
|
||||||
if (ret)
|
|
||||||
hid_warn(hdev,
|
|
||||||
"can't create sysfs report descriptor attribute err: %d\n", ret);
|
|
||||||
|
|
||||||
hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
|
hid_info(hdev, "%s: %s HID v%x.%02x %s [%s] on %s\n",
|
||||||
buf, bus, hdev->version >> 8, hdev->version & 0xff,
|
buf, bus, hdev->version >> 8, hdev->version & 0xff,
|
||||||
type, hdev->name, hdev->phys);
|
type, hdev->name, hdev->phys);
|
||||||
@@ -1707,7 +1702,6 @@ EXPORT_SYMBOL_GPL(hid_connect);
|
|||||||
void hid_disconnect(struct hid_device *hdev)
|
void hid_disconnect(struct hid_device *hdev)
|
||||||
{
|
{
|
||||||
device_remove_file(&hdev->dev, &dev_attr_country);
|
device_remove_file(&hdev->dev, &dev_attr_country);
|
||||||
device_remove_bin_file(&hdev->dev, &dev_bin_attr_report_desc);
|
|
||||||
if (hdev->claimed & HID_CLAIMED_INPUT)
|
if (hdev->claimed & HID_CLAIMED_INPUT)
|
||||||
hidinput_disconnect(hdev);
|
hidinput_disconnect(hdev);
|
||||||
if (hdev->claimed & HID_CLAIMED_HIDDEV)
|
if (hdev->claimed & HID_CLAIMED_HIDDEV)
|
||||||
@@ -2236,7 +2230,15 @@ static struct attribute *hid_dev_attrs[] = {
|
|||||||
&dev_attr_modalias.attr,
|
&dev_attr_modalias.attr,
|
||||||
NULL,
|
NULL,
|
||||||
};
|
};
|
||||||
ATTRIBUTE_GROUPS(hid_dev);
|
static struct bin_attribute *hid_dev_bin_attrs[] = {
|
||||||
|
&dev_bin_attr_report_desc,
|
||||||
|
NULL
|
||||||
|
};
|
||||||
|
static const struct attribute_group hid_dev_group = {
|
||||||
|
.attrs = hid_dev_attrs,
|
||||||
|
.bin_attrs = hid_dev_bin_attrs,
|
||||||
|
};
|
||||||
|
__ATTRIBUTE_GROUPS(hid_dev);
|
||||||
|
|
||||||
static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
|
static int hid_uevent(struct device *dev, struct kobj_uevent_env *env)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user