Merge branch 'for-6.1/logitech' into for-linus
authorBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 5 Oct 2022 09:21:55 +0000 (10:21 +0100)
committerBenjamin Tissoires <benjamin.tissoires@redhat.com>
Wed, 5 Oct 2022 09:21:55 +0000 (10:21 +0100)
- Add hanlding of all Bluetooth HID++ devices and fixes in hid++
  (Bastien Nocera)

12 files changed:
drivers/hid/Kconfig
drivers/hid/hid-core.c
drivers/hid/hid-roccat.c
drivers/hid/hid-steam.c
drivers/hid/i2c-hid/i2c-hid-core.c
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/usbkbd.c
drivers/hid/usbhid/usbmouse.c
drivers/hid/wacom_sys.c
drivers/hid/wacom_wac.c
include/linux/hid.h
include/uapi/linux/hid.h

index 6ce92830b5d1f9c90444401f0167f64b92bde816..11a0c7c40c298ed7166626c5cec438d3ed04bde4 100644 (file)
@@ -28,7 +28,6 @@ if HID
 
 config HID_BATTERY_STRENGTH
        bool "Battery level reporting for HID devices"
-       depends on HID
        select POWER_SUPPLY
        default n
        help
@@ -38,7 +37,6 @@ config HID_BATTERY_STRENGTH
 
 config HIDRAW
        bool "/dev/hidraw raw HID device support"
-       depends on HID
        help
        Say Y here if you want to support HID devices (from the USB
        specification standpoint) that aren't strictly user interface
@@ -57,7 +55,6 @@ config HIDRAW
 
 config UHID
        tristate "User-space I/O driver support for HID subsystem"
-       depends on HID
        default n
        help
        Say Y here if you want to provide HID I/O Drivers from user-space.
@@ -78,7 +75,6 @@ config UHID
 
 config HID_GENERIC
        tristate "Generic HID driver"
-       depends on HID
        default HID
        help
        Support for generic devices on the HID bus. This includes most
@@ -90,11 +86,9 @@ config HID_GENERIC
        If unsure, say Y.
 
 menu "Special HID drivers"
-       depends on HID
 
 config HID_A4TECH
        tristate "A4TECH mice"
-       depends on HID
        default !EXPERT
        help
        Support for some A4TECH mice with two scroll wheels.
@@ -113,7 +107,6 @@ config HID_ACCUTOUCH
 
 config HID_ACRUX
        tristate "ACRUX game controller support"
-       depends on HID
        help
        Say Y here if you want to enable support for ACRUX game controllers.
 
@@ -127,7 +120,6 @@ config HID_ACRUX_FF
 
 config HID_APPLE
        tristate "Apple {i,Power,Mac}Books"
-       depends on HID
        depends on LEDS_CLASS
        depends on NEW_LEDS
        default !EXPERT
@@ -167,13 +159,11 @@ config HID_ASUS
 
 config HID_AUREAL
        tristate "Aureal"
-       depends on HID
        help
        Support for Aureal Cy se W-01RN Remote Controller and other Aureal derived remotes.
 
 config HID_BELKIN
        tristate "Belkin Flip KVM and Wireless keyboard"
-       depends on HID
        default !EXPERT
        help
        Support for Belkin Flip KVM and Wireless keyboard.
@@ -202,7 +192,6 @@ config HID_BIGBEN_FF
 
 config HID_CHERRY
        tristate "Cherry Cymotion keyboard"
-       depends on HID
        default !EXPERT
        help
        Support for Cherry Cymotion keyboard.
@@ -227,7 +216,6 @@ config HID_CORSAIR
 
 config HID_COUGAR
        tristate "Cougar devices"
-       depends on HID
        help
        Support for Cougar devices that are not fully compliant with the
        HID standard.
@@ -237,7 +225,6 @@ config HID_COUGAR
 
 config HID_MACALLY
        tristate "Macally devices"
-       depends on HID
        help
        Support for Macally devices that are not fully compliant with the
        HID standard.
@@ -262,7 +249,6 @@ config HID_PRODIKEYS
 
 config HID_CMEDIA
        tristate "CMedia audio chips"
-       depends on HID
        help
        Support for CMedia CM6533 HID audio jack controls
         and HS100B mute buttons.
@@ -288,14 +274,12 @@ config HID_CREATIVE_SB0540
 
 config HID_CYPRESS
        tristate "Cypress mouse and barcode readers"
-       depends on HID
        default !EXPERT
        help
        Support for cypress mouse and barcode readers.
 
 config HID_DRAGONRISE
        tristate "DragonRise Inc. game controller"
-       depends on HID
        help
        Say Y here if you have DragonRise Inc. game controllers.
        These might be branded as:
@@ -314,7 +298,6 @@ config DRAGONRISE_FF
 
 config HID_EMS_FF
        tristate "EMS Production Inc. force feedback support"
-       depends on HID
        select INPUT_FF_MEMLESS
        help
        Say Y here if you want to enable force feedback support for devices by
@@ -332,7 +315,6 @@ config HID_ELAN
 
 config HID_ELECOM
        tristate "ELECOM HID devices"
-       depends on HID
        help
        Support for ELECOM devices:
          - BM084 Bluetooth Mouse
@@ -349,7 +331,6 @@ config HID_ELO
 
 config HID_EZKEY
        tristate "Ezkey BTC 8193 keyboard"
-       depends on HID
        default !EXPERT
        help
        Support for Ezkey BTC 8193 keyboard.
@@ -367,19 +348,16 @@ config HID_FT260
 
 config HID_GEMBIRD
        tristate "Gembird Joypad"
-       depends on HID
        help
        Support for Gembird JPD-DualForce 2.
 
 config HID_GFRM
        tristate "Google Fiber TV Box remote control support"
-       depends on HID
        help
        Support for Google Fiber TV Box remote controls
 
 config HID_GLORIOUS
        tristate "Glorious PC Gaming Race mice"
-       depends on HID
        help
          Support for Glorious PC Gaming Race mice such as
          the Glorious Model O, O- and D.
@@ -424,7 +402,6 @@ config HID_VIVALDI
        tristate "Vivaldi Keyboard"
        select HID_VIVALDI_COMMON
        select INPUT_VIVALDIFMAP
-       depends on HID
        help
          Say Y here if you want to enable support for Vivaldi keyboards.
 
@@ -447,7 +424,6 @@ config HID_GT683R
 
 config HID_KEYTOUCH
        tristate "Keytouch HID devices"
-       depends on HID
        help
        Support for Keytouch HID devices not fully compliant with
        the specification. Currently supported:
@@ -455,7 +431,6 @@ config HID_KEYTOUCH
 
 config HID_KYE
        tristate "KYE/Genius devices"
-       depends on HID
        help
        Support for KYE/Genius devices not fully compliant with HID standard:
        - Ergo Mouse
@@ -471,32 +446,27 @@ config HID_UCLOGIC
 
 config HID_WALTOP
        tristate "Waltop"
-       depends on HID
        help
        Support for Waltop tablets.
 
 config HID_VIEWSONIC
        tristate "ViewSonic/Signotec"
-       depends on HID
        help
          Support for ViewSonic/Signotec PD1011 signature pad.
 
 config HID_XIAOMI
        tristate "Xiaomi"
-       depends on HID
        help
          Adds support for side buttons of Xiaomi Mi Dual Mode Wireless
          Mouse Silent Edition.
 
 config HID_GYRATION
        tristate "Gyration remote control"
-       depends on HID
        help
        Support for Gyration remote control.
 
 config HID_ICADE
        tristate "ION iCade arcade controller"
-       depends on HID
        help
        Support for the ION iCade arcade controller to work as a joystick.
 
@@ -505,14 +475,12 @@ config HID_ICADE
 
 config HID_ITE
        tristate "ITE devices"
-       depends on HID
        default !EXPERT
        help
        Support for ITE devices not fully compliant with HID standard.
 
 config HID_JABRA
        tristate "Jabra USB HID Driver"
-       depends on HID
        help
        Support for Jabra USB HID devices.
 
@@ -523,26 +491,22 @@ config HID_JABRA
 
 config HID_TWINHAN
        tristate "Twinhan IR remote control"
-       depends on HID
        help
        Support for Twinhan IR remote control.
 
 config HID_KENSINGTON
        tristate "Kensington Slimblade Trackball"
-       depends on HID
        default !EXPERT
        help
        Support for Kensington Slimblade Trackball.
 
 config HID_LCPOWER
        tristate "LC-Power"
-       depends on HID
        help
        Support for LC-Power RC1000MCE RF remote control.
 
 config HID_LED
        tristate "Simple RGB LED support"
-       depends on HID
        depends on LEDS_CLASS
        help
        Support for simple RGB LED devices. Currently supported are:
@@ -557,7 +521,6 @@ config HID_LED
 
 config HID_LENOVO
        tristate "Lenovo / Thinkpad devices"
-       depends on HID
        select NEW_LEDS
        select LEDS_CLASS
        help
@@ -675,7 +638,6 @@ config LOGIWHEELS_FF
 
 config HID_MAGICMOUSE
        tristate "Apple Magic Mouse/Trackpad multi-touch support"
-       depends on HID
        help
        Support for the Apple Magic Mouse/Trackpad multi-touch.
 
@@ -684,14 +646,12 @@ config HID_MAGICMOUSE
 
 config HID_MALTRON
        tristate "Maltron L90 keyboard"
-       depends on HID
        help
        Adds support for the volume up, volume down, mute, and play/pause buttons
        of the Maltron L90 keyboard.
 
 config HID_MAYFLASH
        tristate "Mayflash game controller adapter force feedback"
-       depends on HID
        select INPUT_FF_MEMLESS
        help
        Say Y here if you have HJZ Mayflash PS3 game controller adapters
@@ -707,14 +667,12 @@ config HID_MEGAWORLD_FF
 
 config HID_REDRAGON
        tristate "Redragon keyboards"
-       depends on HID
        default !EXPERT
        help
     Support for Redragon keyboards that need fix-ups to work properly.
 
 config HID_MICROSOFT
        tristate "Microsoft non-fully HID-compliant devices"
-       depends on HID
        default !EXPERT
        select INPUT_FF_MEMLESS
        help
@@ -722,14 +680,12 @@ config HID_MICROSOFT
 
 config HID_MONTEREY
        tristate "Monterey Genius KB29E keyboard"
-       depends on HID
        default !EXPERT
        help
        Support for Monterey Genius KB29E.
 
 config HID_MULTITOUCH
        tristate "HID Multitouch panels"
-       depends on HID
        help
          Generic support for HID multitouch panels.
 
@@ -775,7 +731,6 @@ config HID_MULTITOUCH
 
 config HID_NINTENDO
        tristate "Nintendo Joy-Con and Pro Controller support"
-       depends on HID
        depends on NEW_LEDS
        depends on LEDS_CLASS
        select POWER_SUPPLY
@@ -811,7 +766,6 @@ config HID_NTRIG
 
 config HID_ORTEK
        tristate "Ortek PKB-1700/WKB-2000/Skycable wireless keyboard and mouse trackpad"
-       depends on HID
        help
        There are certain devices which have LogicalMaximum wrong in the keyboard
        usage page of their report descriptor. The most prevailing ones so far
@@ -824,7 +778,6 @@ config HID_ORTEK
 
 config HID_PANTHERLORD
        tristate "Pantherlord/GreenAsia game controller"
-       depends on HID
        help
          Say Y here if you have a PantherLord/GreenAsia based game controller
          or adapter.
@@ -850,13 +803,11 @@ config HID_PENMOUNT
 
 config HID_PETALYNX
        tristate "Petalynx Maxter remote control"
-       depends on HID
        help
        Support for Petalynx Maxter remote control.
 
 config HID_PICOLCD
        tristate "PicoLCD (graphic version)"
-       depends on HID
        help
          This provides support for Minibox PicoLCD devices, currently
          only the graphical ones are supported.
@@ -922,7 +873,6 @@ config HID_PICOLCD_CIR
 
 config HID_PLANTRONICS
        tristate "Plantronics USB HID Driver"
-       depends on HID
        help
          Provides HID support for Plantronics USB audio devices.
          Correctly maps vendor unique volume up/down HID usages to
@@ -933,7 +883,6 @@ config HID_PLANTRONICS
 
 config HID_PLAYSTATION
        tristate "PlayStation HID Driver"
-       depends on HID
        depends on LEDS_CLASS_MULTICOLOR
        select CRC32
        select POWER_SUPPLY
@@ -952,14 +901,12 @@ config PLAYSTATION_FF
 
 config HID_RAZER
        tristate "Razer non-fully HID-compliant devices"
-       depends on HID
        help
        Support for Razer devices that are not fully compliant with the
        HID standard.
 
 config HID_PRIMAX
        tristate "Primax non-fully HID-compliant devices"
-       depends on HID
        help
        Support for Primax devices that are not fully compliant with the
        HID standard.
@@ -981,7 +928,6 @@ config HID_ROCCAT
 
 config HID_SAITEK
        tristate "Saitek (Mad Catz) non-fully HID-compliant devices"
-       depends on HID
        help
        Support for Saitek devices that are not fully compliant with the
        HID standard.
@@ -999,7 +945,6 @@ config HID_SAMSUNG
 
 config HID_SEMITEK
        tristate "Semitek USB keyboards"
-       depends on HID
        help
        Support for Semitek USB keyboards that are not fully compliant
        with the HID standard.
@@ -1050,13 +995,11 @@ config SONY_FF
 
 config HID_SPEEDLINK
        tristate "Speedlink VAD Cezanne mouse support"
-       depends on HID
        help
        Support for Speedlink Vicious and Divine Cezanne mouse.
 
 config HID_STEAM
        tristate "Steam Controller support"
-       depends on HID
        select POWER_SUPPLY
        help
        Say Y here if you have a Steam Controller if you want to use it
@@ -1065,19 +1008,16 @@ config HID_STEAM
 
 config HID_STEELSERIES
        tristate "Steelseries SRW-S1 steering wheel support"
-       depends on HID
        help
        Support for Steelseries SRW-S1 steering wheel
 
 config HID_SUNPLUS
        tristate "Sunplus wireless desktop"
-       depends on HID
        help
        Support for Sunplus wireless desktop.
 
 config HID_RMI
        tristate "Synaptics RMI4 device support"
-       depends on HID
        select RMI4_CORE
        select RMI4_F03
        select RMI4_F11
@@ -1090,7 +1030,6 @@ config HID_RMI
 
 config HID_GREENASIA
        tristate "GreenAsia (Product ID 0x12) game controller support"
-       depends on HID
        help
          Say Y here if you have a GreenAsia (Product ID 0x12) based game
          controller or adapter.
@@ -1112,7 +1051,6 @@ config HID_HYPERV_MOUSE
 
 config HID_SMARTJOYPLUS
        tristate "SmartJoy PLUS PS2/USB adapter support"
-       depends on HID
        help
        Support for SmartJoy PLUS PS2/USB adapter, Super Dual Box,
        Super Joy Box 3 Pro, Super Dual Box Pro, and Super Joy Box 5 Pro.
@@ -1130,20 +1068,17 @@ config SMARTJOYPLUS_FF
 
 config HID_TIVO
        tristate "TiVo Slide Bluetooth remote control support"
-       depends on HID
        help
        Say Y if you have a TiVo Slide Bluetooth remote control.
 
 config HID_TOPSEED
        tristate "TopSeed Cyberlink, BTC Emprex, Conceptronic remote control support"
-       depends on HID
        help
        Say Y if you have a TopSeed Cyberlink or BTC Emprex or Conceptronic
        CLLRCMCE remote control.
 
 config HID_THINGM
        tristate "ThingM blink(1) USB RGB LED"
-       depends on HID
        depends on LEDS_CLASS
        select HID_LED
        help
@@ -1170,7 +1105,6 @@ config THRUSTMASTER_FF
 
 config HID_UDRAW_PS3
        tristate "THQ PS3 uDraw tablet"
-       depends on HID
        help
          Say Y here if you want to use the THQ uDraw gaming tablet for
          the PS3.
@@ -1207,7 +1141,6 @@ config HID_WACOM
 
 config HID_WIIMOTE
        tristate "Nintendo Wii / Wii U peripherals"
-       depends on HID
        depends on LEDS_CLASS
        select POWER_SUPPLY
        select INPUT_FF_MEMLESS
@@ -1232,7 +1165,6 @@ config HID_WIIMOTE
 
 config HID_XINMO
        tristate "Xin-Mo non-fully compliant devices"
-       depends on HID
        help
        Support for Xin-Mo devices that are not fully compliant with the HID
        standard. Currently only supports the Xin-Mo Dual Arcade. Say Y here
@@ -1240,7 +1172,6 @@ config HID_XINMO
 
 config HID_ZEROPLUS
        tristate "Zeroplus based game controller support"
-       depends on HID
        help
          Say Y here if you have a Zeroplus based game controller.
 
@@ -1254,13 +1185,12 @@ config ZEROPLUS_FF
 
 config HID_ZYDACRON
        tristate "Zydacron remote control support"
-       depends on HID
        help
        Support for Zydacron remote control.
 
 config HID_SENSOR_HUB
        tristate "HID Sensors framework support"
-       depends on HID && HAS_IOMEM
+       depends on HAS_IOMEM
        select MFD_CORE
        default n
        help
@@ -1289,7 +1219,6 @@ config HID_SENSOR_CUSTOM_SENSOR
 
 config HID_ALPS
        tristate "Alps HID device support"
-       depends on HID
        help
        Support for Alps I2C HID touchpads and StickPointer.
        Say Y here if you have a Alps touchpads over i2c-hid or usbhid
index 72f8d8835b34ca6be574f17aec784c2518259d91..9c1d31f63f850860ca9c672fbf43b586c13c566f 100644 (file)
@@ -55,7 +55,7 @@ MODULE_PARM_DESC(ignore_special_drivers, "Ignore any special drivers and handle
  */
 
 struct hid_report *hid_register_report(struct hid_device *device,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int application)
 {
        struct hid_report_enum *report_enum = device->report_enum + type;
@@ -967,7 +967,7 @@ static const char * const hid_report_names[] = {
  * parsing.
  */
 struct hid_report *hid_validate_values(struct hid_device *hid,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int field_index,
                                       unsigned int report_counts)
 {
@@ -1921,7 +1921,7 @@ static struct hid_report *hid_get_report(struct hid_report_enum *report_enum,
  * DO NOT USE in hid drivers directly, but through hid_hw_request instead.
  */
 int __hid_request(struct hid_device *hid, struct hid_report *report,
-               int reqtype)
+               enum hid_class_request reqtype)
 {
        char *buf;
        int ret;
@@ -1954,8 +1954,8 @@ out:
 }
 EXPORT_SYMBOL_GPL(__hid_request);
 
-int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
-               int interrupt)
+int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                        int interrupt)
 {
        struct hid_report_enum *report_enum = hid->report_enum + type;
        struct hid_report *report;
@@ -2019,7 +2019,8 @@ EXPORT_SYMBOL_GPL(hid_report_raw_event);
  *
  * This is data entry for lower layers.
  */
-int hid_input_report(struct hid_device *hid, int type, u8 *data, u32 size, int interrupt)
+int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                    int interrupt)
 {
        struct hid_report_enum *report_enum;
        struct hid_driver *hdrv;
@@ -2353,7 +2354,7 @@ EXPORT_SYMBOL_GPL(hid_hw_close);
  * @reqtype: hid request type
  */
 void hid_hw_request(struct hid_device *hdev,
-                   struct hid_report *report, int reqtype)
+                   struct hid_report *report, enum hid_class_request reqtype)
 {
        if (hdev->ll_driver->request)
                return hdev->ll_driver->request(hdev, report, reqtype);
@@ -2378,7 +2379,7 @@ EXPORT_SYMBOL_GPL(hid_hw_request);
  */
 int hid_hw_raw_request(struct hid_device *hdev,
                       unsigned char reportnum, __u8 *buf,
-                      size_t len, unsigned char rtype, int reqtype)
+                      size_t len, enum hid_report_type rtype, enum hid_class_request reqtype)
 {
        if (len < 1 || len > HID_MAX_BUFFER_SIZE || !buf)
                return -EINVAL;
@@ -2740,10 +2741,12 @@ int hid_add_device(struct hid_device *hdev)
                        hid_warn(hdev, "bad device descriptor (%d)\n", ret);
        }
 
+       hdev->id = atomic_inc_return(&id);
+
        /* XXX hack, any other cleaner solution after the driver core
         * is converted to allow more than 20 bytes as the device name? */
        dev_set_name(&hdev->dev, "%04X:%04X:%04X.%04X", hdev->bus,
-                    hdev->vendor, hdev->product, atomic_inc_return(&id));
+                    hdev->vendor, hdev->product, hdev->id);
 
        hid_debug_register(hdev, dev_name(&hdev->dev));
        ret = device_add(&hdev->dev);
index 26373b82fe812510a6755a15ef96755e3396231e..6da80e442fdd1065ed5b5e8b871e402f74b099cf 100644 (file)
@@ -257,6 +257,8 @@ int roccat_report_event(int minor, u8 const *data)
        if (!new_value)
                return -ENOMEM;
 
+       mutex_lock(&device->cbuf_lock);
+
        report = &device->cbuf[device->cbuf_end];
 
        /* passing NULL is safe */
@@ -276,6 +278,8 @@ int roccat_report_event(int minor, u8 const *data)
                        reader->cbuf_start = (reader->cbuf_start + 1) % ROCCAT_CBUF_SIZE;
        }
 
+       mutex_unlock(&device->cbuf_lock);
+
        wake_up_interruptible(&device->wait);
        return 0;
 }
index fc616db4231bb19adc5e39b9fbcc042d23967738..8ee43cb225fce10dd1129df6e3a45de5dc84f945 100644 (file)
@@ -256,7 +256,7 @@ static int steam_get_serial(struct steam_device *steam)
        if (reply[0] != 0xae || reply[1] != 0x15 || reply[2] != 0x01)
                return -EIO;
        reply[3 + STEAM_SERIAL_LEN] = 0;
-       strlcpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
+       strscpy(steam->serial_no, reply + 3, sizeof(steam->serial_no));
        return 0;
 }
 
@@ -524,7 +524,7 @@ static int steam_register(struct steam_device *steam)
                 */
                mutex_lock(&steam->mutex);
                if (steam_get_serial(steam) < 0)
-                       strlcpy(steam->serial_no, "XXXXXXXXXX",
+                       strscpy(steam->serial_no, "XXXXXXXXXX",
                                        sizeof(steam->serial_no));
                mutex_unlock(&steam->mutex);
 
@@ -699,9 +699,9 @@ static struct hid_device *steam_create_client_hid(struct hid_device *hdev)
        client_hdev->version = hdev->version;
        client_hdev->type = hdev->type;
        client_hdev->country = hdev->country;
-       strlcpy(client_hdev->name, hdev->name,
+       strscpy(client_hdev->name, hdev->name,
                        sizeof(client_hdev->name));
-       strlcpy(client_hdev->phys, hdev->phys,
+       strscpy(client_hdev->phys, hdev->phys,
                        sizeof(client_hdev->phys));
        /*
         * Since we use the same device info than the real interface to
index c078f09a2318a04f528889bec961ef0a94739b20..347c80ec6fff24b595f083971582c1c71c4b87b8 100644 (file)
@@ -1036,7 +1036,7 @@ int i2c_hid_core_probe(struct i2c_client *client, struct i2chid_ops *ops,
 
        snprintf(hid->name, sizeof(hid->name), "%s %04X:%04X",
                 client->name, (u16)hid->vendor, (u16)hid->product);
-       strlcpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
+       strscpy(hid->phys, dev_name(&client->dev), sizeof(hid->phys));
 
        ihid->quirks = i2c_hid_lookup_quirk(hid->vendor, hid->product);
 
index 4490e2f7252ac7c55023c2d11a0384e5924e0128..be4c731aaa65daf68a7431f0165838c21ce0e9f7 100644 (file)
@@ -1381,7 +1381,7 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id *
                hid->type = HID_TYPE_USBNONE;
 
        if (dev->manufacturer)
-               strlcpy(hid->name, dev->manufacturer, sizeof(hid->name));
+               strscpy(hid->name, dev->manufacturer, sizeof(hid->name));
 
        if (dev->product) {
                if (dev->manufacturer)
index b4b007c4beb6eb381262b24d8554f6e59decd108..c439ed2f16dbca3bbd229c2a631b41b8af7415fd 100644 (file)
@@ -294,7 +294,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
        spin_lock_init(&kbd->leds_lock);
 
        if (dev->manufacturer)
-               strlcpy(kbd->name, dev->manufacturer, sizeof(kbd->name));
+               strscpy(kbd->name, dev->manufacturer, sizeof(kbd->name));
 
        if (dev->product) {
                if (dev->manufacturer)
index fb1d7d1f6999465babfb2227663af968209d1a90..3fd93c2e4f4ad064106764264b7857e1f8f519dc 100644 (file)
@@ -142,7 +142,7 @@ static int usb_mouse_probe(struct usb_interface *intf, const struct usb_device_i
        mouse->dev = input_dev;
 
        if (dev->manufacturer)
-               strlcpy(mouse->name, dev->manufacturer, sizeof(mouse->name));
+               strscpy(mouse->name, dev->manufacturer, sizeof(mouse->name));
 
        if (dev->product) {
                if (dev->manufacturer)
index 194a2e32759148da8a2afeffb6683365f80e44d0..102302e9afd996c254bfd7b9f69ceb48677bf88f 100644 (file)
@@ -2226,7 +2226,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
                } else if (strstr(product_name, "Wacom") ||
                           strstr(product_name, "wacom") ||
                           strstr(product_name, "WACOM")) {
-                       strlcpy(name, product_name, sizeof(name));
+                       strscpy(name, product_name, sizeof(name));
                } else {
                        snprintf(name, sizeof(name), "Wacom %s", product_name);
                }
@@ -2244,7 +2244,7 @@ static void wacom_update_name(struct wacom *wacom, const char *suffix)
                if (name[strlen(name)-1] == ' ')
                        name[strlen(name)-1] = '\0';
        } else {
-               strlcpy(name, features->name, sizeof(name));
+               strscpy(name, features->name, sizeof(name));
        }
 
        snprintf(wacom_wac->name, sizeof(wacom_wac->name), "%s%s",
@@ -2509,7 +2509,7 @@ static void wacom_wireless_work(struct work_struct *work)
                                goto fail;
                }
 
-               strlcpy(wacom_wac->name, wacom_wac1->name,
+               strscpy(wacom_wac->name, wacom_wac1->name,
                        sizeof(wacom_wac->name));
                error = wacom_initialize_battery(wacom);
                if (error)
index d049239256a268b467c6fe565f3a516d2d609ab1..9fc080e4e66f957a2fc74d0afcb9737233821396 100644 (file)
@@ -713,11 +713,14 @@ static int wacom_intuos_get_tool_type(int tool_id)
        case 0x802: /* Intuos4/5 13HD/24HD General Pen */
        case 0x8e2: /* IntuosHT2 pen */
        case 0x022:
+       case 0x200: /* Pro Pen 3 */
+       case 0x04200: /* Pro Pen 3 */
        case 0x10842: /* MobileStudio Pro Pro Pen slim */
        case 0x14802: /* Intuos4/5 13HD/24HD Classic Pen */
        case 0x16802: /* Cintiq 13HD Pro Pen */
        case 0x18802: /* DTH2242 Pen */
        case 0x10802: /* Intuos4/5 13HD/24HD General Pen */
+       case 0x80842: /* Intuos Pro and Cintiq Pro 3D Pen */
                tool_type = BTN_TOOL_PEN;
                break;
 
@@ -4875,6 +4878,10 @@ static const struct wacom_features wacom_features_0x3c6 =
 static const struct wacom_features wacom_features_0x3c8 =
        { "Wacom Intuos BT M", 21600, 13500, 4095, 63,
          INTUOSHT3_BT, WACOM_INTUOS_RES, WACOM_INTUOS_RES, 4 };
+static const struct wacom_features wacom_features_0x3dd =
+       { "Wacom Intuos Pro S", 31920, 19950, 8191, 63,
+         INTUOSP2S_BT, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 7,
+         .touch_max = 10 };
 
 static const struct wacom_features wacom_features_HID_ANY_ID =
        { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID };
@@ -5050,6 +5057,7 @@ const struct hid_device_id wacom_ids[] = {
        { BT_DEVICE_WACOM(0x393) },
        { BT_DEVICE_WACOM(0x3c6) },
        { BT_DEVICE_WACOM(0x3c8) },
+       { BT_DEVICE_WACOM(0x3dd) },
        { USB_DEVICE_WACOM(0x4001) },
        { USB_DEVICE_WACOM(0x4004) },
        { USB_DEVICE_WACOM(0x5000) },
index 4363a63b9775ef27e4193cd507b77394fd854b9e..8677ae38599e4390a9278a98d95cb763662189e0 100644 (file)
@@ -314,15 +314,6 @@ struct hid_item {
 #define HID_BAT_ABSOLUTESTATEOFCHARGE  0x00850065
 
 #define HID_VD_ASUS_CUSTOM_MEDIA_KEYS  0xff310076
-/*
- * HID report types --- Ouch! HID spec says 1 2 3!
- */
-
-#define HID_INPUT_REPORT       0
-#define HID_OUTPUT_REPORT      1
-#define HID_FEATURE_REPORT     2
-
-#define HID_REPORT_TYPES       3
 
 /*
  * HID connect requests
@@ -509,7 +500,7 @@ struct hid_report {
        struct list_head hidinput_list;
        struct list_head field_entry_list;              /* ordered list of input fields */
        unsigned int id;                                /* id of this report */
-       unsigned int type;                              /* report type */
+       enum hid_report_type type;                      /* report type */
        unsigned int application;                       /* application usage for this report */
        struct hid_field *field[HID_MAX_FIELDS];        /* fields of the report */
        struct hid_field_entry *field_entries;          /* allocated memory of input field_entry */
@@ -658,6 +649,8 @@ struct hid_device {                                                 /* device report descriptor */
        struct list_head debug_list;
        spinlock_t  debug_list_lock;
        wait_queue_head_t debug_wait;
+
+       unsigned int id;                                                /* system unique id */
 };
 
 #define to_hid_device(pdev) \
@@ -924,20 +917,21 @@ extern int hidinput_connect(struct hid_device *hid, unsigned int force);
 extern void hidinput_disconnect(struct hid_device *);
 
 int hid_set_field(struct hid_field *, unsigned, __s32);
-int hid_input_report(struct hid_device *, int type, u8 *, u32, int);
+int hid_input_report(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                    int interrupt);
 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);
-int __hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype);
+int __hid_request(struct hid_device *hid, struct hid_report *rep, enum hid_class_request reqtype);
 u8 *hid_alloc_report_buf(struct hid_report *report, gfp_t flags);
 struct hid_device *hid_allocate_device(void);
 struct hid_report *hid_register_report(struct hid_device *device,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int application);
 int hid_parse_report(struct hid_device *hid, __u8 *start, unsigned size);
 struct hid_report *hid_validate_values(struct hid_device *hid,
-                                      unsigned int type, unsigned int id,
+                                      enum hid_report_type type, unsigned int id,
                                       unsigned int field_index,
                                       unsigned int report_counts);
 
@@ -1106,10 +1100,11 @@ void hid_hw_stop(struct hid_device *hdev);
 int __must_check hid_hw_open(struct hid_device *hdev);
 void hid_hw_close(struct hid_device *hdev);
 void hid_hw_request(struct hid_device *hdev,
-                   struct hid_report *report, int reqtype);
+                   struct hid_report *report, enum hid_class_request reqtype);
 int hid_hw_raw_request(struct hid_device *hdev,
                       unsigned char reportnum, __u8 *buf,
-                      size_t len, unsigned char rtype, int reqtype);
+                      size_t len, enum hid_report_type rtype,
+                      enum hid_class_request reqtype);
 int hid_hw_output_report(struct hid_device *hdev, __u8 *buf, size_t len);
 
 /**
@@ -1137,7 +1132,7 @@ static inline int hid_hw_power(struct hid_device *hdev, int level)
  * @reqtype: hid request type
  */
 static inline int hid_hw_idle(struct hid_device *hdev, int report, int idle,
-               int reqtype)
+               enum hid_class_request reqtype)
 {
        if (hdev->ll_driver->idle)
                return hdev->ll_driver->idle(hdev, report, idle, reqtype);
@@ -1182,8 +1177,8 @@ static inline u32 hid_report_len(struct hid_report *report)
        return DIV_ROUND_UP(report->size, 8) + (report->id > 0);
 }
 
-int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, u32 size,
-               int interrupt);
+int hid_report_raw_event(struct hid_device *hid, enum hid_report_type type, u8 *data, u32 size,
+                        int interrupt);
 
 /* HID quirks API */
 unsigned long hid_lookup_quirk(const struct hid_device *hdev);
index b34492a87a8a46caa06369d7837c7ee40c651b3f..a4dcb34386e3952e5053a7466d9d4be3bcd642ff 100644 (file)
 #define USB_INTERFACE_PROTOCOL_KEYBOARD        1
 #define USB_INTERFACE_PROTOCOL_MOUSE   2
 
+/*
+ * HID report types --- Ouch! HID spec says 1 2 3!
+ */
+
+enum hid_report_type {
+       HID_INPUT_REPORT                = 0,
+       HID_OUTPUT_REPORT               = 1,
+       HID_FEATURE_REPORT              = 2,
+
+       HID_REPORT_TYPES,
+};
+
 /*
  * 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
+enum hid_class_request {
+       HID_REQ_GET_REPORT              = 0x01,
+       HID_REQ_GET_IDLE                = 0x02,
+       HID_REQ_GET_PROTOCOL            = 0x03,
+       HID_REQ_SET_REPORT              = 0x09,
+       HID_REQ_SET_IDLE                = 0x0A,
+       HID_REQ_SET_PROTOCOL            = 0x0B,
+};
 
 /*
  * HID class descriptor types