Exemplo n.º 1
0
static int sony_mapping(struct hid_device *hdev, struct hid_input *hi,
                        struct hid_field *field, struct hid_usage *usage,
                        unsigned long **bit, int *max)
{
    struct sony_sc *sc = hid_get_drvdata(hdev);

    if (sc->quirks & BUZZ_CONTROLLER) {
        unsigned int key = usage->hid & HID_USAGE;

        if ((usage->hid & HID_USAGE_PAGE) != HID_UP_BUTTON)
            return -1;

        switch (usage->collection_index) {
        case 1:
            if (key >= ARRAY_SIZE(buzz_keymap))
                return -1;

            key = buzz_keymap[key];
            if (!key)
                return -1;
            break;
        default:
            return -1;
        }

        hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key);
        return 1;
    }

    if (sc->quirks & PS3REMOTE)
        return ps3remote_mapping(hdev, hi, field, usage, bit, max);

    /* Let hid-core decide for the others */
    return 0;
}
Exemplo n.º 2
0
static int ps3remote_mapping(struct hid_device *hdev, struct hid_input *hi,
                             struct hid_field *field, struct hid_usage *usage,
                             unsigned long **bit, int *max)
{
    unsigned int key = usage->hid & HID_USAGE;

    if ((usage->hid & HID_USAGE_PAGE) != HID_UP_BUTTON)
        return -1;

    switch (usage->collection_index) {
    case 1:
        if (key >= ARRAY_SIZE(ps3remote_keymap_joypad_buttons))
            return -1;

        key = ps3remote_keymap_joypad_buttons[key];
        if (!key)
            return -1;
        break;
    case 2:
        if (key >= ARRAY_SIZE(ps3remote_keymap_remote_buttons))
            return -1;

        key = ps3remote_keymap_remote_buttons[key];
        if (!key)
            return -1;
        break;
    default:
        return -1;
    }

    hid_map_usage_clear(hi, usage, bit, max, EV_KEY, key);
    return 1;
}
Exemplo n.º 3
0
static int gfrm_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	unsigned long hdev_type = (unsigned long) hid_get_drvdata(hdev);

	if (hdev_type == GFRM100) {
		if (usage->hid == (HID_UP_CONSUMER | 0x4)) {
			/* Consumer.0004 -> KEY_INFO */
			hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_INFO);
			return 1;
		}

		if (usage->hid == (HID_UP_CONSUMER | 0x41)) {
			/* Consumer.0041 -> KEY_OK */
			hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_OK);
			return 1;
		}
	}

	return 0;
}
Exemplo n.º 4
0
static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	if (usage->hid == (HID_UP_CUSTOM | 0x0003)) {
		/* The fn key on Apple USB keyboards */
		set_bit(EV_REP, hi->input->evbit);
		hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
		apple_setup_input(hi->input);
		return 1;
	}

	/* we want the hid layer to go through standard path (set and ignore) */
	return 0;
}
Exemplo n.º 5
0
static int apple_input_mapping(struct hid_device *hdev, struct hid_input *hi,
		struct hid_field *field, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	if (usage->hid == (HID_UP_CUSTOM | 0x0003)) {
		
		set_bit(EV_REP, hi->input->evbit);
		hid_map_usage_clear(hi, usage, bit, max, EV_KEY, KEY_FN);
		apple_setup_input(hi->input);
		return 1;
	}

	
	return 0;
}
Exemplo n.º 6
0
static int ms_ergonomy_kb_quirk(struct hid_input *hi, struct hid_usage *usage,
		unsigned long **bit, int *max)
{
	struct input_dev *input = hi->input;

	if ((usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
		switch (usage->hid & HID_USAGE) {
		/*
		 * Microsoft uses these 2 reserved usage ids for 2 keys on
		 * the MS office kb labelled "Office Home" and "Task Pane".
		 */
		case 0x29d:
			ms_map_key_clear(KEY_PROG1);
			return 1;
		case 0x29e:
			ms_map_key_clear(KEY_PROG2);
			return 1;
		}
		return 0;
	}

	if ((usage->hid & HID_USAGE_PAGE) != HID_UP_MSVENDOR)
		return 0;

	switch (usage->hid & HID_USAGE) {
	case 0xfd06: ms_map_key_clear(KEY_CHAT);	break;
	case 0xfd07: ms_map_key_clear(KEY_PHONE);	break;
	case 0xff00:
		/* Special keypad keys */
		ms_map_key_clear(KEY_KPEQUAL);
		set_bit(KEY_KPLEFTPAREN, input->keybit);
		set_bit(KEY_KPRIGHTPAREN, input->keybit);
		break;
	case 0xff01:
		/* Scroll wheel */
		hid_map_usage_clear(hi, usage, bit, max, EV_REL, REL_WHEEL);
		break;
	case 0xff02:
		/*
		 * This byte contains a copy of the modifier keys byte of a
		 * standard hid keyboard report, as send by interface 0
		 * (this usage is found on interface 1).
		 *
		 * This byte only gets send when another key in the same report
		 * changes state, and as such is useless, ignore it.
		 */
		return -1;
	case 0xff05:
		set_bit(EV_REP, input->evbit);
		ms_map_key_clear(KEY_F13);
		set_bit(KEY_F14, input->keybit);
		set_bit(KEY_F15, input->keybit);
		set_bit(KEY_F16, input->keybit);
		set_bit(KEY_F17, input->keybit);
		set_bit(KEY_F18, input->keybit);
		break;
	default:
		return 0;
	}
	return 1;
}