01 Nov, 2011

1 commit

  • The original implementations reference THIS_MODULE in an inline.
    We could include , but it is better to avoid chaining.

    Fortunately someone else already thought of this, and made a similar
    inline into a #define in for device_schedule_callback(),
    [see commit 523ded71de0] so follow that precedent here.

    Also bubble up any __must_check that were used on the prev. wrapper inline
    functions up one to the real __register functions, to preserve any prev.
    sanity checks that were used in those instances.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     

25 Oct, 2011

1 commit


26 Sep, 2011

1 commit


10 Aug, 2011

1 commit

  • HID low level drivers register new devices with the HID core which then
    adds the devices to the HID bus. The HID bus normally immediately probes
    an appropriate driver which then handles HID input for this device.
    The ll driver now uses the hid_input_report() function to report input
    events for a specific device. However, if the HID bus unloads the driver
    at the same time (for instance via a call to
    /sys/bus/hid/devices//unbind) then the hdev->driver pointer may be
    used by hid_input_report() and hid_device_remove() at the same time
    which may cause hdev->driver to point to invalid memory.

    This fix adds a semaphore to every hid device which protects
    hdev->driver from asynchronous access. This semaphore is locked during
    driver *_probe and *_remove and also inside hid_input_report(). The
    *_probe and *_remove functions may sleep so the semaphore is good here,
    however, hid_input_report() is in atomic context and hence only uses
    down_trylock(). If it cannot acquire the lock it simply drops the input
    package.

    The low-level drivers report input events synchronously so
    hid_input_report() should never be entered twice at the same time on the
    same device. Hence, the lock should always be available. But if the
    driver is currently probed/removed then the lock is not available and
    dropping the package should be safe because this is what would have
    happened if the package arrived some milliseconds earlier/later.

    This also fixes another race condition while probing drivers:
    First the *_probe function of the driver is called and only if that
    succeeds, the related input device of hidinput is registered. If the low
    level driver reports input events after the *_probe function returned
    but before the input device is registered, then a NULL pointer
    dereference will occur. (Equivalently on driver remove function).
    This is not possible anymore, since the semaphore lock drops all
    incoming packages until the driver/device is fully initialized.

    Signed-off-by: David Herrmann
    Signed-off-by: Jiri Kosina

    David Herrmann
     

07 Jun, 2011

1 commit

  • Unfortunately, the device seems to have the same Vendor ID and Product ID
    as YUREX leg-shakes sensors, and the commit 6bc235a2e2 ("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=26922

    Signed-off-by: Tomoki Sekiyama
    Cc: Greg KH
    Cc: "Rafael J. Wysocki"
    Cc: Maciej Rutecki
    Reported-by: Thomas B?chler
    Tested-by: Thomas B?chler
    Signed-off-by: Andrew Morton
    Signed-off-by: Jiri Kosina

    Tomoki Sekiyama
     

31 Mar, 2011

1 commit


17 Mar, 2011

1 commit


02 Mar, 2011

1 commit

  • When the multi input quirk is set, there is a new input device
    created for every feature report. Since the idea is to present
    features per hid device, not per input device, revert back to
    the original report loop and change the feature_mapping() callback
    to not take the input device as argument.

    Signed-off-by: Henrik Rydberg
    Tested-by: Benjamin Tissoires
    Signed-off-by: Jiri Kosina

    Henrik Rydberg
     

11 Feb, 2011

1 commit

  • Per the HID Specification, Feature reports must be sent and received on
    the Configuration endpoint (EP 0) through the Set_Report/Get_Report
    interfaces. This patch adds two ioctls to hidraw to set and get feature
    reports to and from the device. Modifications were made to hidraw and
    usbhid.

    New hidraw ioctls:
    HIDIOCSFEATURE - Perform a Set_Report transfer of a Feature report.
    HIDIOCGFEATURE - Perform a Get_Report transfer of a Feature report.

    Signed-off-by: Alan Ott
    Signed-off-by: Antonio Ospite
    Signed-off-by: Jiri Kosina

    Alan Ott
     

14 Jan, 2011

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid:
    HID: hid-multitouch: minor fixes based on additional review
    HID: Switch turbox/mosart touchscreen to hid-mosart
    HID: add Add Cando touch screen 10.1-inch product id
    HID: hid-mulitouch: add support for the 'Sensing Win7-TwoFinger'
    HID: hid-multitouch: add support for Cypress TrueTouch panels
    HID: hid-multitouch: support for PixCir-based panels
    HID: set HID_MAX_FIELD at 128
    HID: add feature_mapping callback

    Linus Torvalds
     

12 Jan, 2011

2 commits

  • Stantums multitouch panels sends more than 64 reports and this results
    in not being able to handle all the touches given by this device.

    This patch is required to be able to include Stantum panels in the
    unified hid-multitouch driver.

    Signed-off-by: Benjamin Tissoires
    Acked-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     
  • Currently hid doesn't export the features it knows to the specific modules.
    Some information can be really important in such features: MosArt and
    Cypress devices are by default not in a multitouch mode.
    We have to send the value 2 on the right feature.

    This patch exports to the module the features report so they can find the
    right feature to set up the correct mode.

    Signed-off-by: Benjamin Tissoires
    Acked-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Benjamin Tissoires
     

10 Dec, 2010

1 commit

  • Neaten current uses of dev_ by adding and using
    hid specific hid_ macros.

    Convert existing uses of dev_ uses to hid_.
    Convert hid-pidff printk uses to hid_.

    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_ can be used by them.
    Fix bad indentation in hid-core hid_input_field function
    that calls extract() function above.

    Signed-off-by: Joe Perches
    Signed-off-by: Jiri Kosina

    Joe Perches
     

08 Dec, 2010

1 commit


24 Oct, 2010

1 commit


21 Sep, 2010

1 commit

  • As of lately, HID devices which send per-frame data split over several
    HID reports have started to emerge. This patch adds a quirk which
    allows the HID driver to take over the input layer synchronization,
    and hence the control of the frame boundary.

    Signed-off-by: Henrik Rydberg
    Signed-off-by: Jiri Kosina

    Henrik Rydberg
     

10 Aug, 2010

1 commit

  • Update hid_driver's report_fixup prototype to allow changing report
    descriptor size and/or returning completely different report descriptor.
    Update existing usage accordingly.

    This is to give more freedom in descriptor fixup and to allow having a whole
    fixed descriptor in the code for the sake of readability.

    Signed-off-by: Nikolai Kondrashov
    Signed-off-by: Jiri Kosina

    Nikolai Kondrashov
     

19 Jul, 2010

1 commit

  • For devices with exotic HID report descriptors, it might be necessary to
    make the HID core force the registration of an input device. Make that
    possible by introducing a new quirk type.

    Signed-off-by: Daniel Mack
    Cc: Jiri Kosina
    Cc: Dmitry Torokhov
    Signed-off-by: Jiri Kosina

    Daniel Mack
     

19 May, 2010

1 commit


27 Apr, 2010

1 commit


19 Apr, 2010

1 commit

  • 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: Bastien Nocera
    Signed-off-by: Jiri Kosina

    Bastien Nocera
     

26 Feb, 2010

1 commit


10 Feb, 2010

1 commit

  • The Apple Magic Mouse (and probably other devices) publish reports that are not
    called out in their HID report descriptors -- they only send them when enabled
    through other writes to the device. This allows a driver to handle these
    unlisted reports.

    Signed-off-by: Michael Poole
    Signed-off-by: Jiri Kosina

    Michael Poole
     

03 Feb, 2010

1 commit

  • In commit 2da31939a42 ("Bluetooth: Implement raw output support for HIDP
    layer"), support for Bluetooth hid_output_raw_report was added, but it
    pushes the data to the intr socket instead of the ctrl one. This has been
    fixed by 6bf8268f9a91f1 ("Bluetooth: Use the control channel for raw HID reports")

    Still, it is necessary to distinguish whether the report in question should be
    either FEATURE or OUTPUT. For this, we have to extend the generic HID API,
    so that hid_output_raw_report() callback provides means to specify this
    value so that it can be passed down to lower level hardware drivers (currently
    Bluetooth and USB).

    Based on original patch by Bastien Nocera
    Acked-by: Marcel Holtmann
    Signed-off-by: Jiri Kosina

    Jiri Kosina
     

18 Jan, 2010

1 commit


05 Nov, 2009

1 commit

  • 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: Jiri Kosina

    Jiri Kosina
     

17 Sep, 2009

1 commit


14 Sep, 2009

1 commit


12 Jun, 2009

2 commits

  • This is a followup patch to the one implemeting rdesc representation in debugfs
    rather than being dependent on compile-time CONFIG_HID_DEBUG setting.

    The API of the appropriate formatting functions is slightly modified -- if
    they are passed seq_file pointer, the one-shot output for 'rdesc' file mode
    is used, and therefore the message is formatted into the corresponding seq_file
    immediately.

    Otherwise the called function allocated a new buffer, formats the text into the
    buffer and returns the pointer to it, so that it can be queued into the ring-buffer
    of the processess blocked waiting on input on 'events' file in debugfs.

    'debug' parameter to the 'hid' module is now used solely for the prupose of inetrnal
    driver state debugging (parser, transport, etc).

    Signed-off-by: Jiri Kosina

    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//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: Jiri Kosina

    Jiri Kosina
     

20 May, 2009

1 commit

  • Added constants to hid.h for all digitizer usages (including the new multitouch
    ones that are not yet in the official USB spec but are being pushed by Microsft
    as described in their paper "Digitizer Drivers for Windows Touch and Pen-Based
    Computers"). Updated hid-debug.c to support the new MT input constants such as
    ABS_MT_POSITION_X.

    Signed-off-by: Stephane Chatty
    Signed-off-by: Jiri Kosina

    Stephane Chatty
     

30 Mar, 2009

3 commits

  • Conflicts:

    drivers/hid/hid-core.c

    Jiri Kosina
     
  • This removal was scheduled and there is no problem with later
    distros to adapt for the new bus, thanks to aliases.

    module-init-tools map files are deprecated nowadays, so that
    the patch which introduced hid ones into the m-i-t won't be
    accepted and hence there is no reason for leaving compat stuff in.

    Signed-off-by: Jiri Slaby
    Cc: Jiri Kosina
    Signed-off-by: Jiri Kosina

    Jiri Slaby
     
  • 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: Jiri Kosina

    Jiri Kosina
     

26 Mar, 2009

1 commit

  • This uses the USB busy mechanism for aggessive autosuspend of USB
    HID devices. It autosuspends all opened devices supporting remote wakeup
    after a timeout unless

    - output is being done to the device
    - a key is being held down (remote wakeup isn't triggered upon key release)
    - LED(s) are lit
    - hiddev is opened

    As in the current driver closed devices will be autosuspended even if they
    don't support remote wakeup.

    The patch is quite large because output to devices is done in hard interrupt
    context meaning a lot a queuing and locking had to be touched. The LED stuff
    has been solved by means of a simple counter. Additions to the generic HID code
    could be avoided. In addition it now covers hidraw. It contains an embryonic
    version of an API to let the generic HID code tell the lower levels which
    capabilities with respect to power management are needed.

    Signed-off-by: Oliver Neukum
    Signed-off-by: Jiri Kosina

    Oliver Neukum
     

31 Jan, 2009

1 commit


04 Jan, 2009

3 commits


27 Oct, 2008

1 commit

  • Usbhid structure is allocated on start invoked only from probe
    of some driver. When there is no driver, the structure is null
    and causes null-dereference oopses.

    Fix it by allocating the structure on probe and disconnect of
    the device itself. Also make sure we won't race between start
    and resume or stop and suspend respectively.

    References: http://bugzilla.kernel.org/show_bug.cgi?id=11827

    Signed-off-by: Jiri Slaby
    Cc: Johannes Berg
    Cc: Andreas Schwab
    Signed-off-by: Jiri Kosina

    Jiri Slaby