1. 01 Mar, 2013 2 commits
    • Andrew de los Reyes's avatar
      HID: logitech-dj: Allow incoming packets during probe(). · a9dd22b7
      Andrew de los Reyes authored
      Historically, logitech-dj communicated with the device during probe()
      to query the list of devices attached. Later, a change was introduced
      to hid-core that prevented incoming packets for a device during
      probe(), as many drivers are unable to handle such input. That change
      broke the device enumeration in logitech-dj, so commit
      59626408 was introduced to workaround that by waiting for
      normal input before enumerating devices.
      
      Now that drivers can opt-in to receive input during probe, this patch
      changes logitech-dj to do that, so that it can successfully complete
      enumeration of devices during probe().
      Signed-off-by: default avatarAndrew de los Reyes <adlr@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      a9dd22b7
    • Andrew de los Reyes's avatar
      HID: Separate struct hid_device's driver_lock into two locks. · c849a614
      Andrew de los Reyes authored
      This patch separates struct hid_device's driver_lock into two. The
      goal is to allow hid device drivers to receive input during their
      probe() or remove() function calls. This is necessary because some
      drivers need to communicate with the device to determine parameters
      needed during probe (e.g., size of a multi-touch surface), and if
      possible, may perfer to communicate with a device on host-initiated
      disconnect (e.g., to put it into a low-power state).
      
      Historically, three functions used driver_lock:
      
      - hid_device_probe: blocks to acquire lock
      - hid_device_remove: blocks to acquire lock
      - hid_input_report: if locked returns -EBUSY, else acquires lock
      
      This patch adds another lock (driver_input_lock) which is used to
      block input from occurring. The lock behavior is now:
      
      - hid_device_probe: blocks to acq. driver_lock, then driver_input_lock
      - hid_device_remove: blocks to acq. driver_lock, then driver_input_lock
      - hid_input_report: if driver_input_lock locked returns -EBUSY, else
        acquires driver_input_lock
      
      This patch also adds two helper functions to be called during probe()
      or remove(): hid_device_io_start() and hid_device_io_stop(). These
      functions lock and unlock, respectively, driver_input_lock; they also
      make a note of whether they did so that hid-core knows if a driver has
      changed the lock state.
      
      This patch results in no behavior change for existing devices and
      drivers. However, during a probe() or remove() function call in a
      driver, that driver may now selectively call hid_device_io_start() to
      let input events come through, then optionally call
      hid_device_io_stop() to stop them.
      Signed-off-by: default avatarAndrew de los Reyes <adlr@chromium.org>
      Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
      c849a614
  2. 22 Feb, 2013 38 commits