Commit d264dd3b authored by Linus Torvalds's avatar Linus Torvalds

Merge tag 'for-linus-2022122101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid

Pull HID updates from Benjamin Tissoires:

 - Four potential NULL pointers dereferences (Bastien Nocera, Enrik
   Berkhan, Jiasheng Jiang and Roderick Colenbrander)

 - Allow Wacom devices in bootloader mode to be flashed (Jason Gerecke)

 - Some assorted devices quirks (José Expósito and Terry Junge)

* tag 'for-linus-2022122101' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: sony: Fix unused function warning
  HID: plantronics: Additional PIDs for double volume key presses quirk
  HID: multitouch: fix Asus ExpertBook P2 P2451FA trackpoint
  HID: Ignore HP Envy x360 eu0009nv stylus battery
  HID: wacom: Ensure bootloader PID is usable in hidraw mode
  HID: amd_sfh: Add missing check for dma_alloc_coherent
  HID: playstation: fix free of uninialized pointer for DS4 in Bluetooth.
  HID: mcp2221: don't connect hidraw
  HID: logitech-hidpp: Guard FF init code against non-USB devices
parents 5461e079 54f27dc5
...@@ -897,7 +897,7 @@ config HID_PLAYSTATION ...@@ -897,7 +897,7 @@ config HID_PLAYSTATION
select CRC32 select CRC32
select POWER_SUPPLY select POWER_SUPPLY
help help
Provides support for Sony PS5 controllers including support for Provides support for Sony PS4/PS5 controllers including support for
its special functionalities e.g. touchpad, lights and motion its special functionalities e.g. touchpad, lights and motion
sensors. sensors.
......
...@@ -237,6 +237,10 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata) ...@@ -237,6 +237,10 @@ int amd_sfh_hid_client_init(struct amd_mp2_dev *privdata)
in_data->sensor_virt_addr[i] = dma_alloc_coherent(dev, sizeof(int) * 8, in_data->sensor_virt_addr[i] = dma_alloc_coherent(dev, sizeof(int) * 8,
&cl_data->sensor_dma_addr[i], &cl_data->sensor_dma_addr[i],
GFP_KERNEL); GFP_KERNEL);
if (!in_data->sensor_virt_addr[i]) {
rc = -ENOMEM;
goto cleanup;
}
cl_data->sensor_sts[i] = SENSOR_DISABLED; cl_data->sensor_sts[i] = SENSOR_DISABLED;
cl_data->sensor_requested_cnt[i] = 0; cl_data->sensor_requested_cnt[i] = 0;
cl_data->cur_hid_dev = i; cl_data->cur_hid_dev = i;
......
...@@ -412,6 +412,7 @@ ...@@ -412,6 +412,7 @@
#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755 #define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
#define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05 #define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05
#define I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100 0x29CF #define I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100 0x29CF
#define I2C_DEVICE_ID_HP_ENVY_X360_EU0009NV 0x2CF9
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817 #define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
#define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544 #define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706 #define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
...@@ -995,7 +996,10 @@ ...@@ -995,7 +996,10 @@
#define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003 #define USB_DEVICE_ID_ORTEK_IHOME_IMAC_A210S 0x8003
#define USB_VENDOR_ID_PLANTRONICS 0x047f #define USB_VENDOR_ID_PLANTRONICS 0x047f
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3210_SERIES 0xc055
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056 #define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES 0xc056
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES 0xc057
#define USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES 0xc058
#define USB_VENDOR_ID_PANASONIC 0x04da #define USB_VENDOR_ID_PANASONIC 0x04da
#define USB_DEVICE_ID_PANABOARD_UBT780 0x1044 #define USB_DEVICE_ID_PANABOARD_UBT780 0x1044
......
...@@ -380,6 +380,8 @@ static const struct hid_device_id hid_battery_quirks[] = { ...@@ -380,6 +380,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15T_DR100),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_EU0009NV),
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
HID_BATTERY_QUIRK_IGNORE }, HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN), { HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN),
......
...@@ -2548,12 +2548,17 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, ...@@ -2548,12 +2548,17 @@ static int hidpp_ff_init(struct hidpp_device *hidpp,
struct hid_device *hid = hidpp->hid_dev; struct hid_device *hid = hidpp->hid_dev;
struct hid_input *hidinput; struct hid_input *hidinput;
struct input_dev *dev; struct input_dev *dev;
const struct usb_device_descriptor *udesc = &(hid_to_usb_dev(hid)->descriptor); struct usb_device_descriptor *udesc;
const u16 bcdDevice = le16_to_cpu(udesc->bcdDevice); u16 bcdDevice;
struct ff_device *ff; struct ff_device *ff;
int error, j, num_slots = data->num_effects; int error, j, num_slots = data->num_effects;
u8 version; u8 version;
if (!hid_is_usb(hid)) {
hid_err(hid, "device is not USB\n");
return -ENODEV;
}
if (list_empty(&hid->inputs)) { if (list_empty(&hid->inputs)) {
hid_err(hid, "no inputs found\n"); hid_err(hid, "no inputs found\n");
return -ENODEV; return -ENODEV;
...@@ -2567,6 +2572,8 @@ static int hidpp_ff_init(struct hidpp_device *hidpp, ...@@ -2567,6 +2572,8 @@ static int hidpp_ff_init(struct hidpp_device *hidpp,
} }
/* Get firmware release */ /* Get firmware release */
udesc = &(hid_to_usb_dev(hid)->descriptor);
bcdDevice = le16_to_cpu(udesc->bcdDevice);
version = bcdDevice & 255; version = bcdDevice & 255;
/* Set supported force feedback capabilities */ /* Set supported force feedback capabilities */
......
...@@ -1110,12 +1110,19 @@ static int mcp2221_probe(struct hid_device *hdev, ...@@ -1110,12 +1110,19 @@ static int mcp2221_probe(struct hid_device *hdev,
return ret; return ret;
} }
ret = hid_hw_start(hdev, HID_CONNECT_HIDRAW); /*
* This driver uses the .raw_event callback and therefore does not need any
* HID_CONNECT_xxx flags.
*/
ret = hid_hw_start(hdev, 0);
if (ret) { if (ret) {
hid_err(hdev, "can't start hardware\n"); hid_err(hdev, "can't start hardware\n");
return ret; return ret;
} }
hid_info(hdev, "USB HID v%x.%02x Device [%s] on %s\n", hdev->version >> 8,
hdev->version & 0xff, hdev->name, hdev->phys);
ret = hid_hw_open(hdev); ret = hid_hw_open(hdev);
if (ret) { if (ret) {
hid_err(hdev, "can't open device\n"); hid_err(hdev, "can't open device\n");
...@@ -1145,8 +1152,7 @@ static int mcp2221_probe(struct hid_device *hdev, ...@@ -1145,8 +1152,7 @@ static int mcp2221_probe(struct hid_device *hdev,
mcp->adapter.retries = 1; mcp->adapter.retries = 1;
mcp->adapter.dev.parent = &hdev->dev; mcp->adapter.dev.parent = &hdev->dev;
snprintf(mcp->adapter.name, sizeof(mcp->adapter.name), snprintf(mcp->adapter.name, sizeof(mcp->adapter.name),
"MCP2221 usb-i2c bridge on hidraw%d", "MCP2221 usb-i2c bridge");
((struct hidraw *)hdev->hidraw)->minor);
ret = devm_i2c_add_adapter(&hdev->dev, &mcp->adapter); ret = devm_i2c_add_adapter(&hdev->dev, &mcp->adapter);
if (ret) { if (ret) {
......
...@@ -1967,6 +1967,10 @@ static const struct hid_device_id mt_devices[] = { ...@@ -1967,6 +1967,10 @@ static const struct hid_device_id mt_devices[] = {
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8, HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
USB_VENDOR_ID_ELAN, 0x313a) }, USB_VENDOR_ID_ELAN, 0x313a) },
{ .driver_data = MT_CLS_WIN_8_FORCE_MULTI_INPUT,
HID_DEVICE(BUS_I2C, HID_GROUP_MULTITOUCH_WIN_8,
USB_VENDOR_ID_ELAN, 0x3148) },
/* Elitegroup panel */ /* Elitegroup panel */
{ .driver_data = MT_CLS_SERIAL, { .driver_data = MT_CLS_SERIAL,
MT_USB_DEVICE(USB_VENDOR_ID_ELITEGROUP, MT_USB_DEVICE(USB_VENDOR_ID_ELITEGROUP,
......
...@@ -198,9 +198,18 @@ static int plantronics_probe(struct hid_device *hdev, ...@@ -198,9 +198,18 @@ static int plantronics_probe(struct hid_device *hdev,
} }
static const struct hid_device_id plantronics_devices[] = { static const struct hid_device_id plantronics_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3210_SERIES),
.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES), USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3220_SERIES),
.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS }, .driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3215_SERIES),
.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS,
USB_DEVICE_ID_PLANTRONICS_BLACKWIRE_3225_SERIES),
.driver_data = PLT_QUIRK_DOUBLE_VOLUME_KEYS },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) }, { HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
{ } { }
}; };
......
...@@ -1916,7 +1916,7 @@ static int dualshock4_get_mac_address(struct dualshock4 *ds4) ...@@ -1916,7 +1916,7 @@ static int dualshock4_get_mac_address(struct dualshock4 *ds4)
if (ret != sizeof(ds4->base.mac_address)) if (ret != sizeof(ds4->base.mac_address))
return -EINVAL; return -EINVAL;
ret = 0; return 0;
} }
err_free: err_free:
......
...@@ -2355,11 +2355,13 @@ static void motion_send_output_report(struct sony_sc *sc) ...@@ -2355,11 +2355,13 @@ static void motion_send_output_report(struct sony_sc *sc)
hid_hw_output_report(hdev, (u8 *)report, MOTION_REPORT_0x02_SIZE); hid_hw_output_report(hdev, (u8 *)report, MOTION_REPORT_0x02_SIZE);
} }
#ifdef CONFIG_SONY_FF
static inline void sony_send_output_report(struct sony_sc *sc) static inline void sony_send_output_report(struct sony_sc *sc)
{ {
if (sc->send_output_report) if (sc->send_output_report)
sc->send_output_report(sc); sc->send_output_report(sc);
} }
#endif
static void sony_state_worker(struct work_struct *work) static void sony_state_worker(struct work_struct *work)
{ {
......
...@@ -155,6 +155,9 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report, ...@@ -155,6 +155,9 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
{ {
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
if (wacom->wacom_wac.features.type == BOOTLOADER)
return 0;
if (size > WACOM_PKGLEN_MAX) if (size > WACOM_PKGLEN_MAX)
return 1; return 1;
...@@ -2785,6 +2788,11 @@ static int wacom_probe(struct hid_device *hdev, ...@@ -2785,6 +2788,11 @@ static int wacom_probe(struct hid_device *hdev,
return error; return error;
} }
if (features->type == BOOTLOADER) {
hid_warn(hdev, "Using device in hidraw-only mode");
return hid_hw_start(hdev, HID_CONNECT_HIDRAW);
}
error = wacom_parse_and_register(wacom, false); error = wacom_parse_and_register(wacom, false);
if (error) if (error)
return error; return error;
......
...@@ -4882,6 +4882,9 @@ static const struct wacom_features wacom_features_0x3dd = ...@@ -4882,6 +4882,9 @@ static const struct wacom_features wacom_features_0x3dd =
static const struct wacom_features wacom_features_HID_ANY_ID = static const struct wacom_features wacom_features_HID_ANY_ID =
{ "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID }; { "Wacom HID", .type = HID_GENERIC, .oVid = HID_ANY_ID, .oPid = HID_ANY_ID };
static const struct wacom_features wacom_features_0x94 =
{ "Wacom Bootloader", .type = BOOTLOADER };
#define USB_DEVICE_WACOM(prod) \ #define USB_DEVICE_WACOM(prod) \
HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\ HID_DEVICE(BUS_USB, HID_GROUP_WACOM, USB_VENDOR_ID_WACOM, prod),\
.driver_data = (kernel_ulong_t)&wacom_features_##prod .driver_data = (kernel_ulong_t)&wacom_features_##prod
...@@ -4955,6 +4958,7 @@ const struct hid_device_id wacom_ids[] = { ...@@ -4955,6 +4958,7 @@ const struct hid_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x84) }, { USB_DEVICE_WACOM(0x84) },
{ USB_DEVICE_WACOM(0x90) }, { USB_DEVICE_WACOM(0x90) },
{ USB_DEVICE_WACOM(0x93) }, { USB_DEVICE_WACOM(0x93) },
{ USB_DEVICE_WACOM(0x94) },
{ USB_DEVICE_WACOM(0x97) }, { USB_DEVICE_WACOM(0x97) },
{ USB_DEVICE_WACOM(0x9A) }, { USB_DEVICE_WACOM(0x9A) },
{ USB_DEVICE_WACOM(0x9F) }, { USB_DEVICE_WACOM(0x9F) },
......
...@@ -243,6 +243,7 @@ enum { ...@@ -243,6 +243,7 @@ enum {
MTTPC, MTTPC,
MTTPC_B, MTTPC_B,
HID_GENERIC, HID_GENERIC,
BOOTLOADER,
MAX_TYPE MAX_TYPE
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment