diff options
Diffstat (limited to 'drivers/hid/hid-vivaldi.c')
-rw-r--r-- | drivers/hid/hid-vivaldi.c | 27 |
1 files changed, 7 insertions, 20 deletions
diff --git a/drivers/hid/hid-vivaldi.c b/drivers/hid/hid-vivaldi.c index 42ceb2058a09..ca8cb40928e6 100644 --- a/drivers/hid/hid-vivaldi.c +++ b/drivers/hid/hid-vivaldi.c @@ -8,37 +8,24 @@ #include <linux/device.h> #include <linux/hid.h> +#include <linux/input/vivaldi-fmap.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/sysfs.h> -#define MIN_FN_ROW_KEY 1 -#define MAX_FN_ROW_KEY 24 +#define MIN_FN_ROW_KEY 1 +#define MAX_FN_ROW_KEY VIVALDI_MAX_FUNCTION_ROW_KEYS #define HID_VD_FN_ROW_PHYSMAP 0x00000001 #define HID_USAGE_FN_ROW_PHYSMAP (HID_UP_GOOGLEVENDOR | HID_VD_FN_ROW_PHYSMAP) -struct vivaldi_data { - u32 function_row_physmap[MAX_FN_ROW_KEY - MIN_FN_ROW_KEY + 1]; - int max_function_row_key; -}; - static ssize_t function_row_physmap_show(struct device *dev, struct device_attribute *attr, char *buf) { struct hid_device *hdev = to_hid_device(dev); struct vivaldi_data *drvdata = hid_get_drvdata(hdev); - ssize_t size = 0; - int i; - - if (!drvdata->max_function_row_key) - return 0; - for (i = 0; i < drvdata->max_function_row_key; i++) - size += sprintf(buf + size, "%02X ", - drvdata->function_row_physmap[i]); - size += sprintf(buf + size, "\n"); - return size; + return vivaldi_function_row_physmap_show(drvdata, buf); } static DEVICE_ATTR_RO(function_row_physmap); @@ -85,11 +72,11 @@ static void vivaldi_feature_mapping(struct hid_device *hdev, (usage->hid & HID_USAGE_PAGE) != HID_UP_ORDINAL) return; - fn_key = (usage->hid & HID_USAGE); + fn_key = usage->hid & HID_USAGE; if (fn_key < MIN_FN_ROW_KEY || fn_key > MAX_FN_ROW_KEY) return; - if (fn_key > drvdata->max_function_row_key) - drvdata->max_function_row_key = fn_key; + if (fn_key > drvdata->num_function_row_keys) + drvdata->num_function_row_keys = fn_key; report_data = buf = hid_alloc_report_buf(report, GFP_KERNEL); if (!report_data) |