summaryrefslogtreecommitdiff
path: root/common/usb_kbd.c
AgeCommit message (Collapse)Author
2015-01-18usb: Fix usb_kbd_deregister when console-muxing is usedHans de Goede
When iomuxing is used we must not only deregister the device with stdio.c, but also remove the reference to the device in the console_devices array used by console-muxing. Add a call to iomux_doenv to usb_kbd_deregister to update console_devices, which will drop the reference. This fixes the console filling with "Failed to enqueue URB to controller" messages after a "usb stop force", or when the USB keyboard is gone after a "usb reset". Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2015-01-18usb: Add an interval parameter to create_int_queueHans de Goede
Currently create_int_queue is only implemented by the ehci code, and that does not honor interrupt intervals, but other drivers which might also want to implement create_int_queue may honor intervals, so add an interval param. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-04usb: kbd: Add (optional) support for using an interrupt queue for pollingHans de Goede
Waiting an interrupt packet to complete in usb_kbd_poll_for_event, causes a 40 ms latency for each call to usb_kbd_testc, which is undesirable. Using control messages leads to lower (but still not 0) latency, but some devices do not work well with control messages (e.g. my kvm behaves funny with them). This commit adds support for using the int_queue mechanism which at least the ehci-hcd driver supports. This allows polling with 0 latency, while using interrupt packets. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-04usb: kbd: Cache pipe, interval and packetsizeHans de Goede
Instead of looking them up every time we need them. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-04usb: kbd: Fix memleak on usb_kbd_deregister()Hans de Goede
Free the keyboard hid-report buffer and private data on deregister. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-11-04usb: kbd: Remove unused usb_kbd_generic_poll functionHans de Goede
This is not used anywhere, so lets remove it. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-10-06usb: kbd: Allow "usb reset" to continue when an usb kbd is usedHans de Goede
Use the new force parameter to make the stdio_deregister succeed, replacing stdin with a nulldev, and assume that the usb keyboard will come back after the reset. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-10-06stdio: Add force parameter to stdio_deregisterHans de Goede
In some cases we really want to move forward with a deregister, add a force parameter to allow this, and replace the dev with a nulldev in this case. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-10-06usb: kbd: Remove check for already being registeredHans de Goede
We now always properly deregister the keyboard before calling drv_usb_kbd_init(), so we can drop the check for already being registered. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-10-06usb: kbd: Do not treat -ENODEV as an error for usb_kbd_deregisterHans de Goede
ENODEV menas no usb keyboard was registered, threat this as a successful usb_kbd_deregister. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-10-06usb: kbd: Fix unaligned buffer usage in usb_kbd_setled()Hans de Goede
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
2014-07-23stdio: Pass device pointer to stdio methodsSimon Glass
At present stdio device functions do not get any clue as to which stdio device is being acted on. Some implementations go to great lengths to work around this, such as defining a whole separate set of functions for each possible device. For driver model we need to associate a stdio_dev with a device. It doesn't seem possible to continue with this work-around approach. Instead, add a stdio_dev pointer to each of the stdio member functions. Note: The serial drivers have the same problem, but it is not strictly necessary to fix that to get driver model running. Also, if we convert serial over to driver model the problem will go away. Code size increases by 244 bytes for Thumb2 and 428 for PowerPC. 22: stdio: Pass device pointer to stdio methods arm: (for 2/2 boards) all +244.0 bss -4.0 text +248.0 powerpc: (for 1/1 boards) all +428.0 text +428.0 Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de> Reviewed-by: Marek Vasut <marex@denx.de>
2014-07-23stdio: Remove redundant code around stdio_register() callsSimon Glass
There is no point in setting a structure's memory to NULL when it has already been zeroed with memset(). Also, there is no need to create a stub function for stdio to call - if the function is NULL it will not be called. This is a clean-up, with no change in functionality. Signed-off-by: Simon Glass <sjg@chromium.org> Acked-by: Marek Vasut <marex@denx.de>
2014-04-30usb: Fix USB keyboard polling via control endpointAdrian Cox
USB keyboard polling failed for some keyboards on PowerPC 5020. This was caused by requesting only 4 bytes of data from keyboards that produce an 8 byte HID report. Signed-off-by: Adrian Cox <adrian@humboldt.co.uk> Signed-off-by: Wolfgang Denk <wd@denx.de> Cc: Marek Vasut <marex@denx.de>
2013-08-26console: usb: kbd: To fix slow TFTP bootingJim Lin
TFTP booting is slow when a USB keyboard is installed and stdin has usbkbd added. This fix is to change Ctrl-C polling for USB keyboard to every second when NET transfer is running. My previous patch is expected to be put into usb_kbd_testc(). But it went into usb_kbd_getc() after applied. This patch is to put change in correct place. Signed-off-by: Jim Lin <jilin@nvidia.com>
2013-08-26console: usb: kbd: To improve TFTP booting performanceJim Lin
TFTP booting is slow when a USB keyboard is installed and stdin has usbkbd added. This fix is to change Ctrl-C polling for USB keyboard to every second when NET transfer is running. Signed-off-by: Jim Lin <jilin@nvidia.com>
2013-07-24Add GPL-2.0+ SPDX-License-Identifier to source filesWolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de> [trini: Fixup common/cmd_io.c] Signed-off-by: Tom Rini <trini@ti.com>
2013-06-12usb: workaround non-working keyboards.Vincent Palatin
If the USB keyboard is not answering properly the first request on its interrupt endpoint, just skip it and try the next one. This workarounds an issue with a wireless mouse dongle which presents itself both as a keyboard and a mouse but has a non-functional keyboard interface. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> (cherry picked from commit 012bbf0ce0301be2482857e3f03b481dd15c2340) Rebased to upstream/master: Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-06-12usb: properly re-initialize the USB keyboard.Vincent Palatin
Allow to reconfigure properly the USB keyboard driver when we enumerate several times the USB devices and its position in the device tree has changes. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Stefan Reinauer <reinauer@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org>
2013-05-05usb: common: Weed out USB_**_PRINTFs from usb frameworkVivek Gautam
USB_PRINTF, USB_HUB_PRINTF, USB_STOR_PRINTF, USB_KBD_PRINTF are nothing but conditional debug prints, depending on DEBUG. So better remove them and use debug() simply. Signed-off-by: Vivek Gautam <gautam.vivek@samsung.com>
2012-11-20USB: add arrow key support to usb_kbdAllen Martin
Check for scancodes for arrow keys and map them to ^F/^B, ^N/^P. Control characters are used instead of ANSI sequence because the queueing code in usb_kbd doesn't handle the data increase when one keypress generates 3 keycodes. The real fix is to convert this driver to use the input subsystem and queue, but this allows arrow keys to work until this driver is converted. Signed-off-by: Allen Martin <amartin@nvidia.com>
2012-11-20USB: make usb_kbd obey USB DMA alignment requirementsAllen Martin
Change usb_kbd driver to obey alignment requirements for USB DMA on the buffer used for data transfer. This is necessary for architectures that enable dcache and enable USB DMA. Signed-off-by: Allen Martin <amartin@nvidia.com> Tested-by: Stephen Warren <swarren@nvidia.com> Reviewed-by: Stephen Warren <swarren@nvidia.com>
2012-03-03USB: move keyboard polling into kbd driveramartin@nvidia.com
This moves keyboard polling logic from USB HCD drivers into USB keyboard driver. Remove usb_event_poll() as keyboard polling was the only user of this API. With this patch USB keyboard works with EHCI controllers again. Tested on a tegra2 seaboard. Signed-off-by: Allen Martin <amartin@nvidia.com>
2012-03-03USB: reevaluate iomux stdin on USB kbd detectamartin@nvidia.com
If CONSOLE_MUX is enabled, reevaluate console stdin when USB keyboard device is detected. Signed-off-by: Allen Martin <amartin@nvidia.com>
2012-03-03usb: add numeric keypad support to HID driverVincent Palatin
When keys are pressed on the numeric keypad, emit key codes for the numbers, operators, dot and enter. Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
2012-03-03USB: fix USB keyboard polling parameterVincent Palatin
When doing a "GET_REPORT" request on the keyboard control endpoint, the report ID should 0 (ie report ID not used) rather than 1 as reports are not used in boot mode. Signed-off-by: Vincent Palatin <vpalatin@chromium.org>
2011-12-11USB: Drop dead code from usb_kbd.cMarek Vasut
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: Remy Bohmer <linux@bohmer.net> Cc: Wolfgang Denk <wd@denx.de>
2011-12-11USB: Rework usb_kbd.cMarek Vasut
* Support dynamic allocation of devices * Passing data via usb device privptr * Reorder functions to avoid forward declarations * Introduce generic polling mechanism to fix musb and ehci-hcd breakage due to using "extern new;" to access keyboard driver data! Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Acked-by: Mike Frysinger <vapier@gentoo.org> Cc: Remy Bohmer <linux@bohmer.net> Cc: Wolfgang Denk <wd@denx.de>
2011-12-11USB: Add functionality to poll the USB keyboard via control EPMarek Vasut
This allows the keyboard to avoid requests via Interrupt Endpoint altogether and run all requests via Control Endpoint. This uses the Get_Report request. Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Remy Bohmer <linux@bohmer.net> Rebased on current code. Signed-off-by: Remy Bohmer <linux@bohmer.net>
2011-12-09common/usb_kbd.c: fix bug introduced in commit 00b7d6eWolfgang Denk
During the rebase of commit 00b7d6e "USB: Squash checkpatch warnings in usb_kbd.c" I missed a brace, resulting in a number of build errors. Fix these. Signed-off-by: Wolfgang Denk <wd@denx.de>
2011-12-09USB: Squash checkpatch warnings in usb_kbd.cMarek Vasut
Signed-off-by: Marek Vasut <marek.vasut@gmail.com> Cc: Mike Frysinger <vapier@gentoo.org> Cc: Remy Bohmer <linux@bohmer.net> Cc: Wolfgang Denk <wd@denx.de> Acked-by: Mike Frysinger <vapier@gentoo.org> Rebased to current code. Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-12-20USB Consolidate descriptor definitionsTom Rix
The header files usb.h and usbdescriptors.h have the same nameed structure definitions for usb_config_descriptor usb_interface_descriptor usb_endpoint_descriptor usb_device_descriptor usb_string_descriptor These are out right duplicates in usb.h usb_device_descriptor usb_string_descriptor This one has extra unused elements usb_endpoint_descriptor unsigned char bRefresh unsigned char bSynchAddress; These in usb.h have extra elements at the end of the usb 2.0 specified descriptor and are used. usb_config_descriptor usb_interface_descriptor The change is to consolidate the definition of the descriptors to usbdescriptors.h. The dublicates in usb.h are removed. The extra element structure will have their name shorted by removing the '_descriptor' suffix. So usb_config_descriptor -> usb_config usb_interface_descriptor -> usb_interface For these, the common descriptor elements are accessed now by an element 'desc'. As an example - if (iface->bInterfaceClass != USB_CLASS_HUB) + if (iface->desc.bInterfaceClass != USB_CLASS_HUB) This has been compile tested on MAKEALL arm, ppc and mips. Signed-off-by: Tom Rix <Tom.Rix@windriver.com>
2009-07-18stdio/device: rework function naming conventionJean-Christophe PLAGNIOL-VILLARD
So far the console API uses the following naming convention: ======Extract====== typedef struct device_t; int device_register (device_t * dev); int devices_init (void); int device_deregister(char *devname); struct list_head* device_get_list(void); device_t* device_get_by_name(char* name); device_t* device_clone(device_t *dev); ======= which is too generic and confusing. Instead of using device_XX and device_t we change this into stdio_XX and stdio_dev This will also allow to add later a generic device mechanism in order to have support for multiple devices and driver instances. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Edited commit message. Signed-off-by: Wolfgang Denk <wd@denx.de>
2009-01-28usb : usb_kbd : Populating 'priv' member of USB keyboard device_t structureThomas Abraham
This patch populates the 'priv' field of the USB keyboard device_t structure. The 'priv' field is populated with the address of the 'struct usb_device' structure that represents the USB device. The 'priv' field can then be used in the 'usb_event_poll' function to determine the USB device that requires to be polled. An example of its usage in 'usb_event_poll' function is as below. device_t *dev; struct usb_device *usb_kbd_dev; <snip> dev = device_get_by_name("usbkbd"); usb_kbd_dev = (struct usb_device *)dev->priv; iface = &usb_kbd_dev->config.if_desc[0]; Signed-off-by: Thomas Abraham <t-abraham@ti.com> Signed-off-by: Remy Bohmer <linux@bohmer.net>
2008-12-20usb_kbd: fix usb_kbd_deregister when DEVICE_DEREGISTER not enableJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> Signed-off-by: Remy Böhmer <linux@bohmer.net>
2008-10-18rename CFG_ macros to CONFIG_SYSJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-09-09Correct drv_usb_kbd_init functionRyan CHEN
The patch is that check if usb_get_dev_index() function return valid pointer. If valid, continue. Otherwise return -1. Signed-off-by: Ryan Chen <ryan.chen@st.com> Acked-by: Markus Klotzbuecher <mk@denx.de>
2008-08-31devices: merge to list_headJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-08-13common: Move conditional compilation to MakefileJean-Christophe PLAGNIOL-VILLARD
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
2008-07-14Code cleanup: fix old style assignment ambiguities like "=-" etc.Wolfgang Denk
Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-05-22USB: replace old swap_ with proper endianess conversion macrosChristian Eggers
Signed-off-by: Christian Eggers <ceggers@gmx.de> Signed-off-by: Markus Klotzbuecher <mk@denx.de>
2008-05-21Big white-space cleanup.Wolfgang Denk
This commit gets rid of a huge amount of silly white-space issues. Especially, all sequences of SPACEs followed by TAB characters get removed (unless they appear in print statements). Also remove all embedded "vim:" and "vi:" statements which hide indentation problems. Signed-off-by: Wolfgang Denk <wd@denx.de>
2008-01-09Add Ctrl combo key support to usb keyboard driver.Zhang Wei
Ctrl combo key support is added, which is very useful to input Ctrl-C for interrupt current job. Also add usb_event_poll() calling to usb_kbd_testc(), which can get key input when tstc() is called. Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
2007-11-03Fix the issue of usb_kbd driver missing the scan code of key 'z'.Zhang Wei
The scan code of the key 'z' is 0x1d, which should be handled. The change has be tested on NOVATEK USB keyboard and ULI PCI OHCI controller. Signed-off-by: Zhang Wei <wei.zhang@freescale.com>
2007-06-06USB event poll supportZhang Wei
This patch adds USB event poll support, which could be used in usbkbd and other usb devices driver when the asynchronous interrupt processing is supported. Signed-off-by: Zhang Wei <wei.zhang@freescale.com
2003-06-27* Code cleanup:wdenk
- remove trailing white space, trailing empty lines, C++ comments, etc. - split cmd_boot.c (separate cmd_bdinfo.c and cmd_load.c) * Patches by Kenneth Johansson, 25 Jun 2003: - major rework of command structure (work done mostly by Michal Cendrowski and Joakim Kristiansen)
2002-08-17Initial revisionwdenk