diff options
author | Ping Cheng <pinglinux@gmail.com> | 2014-09-10 15:40:05 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2014-09-11 04:24:11 -0400 |
commit | e0984bc376d84190d631d0a4f81215e48fa3a902 (patch) | |
tree | 1ad4d22bece9f09d4e944f3ccf9ef74313201d50 /drivers/hid/wacom_sys.c | |
parent | 89f2ab55ea0292bbdf07e5e0b3266ebf0018a224 (diff) |
HID: wacom - Add default permission defines for sysfs attributes
RW : ug=rw,o=r
WO : ug=w
And enabled reading relavent sysfs attributes.
Signed-off-by: Paul A. Tessier <phernost@gmail.com>
Signed-Off-by: Ping Cheng <pingc@wacom.com>
Tested-by: Benjamin Tissoires <benjamin.tissoires@redhat.com>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
Diffstat (limited to 'drivers/hid/wacom_sys.c')
-rw-r--r-- | drivers/hid/wacom_sys.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/hid/wacom_sys.c b/drivers/hid/wacom_sys.c index f0db7eca9023..779fd32c05d2 100644 --- a/drivers/hid/wacom_sys.c +++ b/drivers/hid/wacom_sys.c | |||
@@ -23,6 +23,9 @@ | |||
23 | #define WAC_CMD_ICON_BT_XFER 0x26 | 23 | #define WAC_CMD_ICON_BT_XFER 0x26 |
24 | #define WAC_CMD_RETRIES 10 | 24 | #define WAC_CMD_RETRIES 10 |
25 | 25 | ||
26 | #define DEV_ATTR_RW_PERM (S_IRUGO | S_IWUSR | S_IWGRP) | ||
27 | #define DEV_ATTR_WO_PERM (S_IWUSR | S_IWGRP) | ||
28 | |||
26 | static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, | 29 | static int wacom_get_report(struct hid_device *hdev, u8 type, u8 id, |
27 | void *buf, size_t size, unsigned int retries) | 30 | void *buf, size_t size, unsigned int retries) |
28 | { | 31 | { |
@@ -604,7 +607,7 @@ static ssize_t wacom_led##SET_ID##_select_show(struct device *dev, \ | |||
604 | struct wacom *wacom = hid_get_drvdata(hdev); \ | 607 | struct wacom *wacom = hid_get_drvdata(hdev); \ |
605 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ | 608 | return snprintf(buf, 2, "%d\n", wacom->led.select[SET_ID]); \ |
606 | } \ | 609 | } \ |
607 | static DEVICE_ATTR(status_led##SET_ID##_select, S_IWUSR | S_IRUSR, \ | 610 | static DEVICE_ATTR(status_led##SET_ID##_select, DEV_ATTR_RW_PERM, \ |
608 | wacom_led##SET_ID##_select_show, \ | 611 | wacom_led##SET_ID##_select_show, \ |
609 | wacom_led##SET_ID##_select_store) | 612 | wacom_led##SET_ID##_select_store) |
610 | 613 | ||
@@ -641,7 +644,7 @@ static ssize_t wacom_##name##_luminance_store(struct device *dev, \ | |||
641 | return wacom_luminance_store(wacom, &wacom->led.field, \ | 644 | return wacom_luminance_store(wacom, &wacom->led.field, \ |
642 | buf, count); \ | 645 | buf, count); \ |
643 | } \ | 646 | } \ |
644 | static DEVICE_ATTR(name##_luminance, S_IWUSR, \ | 647 | static DEVICE_ATTR(name##_luminance, DEV_ATTR_RW_PERM, \ |
645 | NULL, wacom_##name##_luminance_store) | 648 | NULL, wacom_##name##_luminance_store) |
646 | 649 | ||
647 | DEVICE_LUMINANCE_ATTR(status0, llv); | 650 | DEVICE_LUMINANCE_ATTR(status0, llv); |
@@ -683,7 +686,7 @@ static ssize_t wacom_btnimg##BUTTON_ID##_store(struct device *dev, \ | |||
683 | { \ | 686 | { \ |
684 | return wacom_button_image_store(dev, BUTTON_ID, buf, count); \ | 687 | return wacom_button_image_store(dev, BUTTON_ID, buf, count); \ |
685 | } \ | 688 | } \ |
686 | static DEVICE_ATTR(button##BUTTON_ID##_rawimg, S_IWUSR, \ | 689 | static DEVICE_ATTR(button##BUTTON_ID##_rawimg, DEV_ATTR_WO_PERM, \ |
687 | NULL, wacom_btnimg##BUTTON_ID##_store) | 690 | NULL, wacom_btnimg##BUTTON_ID##_store) |
688 | 691 | ||
689 | DEVICE_BTNIMG_ATTR(0); | 692 | DEVICE_BTNIMG_ATTR(0); |
@@ -989,7 +992,7 @@ static ssize_t wacom_store_speed(struct device *dev, | |||
989 | return count; | 992 | return count; |
990 | } | 993 | } |
991 | 994 | ||
992 | static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP, | 995 | static DEVICE_ATTR(speed, DEV_ATTR_RW_PERM, |
993 | wacom_show_speed, wacom_store_speed); | 996 | wacom_show_speed, wacom_store_speed); |
994 | 997 | ||
995 | static struct input_dev *wacom_allocate_input(struct wacom *wacom) | 998 | static struct input_dev *wacom_allocate_input(struct wacom *wacom) |