• Home
  • Raw
  • Download

Lines Matching full:usage

51 #define map_abs(c)	hid_map_usage(hidinput, usage, &bit, &max, EV_ABS, (c))
52 #define map_rel(c) hid_map_usage(hidinput, usage, &bit, &max, EV_REL, (c))
53 #define map_key(c) hid_map_usage(hidinput, usage, &bit, &max, EV_KEY, (c))
54 #define map_led(c) hid_map_usage(hidinput, usage, &bit, &max, EV_LED, (c))
56 #define map_abs_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
58 #define map_key_clear(c) hid_map_usage_clear(hidinput, usage, &bit, \
61 static bool match_scancode(struct hid_usage *usage, in match_scancode() argument
64 return (usage->hid & (HID_USAGE_PAGE | HID_USAGE)) == scancode; in match_scancode()
67 static bool match_keycode(struct hid_usage *usage, in match_keycode() argument
73 return (usage->type == EV_KEY && usage->code == keycode); in match_keycode()
76 static bool match_index(struct hid_usage *usage, in match_index() argument
82 typedef bool (*hid_usage_cmp_t)(struct hid_usage *usage,
92 struct hid_usage *usage; in hidinput_find_key() local
98 usage = report->field[i]->usage + j; in hidinput_find_key()
99 if (usage->type == EV_KEY || usage->type == 0) { in hidinput_find_key()
100 if (match(usage, cur_idx, value)) { in hidinput_find_key()
103 return usage; in hidinput_find_key()
118 struct hid_usage *usage; in hidinput_locate_usage() local
122 usage = hidinput_find_key(hid, match_index, ke->index, index); in hidinput_locate_usage()
124 usage = hidinput_find_key(hid, match_scancode, scancode, index); in hidinput_locate_usage()
126 usage = NULL; in hidinput_locate_usage()
128 return usage; in hidinput_locate_usage()
135 struct hid_usage *usage; in hidinput_getkeycode() local
138 usage = hidinput_locate_usage(hid, ke, &index); in hidinput_getkeycode()
139 if (usage) { in hidinput_getkeycode()
140 ke->keycode = usage->type == EV_KEY ? in hidinput_getkeycode()
141 usage->code : KEY_RESERVED; in hidinput_getkeycode()
143 scancode = usage->hid & (HID_USAGE_PAGE | HID_USAGE); in hidinput_getkeycode()
157 struct hid_usage *usage; in hidinput_setkeycode() local
159 usage = hidinput_locate_usage(hid, ke, NULL); in hidinput_setkeycode()
160 if (usage) { in hidinput_setkeycode()
161 *old_keycode = usage->type == EV_KEY ? in hidinput_setkeycode()
162 usage->code : KEY_RESERVED; in hidinput_setkeycode()
163 usage->code = ke->keycode; in hidinput_setkeycode()
166 set_bit(usage->code, dev->keybit); in hidinput_setkeycode()
167 dbg_hid("Assigned keycode %d to HID usage code %x\n", in hidinput_setkeycode()
168 usage->code, usage->hid); in hidinput_setkeycode()
567 struct hid_usage *usage) in hidinput_configure_usage() argument
585 (usage->hid & HID_USAGE_PAGE) != HID_UP_LED) { in hidinput_configure_usage()
591 usage, &bit, &max); in hidinput_configure_usage()
598 switch (usage->hid & HID_USAGE_PAGE) { in hidinput_configure_usage()
605 if ((usage->hid & HID_USAGE) < 256) { in hidinput_configure_usage()
606 if (!hid_keyboard[usage->hid & HID_USAGE]) goto ignore; in hidinput_configure_usage()
607 map_key_clear(hid_keyboard[usage->hid & HID_USAGE]); in hidinput_configure_usage()
614 code = ((usage->hid - 1) & HID_USAGE); in hidinput_configure_usage()
645 switch (usage->hid & 0xffff) { in hidinput_configure_usage()
656 if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ in hidinput_configure_usage()
657 switch (usage->hid & 0xf) { in hidinput_configure_usage()
678 if ((usage->hid & 0xf0) == 0xb0) { /* SC - Display */ in hidinput_configure_usage()
679 switch (usage->hid & 0xf) { in hidinput_configure_usage()
695 if ((usage->hid & 0xf0) == 0x90) { /* D-pad */ in hidinput_configure_usage()
696 switch (usage->hid) { in hidinput_configure_usage()
697 case HID_GD_UP: usage->hat_dir = 1; break; in hidinput_configure_usage()
698 case HID_GD_DOWN: usage->hat_dir = 5; break; in hidinput_configure_usage()
699 case HID_GD_RIGHT: usage->hat_dir = 3; break; in hidinput_configure_usage()
700 case HID_GD_LEFT: usage->hat_dir = 7; break; in hidinput_configure_usage()
711 switch (usage->hid) { in hidinput_configure_usage()
712 /* These usage IDs map directly to the usage codes. */ in hidinput_configure_usage()
716 map_rel(usage->hid & 0xf); in hidinput_configure_usage()
718 map_abs_clear(usage->hid & 0xf); in hidinput_configure_usage()
726 map_abs(usage->hid & 0xf); in hidinput_configure_usage()
731 map_rel(usage->hid & 0xf); in hidinput_configure_usage()
733 map_abs(usage->hid & 0xf); in hidinput_configure_usage()
737 usage->hat_min = field->logical_minimum; in hidinput_configure_usage()
738 usage->hat_max = field->logical_maximum; in hidinput_configure_usage()
760 switch (usage->hid & 0xffff) { /* HID-Value: */ in hidinput_configure_usage()
783 switch (usage->hid & 0xff) { in hidinput_configure_usage()
806 usage->type = EV_PWR; in hidinput_configure_usage()
835 * Actual eraser (BTN_TOOL_RUBBER) is set by Invert usage when in hidinput_configure_usage()
847 usage->type = EV_MSC; in hidinput_configure_usage()
848 usage->code = MSC_SERIAL; in hidinput_configure_usage()
858 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
881 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1071 switch (usage->hid) { in hidinput_configure_usage()
1074 usage->type = EV_PWR; in hidinput_configure_usage()
1081 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1100 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1123 switch (usage->hid & HID_USAGE) { in hidinput_configure_usage()
1153 device->driver->input_mapped(device, hidinput, field, usage, in hidinput_configure_usage()
1157 * of the usage is desired. in hidinput_configure_usage()
1162 set_bit(usage->type, input->evbit); in hidinput_configure_usage()
1179 while (usage->code <= max && test_and_set_bit(usage->code, bit)) { in hidinput_configure_usage()
1181 usage->code = find_next_zero_bit(bit, in hidinput_configure_usage()
1183 usage->code); in hidinput_configure_usage()
1190 if (usage->code > max) in hidinput_configure_usage()
1193 if (usage->type == EV_ABS) { in hidinput_configure_usage()
1198 if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) { in hidinput_configure_usage()
1204 input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); in hidinput_configure_usage()
1205 else input_set_abs_params(input, usage->code, a, b, 0, 0); in hidinput_configure_usage()
1207 input_abs_set_res(input, usage->code, in hidinput_configure_usage()
1208 hidinput_calc_abs_res(field, usage->code)); in hidinput_configure_usage()
1211 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) in hidinput_configure_usage()
1215 if (usage->type == EV_ABS && in hidinput_configure_usage()
1216 (usage->hat_min < usage->hat_max || usage->hat_dir)) { in hidinput_configure_usage()
1218 for (i = usage->code; i < usage->code + 2 && i <= max; i++) { in hidinput_configure_usage()
1222 if (usage->hat_dir && !field->dpad) in hidinput_configure_usage()
1223 field->dpad = usage->code; in hidinput_configure_usage()
1226 /* for those devices which produce Consumer volume usage as relative, in hidinput_configure_usage()
1230 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && in hidinput_configure_usage()
1231 (usage->code == ABS_VOLUME)) { in hidinput_configure_usage()
1236 if (usage->type == EV_KEY) { in hidinput_configure_usage()
1244 usage->type = 0; in hidinput_configure_usage()
1245 usage->code = 0; in hidinput_configure_usage()
1248 static void hidinput_handle_scroll(struct hid_usage *usage, in hidinput_handle_scroll() argument
1258 if (usage->code == REL_WHEEL_HI_RES) in hidinput_handle_scroll()
1269 hi_res = value * 120/usage->resolution_multiplier; in hidinput_handle_scroll()
1271 usage->wheel_accumulated += hi_res; in hidinput_handle_scroll()
1272 lo_res = usage->wheel_accumulated/120; in hidinput_handle_scroll()
1274 usage->wheel_accumulated -= lo_res * 120; in hidinput_handle_scroll()
1277 input_event(input, EV_REL, usage->code, hi_res); in hidinput_handle_scroll()
1280 void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, _… in hidinput_hid_event() argument
1285 if (!usage->type) in hidinput_hid_event()
1288 if (usage->type == EV_PWR) { in hidinput_hid_event()
1298 if (usage->type == EV_ABS && in hidinput_hid_event()
1299 (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) || in hidinput_hid_event()
1300 ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) { in hidinput_hid_event()
1304 if (usage->hat_min < usage->hat_max || usage->hat_dir) { in hidinput_hid_event()
1305 int hat_dir = usage->hat_dir; in hidinput_hid_event()
1307 hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; in hidinput_hid_event()
1309 input_event(input, usage->type, usage->code , hid_hat_to_axis[hat_dir].x); in hidinput_hid_event()
1310 input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y); in hidinput_hid_event()
1314 if (usage->hid == (HID_UP_DIGITIZER | 0x003c)) { /* Invert */ in hidinput_hid_event()
1319 if (usage->hid == (HID_UP_DIGITIZER | 0x0032)) { /* InRange */ in hidinput_hid_event()
1321 input_event(input, usage->type, (*quirks & HID_QUIRK_INVERT) ? BTN_TOOL_RUBBER : usage->code, 1); in hidinput_hid_event()
1324 input_event(input, usage->type, usage->code, 0); in hidinput_hid_event()
1325 input_event(input, usage->type, BTN_TOOL_RUBBER, 0); in hidinput_hid_event()
1329 if (usage->hid == (HID_UP_DIGITIZER | 0x0030) && (*quirks & HID_QUIRK_NOTOUCH)) { /* Pressure */ in hidinput_hid_event()
1335 if (usage->hid == (HID_UP_PID | 0x83UL)) { /* Simultaneous Effects Max */ in hidinput_hid_event()
1340 if (usage->hid == (HID_UP_PID | 0x7fUL)) { in hidinput_hid_event()
1345 if ((usage->type == EV_KEY) && (usage->code == 0)) /* Key 0 is "unassigned", not KEY_UNKNOWN */ in hidinput_hid_event()
1348 if ((usage->type == EV_REL) && (usage->code == REL_WHEEL_HI_RES || in hidinput_hid_event()
1349 usage->code == REL_HWHEEL_HI_RES)) { in hidinput_hid_event()
1350 hidinput_handle_scroll(usage, input, value); in hidinput_hid_event()
1354 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && in hidinput_hid_event()
1355 (usage->code == ABS_VOLUME)) { in hidinput_hid_event()
1406 usage->usage_index < field->maxusage && in hidinput_hid_event()
1407 value == field->value[usage->usage_index]) in hidinput_hid_event()
1410 /* report the usage code as scancode if the key status has changed */ in hidinput_hid_event()
1411 if (usage->type == EV_KEY && in hidinput_hid_event()
1412 (!test_bit(usage->code, input->key)) == value) in hidinput_hid_event()
1413 input_event(input, EV_MSC, MSC_SCAN, usage->hid); in hidinput_hid_event()
1415 input_event(input, usage->type, usage->code, value); in hidinput_hid_event()
1418 usage->type == EV_KEY && value) { in hidinput_hid_event()
1420 input_event(input, usage->type, usage->code, 0); in hidinput_hid_event()
1445 if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) in hidinput_find_field()
1465 if (field->usage[j].type == EV_LED) in hidinput_get_led_field()
1486 if (field->usage[j].type == EV_LED && in hidinput_count_leds()
1584 struct hid_usage *usage; in __hidinput_change_resolution_multipliers() local
1605 usage = &report->field[i]->usage[j]; in __hidinput_change_resolution_multipliers()
1607 if (usage->hid != HID_GD_RESOLUTION_MULTIPLIER) in __hidinput_change_resolution_multipliers()
1667 struct hid_usage *usage; in report_features() local
1678 usage = &rep->field[i]->usage[j]; in report_features()
1681 if (usage->hid == HID_DC_BATTERYSTRENGTH) in report_features()
1686 drv->feature_mapping(hid, rep->field[i], usage); in report_features()
1880 report->field[i]->usage + j); in hidinput_configure_usages()
1907 if (IS_INPUT_APPLICATION(col->usage)) in hidinput_connect()