Lines Matching refs:code
74 return (usage->type == EV_KEY && usage->code == keycode);
138 ke->keycode = usage->type == EV_KEY ? usage->code : KEY_RESERVED;
156 *old_keycode = usage->type == EV_KEY ? usage->code : KEY_RESERVED;
157 usage->code = ke->keycode;
160 set_bit(usage->code, dev->keybit);
161 dbg_hid("Assigned keycode %d to HID usage code %x\n", usage->code, usage->hid);
180 * @code: axis code
192 __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
208 switch (code) {
542 int max = 0, code;
590 code = ((usage->hid - 1) & HID_USAGE);
595 code += BTN_MOUSE;
598 if (code <= 0xf) {
599 code += BTN_JOYSTICK;
601 code += BTN_TRIGGER_HAPPY - 0x10;
605 if (code <= 0xf) {
606 code += BTN_GAMEPAD;
608 code += BTN_TRIGGER_HAPPY - 0x10;
615 code += BTN_MOUSE;
618 code += BTN_JOYSTICK;
621 code += BTN_GAMEPAD;
624 code += BTN_MISC;
628 map_key(code);
932 usage->code = MSC_SERIAL;
1655 while (usage->code <= max && test_and_set_bit(usage->code, bit)) {
1657 usage->code = find_next_zero_bit(bit, max + 1, usage->code);
1664 if (usage->code > max) {
1672 if ((device->quirks & HID_QUIRK_BADPAD) && (usage->code == ABS_X || usage->code == ABS_Y)) {
1678 input_set_abs_params(input, usage->code, a, b, (b - a) >> 0x8, (b - a) >> 0x4);
1680 input_set_abs_params(input, usage->code, a, b, 0, 0);
1683 input_abs_set_res(input, usage->code, hidinput_calc_abs_res(field, usage->code));
1686 if (usage->code == ABS_MT_POSITION_X && input->hint_events_per_packet == 0) {
1693 for (i = usage->code; i < usage->code + 0x2 && i <= max; i++) {
1698 field->dpad = usage->code;
1706 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->code == ABS_VOLUME)) {
1720 usage->code = 0;
1725 int code;
1732 if (usage->code == REL_WHEEL_HI_RES) {
1733 code = REL_WHEEL;
1735 code = REL_HWHEEL;
1752 input_event(input, EV_REL, code, lo_res);
1753 input_event(input, EV_REL, usage->code, hi_res);
1777 (((*quirks & HID_QUIRK_X_INVERT) && usage->code == ABS_X) ||
1778 ((*quirks & HID_QUIRK_Y_INVERT) && usage->code == ABS_Y))) {
1790 input_event(input, usage->type, usage->code, hid_hat_to_axis[hat_dir].x);
1791 input_event(input, usage->type, usage->code + 1, hid_hat_to_axis[hat_dir].y);
1802 input_event(input, usage->type, (*quirks & HID_QUIRK_INVERT) ? BTN_TOOL_RUBBER : usage->code, 1);
1805 input_event(input, usage->type, usage->code, 0);
1826 if ((usage->type == EV_KEY) && (usage->code == 0)) { /* Key 0 is "unassigned", not KEY_UNKNOWN */
1830 if ((usage->type == EV_REL) && (usage->code == REL_WHEEL_HI_RES || usage->code == REL_HWHEEL_HI_RES)) {
1835 if ((usage->type == EV_ABS) && (field->flags & HID_MAIN_ITEM_RELATIVE) && (usage->code == ABS_VOLUME)) {
1885 /* report the usage code as scancode if the key status has changed */
1886 if (usage->type == EV_KEY && (!test_bit(usage->code, input->key)) == value) {
1890 input_event(input, usage->type, usage->code, value);
1894 input_event(input, usage->type, usage->code, 0);
1910 int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field)
1920 if ((*field)->usage[j].type == type && (*field)->usage[j].code == code) {
2023 static int hidinput_input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value)
2030 return input_ff_event(dev, type, code, value);
2037 if ((offset = hidinput_find_field(hid, type, code, &field)) == -1) {