From b8c9c642db4ab0811cc5bb0d8b90cc7819055c95 Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:07:37 -0500 Subject: Inpur: recognize and ignore Logitech vendor usages in HID These get in our way with MX mice. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-input.c | 1 + drivers/usb/input/hid.h | 1 + 2 files changed, 2 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 63a4db721f7..3b162a19d7b 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -296,6 +296,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel break; case HID_UP_MSVENDOR: + case HID_UP_LOGIVENDOR: goto ignore; diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index c1b6b69bc4a..f3b85a0c200 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -182,6 +182,7 @@ struct hid_item { #define HID_UP_PID 0x000f0000 #define HID_UP_HPVENDOR 0xff7f0000 #define HID_UP_MSVENDOR 0xff000000 +#define HID_UP_LOGIVENDOR 0x00ff0000 #define HID_USAGE 0x0000ffff -- cgit v1.2.3 From 0aebfdac042b63d0f2625414062e138a4333181c Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:07:59 -0500 Subject: Input: add HID simulation mappings Add simulation usage page mappings to hid-input.c to support a new crop of joysticks using them to designate Rudder and Throttle controls. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-debug.h | 17 +++++++++++++++++ drivers/usb/input/hid-input.c | 9 +++++++++ drivers/usb/input/hid.h | 1 + 3 files changed, 27 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-debug.h b/drivers/usb/input/hid-debug.h index 52437e5e2e7..789df807b11 100644 --- a/drivers/usb/input/hid-debug.h +++ b/drivers/usb/input/hid-debug.h @@ -85,6 +85,23 @@ static const struct hid_usage_entry hid_usage_table[] = { {0, 0x91, "D-PadDown"}, {0, 0x92, "D-PadRight"}, {0, 0x93, "D-PadLeft"}, + { 2, 0, "Simulation" }, + {0, 0xb0, "Aileron"}, + {0, 0xb1, "AileronTrim"}, + {0, 0xb2, "Anti-Torque"}, + {0, 0xb3, "Autopilot"}, + {0, 0xb4, "Chaff"}, + {0, 0xb5, "Collective"}, + {0, 0xb6, "DiveBrake"}, + {0, 0xb7, "ElectronicCountermeasures"}, + {0, 0xb8, "Elevator"}, + {0, 0xb9, "ElevatorTrim"}, + {0, 0xba, "Rudder"}, + {0, 0xbb, "Throttle"}, + {0, 0xbc, "FlightCommunications"}, + {0, 0xbd, "FlareRelease"}, + {0, 0xbe, "LandingGear"}, + {0, 0xbf, "ToeBrake"}, { 7, 0, "Keyboard" }, { 8, 0, "LED" }, {0, 0x01, "NumLock"}, diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 3b162a19d7b..fa4f79d88aa 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -131,6 +131,15 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel map_key(code); break; + + case HID_UP_SIMULATION: + + switch (usage->hid & 0xffff) { + case 0xba: map_abs(ABS_RUDDER); break; + case 0xbb: map_abs(ABS_THROTTLE); break; + } + break; + case HID_UP_GENDESK: if ((usage->hid & 0xf0) == 0x80) { /* SystemControl */ diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index f3b85a0c200..cea5cf34b5f 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -173,6 +173,7 @@ struct hid_item { #define HID_UP_UNDEFINED 0x00000000 #define HID_UP_GENDESK 0x00010000 +#define HID_UP_SIMULATION 0x00020000 #define HID_UP_KEYBOARD 0x00070000 #define HID_UP_LED 0x00080000 #define HID_UP_BUTTON 0x00090000 -- cgit v1.2.3 From 8a409b0118c2d78f84f740f60fe03abda1fe3333 Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:08:08 -0500 Subject: Input: HID - add more consumer usages Extend mapping of the consumer usage page in hid-input.c to handle more cases appearing on new USB keyboards. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-debug.h | 17 +++++++++++------ drivers/usb/input/hid-input.c | 19 ++++++++++++++++--- drivers/usb/input/hid.h | 1 + 3 files changed, 28 insertions(+), 9 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-debug.h b/drivers/usb/input/hid-debug.h index 789df807b11..ceebab99eff 100644 --- a/drivers/usb/input/hid-debug.h +++ b/drivers/usb/input/hid-debug.h @@ -109,6 +109,7 @@ static const struct hid_usage_entry hid_usage_table[] = { {0, 0x03, "ScrollLock"}, {0, 0x04, "Compose"}, {0, 0x05, "Kana"}, + {0, 0x4b, "GenericIndicator"}, { 9, 0, "Button" }, { 10, 0, "Ordinal" }, { 12, 0, "Consumer" }, @@ -591,7 +592,8 @@ static char *keys[KEY_MAX + 1] = { [KEY_EXIT] = "Exit", [KEY_MOVE] = "Move", [KEY_EDIT] = "Edit", [KEY_SCROLLUP] = "ScrollUp", [KEY_SCROLLDOWN] = "ScrollDown", [KEY_KPLEFTPAREN] = "KPLeftParenthesis", - [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_F13] = "F13", + [KEY_KPRIGHTPAREN] = "KPRightParenthesis", [KEY_NEW] = "New", + [KEY_REDO] = "Redo", [KEY_F13] = "F13", [KEY_F14] = "F14", [KEY_F15] = "F15", [KEY_F16] = "F16", [KEY_F17] = "F17", [KEY_F18] = "F18", [KEY_F19] = "F19", @@ -601,15 +603,15 @@ static char *keys[KEY_MAX + 1] = { [KEY_PAUSECD] = "PauseCD", [KEY_PROG3] = "Prog3", [KEY_PROG4] = "Prog4", [KEY_SUSPEND] = "Suspend", [KEY_CLOSE] = "Close", [KEY_PLAY] = "Play", - [KEY_FASTFORWARD] = "Fast Forward", [KEY_BASSBOOST] = "Bass Boost", + [KEY_FASTFORWARD] = "FastForward", [KEY_BASSBOOST] = "BassBoost", [KEY_PRINT] = "Print", [KEY_HP] = "HP", [KEY_CAMERA] = "Camera", [KEY_SOUND] = "Sound", [KEY_QUESTION] = "Question", [KEY_EMAIL] = "Email", [KEY_CHAT] = "Chat", [KEY_SEARCH] = "Search", [KEY_CONNECT] = "Connect", [KEY_FINANCE] = "Finance", [KEY_SPORT] = "Sport", [KEY_SHOP] = "Shop", - [KEY_ALTERASE] = "Alternate Erase", [KEY_CANCEL] = "Cancel", - [KEY_BRIGHTNESSDOWN] = "Brightness down", [KEY_BRIGHTNESSUP] = "Brightness up", + [KEY_ALTERASE] = "AlternateErase", [KEY_CANCEL] = "Cancel", + [KEY_BRIGHTNESSDOWN] = "BrightnessDown", [KEY_BRIGHTNESSUP] = "BrightnessUp", [KEY_MEDIA] = "Media", [KEY_UNKNOWN] = "Unknown", [BTN_0] = "Btn0", [BTN_1] = "Btn1", [BTN_2] = "Btn2", [BTN_3] = "Btn3", @@ -639,8 +641,8 @@ static char *keys[KEY_MAX + 1] = { [BTN_TOOL_AIRBRUSH] = "ToolAirbrush", [BTN_TOOL_FINGER] = "ToolFinger", [BTN_TOOL_MOUSE] = "ToolMouse", [BTN_TOOL_LENS] = "ToolLens", [BTN_TOUCH] = "Touch", [BTN_STYLUS] = "Stylus", - [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "Tool Doubletap", - [BTN_TOOL_TRIPLETAP] = "Tool Tripletap", [BTN_GEAR_DOWN] = "WheelBtn", + [BTN_STYLUS2] = "Stylus2", [BTN_TOOL_DOUBLETAP] = "ToolDoubleTap", + [BTN_TOOL_TRIPLETAP] = "ToolTripleTap", [BTN_GEAR_DOWN] = "WheelBtn", [BTN_GEAR_UP] = "Gear up", [KEY_OK] = "Ok", [KEY_SELECT] = "Select", [KEY_GOTO] = "Goto", [KEY_CLEAR] = "Clear", [KEY_POWER2] = "Power2", @@ -676,6 +678,9 @@ static char *keys[KEY_MAX + 1] = { [KEY_TWEN] = "TWEN", [KEY_DEL_EOL] = "DeleteEOL", [KEY_DEL_EOS] = "DeleteEOS", [KEY_INS_LINE] = "InsertLine", [KEY_DEL_LINE] = "DeleteLine", + [KEY_SEND] = "Send", [KEY_REPLY] = "Reply", + [KEY_FORWARDMAIL] = "ForwardMail", [KEY_SAVE] = "Save", + [KEY_DOCUMENTS] = "Documents", }; static char *relatives[REL_MAX + 1] = { diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index fa4f79d88aa..b28cf8593b4 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -78,8 +78,8 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel { struct input_dev *input = &hidinput->input; struct hid_device *device = hidinput->input.private; - int max, code; - unsigned long *bit; + int max = 0, code; + unsigned long *bit = NULL; field->hidinput = hidinput; @@ -248,7 +248,10 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x034: map_key_clear(KEY_SLEEP); break; case 0x036: map_key_clear(BTN_MISC); break; case 0x08a: map_key_clear(KEY_WWW); break; + case 0x08d: map_key_clear(KEY_PROGRAM); break; case 0x095: map_key_clear(KEY_HELP); break; + case 0x09c: map_key_clear(KEY_CHANNELUP); break; + case 0x09d: map_key_clear(KEY_CHANNELDOWN); break; case 0x0b0: map_key_clear(KEY_PLAY); break; case 0x0b1: map_key_clear(KEY_PAUSE); break; case 0x0b2: map_key_clear(KEY_RECORD); break; @@ -268,6 +271,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x18a: map_key_clear(KEY_MAIL); break; case 0x192: map_key_clear(KEY_CALC); break; case 0x194: map_key_clear(KEY_FILE); break; + case 0x1a7: map_key_clear(KEY_DOCUMENTS); break; + case 0x201: map_key_clear(KEY_NEW); break; + case 0x207: map_key_clear(KEY_SAVE); break; + case 0x208: map_key_clear(KEY_PRINT); break; + case 0x209: map_key_clear(KEY_PROPS); break; case 0x21a: map_key_clear(KEY_UNDO); break; case 0x21b: map_key_clear(KEY_COPY); break; case 0x21c: map_key_clear(KEY_CUT); break; @@ -280,7 +288,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x227: map_key_clear(KEY_REFRESH); break; case 0x22a: map_key_clear(KEY_BOOKMARKS); break; case 0x238: map_rel(REL_HWHEEL); break; - default: goto unknown; + case 0x279: map_key_clear(KEY_REDO); break; + case 0x289: map_key_clear(KEY_REPLY); break; + case 0x28b: map_key_clear(KEY_FORWARDMAIL); break; + case 0x28c: map_key_clear(KEY_SEND); break; + default: goto ignore; } break; @@ -306,6 +318,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case HID_UP_MSVENDOR: case HID_UP_LOGIVENDOR: + case HID_UP_LOGIVENDOR2: goto ignore; diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index cea5cf34b5f..ca3e170ce0b 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -184,6 +184,7 @@ struct hid_item { #define HID_UP_HPVENDOR 0xff7f0000 #define HID_UP_MSVENDOR 0xff000000 #define HID_UP_LOGIVENDOR 0x00ff0000 +#define HID_UP_LOGIVENDOR2 0xffbc0000 #define HID_USAGE 0x0000ffff -- cgit v1.2.3 From bf0964dcda97e42964d312d0ff73a832171e080a Mon Sep 17 00:00:00 2001 From: Michael Haboustak Date: Mon, 5 Sep 2005 00:12:01 -0500 Subject: Input: HID - handle multi-transascion reports Fixes handling of multi-transaction reports for HID devices. New function hid_size_buffers() that calculates the longest report for each endpoint and stores the result in the hid_device object. These lengths are used to allocate buffers that are large enough to store any report on the endpoint. For compatibility, the minimum size for an endpoint buffer set to HID_BUFFER_SIZE rather than the known optimal case (the longest report length). It fixes bug #3063 in bugzilla. Signed-off-by: Michael Haboustak I simplified the patch a bit to use just a single buffer size. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-core.c | 62 +++++++++++++++++++++++++++++++------------- drivers/usb/input/hid.h | 5 +++- 2 files changed, 48 insertions(+), 19 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index b2cb2b35892..376b6043bbf 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -2,7 +2,8 @@ * USB HID support for Linux * * Copyright (c) 1999 Andreas Gal - * Copyright (c) 2000-2001 Vojtech Pavlik + * Copyright (c) 2000-2005 Vojtech Pavlik + * Copyright (c) 2005 Michael Haboustak for Concept2, Inc */ /* @@ -38,7 +39,7 @@ * Version Information */ -#define DRIVER_VERSION "v2.01" +#define DRIVER_VERSION "v2.6" #define DRIVER_AUTHOR "Andreas Gal, Vojtech Pavlik" #define DRIVER_DESC "USB HID core driver" #define DRIVER_LICENSE "GPL" @@ -1058,8 +1059,8 @@ static int hid_submit_ctrl(struct hid_device *hid) if (maxpacket > 0) { padlen = (len + maxpacket - 1) / maxpacket; padlen *= maxpacket; - if (padlen > HID_BUFFER_SIZE) - padlen = HID_BUFFER_SIZE; + if (padlen > hid->bufsize) + padlen = hid->bufsize; } else padlen = 0; hid->urbctrl->transfer_buffer_length = padlen; @@ -1284,13 +1285,8 @@ void hid_init_reports(struct hid_device *hid) struct hid_report *report; int err, ret; - list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) { - int size = ((report->size - 1) >> 3) + 1 + hid->report_enum[HID_INPUT_REPORT].numbered; - if (size > HID_BUFFER_SIZE) size = HID_BUFFER_SIZE; - if (size > hid->urbin->transfer_buffer_length) - hid->urbin->transfer_buffer_length = size; + list_for_each_entry(report, &hid->report_enum[HID_INPUT_REPORT].report_list, list) hid_submit_report(hid, report, USB_DIR_IN); - } list_for_each_entry(report, &hid->report_enum[HID_FEATURE_REPORT].report_list, list) hid_submit_report(hid, report, USB_DIR_IN); @@ -1564,15 +1560,32 @@ static struct hid_blacklist { { 0, 0 } }; +/* + * Traverse the supplied list of reports and find the longest + */ +static void hid_find_max_report(struct hid_device *hid, unsigned int type, int *max) +{ + struct hid_report *report; + int size; + + list_for_each_entry(report, &hid->report_enum[type].report_list, list) { + size = ((report->size - 1) >> 3) + 1; + if (type == HID_INPUT_REPORT && hid->report_enum[type].numbered) + size++; + if (*max < size) + *max = size; + } +} + static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) { - if (!(hid->inbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->inbuf_dma))) + if (!(hid->inbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->inbuf_dma))) return -1; - if (!(hid->outbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->outbuf_dma))) + if (!(hid->outbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->outbuf_dma))) return -1; if (!(hid->cr = usb_buffer_alloc(dev, sizeof(*(hid->cr)), SLAB_ATOMIC, &hid->cr_dma))) return -1; - if (!(hid->ctrlbuf = usb_buffer_alloc(dev, HID_BUFFER_SIZE, SLAB_ATOMIC, &hid->ctrlbuf_dma))) + if (!(hid->ctrlbuf = usb_buffer_alloc(dev, hid->bufsize, SLAB_ATOMIC, &hid->ctrlbuf_dma))) return -1; return 0; @@ -1581,13 +1594,13 @@ static int hid_alloc_buffers(struct usb_device *dev, struct hid_device *hid) static void hid_free_buffers(struct usb_device *dev, struct hid_device *hid) { if (hid->inbuf) - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->inbuf, hid->inbuf_dma); + usb_buffer_free(dev, hid->bufsize, hid->inbuf, hid->inbuf_dma); if (hid->outbuf) - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->outbuf, hid->outbuf_dma); + usb_buffer_free(dev, hid->bufsize, hid->outbuf, hid->outbuf_dma); if (hid->cr) usb_buffer_free(dev, sizeof(*(hid->cr)), hid->cr, hid->cr_dma); if (hid->ctrlbuf) - usb_buffer_free(dev, HID_BUFFER_SIZE, hid->ctrlbuf, hid->ctrlbuf_dma); + usb_buffer_free(dev, hid->bufsize, hid->ctrlbuf, hid->ctrlbuf_dma); } static struct hid_device *usb_hid_configure(struct usb_interface *intf) @@ -1598,7 +1611,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) struct hid_device *hid; unsigned quirks = 0, rsize = 0; char *buf, *rdesc; - int n; + int n, insize = 0; for (n = 0; hid_blacklist[n].idVendor; n++) if ((hid_blacklist[n].idVendor == le16_to_cpu(dev->descriptor.idVendor)) && @@ -1652,6 +1665,19 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) kfree(rdesc); hid->quirks = quirks; + hid->bufsize = HID_MIN_BUFFER_SIZE; + hid_find_max_report(hid, HID_INPUT_REPORT, &hid->bufsize); + hid_find_max_report(hid, HID_OUTPUT_REPORT, &hid->bufsize); + hid_find_max_report(hid, HID_FEATURE_REPORT, &hid->bufsize); + + if (hid->bufsize > HID_MAX_BUFFER_SIZE) + hid->bufsize = HID_MAX_BUFFER_SIZE; + + hid_find_max_report(hid, HID_INPUT_REPORT, &insize); + + if (insize > HID_MAX_BUFFER_SIZE) + insize = HID_MAX_BUFFER_SIZE; + if (hid_alloc_buffers(dev, hid)) { hid_free_buffers(dev, hid); goto fail; @@ -1682,7 +1708,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) if (!(hid->urbin = usb_alloc_urb(0, GFP_KERNEL))) goto fail; pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); - usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, 0, + usb_fill_int_urb(hid->urbin, dev, pipe, hid->inbuf, insize, hid_irq_in, hid, interval); hid->urbin->transfer_dma = hid->inbuf_dma; hid->urbin->transfer_flags |=(URB_NO_TRANSFER_DMA_MAP | URB_ASYNC_UNLINK); diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index ca3e170ce0b..d76bbc81f6a 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -351,7 +351,8 @@ struct hid_report_enum { #define HID_REPORT_TYPES 3 -#define HID_BUFFER_SIZE 64 /* use 64 for compatibility with all possible packetlen */ +#define HID_MIN_BUFFER_SIZE 64 /* make sure there is at least a packet size of space */ +#define HID_MAX_BUFFER_SIZE 4096 /* 4kb */ #define HID_CONTROL_FIFO_SIZE 256 /* to init devices with >100 reports */ #define HID_OUTPUT_FIFO_SIZE 64 @@ -389,6 +390,8 @@ struct hid_device { /* device report descriptor */ unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */ + unsigned int bufsize; /* URB buffer size */ + struct urb *urbin; /* Input URB */ char *inbuf; /* Input buffer */ dma_addr_t inbuf_dma; /* Input buffer dma */ -- cgit v1.2.3 From 39fd748f56012fdde4cf862f127ce4cdec50d661 Mon Sep 17 00:00:00 2001 From: "Micah F. Galizia" Date: Mon, 5 Sep 2005 00:12:15 -0500 Subject: Input: HID - add support for Logitech UltraX Media Remote control The hid now supports the Logitech UltraX Media Remote control. For now, ID 45 on the consumer usage page has been incorrectly mapped to KEY_RADIO since no other devices uses it. Signed-off-by: Micah F. Galizia Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-input.c | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index b28cf8593b4..22f9d919a3f 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -247,6 +247,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x000: goto ignore; case 0x034: map_key_clear(KEY_SLEEP); break; case 0x036: map_key_clear(BTN_MISC); break; + case 0x045: map_key_clear(KEY_RADIO); break; case 0x08a: map_key_clear(KEY_WWW); break; case 0x08d: map_key_clear(KEY_PROGRAM); break; case 0x095: map_key_clear(KEY_HELP); break; @@ -318,10 +319,33 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case HID_UP_MSVENDOR: case HID_UP_LOGIVENDOR: - case HID_UP_LOGIVENDOR2: - goto ignore; + case HID_UP_LOGIVENDOR2: /* Reported on Logitech Ultra X Media Remote */ + + set_bit(EV_REP, input->evbit); + switch(usage->hid & HID_USAGE) { + case 0x004: map_key_clear(KEY_AGAIN); break; + case 0x00d: map_key_clear(KEY_HOME); break; + case 0x024: map_key_clear(KEY_SHUFFLE); break; + case 0x025: map_key_clear(KEY_TV); break; + case 0x026: map_key_clear(KEY_MENU); break; + case 0x031: map_key_clear(KEY_AUDIO); break; + case 0x032: map_key_clear(KEY_SUBTITLE); break; + case 0x033: map_key_clear(KEY_LAST); break; + case 0x047: map_key_clear(KEY_MP3); break; + case 0x048: map_key_clear(KEY_DVD); break; + case 0x049: map_key_clear(KEY_MEDIA); break; + case 0x04a: map_key_clear(KEY_VIDEO); break; + case 0x04b: map_key_clear(KEY_ANGLE); break; + case 0x04c: map_key_clear(KEY_LANGUAGE); break; + case 0x04d: map_key_clear(KEY_SUBTITLE); break; + case 0x051: map_key_clear(KEY_RED); break; + case 0x052: map_key_clear(KEY_CLOSE); break; + default: goto ignore; + } + break; + case HID_UP_PID: set_bit(EV_FF, input->evbit); -- cgit v1.2.3 From c4786ca8a4274a0bbffe217917972943348bed64 Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:13:03 -0500 Subject: Input: HID - fix URB success status handling Add a missing break; statement to the URB status handling in hid-core.c, avoiding flushing the request queue on success. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-core.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 376b6043bbf..7d5eb4deb1e 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1097,6 +1097,7 @@ static void hid_irq_out(struct urb *urb, struct pt_regs *regs) switch (urb->status) { case 0: /* success */ + break; case -ESHUTDOWN: /* unplug */ case -EILSEQ: /* unplug timeout on uhci */ unplug = 1; @@ -1144,6 +1145,7 @@ static void hid_ctrl(struct urb *urb, struct pt_regs *regs) case 0: /* success */ if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs); + break; case -ESHUTDOWN: /* unplug */ case -EILSEQ: /* unplug timectrl on uhci */ unplug = 1; -- cgit v1.2.3 From c58de6d949a9d2c386c4d814013b6c967c14ea5a Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:13:15 -0500 Subject: Input: HID - add a quirk for the Apple Powermouse Add a quirk for the Apple Powermouse, remapping GenericDesktop.Z to Rel.HWheel, to allow horizontal scrolling in Linux. Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-core.c | 3 +++ drivers/usb/input/hid-input.c | 3 +++ drivers/usb/input/hid.h | 1 + 3 files changed, 7 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 7d5eb4deb1e..661709a35b0 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1442,6 +1442,8 @@ void hid_init_reports(struct hid_device *hid) #define USB_DEVICE_ID_NETWORKANALYSER 0x2020 #define USB_DEVICE_ID_POWERCONTROL 0x2030 +#define USB_VENDOR_ID_APPLE 0x05ac +#define USB_DEVICE_ID_APPLE_POWERMOUSE 0x0304 /* * Alphabetically sorted blacklist by quirk type. @@ -1546,6 +1548,7 @@ static struct hid_blacklist { { USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_USBHUB_KB, HID_QUIRK_NOGET}, { USB_VENDOR_ID_TANGTOP, USB_DEVICE_ID_TANGTOP_USBPS2, HID_QUIRK_NOGET }, + { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_POWERMOUSE, HID_QUIRK_2WHEEL_POWERMOUSE }, { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 22f9d919a3f..14acfc579f8 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -396,6 +396,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel if (usage->code > max) goto ignore; + if (((device->quirks & (HID_QUIRK_2WHEEL_POWERMOUSE)) && (usage->hid == 0x00010032))) + map_rel(REL_HWHEEL); + if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && (usage->type == EV_REL) && (usage->code == REL_WHEEL)) set_bit(REL_HWHEEL, bit); diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index d76bbc81f6a..47f75a43a46 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -245,6 +245,7 @@ struct hid_item { #define HID_QUIRK_2WHEEL_MOUSE_HACK_7 0x080 #define HID_QUIRK_2WHEEL_MOUSE_HACK_5 0x100 #define HID_QUIRK_2WHEEL_MOUSE_HACK_ON 0x200 +#define HID_QUIRK_2WHEEL_POWERMOUSE 0x400 /* * This is the global environment of the parser. This information is -- cgit v1.2.3 From 61cdecd9f5f602775af1e89c200179d093a94ae2 Mon Sep 17 00:00:00 2001 From: Vojtech Pavlik Date: Mon, 5 Sep 2005 00:13:32 -0500 Subject: Input: HID - add the Trust Predator TH 400 gamepad to the badpad list Reported-by: Karl Relton Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-core.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 661709a35b0..485575a70be 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1370,8 +1370,9 @@ void hid_init_reports(struct hid_device *hid) #define USB_VENDOR_ID_A4TECH 0x09da #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 -#define USB_VENDOR_ID_AASHIMA 0x06D6 +#define USB_VENDOR_ID_AASHIMA 0x06d6 #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 +#define USB_DEVICE_ID_AASHIMA_PREDATOR 0x0026 #define USB_VENDOR_ID_CYPRESS 0x04b4 #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 @@ -1553,6 +1554,7 @@ static struct hid_blacklist { { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, + { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_PREDATOR, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, -- cgit v1.2.3 From e875ce374759087771313c9e76b672b86ac20950 Mon Sep 17 00:00:00 2001 From: Stelian Pop Date: Mon, 5 Sep 2005 01:57:33 -0500 Subject: Input: HID - add mapping for Powerbook USB keyboard Map custom HID events (such as the ones generated by some Logitech and Apple Powerbooks USB keyboards) to the FN keycode. Signed-off-by: Stelian Pop Signed-off-by: Vojtech Pavlik Signed-off-by: Andrew Morton Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-input.c | 12 ++++++++++-- drivers/usb/input/hid.h | 4 ++-- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 14acfc579f8..0b6452248a3 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c @@ -318,10 +318,18 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel break; case HID_UP_MSVENDOR: - case HID_UP_LOGIVENDOR: goto ignore; - case HID_UP_LOGIVENDOR2: /* Reported on Logitech Ultra X Media Remote */ + case HID_UP_CUSTOM: /* Reported on Logitech and Powerbook USB keyboards */ + + set_bit(EV_REP, input->evbit); + switch(usage->hid & HID_USAGE) { + case 0x003: map_key_clear(KEY_FN); break; + default: goto ignore; + } + break; + + case HID_UP_LOGIVENDOR: /* Reported on Logitech Ultra X Media Remote */ set_bit(EV_REP, input->evbit); switch(usage->hid & HID_USAGE) { diff --git a/drivers/usb/input/hid.h b/drivers/usb/input/hid.h index 47f75a43a46..ec2412c42f1 100644 --- a/drivers/usb/input/hid.h +++ b/drivers/usb/input/hid.h @@ -183,8 +183,8 @@ struct hid_item { #define HID_UP_PID 0x000f0000 #define HID_UP_HPVENDOR 0xff7f0000 #define HID_UP_MSVENDOR 0xff000000 -#define HID_UP_LOGIVENDOR 0x00ff0000 -#define HID_UP_LOGIVENDOR2 0xffbc0000 +#define HID_UP_CUSTOM 0x00ff0000 +#define HID_UP_LOGIVENDOR 0xffbc0000 #define HID_USAGE 0x0000ffff -- cgit v1.2.3 From 7d25258f69cedc2f2e55eb25ba2e2078060b44f4 Mon Sep 17 00:00:00 2001 From: Brian Schau Date: Mon, 5 Sep 2005 01:57:41 -0500 Subject: Input: HID - add Wireless Security Lock to HID blacklist The device is a Wireless Security Lock (WSL). The device identifies itself as a Cypress Ultra Mouse. It is, however, not a mouse at all and as such, shouldn't be handled as one. Signed-off-by: Brian Schau Signed-off-by: Vojtech Pavlik Signed-off-by: Andrew Morton Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hid-core.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 485575a70be..a7212990045 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c @@ -1377,6 +1377,7 @@ void hid_init_reports(struct hid_device *hid) #define USB_VENDOR_ID_CYPRESS 0x04b4 #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 +#define USB_DEVICE_ID_CYPRESS_ULTRAMOUSE 0x7417 #define USB_VENDOR_ID_BERKSHIRE 0x0c98 #define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140 @@ -1469,6 +1470,7 @@ static struct hid_blacklist { { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW48, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_CODEMERCS, USB_DEVICE_ID_CODEMERCS_IOW28, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE }, + { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_ULTRAMOUSE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EARTHMATE, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_DELORME, USB_DEVICE_ID_DELORME_EM_LT20, HID_QUIRK_IGNORE }, { USB_VENDOR_ID_ESSENTIAL_REALITY, USB_DEVICE_ID_ESSENTIAL_REALITY_P5, HID_QUIRK_IGNORE }, -- cgit v1.2.3 From 010988e888a0abbe7118635c1b33d049caae6b29 Mon Sep 17 00:00:00 2001 From: Stefan Nickl Date: Mon, 5 Sep 2005 01:57:46 -0500 Subject: Input: HIDDEV - make HIDIOCSREPORT wait IO completion When trying to make the hiddev driver issue several Set_Report control transfers to a custom device with 2.6.13-rc6, only the first transfer in a row is carried out, while others immediately following it are silently dropped. This happens where hid_submit_report() (in hid-core.c) tests for HID_CTRL_RUNNING, which seems to be still set because the first transfer is not finished yet. As a workaround, inserting a delay between the two calls to ioctl(HIDIOCSREPORT) in userspace "solves" the problem. The straightforward fix is to add a call to hid_wait_io() to the implementation of HIDIOCSREPORT (in hiddev.c), just like for HIDIOCGREPORT. Works fine for me. Apparently, this issue has some history: http://marc.theaimsgroup.com/?l=linux-usb-users&m=111100670105558&w=2 Signed-off-by: Stefan Nickl Signed-off-by: Andrew Morton Signed-off-by: Vojtech Pavlik Signed-off-by: Dmitry Torokhov --- drivers/usb/input/hiddev.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/usb') diff --git a/drivers/usb/input/hiddev.c b/drivers/usb/input/hiddev.c index 4c13331b5f4..d32427818af 100644 --- a/drivers/usb/input/hiddev.c +++ b/drivers/usb/input/hiddev.c @@ -507,6 +507,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd return -EINVAL; hid_submit_report(hid, report, USB_DIR_OUT); + hid_wait_io(hid); return 0; -- cgit v1.2.3