1. 01 5月, 2012 1 次提交
  2. 21 12月, 2011 3 次提交
    • D
      HID: usbhid: defer LED setting to a workqueue · 4371ea82
      Daniel Kurtz 提交于
      Defer LED setting action to a workqueue.
      This is more likely to send all LED change events in a single URB.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4371ea82
    • D
      HID: usbhid: hid-core: submit queued urbs before suspend · f0befcd6
      Daniel Kurtz 提交于
      If any userspace program has opened a keyboard device, the input core
      de-activates the keyboard's LEDs upon suspend().  It does this by sending
      individual EV_LED[LED_X]=0 events to the underlying device driver by
      directly calling the driver's registered event() handler.
      
      The usb-hid driver event() handler processes each request by immediately
      attempting to submit a CTRL URB to turn off the LED.  USB URB submission
      is asynchronous.  First the URB is added to the head of the ctrl queue.
      Then, if the CTRL_RUNNING flag is false, the URB is submitted immediately
      (and CTRL_RUNNING is set).  If the CTRL_RUNNING flag was already true,
      then the newly queued URB is submitted in the ctrl completion handler when
      all previously submitted URBs have completed.  When all queued URBs have
      been submitted, the completion handler clears the CTRL_RUNNING flag.
      
      In the 2-LED suspend case, at input suspend(), 2 LED event CTRL URBs get
      queued, with only the first actually submitted.  Soon after input
      suspend() handler finishes, the usb-hid suspend() handler gets called.
      Since this is NOT a PM_EVENT_AUTO suspend, the handler sets
      REPORTED_IDLE, then waits for io to complete.
      
      Unfortunately, this usually happens while the first LED request is
      actually still being processed.  Thus when the completion handler tries
      to submit the second LED request it fails, since REPORTED_IDLE is
      already set!  This REPORTED_IDLE check failure causes the completion
      handler to complete, however without clearing the CTRL_RUNNING flag.
      This, in turn, means that the suspend() handler's wait_io() condition
      is never satisfied, and instead it times out after 10 seconds, aborting
      the original system suspend.
      
      This patch changes the behavior to the following:
        (1) allow completion handler to finish submitting all queued URBs, even if
            REPORTED_IDLE is set.  This guarantees that all URBs queued before the
            hid-core suspend() call will be submitted before the system is
            suspended.
        (2) if REPORTED_IDLE is set and the URB queue is empty, queue, but
            don't submit, new URB submission requests.  These queued requests get
            submitted when resume() flushes the URB queue. This is similar to the
            existing behavior, however, any requests that arrive while the queue is
            not yet empty will still get submitted before suspend.
        (3) set the RUNNING flag when flushing the URB queue in resume().
            This keeps URBs that were queued in (2) from colliding with any new
            URBs that are being submitted during the resume process.  The new URB
            submission requests upon resume get properly queued behind the ones
            being flushed instead of the current situation where they collide,
            causing memory corruption and oopses.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      f0befcd6
    • D
      HID: usbhid: remove LED_ON · ede6a8b2
      Daniel Kurtz 提交于
      LED_ON was defined in the original version of the hid-core autosuspend patch.
      However, during review, the setting and clearing of it was redone
      using ledcount.  The test was left in accidentally.
      Signed-off-by: NDaniel Kurtz <djkurtz@chromium.org>
      Acked-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      ede6a8b2
  3. 14 10月, 2011 1 次提交
  4. 20 8月, 2011 1 次提交
  5. 07 6月, 2011 1 次提交
    • T
      HID: yurex: recognize GeneralKeys wireless presenter as generic HID · 6dc1418e
      Tomoki Sekiyama 提交于
      Unfortunately, the device seems to have the same Vendor ID and Product ID
      as YUREX leg-shakes sensors, and the commit 6bc235a2 ("USB: add driver
      for Meywa-Denki & Kayac YUREX") added the ID to hid_ignore_list.
      
      I believe that we can distinguish YUREX and the Wireless Presenter by
      device type.  The patch below makes the driver ignore only YUREX
      (bInterfaceProtocol==0), and recognize Wireless Presenter
      (bInterfaceProtocol is keyboard or mouse) as generic HID.  (I don't have
      the Wireless Presenter, so not yet ested.)
      
      ** YUREX lsusb information:
      Bus 002 Device 007: ID 0c45:1010 Microdia
      Device Descriptor:
         bLength                18
         bDescriptorType         1
         bcdUSB               1.10
         bDeviceClass            0 (Defined at Interface level)
         bDeviceSubClass         0
         bDeviceProtocol         0
         bMaxPacketSize0         8
         idVendor           0x0c45 Microdia
         idProduct          0x1010
         bcdDevice            0.03
         iManufacturer           1 JESS
         iProduct                2 YUREX
         iSerial                 3 10000269
         bNumConfigurations      1
         Configuration Descriptor:
           bLength                 9
           bDescriptorType         2
           wTotalLength           34
           bNumInterfaces          1
           bConfigurationValue     1
           iConfiguration          0
           bmAttributes         0xa0
             (Bus Powered)
             Remote Wakeup
           MaxPower              100mA
           Interface Descriptor:
             bLength                 9
             bDescriptorType         4
             bInterfaceNumber        0
             bAlternateSetting       0
             bNumEndpoints           1
             bInterfaceClass         3 Human Interface Device
             bInterfaceSubClass      1 Boot Interface Subclass
             bInterfaceProtocol      0 None
             iInterface              0
               HID Device Descriptor:
                 bLength                 9
                 bDescriptorType        33
                 bcdHID               1.10
                 bCountryCode            0 Not supported
                 bNumDescriptors         1
                 bDescriptorType        34 Report
                 wDescriptorLength      31
                Report Descriptors:
                  ** UNAVAILABLE **
             Endpoint Descriptor:
               bLength                 7
               bDescriptorType         5
               bEndpointAddress     0x81  EP 1 IN
               bmAttributes            3
                 Transfer Type            Interrupt
                 Synch Type               None
                 Usage Type               Data
               wMaxPacketSize     0x0008  1x 8 bytes
               bInterval              10
      Device Status:     0x0002
         (Bus Powered)
         Remote Wakeup Enabled
      
      Addresses https://bugzilla.kernel.org/show_bug.cgi?id=26922Signed-off-by: NTomoki Sekiyama <tomoki.sekiyama@gmail.com>
      Cc: Greg KH <gregkh@suse.de>
      Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
      Cc: Maciej Rutecki <maciej.rutecki@gmail.com>
      Reported-by: NThomas B?chler <thomas@archlinux.org>
      Tested-by: NThomas B?chler <thomas@archlinux.org>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6dc1418e
  6. 11 2月, 2011 1 次提交
  7. 23 12月, 2010 1 次提交
  8. 10 12月, 2010 1 次提交
    • J
      HID: Add and use hid_<level>: dev_<level> equivalents · 4291ee30
      Joe Perches 提交于
      Neaten current uses of dev_<level> by adding and using
      hid specific hid_<level> macros.
      
      Convert existing uses of dev_<level> uses to hid_<level>.
      Convert hid-pidff printk uses to hid_<level>.
      
      Remove err_hid and use hid_err instead.
      
      Add missing newlines to logging messages where necessary.
      Coalesce format strings.
      
      Add and use pr_fmt(fmt) KBUILD_MODNAME ": " fmt
      
      Other miscellaneous changes:
      
      Add const struct hid_device * argument to hid-core functions
      extract() and implement() so hid_<level> can be used by them.
      Fix bad indentation in hid-core hid_input_field function
      that calls extract() function above.
      Signed-off-by: NJoe Perches <joe@perches.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      4291ee30
  9. 24 9月, 2010 1 次提交
  10. 22 9月, 2010 2 次提交
    • A
      HID: trivial formatting fix · 12e52725
      Alan Ott 提交于
      Added blank line after declarations.
      Signed-off-by: NAlan Ott <alan@signal11.us>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      12e52725
    • A
      HID: don't Send Feature Reports on Interrupt Endpoint · fe2c91ee
      Alan Ott 提交于
      Feature reports should only be sent on the control endpoint.
      
      The USB HID standard is unclear and confusing on this issue. It seems to
      suggest that Feature reports can be sent on a HID device's Interrupt OUT
      endpoint.  This cannot be the case because the report type is not encoded in
      transfers sent out the Interrput OUT endpoint.  If Feature reports were sent on
      the Interrupt OUT endpint, they would be indistinguishable from Output reports
      in the case where Report IDs were not used.
      
      Further, Windows and Mac OS X do not send Feature reports out the interrupt OUT
      Endpoint.  They will only go out the Control Endpoint.
      
      In addition, many devices simply do not hande Feature reports sent out the
      Interrupt OUT endpoint.
      
      Reported-by: simon@mungewell.org
      Signed-off-by: NAlan Ott <alan@signal11.us>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      fe2c91ee
  11. 14 9月, 2010 1 次提交
    • G
      HID: fix hiddev's use of usb_find_interface · 8fe294ca
      Guillaume Chazarain 提交于
      My macbook infrared remote control was broken by commit
      bd25f4dd ("HID: hiddev: use
      usb_find_interface, get rid of BKL").
      
      This device appears in dmesg as:
      apple 0003:05AC:8242.0001: hiddev0,hidraw0: USB HID v1.11 Device
      [Apple Computer, Inc. IR Receiver] on usb-0000:00:1d.2-1/input0
      
      It stopped working as lircd was getting ENODEV when opening /dev/usb/hiddev0.
      
      AFAICS hiddev_driver is a dummy driver so usb_find_interface(&hiddev_driver)
      does not find anything.
      
      The device is associated with the usbhid driver, so let's do
      usb_find_interface(&hid_driver) instead.
      
      $ ls -l /sys/devices/pci0000:00/0000:00:1d.2/usb7/7-1/7-1:1.0/usb/hiddev0/device/driver
      lrwxrwxrwx 1 root root 0 2010-09-12 16:28 /sys/devices/pci0000:00/0000:00:1d.2/usb7/7-1/7-1:1.0/usb/hiddev0/device/driver -> ../../../../../../bus/usb/drivers/usbhid
      Signed-off-by: NGuillaume Chazarain <guichaz@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      8fe294ca
  12. 24 8月, 2010 1 次提交
  13. 12 7月, 2010 1 次提交
  14. 21 5月, 2010 2 次提交
    • D
      USB: rename usb_buffer_alloc() and usb_buffer_free() users · 997ea58e
      Daniel Mack 提交于
      For more clearance what the functions actually do,
      
        usb_buffer_alloc() is renamed to usb_alloc_coherent()
        usb_buffer_free()  is renamed to usb_free_coherent()
      
      They should only be used in code which really needs DMA coherency.
      
      All call sites have been changed accordingly, except for staging
      drivers.
      Signed-off-by: NDaniel Mack <daniel@caiaq.de>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Pedro Ribeiro <pedrib@gmail.com>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      997ea58e
    • A
      USB: remove uses of URB_NO_SETUP_DMA_MAP · 0ede76fc
      Alan Stern 提交于
      This patch (as1350) removes all usages of coherent buffers for USB
      control-request setup-packet buffers.  There's no good reason to
      reserve coherent memory for these things; control requests are hardly
      ever used in large quantity (the major exception is firmware
      transfers, and they aren't time-critical).  Furthermore, only seven
      drivers used it.  We might as well always use streaming DMA mappings
      for setup-packet buffers, and remove some extra complexity from
      usbcore.
      
      The DMA-mapping portion of hcd.c is currently in flux.  A separate
      patch will be submitted to remove support for URB_NO_SETUP_DMA_MAP
      after everything else settles down.  The removal should go smoothly,
      as by then nobody will be using it.
      Signed-off-by: NAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
      0ede76fc
  15. 18 5月, 2010 1 次提交
    • A
      HID: hidraw: Use Interrupt Endpoint for OUT Transfers if Available · a8ab5d58
      Alan Ott 提交于
      This patch makes the hidraw driver use the first Interrupt OUT endpoint for
      HID transfers to the device if such an endpoint exists. This is consistent
      with the behavior of the hiddev driver, and the logic is similar.
      
      From the USB HID specification:
      
         The Interrupt Out pipe is optional. If a device declares an Interrupt Out
         endpoint then Output reports are transmitted by the host to the device
         through the Interrupt Out endpoint. If no Interrupt Out endpoint is
         declared then Output reports are transmitted to a device through the
         Control endpoint, using Set_Report(Output) requests.
      Signed-off-by: NAlan Ott <alan@signal11.us>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      a8ab5d58
  16. 08 5月, 2010 1 次提交
  17. 27 4月, 2010 1 次提交
  18. 19 4月, 2010 1 次提交
    • B
      HID: add HID_QUIRK_HIDDEV_FORCE and HID_QUIRK_NO_IGNORE · b5e5a37e
      Bastien Nocera 提交于
      Add two quirks to make it possible for usbhid module options to
      override whether a device is ignored (HID_QUIRK_NO_IGNORE) and
      whether to connect a hiddev device (HID_QUIRK_HIDDEV_FORCE).
      
      Passing HID_QUIRK_NO_IGNORE for your device means that it will
      not be ignored by the HID layer, even if present in a blacklist.
      
      HID_QUIRK_HIDDEV_FORCE will force the creation of a hiddev for that
      device, making it accessible from user-space.
      
      Tested with an Apple IR Receiver, switching it from using appleir
      to using lirc's macmini driver.
      Signed-off-by: NBastien Nocera <hadess@hadess.net>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      b5e5a37e
  19. 03 4月, 2010 1 次提交
  20. 31 3月, 2010 1 次提交
  21. 17 2月, 2010 1 次提交
  22. 12 2月, 2010 1 次提交
  23. 03 2月, 2010 2 次提交
  24. 12 1月, 2010 1 次提交
    • M
      HID: make USB device id constant · d67dec5b
      Márton Németh 提交于
      The id_table field of the struct usb_device_id is constant in <linux/usb.h>
      so it is worth to make the initialization data also constant.
      
      The semantic match that finds this kind of pattern is as follows:
      (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @r@
      disable decl_init,const_decl_init;
      identifier I1, I2, x;
      @@
      	struct I1 {
      	  ...
      	  const struct I2 *x;
      	  ...
      	};
      @s@
      identifier r.I1, y;
      identifier r.x, E;
      @@
      	struct I1 y = {
      	  .x = E,
      	};
      @c@
      identifier r.I2;
      identifier s.E;
      @@
      	const struct I2 E[] = ... ;
      @depends on !c@
      identifier r.I2;
      identifier s.E;
      @@
      +	const
      	struct I2 E[] = ...;
      // </smpl>
      Signed-off-by: NMárton Németh <nm127@freemail.hu>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: cocci@diku.dk
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      d67dec5b
  25. 12 12月, 2009 1 次提交
  26. 05 11月, 2009 1 次提交
    • J
      HID: fixup quirk for NCR devices · 5b915d9e
      Jiri Kosina 提交于
      NCR devices are terminally broken by design -- they claim themselves to contain
      proper input applications in their HID report descriptor, but behave very badly
      if treated in standard way.
      
      According to NCR developers, the devices get confused when queried for reports
      in a standard way, rendering them unusable.
      
      NCR is shipping application called "RPSL" that can be used to drive these
      devices through hiddev, under the assumption that in-kernel driver doesn't
      perform initial report query.
      If it does, neither in-kernel nor hiddev-based driver can operate with these
      devices any more.
      
      Introduce a quirk that skips the report query for all NCR devices. The previous
      NOGET quirk was wrong and had been introduced because I misunderstood the nature
      of brokenness of these devices.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      5b915d9e
  27. 14 10月, 2009 2 次提交
  28. 17 9月, 2009 1 次提交
  29. 18 8月, 2009 1 次提交
  30. 23 7月, 2009 1 次提交
  31. 13 7月, 2009 1 次提交
  32. 12 6月, 2009 1 次提交
    • J
      HID: use debugfs for report dumping descriptor · a635f9dd
      Jiri Kosina 提交于
      It is a little bit inconvenient for people who have some non-standard
      HID hardware (usually violating the HID specification) to have to
      recompile kernel with CONFIG_HID_DEBUG to be able to see kernel's perspective
      of the HID report descriptor and observe the parsed events. Plus the messages
      are then mixed up inconveniently with the rest of the dmesg stuff.
      
      This patch implements /sys/kernel/debug/hid/<device>/rdesc file, which
      represents the kernel's view of report descriptor (both the raw report
      descriptor data and parsed contents).
      
      With all the device-specific debug data being available through debugfs, there
      is no need for keeping CONFIG_HID_DEBUG, as the 'debug' parameter to the
      hid module will now only output only driver-specific debugging options, which has
      absolutely minimal memory footprint, just a few error messages and one global
      flag (hid_debug).
      
      We use the current set of output formatting functions. The ones that need to be
      used both for one-shot rdesc seq_file and also for continuous flow of data
      (individual reports, as being sent by the device) distinguish according to the
      passed seq_file parameter, and if it is NULL, it still output to kernel ringbuffer,
      otherwise the corresponding seq_file is used for output.
      
      The format of the output is preserved.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      a635f9dd
  33. 04 6月, 2009 1 次提交
  34. 11 5月, 2009 1 次提交