1. 20 8月, 2009 1 次提交
    • J
      HID: support larger reports than 64 bytes in hiddev · affbb8c6
      Jiri Kosina 提交于
      hiddev userspace driver uses a rignbuffer to store the parsed usages
      that should be returned through read(). This buffer is 64 bytes long,
      which is sufficient for queueing single USB 1.0 low-speed report, which
      is of maximum size 48 bytes.
      
      There are however USB HID devices which are full-speed USB devices, and
      therefore they are free to produce reports 64 bytes long. This is correctly
      handled by HID core, but read() on hiddev node gets stuck forever, because
      the ring buffer loops infinitely (as it is exactly 64 bytes long as well),
      never advancing the buffer pointer.
      
      Plus, the core driver is ready to handle highspeed devices, so we should be
      able to handle reports from such devices in the hiddev driver as well, which
      means we need larger ringbuffer.
      Reported-by: NMichael Zeisel <michael.zeisel@philips.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      affbb8c6
  2. 18 8月, 2009 1 次提交
  3. 08 8月, 2009 1 次提交
  4. 23 7月, 2009 1 次提交
  5. 13 7月, 2009 1 次提交
  6. 22 6月, 2009 1 次提交
  7. 16 6月, 2009 1 次提交
  8. 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
  9. 04 6月, 2009 1 次提交
  10. 11 5月, 2009 2 次提交
  11. 29 4月, 2009 1 次提交
  12. 30 3月, 2009 2 次提交
    • O
      HID: fix race between usb_register_dev() and hiddev_open() · e43bd67d
      Oliver Neukum 提交于
      upon further thought this code is still racy.
      
      	retval = usb_register_dev(usbhid->intf, &hiddev_class);
      
      here you open a window during which open can happen
      
      	if (retval) {
      		err_hid("Not able to get a minor for this device.");
      		hid->hiddev = NULL;
      		kfree(hiddev);
      		return -1;
      	} else {
      		hid->minor = usbhid->intf->minor;
      		hiddev_table[usbhid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
      
      and will fail because hiddev_table hasn't been updated
      
      The obvious fix of using a mutex to guard hiddev_table doesn't work because
      usb_open() and usb_register_dev() take minor_rwsem and we'd have an AB-BA
      deadlock. We need a lock usb_open() also takes in the right order and that leaves
      only one option, BKL. I don't like it but I see no alternative.
      
      Once the usb_open() implements something better than lock_kernel(), we could also
      do so.
      Signed-off-by: NOliver Neukum <oneukum@suse.de>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e43bd67d
    • J
      HID: bring back possibility to specify vid/pid ignore on module load · 6f4303fb
      Jiri Kosina 提交于
      When hid quirks were converted to specialized driver, the HID_QUIRK_IGNORE
      has been moved completely, as the hid_ignore_list[] has been moved into the
      generic code.
      
      However userspace already got used to the possibility that modprobing
      usbhid with
      
      	'quirks=vid:pid:0x4'
      
      makes the device ignored by usbhid driver. So keep this quirk flag in place
      for backwards compatibility.
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      6f4303fb
  13. 26 3月, 2009 5 次提交
  14. 16 3月, 2009 1 次提交
    • J
      Rationalize fasync return values · 60aa4924
      Jonathan Corbet 提交于
      Most fasync implementations do something like:
      
           return fasync_helper(...);
      
      But fasync_helper() will return a positive value at times - a feature used
      in at least one place.  Thus, a number of other drivers do:
      
           err = fasync_helper(...);
           if (err < 0)
                   return err;
           return 0;
      
      In the interests of consistency and more concise code, it makes sense to
      map positive return values onto zero where ->fasync() is called.
      
      Cc: Al Viro <viro@ZenIV.linux.org.uk>
      Signed-off-by: NJonathan Corbet <corbet@lwn.net>
      60aa4924
  15. 11 3月, 2009 2 次提交
    • J
      HID: fix waitqueue usage in hiddev · 96fe2ab8
      Johannes Weiner 提交于
      DECLARE_WAITQUEUE doesn't initialize the wait descriptor's task_list
      to 'empty' but to zero.
      
      prepare_to_wait() will not enqueue the descriptor to the waitqueue and
      finish_wait() will do list_del_init() on a list head that contains
      NULL pointers, which oopses.
      
      This was introduced by 07903407 "HID: hiddev cleanup -- handle all
      error conditions properly".
      
      The prior code used an unconditional add_to_waitqueue() which didn't
      care about the wait descriptor's list head and enqueued the thing
      unconditionally.
      
      The new code uses prepare_to_wait() which DOES check the prior list
      state, so use DEFINE_WAIT instead.
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      96fe2ab8
    • J
      HID: fix incorrect free in hiddev · 48e7a3c9
      Johannes Weiner 提交于
      If hiddev_open() fails, it wrongly frees the shared hiddev structure
      kept in hiddev_table instead of the hiddev_list structure allocated
      for the opened file descriptor.  Existing references to this structure
      will then accessed free memory.
      
      This was introduced by 07903407 "HID: hiddev cleanup -- handle all
      error conditions properly".
      Signed-off-by: NJohannes Weiner <hannes@cmpxchg.org>
      Cc: Oliver Neukum <oliver@neukum.name>
      Cc: Jiri Kosina <jkosina@suse.cz>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      48e7a3c9
  16. 29 1月, 2009 1 次提交
  17. 08 1月, 2009 2 次提交
  18. 04 1月, 2009 8 次提交
  19. 23 11月, 2008 1 次提交
  20. 14 11月, 2008 1 次提交
  21. 13 11月, 2008 1 次提交
    • J
      HID: fix start/stop cycle in usbhid driver · e3e14de5
      Jiri Slaby 提交于
      `stop' left out usbhid->urb* pointers and so the next `start' thought
      it needs to allocate nothing and used the memory pointers previously
      pointed to. This led to memory corruption and device malfunction.
      
      Also don't forget to clear disconnect flag on start which was left set
      by the previous `stop'.
      
      This fixes
      
      	echo DEVICE > /sys/bus/hid/drivers/DRIVER/unbind
      	echo DEVICE > /sys/bus/hid/drivers/DRIVER/bind
      
      failures.
      Signed-off-by: NJiri Slaby <jirislaby@gmail.com>
      Signed-off-by: NJiri Kosina <jkosina@suse.cz>
      e3e14de5
  22. 02 11月, 2008 1 次提交
    • A
      saner FASYNC handling on file close · 233e70f4
      Al Viro 提交于
      As it is, all instances of ->release() for files that have ->fasync()
      need to remember to evict file from fasync lists; forgetting that
      creates a hole and we actually have a bunch that *does* forget.
      
      So let's keep our lives simple - let __fput() check FASYNC in
      file->f_flags and call ->fasync() there if it's been set.  And lose that
      crap in ->release() instances - leaving it there is still valid, but we
      don't have to bother anymore.
      Signed-off-by: NAl Viro <viro@zeniv.linux.org.uk>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      233e70f4
  23. 27 10月, 2008 2 次提交
  24. 23 10月, 2008 1 次提交