Merge branches 'for-3.7/upstream-fixes', 'for-3.8/hidraw', 'for-3.8/i2c-hid', 'for...
authorJiri Kosina <jkosina@suse.cz>
Wed, 12 Dec 2012 20:41:55 +0000 (21:41 +0100)
committerJiri Kosina <jkosina@suse.cz>
Wed, 12 Dec 2012 20:41:55 +0000 (21:41 +0100)
Conflicts:
drivers/hid/hid-core.c

1  2  3  4  5  6  7 
drivers/hid/Kconfig
drivers/hid/Makefile
drivers/hid/hid-apple.c
drivers/hid/hid-core.c
drivers/hid/hid-ids.h
drivers/hid/hid-input.c
drivers/hid/hid-sensor-hub.c
drivers/hid/usbhid/hid-quirks.c
include/linux/hid.h

diff --combined drivers/hid/Kconfig
@@@@@@@@ -265,6 -265,6 -265,6 -265,6 -265,6 -265,6 -265,15 +265,15 @@@@@@@@ config HID_GYRATIO
        ---help---
        Support for Gyration remote control.
       
++++++ config HID_ICADE
++++++  tristate "ION iCade arcade controller"
++++++  depends on BT_HIDP
++++++  ---help---
++++++  Support for the ION iCade arcade controller to work as a joystick.
++++++ 
++++++  To compile this driver as a module, choose M here: the
++++++  module will be called hid-icade.
++++++ 
       config HID_TWINHAN
        tristate "Twinhan IR remote control"
        depends on USB_HID
@@@@@@@@ -728,4 -728,4 -728,6 -728,4 -728,4 -728,4 -737,4 +737,6 @@@@@@@@ endif # HI
       
       source "drivers/hid/usbhid/Kconfig"
       
++ ++++source "drivers/hid/i2c-hid/Kconfig"
++ ++++
       endmenu
diff --combined drivers/hid/Makefile
@@@@@@@@ -52,6 -52,6 -52,6 -52,6 -52,6 -52,6 -52,7 +52,7 @@@@@@@@ obj-$(CONFIG_HID_GYRATION)    += hid-gyrat
       obj-$(CONFIG_HID_HOLTEK) += hid-holtek-kbd.o
       obj-$(CONFIG_HID_HOLTEK) += hid-holtekff.o
       obj-$(CONFIG_HID_HYPERV_MOUSE)   += hid-hyperv.o
++++++ obj-$(CONFIG_HID_ICADE)          += hid-icade.o
       obj-$(CONFIG_HID_KENSINGTON)     += hid-kensington.o
       obj-$(CONFIG_HID_KEYTOUCH)       += hid-keytouch.o
       obj-$(CONFIG_HID_KYE)            += hid-kye.o
@@@@@@@@ -93,8 -93,8 -93,8 -93,8 -93,8 -93,8 -94,8 +94,8 @@@@@@@@ obj-$(CONFIG_HID_PRIMAX)      += hid-primax.
       obj-$(CONFIG_HID_PS3REMOTE)      += hid-ps3remote.o
       obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
        hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \
---- -- hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-pyra.o \
---- -- hid-roccat-savu.o
++++ ++ hid-roccat-koneplus.o hid-roccat-kovaplus.o hid-roccat-lua.o \
++++ ++ hid-roccat-pyra.o hid-roccat-savu.o
       obj-$(CONFIG_HID_SAITEK) += hid-saitek.o
       obj-$(CONFIG_HID_SAMSUNG)        += hid-samsung.o
       obj-$(CONFIG_HID_SMARTJOYPLUS)   += hid-sjoy.o
@@@@@@@@ -118,3 -118,3 -118,4 -118,3 -118,3 -118,3 -119,3 +119,4 @@@@@@@@ obj-$(CONFIG_USB_HID)         += usbhid
       obj-$(CONFIG_USB_MOUSE)          += usbhid/
       obj-$(CONFIG_USB_KBD)            += usbhid/
       
++ ++++obj-$(CONFIG_I2C_HID)            += i2c-hid/
diff --combined drivers/hid/hid-apple.c
@@@@@@@@ -439,7 -439,7 -439,7 -439,7 -439,7 -439,7 -439,8 +439,8 @@@@@@@@ static const struct hid_device_id apple
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_ISO),
------          .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
++++++          .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
++++++                  APPLE_ISO_KEYBOARD },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER4_HF_JIS),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN |
                        APPLE_RDESC_JIS },
                .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS),
                .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI),
    + +         .driver_data = APPLE_HAS_FN },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO),
    + +         .driver_data = APPLE_HAS_FN | APPLE_ISO_KEYBOARD },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS),
    + +         .driver_data = APPLE_HAS_FN | APPLE_RDESC_JIS },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI),
                .driver_data = APPLE_NUMLOCK_EMULATION | APPLE_HAS_FN },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
diff --combined drivers/hid/hid-core.c
@@@@@@@@ -92,6 -92,6 -92,6 -92,7 -92,6 -92,6 -92,6 +92,7 @@@@@@@@ EXPORT_SYMBOL_GPL(hid_register_report)
       static struct hid_field *hid_register_field(struct hid_report *report, unsigned usages, unsigned values)
       {
        struct hid_field *field;
+++ +++ int i;
       
        if (report->maxfield == HID_MAX_FIELDS) {
                hid_err(report->device, "too many fields in report\n");
        field->value = (s32 *)(field->usage + usages);
        field->report = report;
       
+++ +++ for (i = 0; i < usages; i++)
+++ +++         field->usage[i].usage_index = i;
+++ +++
        return field;
       }
       
@@@@@@@@ -315,6 -315,6 -315,6 -319,7 -315,6 -315,6 -315,6 +319,7 @@@@@@@@ static s32 item_sdata(struct hid_item *
       
       static int hid_parser_global(struct hid_parser *parser, struct hid_item *item)
       {
+++ +++ __u32 raw_value;
        switch (item->tag) {
        case HID_GLOBAL_ITEM_TAG_PUSH:
       
                return 0;
       
        case HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT:
--- ---         parser->global.unit_exponent = item_sdata(item);
+++ +++         /* Units exponent negative numbers are given through a
+++ +++          * two's complement.
+++ +++          * See "6.2.2.7 Global Items" for more information. */
+++ +++         raw_value = item_udata(item);
+++ +++         if (!(raw_value & 0xfffffff0))
+++ +++                 parser->global.unit_exponent = hid_snto32(raw_value, 4);
+++ +++         else
+++ +++                 parser->global.unit_exponent = raw_value;
                return 0;
       
        case HID_GLOBAL_ITEM_TAG_UNIT:
@@@@@@@@ -713,7 -713,7 -713,7 -725,7 -713,7 -713,12 -713,7 +725,12 @@@@@@@@ static int hid_scan_report(struct hid_d
                                        hid_scan_usage(hid, u);
                                break;
                        }
----- -         }
+++++ +         } else if (page == HID_UP_SENSOR &&
+++++ +                 item.type == HID_ITEM_TYPE_MAIN &&
+++++ +                 item.tag == HID_MAIN_ITEM_TAG_BEGIN_COLLECTION &&
+++++ +                 (item_udata(&item) & 0xff) == HID_COLLECTION_PHYSICAL &&
+++++ +                 hid->bus == BUS_USB)
+++++ +                 hid->group = HID_GROUP_SENSOR_HUB;
        }
       
        return 0;
@@@@@@@@ -865,6 -865,6 -865,6 -877,12 -865,6 -870,6 -865,6 +882,12 @@@@@@@@ static s32 snto32(__u32 value, unsigne
        return value & (1 << (n - 1)) ? value | (-1 << n) : value;
       }
       
+++ +++s32 hid_snto32(__u32 value, unsigned n)
+++ +++{
+++ +++ return snto32(value, n);
+++ +++}
+++ +++EXPORT_SYMBOL_GPL(hid_snto32);
+++ +++
       /*
        * Convert a signed 32-bit integer to a signed n-bit integer.
        */
@@@@@@@@ -1465,6 -1465,6 -1465,6 -1483,6 -1465,6 -1470,10 -1465,6 +1488,10 @@@@@@@@ EXPORT_SYMBOL_GPL(hid_disconnect)
        * there is a proper autodetection and autoloading in place (based on presence
        * of HID_DG_CONTACTID), so those devices don't need to be added to this list,
        * as we are doing the right thing in hid_scan_usage().
+++++ + *
+++++ + * Autodetection for (USB) HID sensor hubs exists too. If a collection of type
+++++ + * physical is found inside a usage page of type sensor, hid-sensor-hub will be
+++++ + * used as a driver. See hid_scan_report().
        */
       static const struct hid_device_id hid_have_special_driver[] = {
        { HID_USB_DEVICE(USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ANSI) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_JIS) },
 ++++++ { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_GYRATION, USB_DEVICE_ID_GYRATION_REMOTE_3) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK, USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP) },
        { HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT, USB_DEVICE_ID_HOLTEK_ALT_KEYBOARD) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086, USB_DEVICE_ID_SENSOR_HUB_1020) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086, USB_DEVICE_ID_SENSOR_HUB_09FA) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087, USB_DEVICE_ID_SENSOR_HUB_1020) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087, USB_DEVICE_ID_SENSOR_HUB_09FA) },
++++++  { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_ION, USB_DEVICE_ID_ICADE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KENSINGTON, USB_DEVICE_ID_KS_SLIMBLADE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KEYTOUCH, USB_DEVICE_ID_KEYTOUCH_IEC) },
        { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_ERGO_525V) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) },
++++ ++ { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_SAVU) },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_CONTROLLER) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE) },
        { HID_USB_DEVICE(USB_VENDOR_ID_SUNPLUS, USB_DEVICE_ID_SUNPLUS_WDESKTOP) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM, USB_DEVICE_ID_SENSOR_HUB_7014) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb300) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb304) },
        { HID_USB_DEVICE(USB_VENDOR_ID_THRUSTMASTER, 0xb323) },
@@@@@@@@ -2143,16 -2142,16 -2142,16 -2160,16 -2140,13 -2146,16 -2140,18 +2167,21 @@@@@@@@ static const struct hid_device_id hid_m
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ANSI) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_ISO) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7_JIS) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO) },
    + + { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY) },
        { HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
        { }
       };
       
------ static bool hid_ignore(struct hid_device *hdev)
++++++ bool hid_ignore(struct hid_device *hdev)
       {
++++++  if (hdev->quirks & HID_QUIRK_NO_IGNORE)
++++++          return false;
++++++  if (hdev->quirks & HID_QUIRK_IGNORE)
++++++          return true;
++++++ 
        switch (hdev->vendor) {
        case USB_VENDOR_ID_CODEMERCS:
                /* ignore all Code Mercenaries IOWarrior devices */
                if (hdev->product == USB_DEVICE_ID_JESS_YUREX &&
                                hdev->type == HID_TYPE_USBNONE)
                        return true;
------  break;
++++++          break;
++++++  case USB_VENDOR_ID_DWAV:
++++++          /* These are handled by usbtouchscreen. hdev->type is probably
++++++           * HID_TYPE_USBNONE, but we say !HID_TYPE_USBMOUSE to match
++++++           * usbtouchscreen. */
++++++          if ((hdev->product == USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER ||
++++++               hdev->product == USB_DEVICE_ID_DWAV_TOUCHCONTROLLER) &&
++++++              hdev->type != HID_TYPE_USBMOUSE)
++++++                  return true;
++++++          break;
        }
       
        if (hdev->type == HID_TYPE_USBMOUSE &&
       
        return !!hid_match_id(hdev, hid_ignore_list);
       }
++++++ EXPORT_SYMBOL_GPL(hid_ignore);
       
       int hid_add_device(struct hid_device *hdev)
       {
       
        /* we need to kill them here, otherwise they will stay allocated to
         * wait for coming driver */
------  if (!(hdev->quirks & HID_QUIRK_NO_IGNORE)
------             && (hid_ignore(hdev) || (hdev->quirks & HID_QUIRK_IGNORE)))
++++++  if (hid_ignore(hdev))
                return -ENODEV;
       
        /*
diff --combined drivers/hid/hid-ids.h
       #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ANSI    0x0252
       #define USB_DEVICE_ID_APPLE_WELLSPRING5A_ISO     0x0253
       #define USB_DEVICE_ID_APPLE_WELLSPRING5A_JIS     0x0254
    + +#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ANSI    0x0259
    + +#define USB_DEVICE_ID_APPLE_WELLSPRING7A_ISO     0x025a
    + +#define USB_DEVICE_ID_APPLE_WELLSPRING7A_JIS     0x025b
       #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ANSI    0x0249
       #define USB_DEVICE_ID_APPLE_WELLSPRING6A_ISO     0x024a
       #define USB_DEVICE_ID_APPLE_WELLSPRING6A_JIS     0x024b
       
       #define USB_VENDOR_ID_DWAV               0x0eef
       #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER     0x0001
++++++ #define USB_DEVICE_ID_DWAV_TOUCHCONTROLLER       0x0002
       #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480D        0x480d
       #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_480E        0x480e
       #define USB_DEVICE_ID_DWAV_EGALAX_MULTITOUCH_7207        0x7207
       #define USB_VENDOR_ID_ILITEK             0x222a
       #define USB_DEVICE_ID_ILITEK_MULTITOUCH  0x0001
       
++++++ #define USB_VENDOR_ID_ION                0x15e4
++++++ #define USB_DEVICE_ID_ICADE              0x0132
++++++ 
       #define USB_VENDOR_ID_HOLTEK             0x1241
       #define USB_DEVICE_ID_HOLTEK_ON_LINE_GRIP        0x5015
       
       #define USB_VENDOR_ID_IMATION            0x0718
       #define USB_DEVICE_ID_DISC_STAKKA        0xd000
       
----- -#define USB_VENDOR_ID_INTEL_8086 0x8086
----- -#define USB_VENDOR_ID_INTEL_8087 0x8087
----- -#define USB_DEVICE_ID_SENSOR_HUB_1020    0x1020
----- -#define USB_DEVICE_ID_SENSOR_HUB_09FA    0x09FA
----- -
       #define USB_VENDOR_ID_IRTOUCHSYSTEMS     0x6615
       #define USB_DEVICE_ID_IRTOUCH_INFRARED_USB       0x0070
       
       
       #define USB_VENDOR_ID_NOVATEK            0x0603
       #define USB_DEVICE_ID_NOVATEK_PCT        0x0600
 ++++++#define USB_DEVICE_ID_NOVATEK_MOUSE      0x1602
       
       #define USB_VENDOR_ID_NTRIG              0x1b96
       #define USB_DEVICE_ID_NTRIG_TOUCH_SCREEN   0x0001
       #define USB_DEVICE_ID_ROCCAT_ISKU        0x319c
       #define USB_DEVICE_ID_ROCCAT_KONE        0x2ced
       #define USB_DEVICE_ID_ROCCAT_KONEPLUS    0x2d51
++++ ++#define USB_DEVICE_ID_ROCCAT_KONEXTD     0x2e22
       #define USB_DEVICE_ID_ROCCAT_KOVAPLUS    0x2d50
++++ ++#define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e
       #define USB_DEVICE_ID_ROCCAT_PYRA_WIRED  0x2c24
       #define USB_DEVICE_ID_ROCCAT_PYRA_WIRELESS       0x2cf6
       #define USB_DEVICE_ID_ROCCAT_SAVU        0x2d5a
       #define USB_VENDOR_ID_SIGMA_MICRO        0x1c4f
       #define USB_DEVICE_ID_SIGMA_MICRO_KEYBOARD       0x0002
       
++++++ #define USB_VENDOR_ID_SIGMATEL           0x066F
++++++ #define USB_DEVICE_ID_SIGMATEL_STMP3780  0x3780
++++++ 
       #define USB_VENDOR_ID_SKYCABLE                   0x1223
       #define  USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER       0x3F07
       
       
       #define USB_VENDOR_ID_STANTUM_STM                0x0483
       #define USB_DEVICE_ID_MTP_STM            0x3261
----- -#define USB_DEVICE_ID_SENSOR_HUB_7014    0x7014
       
       #define USB_VENDOR_ID_STANTUM_SITRONIX           0x1403
       #define USB_DEVICE_ID_MTP_SITRONIX               0x5001
       #define USB_VENDOR_ID_TOUCHPACK          0x1bfd
       #define USB_DEVICE_ID_TOUCHPACK_RTS      0x1688
       
++++++ #define USB_VENDOR_ID_TPV                0x25aa
++++++ #define USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN    0x8883
++++++ 
       #define USB_VENDOR_ID_TURBOX             0x062a
       #define USB_DEVICE_ID_TURBOX_KEYBOARD    0x0201
       #define USB_DEVICE_ID_TURBOX_TOUCHSCREEN_MOSART  0x7100
diff --combined drivers/hid/hid-input.c
@@@@@@@@ -192,7 -192,7 -192,7 -192,6 -192,7 -192,7 -192,7 +192,6 @@@@@@@@ static int hidinput_setkeycode(struct i
        return -EINVAL;
       }
       
--- ---
       /**
        * hidinput_calc_abs_res - calculate an absolute axis resolution
        * @field: the HID report field to calculate resolution for
        * Only exponent 1 length units are processed. Centimeters and inches are
        * converted to millimeters. Degrees are converted to radians.
        */
--- ---static __s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
+++ +++__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code)
       {
        __s32 unit_exponent = field->unit_exponent;
        __s32 logical_extents = field->logical_maximum -
        case ABS_X:
        case ABS_Y:
        case ABS_Z:
--- ---         if (field->unit == 0x11) {              /* If centimeters */
+++ +++ case ABS_MT_POSITION_X:
+++ +++ case ABS_MT_POSITION_Y:
+++ +++ case ABS_MT_TOOL_X:
+++ +++ case ABS_MT_TOOL_Y:
+++ +++ case ABS_MT_TOUCH_MAJOR:
+++ +++ case ABS_MT_TOUCH_MINOR:
+++ +++         if (field->unit & 0xffffff00)           /* Not a length */
+++ +++                 return 0;
+++ +++         unit_exponent += hid_snto32(field->unit >> 4, 4) - 1;
+++ +++         switch (field->unit & 0xf) {
+++ +++         case 0x1:                               /* If centimeters */
                        /* Convert to millimeters */
                        unit_exponent += 1;
--- ---         } else if (field->unit == 0x13) {       /* If inches */
+++ +++                 break;
+++ +++         case 0x3:                               /* If inches */
                        /* Convert to millimeters */
                        prev = physical_extents;
                        physical_extents *= 254;
                        if (physical_extents < prev)
                                return 0;
                        unit_exponent -= 1;
--- ---         } else {
+++ +++                 break;
+++ +++         default:
                        return 0;
                }
                break;
        }
       
        /* Calculate resolution */
--- --- return logical_extents / physical_extents;
+++ +++ return DIV_ROUND_CLOSEST(logical_extents, physical_extents);
       }
+++ +++EXPORT_SYMBOL_GPL(hidinput_calc_abs_res);
       
       #ifdef CONFIG_HID_BATTERY_STRENGTH
       static enum power_supply_property hidinput_battery_props[] = {
       
       static const struct hid_device_id hid_battery_quirks[] = {
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
++++++                  USB_DEVICE_ID_APPLE_ALU_WIRELESS_2009_ISO),
++++++  HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
++++++  { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
                               USB_DEVICE_ID_APPLE_ALU_WIRELESS_2011_ANSI),
          HID_BATTERY_QUIRK_PERCENT | HID_BATTERY_QUIRK_FEATURE },
        { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_APPLE,
@@@@@@@@ -502,9 -502,9 -502,9 -514,9 -502,9 -502,9 -505,14 +517,14 @@@@@@@@ static void hidinput_configure_usage(st
                                if (code <= 0xf)
                                        code += BTN_JOYSTICK;
                                else
------                                  code += BTN_TRIGGER_HAPPY;
++++++                                  code += BTN_TRIGGER_HAPPY - 0x10;
++++++                          break;
++++++          case HID_GD_GAMEPAD:
++++++                          if (code <= 0xf)
++++++                                  code += BTN_GAMEPAD;
++++++                          else
++++++                                  code += BTN_TRIGGER_HAPPY - 0x10;
                                break;
------          case HID_GD_GAMEPAD:  code += BTN_GAMEPAD; break;
                default:
                        switch (field->physical) {
                        case HID_GD_MOUSE:
@@@@@@@@ -1146,6 -1146,6 -1146,6 -1158,6 -1146,6 -1146,6 -1154,38 +1166,38 @@@@@@@@ static void report_features(struct hid_
                        }
       }
       
++++++ static struct hid_input *hidinput_allocate(struct hid_device *hid)
++++++ {
++++++  struct hid_input *hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL);
++++++  struct input_dev *input_dev = input_allocate_device();
++++++  if (!hidinput || !input_dev) {
++++++          kfree(hidinput);
++++++          input_free_device(input_dev);
++++++          hid_err(hid, "Out of memory during hid input probe\n");
++++++          return NULL;
++++++  }
++++++ 
++++++  input_set_drvdata(input_dev, hid);
++++++  input_dev->event = hid->ll_driver->hidinput_input_event;
++++++  input_dev->open = hidinput_open;
++++++  input_dev->close = hidinput_close;
++++++  input_dev->setkeycode = hidinput_setkeycode;
++++++  input_dev->getkeycode = hidinput_getkeycode;
++++++ 
++++++  input_dev->name = hid->name;
++++++  input_dev->phys = hid->phys;
++++++  input_dev->uniq = hid->uniq;
++++++  input_dev->id.bustype = hid->bus;
++++++  input_dev->id.vendor  = hid->vendor;
++++++  input_dev->id.product = hid->product;
++++++  input_dev->id.version = hid->version;
++++++  input_dev->dev.parent = hid->dev.parent;
++++++  hidinput->input = input_dev;
++++++  list_add_tail(&hidinput->list, &hid->inputs);
++++++ 
++++++  return hidinput;
++++++ }
++++++ 
       /*
        * Register the input device; print a message.
        * Configure the input layer interface
@@@@@@@@ -1157,7 -1157,7 -1157,7 -1169,7 -1157,7 -1157,7 -1197,6 +1209,6 @@@@@@@@ int hidinput_connect(struct hid_device 
        struct hid_driver *drv = hid->driver;
        struct hid_report *report;
        struct hid_input *hidinput = NULL;
------  struct input_dev *input_dev;
        int i, j, k;
       
        INIT_LIST_HEAD(&hid->inputs);
                                continue;
       
                        if (!hidinput) {
------                          hidinput = kzalloc(sizeof(*hidinput), GFP_KERNEL);
------                          input_dev = input_allocate_device();
------                          if (!hidinput || !input_dev) {
------                                  kfree(hidinput);
------                                  input_free_device(input_dev);
------                                  hid_err(hid, "Out of memory during hid input probe\n");
++++++                          hidinput = hidinput_allocate(hid);
++++++                          if (!hidinput)
                                        goto out_unwind;
------                          }
------ 
------                          input_set_drvdata(input_dev, hid);
------                          input_dev->event =
------                                  hid->ll_driver->hidinput_input_event;
------                          input_dev->open = hidinput_open;
------                          input_dev->close = hidinput_close;
------                          input_dev->setkeycode = hidinput_setkeycode;
------                          input_dev->getkeycode = hidinput_getkeycode;
------ 
------                          input_dev->name = hid->name;
------                          input_dev->phys = hid->phys;
------                          input_dev->uniq = hid->uniq;
------                          input_dev->id.bustype = hid->bus;
------                          input_dev->id.vendor  = hid->vendor;
------                          input_dev->id.product = hid->product;
------                          input_dev->id.version = hid->version;
------                          input_dev->dev.parent = hid->dev.parent;
------                          hidinput->input = input_dev;
------                          list_add_tail(&hidinput->list, &hid->inputs);
                        }
       
                        for (i = 0; i < report->maxfield; i++)
@@@@@@@@ -82,23 -82,23 -82,23 -82,23 -82,23 -82,6 -82,23 +82,6 @@@@@@@@ struct hid_sensor_hub_callbacks_list 
        void *priv;
       };
       
----- -static int sensor_hub_check_for_sensor_page(struct hid_device *hdev)
----- -{
----- - int i;
----- - int ret = -EINVAL;
----- -
----- - for (i = 0; i < hdev->maxcollection; i++) {
----- -         struct hid_collection *col = &hdev->collection[i];
----- -         if (col->type == HID_COLLECTION_PHYSICAL &&
----- -            (col->usage & HID_USAGE_PAGE) == HID_UP_SENSOR) {
----- -                 ret = 0;
----- -                 break;
----- -         }
----- - }
----- -
----- - return ret;
----- -}
----- -
       static struct hid_report *sensor_hub_report(int id, struct hid_device *hdev,
                                                int dir)
       {
@@@@@@@@ -437,9 -437,9 -437,9 -437,9 -437,9 -420,9 -437,6 +420,6 @@@@@@@@ static int sensor_hub_raw_event(struct 
        ptr = raw_data;
        ptr++; /*Skip report id*/
       
------  if (!report)
------          goto err_report;
------ 
        spin_lock_irqsave(&pdata->lock, flags);
       
        for (i = 0; i < report->maxfield; ++i) {
                                callback->pdev);
        spin_unlock_irqrestore(&pdata->lock, flags);
       
------ err_report:
        return 1;
       }
       
@@@@@@@@ -524,10 -524,10 -524,10 -524,10 -524,10 -507,6 -520,10 +503,6 @@@@@@@@ static int sensor_hub_probe(struct hid_
                hid_err(hdev, "parse failed\n");
                goto err_free;
        }
----- - if (sensor_hub_check_for_sensor_page(hdev) < 0) {
----- -         hid_err(hdev, "sensor page not found\n");
----- -         goto err_free;
----- - }
        INIT_LIST_HEAD(&hdev->inputs);
       
        ret = hid_hw_start(hdev, 0);
@@@@@@@@ -630,16 -630,16 -630,16 -630,16 -630,16 -609,7 -626,16 +605,7 @@@@@@@@ static void sensor_hub_remove(struct hi
       }
       
       static const struct hid_device_id sensor_hub_devices[] = {
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086,
----- -                 USB_DEVICE_ID_SENSOR_HUB_1020) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
----- -                 USB_DEVICE_ID_SENSOR_HUB_1020) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8086,
----- -                 USB_DEVICE_ID_SENSOR_HUB_09FA) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_INTEL_8087,
----- -                 USB_DEVICE_ID_SENSOR_HUB_09FA) },
----- - { HID_USB_DEVICE(USB_VENDOR_ID_STANTUM_STM,
----- -                 USB_DEVICE_ID_SENSOR_HUB_7014) },
+++++ + { HID_DEVICE(BUS_USB, HID_GROUP_SENSOR_HUB, HID_ANY_ID, HID_ANY_ID) },
        { }
       };
       MODULE_DEVICE_TABLE(hid, sensor_hub_devices);
@@@@@@@@ -72,7 -72,6 -72,6 -72,6 -72,6 -72,6 -72,6 +72,7 @@@@@@@@ static const struct hid_blacklist 
        { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
 ++++++ { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN1, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_PIXART, USB_DEVICE_ID_PIXART_OPTICAL_TOUCH_SCREEN2, HID_QUIRK_NO_INIT_REPORTS },
        { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_QUANTA, USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SENNHEISER, USB_DEVICE_ID_SENNHEISER_BTD500USB, HID_QUIRK_NOGET },
++++++  { USB_VENDOR_ID_SIGMATEL, USB_DEVICE_ID_SIGMATEL_STMP3780, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SUN, USB_DEVICE_ID_RARITAN_KVM_DONGLE, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_1, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_SYMBOL, USB_DEVICE_ID_SYMBOL_SCANNER_2, HID_QUIRK_NOGET },
++++++  { USB_VENDOR_ID_TPV, USB_DEVICE_ID_TPV_OPTICAL_TOUCHSCREEN, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_TURBOX, USB_DEVICE_ID_TURBOX_KEYBOARD, HID_QUIRK_NOGET },
        { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_PF1209, HID_QUIRK_MULTI_INPUT },
        { USB_VENDOR_ID_UCLOGIC, USB_DEVICE_ID_UCLOGIC_TABLET_WP4030U, HID_QUIRK_MULTI_INPUT },
diff --combined include/linux/hid.h
@@@@@@@@ -1,12 -1,8 -1,8 -1,8 -1,12 -1,8 -1,12 +1,8 @@@@@@@@
-   - -#ifndef __HID_H
-   - -#define __HID_H
-   - -
       /*
        *  Copyright (c) 1999 Andreas Gal
        *  Copyright (c) 2000-2001 Vojtech Pavlik
        *  Copyright (c) 2006-2007 Jiri Kosina
        */
-   - -
       /*
        * This program is free software; you can redistribute it and/or modify
        * it under the terms of the GNU General Public License as published by
        * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
        * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
        */
+   + +#ifndef __HID_H
+   + +#define __HID_H
       
-   - -/*
-   - - * USB HID (Human Interface Device) interface class code
-   - - */
-   - -
-   - -#define USB_INTERFACE_CLASS_HID          3
-   - -
-   - -/*
-   - - * USB HID interface subclass and protocol codes
-   - - */
-   - -
-   - -#define USB_INTERFACE_SUBCLASS_BOOT      1
-   - -#define USB_INTERFACE_PROTOCOL_KEYBOARD  1
-   - -#define USB_INTERFACE_PROTOCOL_MOUSE     2
-   - -
-   - -/*
-   - - * HID class requests
-   - - */
-   - -
-   - -#define HID_REQ_GET_REPORT               0x01
-   - -#define HID_REQ_GET_IDLE         0x02
-   - -#define HID_REQ_GET_PROTOCOL             0x03
-   - -#define HID_REQ_SET_REPORT               0x09
-   - -#define HID_REQ_SET_IDLE         0x0A
-   - -#define HID_REQ_SET_PROTOCOL             0x0B
-   - -
-   - -/*
-   - - * HID class descriptor types
-   - - */
-   - -
-   - -#define HID_DT_HID                       (USB_TYPE_CLASS | 0x01)
-   - -#define HID_DT_REPORT                    (USB_TYPE_CLASS | 0x02)
-   - -#define HID_DT_PHYSICAL                  (USB_TYPE_CLASS | 0x03)
-   - -
-   - -#define HID_MAX_DESCRIPTOR_SIZE          4096
-   - -
-   - -#ifdef __KERNEL__
       
       #include <linux/types.h>
       #include <linux/slab.h>
       #include <linux/input.h>
       #include <linux/semaphore.h>
       #include <linux/power_supply.h>
+   + +#include <uapi/linux/hid.h>
       
       /*
        * We parse each description item into this structure. Short items data
@@@@@@@@ -204,6 -167,6 -167,6 -167,6 -204,6 -167,7 -204,6 +167,7 @@@@@@@@ struct hid_item 
       #define HID_UP_MSVENDOR          0xff000000
       #define HID_UP_CUSTOM            0x00ff0000
       #define HID_UP_LOGIVENDOR        0xffbc0000
+++++ +#define HID_UP_SENSOR            0x00200000
       
       #define HID_USAGE                0x0000ffff
       
        */
       #define HID_GROUP_GENERIC                        0x0001
       #define HID_GROUP_MULTITOUCH                     0x0002
+++++ +#define HID_GROUP_SENSOR_HUB                     0x0003
       
       /*
        * This is the global environment of the parser. This information is
@@@@@@@@ -379,6 -342,6 -342,6 -342,7 -379,6 -344,6 -379,6 +344,7 @@@@@@@@ struct hid_collection 
       struct hid_usage {
        unsigned  hid;                  /* hid usage code */
        unsigned  collection_index;     /* index into collection array */
+++ +++ unsigned  usage_index;          /* index into usage array */
        /* hidinput data */
        __u16     code;                 /* input driver code */
        __u8      type;                 /* input driver type */
@@@@@@@@ -721,6 -684,6 -684,6 -685,6 -721,6 -686,6 -721,7 +687,7 @@@@@@@@ struct hid_ll_driver 
       
       extern int hid_debug;
       
++++++ extern bool hid_ignore(struct hid_device *);
       extern int hid_add_device(struct hid_device *);
       extern void hid_destroy_device(struct hid_device *);
       
@@@@@@@@ -743,6 -706,6 -706,6 -707,7 -743,6 -708,6 -744,6 +710,7 @@@@@@@@ int hid_input_report(struct hid_device 
       int hidinput_find_field(struct hid_device *hid, unsigned int type, unsigned int code, struct hid_field **field);
       struct hid_field *hidinput_get_led_field(struct hid_device *hid);
       unsigned int hidinput_count_leds(struct hid_device *hid);
+++ +++__s32 hidinput_calc_abs_res(const struct hid_field *field, __u16 code);
       void hid_output_report(struct hid_report *report, __u8 *data);
       struct hid_device *hid_allocate_device(void);
       struct hid_report *hid_register_report(struct hid_device *device, unsigned type, unsigned id);
@@@@@@@@ -753,6 -716,6 -716,6 -718,7 -753,6 -718,6 -754,6 +721,7 @@@@@@@@ int hid_connect(struct hid_device *hid
       void hid_disconnect(struct hid_device *hid);
       const struct hid_device_id *hid_match_id(struct hid_device *hdev,
                                         const struct hid_device_id *id);
+++ +++s32 hid_snto32(__u32 value, unsigned n);
       
       /**
        * hid_map_usage - map usage input bits
@@@@@@@@ -943,7 -906,4 -906,4 -909,4 -943,7 -908,4 -944,7 +912,4 @@@@@@@@ do {                                                                  
       #define hid_dbg(hid, fmt, arg...)                        \
        dev_dbg(&(hid)->dev, fmt, ##arg)
       
-   - -#endif /* __KERNEL__ */
-   - -
       #endif
-   - -