Lines Matching full:usage

52 	__u32 usage;			/* the HID usage associated */  member
56 unsigned int slot_overwrite; /* for globals: allows to set the usage
80 .usage = HID_DG_ERASER,
83 .usage = HID_DG_INVERT,
86 .usage = HID_DG_TIPSWITCH,
89 .usage = HID_DG_TIPPRESSURE,
92 .usage = HID_DG_INRANGE,
96 #define map_abs(c) hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c))
97 #define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
98 #define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
99 #define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
100 #define map_msc(c) hid_map_usage(hidinput, usage, &bit, &max, EV_MSC, (c))
102 #define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
104 #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
107 static bool match_scancode(struct hid_usage *usage, in match_scancode() argument
110 return (usage->hid & (HID_USAGE_PAGE | HID_USAGE)) == scancode; in match_scancode()
113 static bool match_keycode(struct hid_usage *usage, in match_keycode() argument
119 return (usage->type == EV_KEY && usage->code == keycode); in match_keycode()
122 static bool match_index(struct hid_usage *usage, in match_index() argument
128 typedef bool (*hid_usage_cmp_t)(struct hid_usage *usage,
138 struct hid_usage *usage; in hidinput_find_key() local
144 usage = report->field[i]->usage + j; in hidinput_find_key()
145 if (usage->type == EV_KEY || usage->type == 0) { in hidinput_find_key()
146 if (match(usage, cur_idx, value)) { in hidinput_find_key()
149 return usage; in hidinput_find_key()
164 struct hid_usage *usage; in hidinput_locate_usage() local
168 usage = hidinput_find_key(hid, match_index, ke->index, index); in hidinput_locate_usage()
170 usage = hidinput_find_key(hid, match_scancode, scancode, index); in hidinput_locate_usage()
172 usage = NULL; in hidinput_locate_usage()
174 return usage; in hidinput_locate_usage()
181 struct hid_usage *usage; in hidinput_getkeycode() local
184 usage = hidinput_locate_usage(hid, ke, &index); in hidinput_getkeycode()
185 if (usage) { in hidinput_getkeycode()
186 ke->keycode = usage->type == EV_KEY ? in hidinput_getkeycode()
187 usage->code : KEY_RESERVED; in hidinput_getkeycode()
189 scancode = usage->hid & (HID_USAGE_PAGE | HID_USAGE); in hidinput_getkeycode()
203 struct hid_usage *usage; in hidinput_setkeycode() local
205 usage = hidinput_locate_usage(hid, ke, NULL); in hidinput_setkeycode()
206 if (usage) { in hidinput_setkeycode()
207 *old_keycode = usage->type == EV_KEY ? in hidinput_setkeycode()
208 usage->code : KEY_RESERVED; in hidinput_setkeycode()
209 usage->type = EV_KEY; in hidinput_setkeycode()
210 usage->code = ke->keycode; in hidinput_setkeycode()
213 set_bit(usage->code, dev->keybit); in hidinput_setkeycode()
214 dbg_hid("Assigned keycode %d to HID usage code %x\n", in hidinput_setkeycode()
215 usage->code, usage->hid); in hidinput_setkeycode()
628 unsigned int type, unsigned int usage) in hidinput_field_in_collection() argument
632 collection = &device->collection[field->usage->collection_index]; in hidinput_field_in_collection()
634 return collection->type == type && collection->usage == usage; in hidinput_field_in_collection()
638 struct hid_usage *usage, unsigned int usage_index) in hidinput_configure_usage() argument
658 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { in hidinput_configure_usage()
664 if (usage->hid == hidinput_usages_priorities[i].usage) { in hidinput_configure_usage()
686 usage, &bit, &max); in hidinput_configure_usage()
693 switch (usage->hid & HID_USAGE_PAGE) { in hidinput_configure_usage()
700 if ((usage->hid & HID_USAGE) < 256) { in hidinput_configure_usage()
701 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; in hidinput_configure_usage()
702 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); in hidinput_configure_usage()
709 code = ((usage->hid - 1) & HID_USAGE); in hidinput_configure_usage()
751 switch (usage->hid & 0xffff) { in hidinput_configure_usage()
762 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ in hidinput_configure_usage()
763 switch (usage->hid & 0xf) { in hidinput_configure_usage()
784 if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ in hidinput_configure_usage()
785 switch (usage->hid & 0xf) { in hidinput_configure_usage()
801 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ in hidinput_configure_usage()
802 switch (usage->hid) { in hidinput_configure_usage()
803 case HID_GD_UP: usage->hat_dir = 1; break; in hidinput_configure_usage()
804 case HID_GD_DOWN: usage->hat_dir = 5; break; in hidinput_configure_usage()
805 case HID_GD_RIGHT: usage->hat_dir = 3; break; in hidinput_configure_usage()
806 case HID_GD_LEFT: usage->hat_dir = 7; break; in hidinput_configure_usage()
817 switch (usage->hid) { in hidinput_configure_usage()
818 /* These usage IDs map directly to the usage codes. */ in hidinput_configure_usage()
822 map_rel(usage->hid & 0xf); in hidinput_configure_usage()
824 map_abs_clear(usage->hid & 0xf); in hidinput_configure_usage()
832 map_abs(usage->hid & 0xf); in hidinput_configure_usage()
837 map_rel(usage->hid & 0xf); in hidinput_configure_usage()
839 map_abs(usage->hid & 0xf); in hidinput_configure_usage()
843 usage->hat_min = field->logical_minimum; in hidinput_configure_usage()
844 usage->hat_max = field->logical_maximum; in hidinput_configure_usage()
867 switch (usage->hid & 0xffff) { /* HID-Value: */ in hidinput_configure_usage()
890 switch (usage->hid & 0xff) { in hidinput_configure_usage()
934 usage->type = EV_PWR; in hidinput_configure_usage()
963 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when in hidinput_configure_usage()
984 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1007 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1197 switch (usage->hid) { in hidinput_configure_usage()
1200 usage->type = EV_PWR; in hidinput_configure_usage()
1206 switch (usage->hid) { in hidinput_configure_usage()
1209 usage->type = EV_PWR; in hidinput_configure_usage()
1216 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1235 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1258 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1288 device->driver->input_mapped(device, hidinput, field, usage, in hidinput_configure_usage()
1292 * of the usage is desired. in hidinput_configure_usage()
1297 set_bit(usage->type, input->evbit); in hidinput_configure_usage()
1314 while (usage->code <= max && test_and_set_bit(usage->code, bit)) { in hidinput_configure_usage()
1316 usage->code = find_next_zero_bit(bit, in hidinput_configure_usage()
1318 usage->code); in hidinput_configure_usage()
1325 if (usage->code > max) in hidinput_configure_usage()
1328 if (usage->type == EV_ABS) { in hidinput_configure_usage()
1333 if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { in hidinput_configure_usage()
1339 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); in hidinput_configure_usage()
1340 else input_set_abs_params(input, usage->code, a, b, 0, 0); in hidinput_configure_usage()
1342 input_abs_set_res(input, usage->code, in hidinput_configure_usage()
1343 hidinput_calc_abs_res(field, usage->code)); in hidinput_configure_usage()
1346 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) in hidinput_configure_usage()
1350 if (usage->type == EV_ABS && in hidinput_configure_usage()
1351 (usage->hat_min < usage->hat_max || usage->hat_dir)) { in hidinput_configure_usage()
1353 for (i = usage->code; i < usage->code + 2 && i <= max; i++) { in hidinput_configure_usage()
1357 if (usage->hat_dir && !field->dpad) in hidinput_configure_usage()
1358 field->dpad = usage->code; in hidinput_configure_usage()
1361 /* for those devices which produce Consumer volume usage as relative, in hidinput_configure_usage()
1365 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && in hidinput_configure_usage()
1366 (usage->code == ABS_VOLUME)) { in hidinput_configure_usage()
1371 if (usage->type == EV_KEY) { in hidinput_configure_usage()
1379 usage->type = 0; in hidinput_configure_usage()
1380 usage->code = 0; in hidinput_configure_usage()
1383 static void hidinput_handle_scroll(struct hid_usage *usage, in hidinput_handle_scroll() argument
1393 if (usage->code == REL_WHEEL_HI_RES) in hidinput_handle_scroll()
1404 hi_res = value * 120/usage->resolution_multiplier; in hidinput_handle_scroll()
1406 usage->wheel_accumulated += hi_res; in hidinput_handle_scroll()
1407 lo_res = usage->wheel_accumulated/120; in hidinput_handle_scroll()
1409 usage->wheel_accumulated -= lo_res * 120; in hidinput_handle_scroll()
1412 input_event(input, EV_REL, usage->code, hi_res); in hidinput_handle_scroll()
1443 void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, _… in hidinput_hid_event() argument
1449 if (!usage->type) in hidinput_hid_event()
1452 if (usage->type == EV_PWR) { in hidinput_hid_event()
1462 if (usage->hat_min < usage->hat_max || usage->hat_dir) { in hidinput_hid_event()
1463 int hat_dir = usage->hat_dir; in hidinput_hid_event()
1465 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; in hidinput_hid_event()
1467 input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); in hidinput_hid_event()
1468 input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); in hidinput_hid_event()
1496 switch (usage->hid) { in hidinput_hid_event()
1537 report->tool = usage->code; in hidinput_hid_event()
1542 hid_report_release_tool(report, input, usage->code); in hidinput_hid_event()
1581 switch (usage->type) { in hidinput_hid_event()
1583 if (usage->code == 0) /* Key 0 is "unassigned", not KEY_UNKNOWN */ in hidinput_hid_event()
1588 if (usage->code == REL_WHEEL_HI_RES || in hidinput_hid_event()
1589 usage->code == REL_HWHEEL_HI_RES) { in hidinput_hid_event()
1590 hidinput_handle_scroll(usage, input, value); in hidinput_hid_event()
1597 usage->code == ABS_VOLUME) { in hidinput_hid_event()
1610 } else if (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || in hidinput_hid_event()
1611 ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y)) in hidinput_hid_event()
1629 usage->usage_index < field->maxusage && in hidinput_hid_event()
1630 value == field->value[usage->usage_index]) in hidinput_hid_event()
1633 /* report the usage code as scancode if the key status has changed */ in hidinput_hid_event()
1634 if (usage->type == EV_KEY && in hidinput_hid_event()
1635 (!test_bit(usage->code, input->key)) == value) in hidinput_hid_event()
1636 input_event(input, EV_MSC, MSC_SCAN, usage->hid); in hidinput_hid_event()
1638 input_event(input, usage->type, usage->code, value); in hidinput_hid_event()
1641 usage->type == EV_KEY && value) { in hidinput_hid_event()
1643 input_event(input, usage->type, usage->code, 0); in hidinput_hid_event()
1669 if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) in hidinput_find_field()
1688 if (field->usage[j].type == EV_LED) in hidinput_get_led_field()
1709 if (field->usage[j].type == EV_LED && in hidinput_count_leds()
1807 struct hid_usage *usage; in __hidinput_change_resolution_multipliers() local
1828 usage = &report->field[i]->usage[j]; in __hidinput_change_resolution_multipliers()
1830 if (usage->hid != HID_GD_RESOLUTION_MULTIPLIER) in __hidinput_change_resolution_multipliers()
1890 struct hid_usage *usage; in report_features() local
1901 usage = &rep->field[i]->usage[j]; in report_features()
1904 if (usage->hid == HID_DC_BATTERYSTRENGTH) in report_features()
1909 drv->feature_mapping(hid, rep->field[i], usage); in report_features()
2132 /* ignore fields without usage */ in hidinput_configure_usages()
2139 if (prev_collection_index != field->usage->collection_index) { in hidinput_configure_usages()
2140 prev_collection_index = field->usage->collection_index; in hidinput_configure_usages()
2148 if (slot_collection_index == field->usage->collection_index) { in hidinput_configure_usages()
2155 if (field->usage[j].hid == HID_DG_CONTACTID) { in hidinput_configure_usages()
2156 slot_collection_index = field->usage->collection_index; in hidinput_configure_usages()
2173 report->field[i]->usage + j, in hidinput_configure_usages()
2201 if (IS_INPUT_APPLICATION(col->usage)) in hidinput_connect()