Lines Matching defs:hid
20 #include <linux/hid.h>
21 #include <linux/hid-debug.h>
23 #include "hid-ids.h"
66 return (usage->hid & (HID_USAGE_PAGE | HID_USAGE)) == scancode;
84 static struct hid_usage *hidinput_find_key(struct hid_device *hid, hid_usage_cmp_t match, unsigned int value,
92 list_for_each_entry(report, &hid->report_enum[k].report_list, list)
113 static struct hid_usage *hidinput_locate_usage(struct hid_device *hid, const struct input_keymap_entry *ke,
120 usage = hidinput_find_key(hid, match_index, ke->index, index);
122 usage = hidinput_find_key(hid, match_scancode, scancode, index);
132 struct hid_device *hid = input_get_drvdata(dev);
136 usage = hidinput_locate_usage(hid, ke, &index);
140 scancode = usage->hid & (HID_USAGE_PAGE | HID_USAGE);
151 struct hid_device *hid = input_get_drvdata(dev);
154 usage = hidinput_locate_usage(hid, ke, NULL);
161 dbg_hid("Assigned keycode %d to HID usage code %x\n", usage->code, usage->hid);
167 if (hidinput_find_key(hid, match_keycode, *old_keycode, NULL)) {
438 psy_desc->name = kasprintf(GFP_KERNEL, "hid-%s-battery", strlen(dev->uniq) ? dev->uniq : dev_name(&dev->dev));
557 if (field->report_type == HID_OUTPUT_REPORT && (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) {
571 switch (usage->hid & HID_USAGE_PAGE) {
578 if ((usage->hid & HID_USAGE) < 0x100) {
579 if (!hid_keyboard[usage->hid & HID_USAGE]) {
582 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]);
590 code = ((usage->hid - 1) & HID_USAGE);
632 switch (usage->hid & 0xffff) {
654 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */
655 switch (usage->hid & 0xf) {
707 if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */
708 switch (usage->hid & 0xf) {
728 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */
729 switch (usage->hid) {
753 switch (usage->hid) {
762 map_rel(usage->hid & 0xf);
764 map_abs_clear(usage->hid & 0xf);
773 map_abs(usage->hid & 0xf);
779 map_rel(usage->hid & 0xf);
781 map_abs(usage->hid & 0xf);
814 switch (usage->hid & 0xffff) { /* HID-Value: */
861 switch (usage->hid & 0xff) {
943 switch (usage->hid & HID_USAGE) {
1001 switch (usage->hid & HID_USAGE) {
1511 switch (usage->hid) {
1523 switch (usage->hid & HID_USAGE) {
1567 switch (usage->hid & HID_USAGE) {
1597 switch (usage->hid & HID_USAGE) {
1756 void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value)
1759 unsigned *quirks = &hid->quirks;
1766 hidinput_update_battery(hid, value);
1795 if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */
1800 if (usage->hid == (HID_UP_DIGITIZER | 0x0032)) { /* InRange */
1810 if (usage->hid == (HID_UP_DIGITIZER | 0x0030) && (*quirks & HID_QUIRK_NOTOUCH)) { /* Pressure */
1816 if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */
1821 if (usage->hid == (HID_UP_PID | 0x7fUL)) {
1887 input_event(input, EV_MSC, MSC_SCAN, usage->hid);
1898 void hidinput_report_event(struct hid_device *hid, struct hid_report *report)
1902 if (hid->quirks & HID_QUIRK_NO_INPUT_SYNC) {
1906 list_for_each_entry(hidinput, &hid->inputs, list) input_sync(hidinput->input);
1910 int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field)
1915 list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list)
1930 struct hid_field *hidinput_get_led_field(struct hid_device *hid)
1936 list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list)
1951 unsigned int hidinput_count_leds(struct hid_device *hid)
1958 list_for_each_entry(report, &hid->report_enum[HID_OUTPUT_REPORT].report_list, list)
1975 struct hid_device *hid = container_of(work, struct hid_device, led_work);
1982 field = hidinput_get_led_field(hid);
2003 if (hid->ll_driver->request) {
2004 return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT);
2016 ret = hid_hw_output_report(hid, buf, len);
2018 hid_hw_raw_request(hid, report->id, buf, len, HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
2025 struct hid_device *hid = input_get_drvdata(dev);
2037 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) {
2044 schedule_work(&hid->led_work);
2050 struct hid_device *hid = input_get_drvdata(dev);
2052 return hid_hw_open(hid);
2057 struct hid_device *hid = input_get_drvdata(dev);
2059 hid_hw_close(hid);
2062 static bool __hidinput_change_resolution_multipliers(struct hid_device *hid, struct hid_report *report,
2088 if (usage->hid != HID_GD_RESOLUTION_MULTIPLIER) {
2103 if (hid->quirks & HID_QUIRK_NO_INIT_REPORTS) {
2107 hid_hw_request(hid, report, HID_REQ_GET_REPORT);
2108 hid_hw_wait(hid);
2120 static void hidinput_change_resolution_multipliers(struct hid_device *hid)
2126 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
2129 bool update_needed = __hidinput_change_resolution_multipliers(hid, rep, true);
2131 ret = __hid_request(hid, rep, HID_REQ_SET_REPORT);
2133 __hidinput_change_resolution_multipliers(hid, rep, false);
2139 hid_setup_resolution_multiplier(hid);
2142 static void report_features(struct hid_device *hid)
2144 struct hid_driver *drv = hid->driver;
2150 rep_enum = &hid->report_enum[HID_FEATURE_REPORT];
2162 if (usage->hid == HID_DC_BATTERYSTRENGTH) {
2163 hidinput_setup_battery(hid, HID_FEATURE_REPORT, rep->field[i]);
2167 drv->feature_mapping(hid, rep->field[i], usage);
2174 static struct hid_input *hidinput_allocate(struct hid_device *hid, unsigned int application)
2185 if ((hid->quirks & HID_QUIRK_INPUT_PER_APP) && hid->maxapplication > 1) {
2223 name_len = strlen(hid->name);
2225 if ((name_len < suffix_len) || strcmp(hid->name + name_len - suffix_len, suffix)) {
2226 hidinput->name = kasprintf(GFP_KERNEL, "%s %s", hid->name, suffix);
2233 input_set_drvdata(input_dev, hid);
2240 input_dev->name = hidinput->name ? hidinput->name : hid->name;
2241 input_dev->phys = hid->phys;
2242 input_dev->uniq = hid->uniq;
2243 input_dev->id.bustype = hid->bus;
2244 input_dev->id.vendor = hid->vendor;
2245 input_dev->id.product = hid->product;
2246 input_dev->id.version = hid->version;
2247 input_dev->dev.parent = &hid->dev;
2251 list_add_tail(&hidinput->list, &hid->inputs);
2260 hid_err(hid, "Out of memory during hid input probe\n");
2308 static void hidinput_cleanup_hidinput(struct hid_device *hid, struct hid_input *hidinput)
2318 if ((k == HID_OUTPUT_REPORT) && (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)) {
2322 list_for_each_entry(report, &hid->report_enum[k].report_list, list)
2337 struct hid_device *hid = report->device;
2340 list_for_each_entry(hidinput, &hid->inputs, list)
2352 struct hid_device *hid = report->device;
2355 list_for_each_entry(hidinput, &hid->inputs, list)
2382 int hidinput_connect(struct hid_device *hid, unsigned int force)
2384 struct hid_driver *drv = hid->driver;
2390 INIT_LIST_HEAD(&hid->inputs);
2391 INIT_WORK(&hid->led_work, hidinput_led_worker);
2393 hid->status &= ~HID_STAT_DUP_DETECTED;
2396 for (i = 0; i < hid->maxcollection; i++) {
2397 struct hid_collection *col = &hid->collection[i];
2405 if (i == hid->maxcollection) {
2410 report_features(hid);
2413 if ((k == HID_OUTPUT_REPORT) && (hid->quirks & HID_QUIRK_SKIP_OUTPUT_REPORTS)) {
2417 list_for_each_entry(report, &hid->report_enum[k].report_list, list)
2429 if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
2431 } else if (hid->maxapplication > 1 && (hid->quirks & HID_QUIRK_INPUT_PER_APP)) {
2436 hidinput = hidinput_allocate(hid, application);
2444 if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
2452 hidinput_change_resolution_multipliers(hid);
2454 list_for_each_entry_safe(hidinput, next, &hid->inputs, list)
2456 if (drv->input_configured && drv->input_configured(hid, hidinput)) {
2462 hidinput_cleanup_hidinput(hid, hidinput);
2472 if (list_empty(&hid->inputs)) {
2473 hid_err(hid, "No inputs registered, leaving\n");
2477 if (hid->status & HID_STAT_DUP_DETECTED) {
2478 hid_dbg(hid, "Some usages could not be mapped, please use HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE if this is "
2486 hidinput_disconnect(hid);
2492 void hidinput_disconnect(struct hid_device *hid)
2496 hidinput_cleanup_battery(hid);
2498 list_for_each_entry_safe(hidinput, next, &hid->inputs, list)
2514 cancel_work_sync(&hid->led_work);