Skip to content

Commit

Permalink
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel…
Browse files Browse the repository at this point in the history
…/git/hid/hid

Pull HID fixes from Jiri Kosina:

 - fixes for various drivers which assume that a HID device is on USB
   transport, but that might not necessarily be the case, as the device
   can be faked by uhid. (Greg, Benjamin Tissoires)

 - fix for spurious wakeups on certain Lenovo notebooks (Thomas
   Weißschuh)

 - a few other device-specific quirks

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/hid/hid:
  HID: Ignore battery for Elan touchscreen on Asus UX550VE
  HID: intel-ish-hid: ipc: only enable IRQ wakeup when requested
  HID: google: add eel USB id
  HID: add USB_HID dependancy to hid-prodikeys
  HID: add USB_HID dependancy to hid-chicony
  HID: bigbenff: prevent null pointer dereference
  HID: sony: fix error path in probe
  HID: add USB_HID dependancy on some USB HID drivers
  HID: check for valid USB device for many HID drivers
  HID: wacom: fix problems when device is not a valid USB device
  HID: add hid_is_usb() function to make it simpler for USB detection
  HID: quirks: Add quirk for the Microsoft Surface 3 type-cover
  • Loading branch information
Linus Torvalds committed Dec 9, 2021
2 parents 2990c89 + 14902f8 commit 03090cc
Show file tree
Hide file tree
Showing 36 changed files with 146 additions and 36 deletions.
10 changes: 5 additions & 5 deletions drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,14 @@ config HID_CHERRY

config HID_CHICONY
tristate "Chicony devices"
depends on HID
depends on USB_HID
default !EXPERT
help
Support for Chicony Tactical pad and special keys on Chicony keyboards.

config HID_CORSAIR
tristate "Corsair devices"
depends on HID && USB && LEDS_CLASS
depends on USB_HID && LEDS_CLASS
help
Support for Corsair devices that are not fully compliant with the
HID standard.
Expand Down Expand Up @@ -245,7 +245,7 @@ config HID_MACALLY

config HID_PRODIKEYS
tristate "Prodikeys PC-MIDI Keyboard support"
depends on HID && SND
depends on USB_HID && SND
select SND_RAWMIDI
help
Support for Prodikeys PC-MIDI Keyboard device support.
Expand Down Expand Up @@ -560,7 +560,7 @@ config HID_LENOVO

config HID_LOGITECH
tristate "Logitech devices"
depends on HID
depends on USB_HID
depends on LEDS_CLASS
default !EXPERT
help
Expand Down Expand Up @@ -951,7 +951,7 @@ config HID_SAITEK

config HID_SAMSUNG
tristate "Samsung InfraRed remote control or keyboards"
depends on HID
depends on USB_HID
help
Support for Samsung InfraRed remote control or keyboards.

Expand Down
6 changes: 2 additions & 4 deletions drivers/hid/hid-asus.c
Original file line number Diff line number Diff line change
Expand Up @@ -1028,8 +1028,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
if (drvdata->quirks & QUIRK_IS_MULTITOUCH)
drvdata->tp = &asus_i2c_tp;

if ((drvdata->quirks & QUIRK_T100_KEYBOARD) &&
hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb(hdev)) {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) {
Expand Down Expand Up @@ -1057,8 +1056,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id)
drvdata->tp = &asus_t100chi_tp;
}

if ((drvdata->quirks & QUIRK_MEDION_E1239T) &&
hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb(hdev)) {
struct usb_host_interface *alt =
to_usb_interface(hdev->dev.parent)->altsetting;

Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-bigbenff.c
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ static void bigben_worker(struct work_struct *work)
struct bigben_device, worker);
struct hid_field *report_field = bigben->report->field[0];

if (bigben->removed)
if (bigben->removed || !report_field)
return;

if (bigben->work_led) {
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-chicony.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ static int ch_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;

if (!hid_is_usb(hdev))
return -EINVAL;

hdev->quirks |= HID_QUIRK_INPUT_PER_APP;
ret = hid_parse(hdev);
if (ret) {
Expand Down
7 changes: 6 additions & 1 deletion drivers/hid/hid-corsair.c
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,12 @@ static int corsair_probe(struct hid_device *dev, const struct hid_device_id *id)
int ret;
unsigned long quirks = id->driver_data;
struct corsair_drvdata *drvdata;
struct usb_interface *usbif = to_usb_interface(dev->dev.parent);
struct usb_interface *usbif;

if (!hid_is_usb(dev))
return -EINVAL;

usbif = to_usb_interface(dev->dev.parent);

drvdata = devm_kzalloc(&dev->dev, sizeof(struct corsair_drvdata),
GFP_KERNEL);
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-elan.c
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct elan_drvdata {

static int is_not_elan_touchpad(struct hid_device *hdev)
{
if (hdev->bus == BUS_USB) {
if (hid_is_usb(hdev)) {
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);

return (intf->altsetting->desc.bInterfaceNumber !=
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-elo.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,9 @@ static int elo_probe(struct hid_device *hdev, const struct hid_device_id *id)
int ret;
struct usb_device *udev;

if (!hid_is_usb(hdev))
return -EINVAL;

priv = kzalloc(sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-ft260.c
Original file line number Diff line number Diff line change
Expand Up @@ -915,6 +915,9 @@ static int ft260_probe(struct hid_device *hdev, const struct hid_device_id *id)
struct ft260_get_chip_version_report version;
int ret;

if (!hid_is_usb(hdev))
return -EINVAL;

dev = devm_kzalloc(&hdev->dev, sizeof(*dev), GFP_KERNEL);
if (!dev)
return -ENOMEM;
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/hid-google-hammer.c
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,8 @@ static void hammer_remove(struct hid_device *hdev)
static const struct hid_device_id hammer_devices[] = {
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_DON) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_EEL) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
USB_VENDOR_ID_GOOGLE, USB_DEVICE_ID_GOOGLE_HAMMER) },
{ HID_DEVICE(BUS_USB, HID_GROUP_GENERIC,
Expand Down
9 changes: 7 additions & 2 deletions drivers/hid/hid-holtek-kbd.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,17 @@ static int holtek_kbd_input_event(struct input_dev *dev, unsigned int type,
static int holtek_kbd_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
int ret = hid_parse(hdev);
struct usb_interface *intf;
int ret;

if (!hid_is_usb(hdev))
return -EINVAL;

ret = hid_parse(hdev);
if (!ret)
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);

intf = to_usb_interface(hdev->dev.parent);
if (!ret && intf->cur_altsetting->desc.bInterfaceNumber == 1) {
struct hid_input *hidinput;
list_for_each_entry(hidinput, &hdev->inputs, list) {
Expand Down
9 changes: 9 additions & 0 deletions drivers/hid/hid-holtek-mouse.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ static __u8 *holtek_mouse_report_fixup(struct hid_device *hdev, __u8 *rdesc,
return rdesc;
}

static int holtek_mouse_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
if (!hid_is_usb(hdev))
return -EINVAL;
return 0;
}

static const struct hid_device_id holtek_mouse_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_HOLTEK_ALT,
USB_DEVICE_ID_HOLTEK_ALT_MOUSE_A067) },
Expand All @@ -83,6 +91,7 @@ static struct hid_driver holtek_mouse_driver = {
.name = "holtek_mouse",
.id_table = holtek_mouse_devices,
.report_fixup = holtek_mouse_report_fixup,
.probe = holtek_mouse_probe,
};

module_hid_driver(holtek_mouse_driver);
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@
#define USB_DEVICE_ID_HP_X2_10_COVER 0x0755
#define I2C_DEVICE_ID_HP_ENVY_X360_15 0x2d05
#define I2C_DEVICE_ID_HP_SPECTRE_X360_15 0x2817
#define USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN 0x2544
#define USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN 0x2706
#define I2C_DEVICE_ID_SURFACE_GO_TOUCHSCREEN 0x261A

Expand Down Expand Up @@ -501,6 +502,7 @@
#define USB_DEVICE_ID_GOOGLE_MAGNEMITE 0x503d
#define USB_DEVICE_ID_GOOGLE_MOONBALL 0x5044
#define USB_DEVICE_ID_GOOGLE_DON 0x5050
#define USB_DEVICE_ID_GOOGLE_EEL 0x5057

#define USB_VENDOR_ID_GOTOP 0x08f2
#define USB_DEVICE_ID_SUPER_Q2 0x007f
Expand Down Expand Up @@ -886,6 +888,7 @@
#define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7
#define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9
#define USB_DEVICE_ID_MS_POWER_COVER 0x07da
#define USB_DEVICE_ID_MS_SURFACE3_COVER 0x07de
#define USB_DEVICE_ID_MS_XBOX_ONE_S_CONTROLLER 0x02fd
#define USB_DEVICE_ID_MS_PIXART_MOUSE 0x00cb
#define USB_DEVICE_ID_8BITDO_SN30_PRO_PLUS 0x02e0
Expand Down
2 changes: 2 additions & 0 deletions drivers/hid/hid-input.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ static const struct hid_device_id hid_battery_quirks[] = {
HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE },
{ HID_USB_DEVICE(USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ASUS_UX550VE_TOUCHSCREEN),
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_ENVY_X360_15),
HID_BATTERY_QUIRK_IGNORE },
{ HID_I2C_DEVICE(USB_VENDOR_ID_ELAN, I2C_DEVICE_ID_HP_SPECTRE_X360_15),
Expand Down
10 changes: 8 additions & 2 deletions drivers/hid/hid-lg.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,12 +749,18 @@ static int lg_raw_event(struct hid_device *hdev, struct hid_report *report,

static int lg_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
struct usb_interface *iface = to_usb_interface(hdev->dev.parent);
__u8 iface_num = iface->cur_altsetting->desc.bInterfaceNumber;
struct usb_interface *iface;
__u8 iface_num;
unsigned int connect_mask = HID_CONNECT_DEFAULT;
struct lg_drv_data *drv_data;
int ret;

if (!hid_is_usb(hdev))
return -EINVAL;

iface = to_usb_interface(hdev->dev.parent);
iface_num = iface->cur_altsetting->desc.bInterfaceNumber;

/* G29 only work with the 1st interface */
if ((hdev->product == USB_DEVICE_ID_LOGITECH_G29_WHEEL) &&
(iface_num != 0)) {
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-logitech-dj.c
Original file line number Diff line number Diff line change
Expand Up @@ -1777,7 +1777,7 @@ static int logi_dj_probe(struct hid_device *hdev,
case recvr_type_bluetooth: no_dj_interfaces = 2; break;
case recvr_type_dinovo: no_dj_interfaces = 2; break;
}
if (hid_is_using_ll_driver(hdev, &usb_hid_driver)) {
if (hid_is_usb(hdev)) {
intf = to_usb_interface(hdev->dev.parent);
if (intf && intf->altsetting->desc.bInterfaceNumber >=
no_dj_interfaces) {
Expand Down
10 changes: 8 additions & 2 deletions drivers/hid/hid-prodikeys.c
Original file line number Diff line number Diff line change
Expand Up @@ -798,12 +798,18 @@ static int pk_raw_event(struct hid_device *hdev, struct hid_report *report,
static int pk_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int ret;
struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
unsigned short ifnum = intf->cur_altsetting->desc.bInterfaceNumber;
struct usb_interface *intf;
unsigned short ifnum;
unsigned long quirks = id->driver_data;
struct pk_device *pk;
struct pcmidi_snd *pm = NULL;

if (!hid_is_usb(hdev))
return -EINVAL;

intf = to_usb_interface(hdev->dev.parent);
ifnum = intf->cur_altsetting->desc.bInterfaceNumber;

pk = kzalloc(sizeof(*pk), GFP_KERNEL);
if (pk == NULL) {
hid_err(hdev, "can't alloc descriptor\n");
Expand Down
1 change: 1 addition & 0 deletions drivers/hid/hid-quirks.c
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ static const struct hid_device_id hid_quirks[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MCS, USB_DEVICE_ID_MCS_GAMEPADBLOCK), HID_QUIRK_MULTI_INPUT },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PIXART_MOUSE), HID_QUIRK_ALWAYS_POLL },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_POWER_COVER), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE3_COVER), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_SURFACE_PRO_2), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TOUCH_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_2), HID_QUIRK_NO_INIT_REPORTS },
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-arvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ static int arvo_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-isku.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,9 @@ static int isku_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-kone.c
Original file line number Diff line number Diff line change
Expand Up @@ -749,6 +749,9 @@ static int kone_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-koneplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ static int koneplus_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-konepure.c
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,9 @@ static int konepure_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-kovaplus.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ static int kovaplus_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-lua.c
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ static int lua_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-pyra.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,6 +449,9 @@ static int pyra_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-ryos.c
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ static int ryos_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-roccat-savu.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ static int savu_probe(struct hid_device *hdev,
{
int retval;

if (!hid_is_usb(hdev))
return -EINVAL;

retval = hid_parse(hdev);
if (retval) {
hid_err(hdev, "parse failed\n");
Expand Down
3 changes: 3 additions & 0 deletions drivers/hid/hid-samsung.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ static int samsung_probe(struct hid_device *hdev,
int ret;
unsigned int cmask = HID_CONNECT_DEFAULT;

if (!hid_is_usb(hdev))
return -EINVAL;

ret = hid_parse(hdev);
if (ret) {
hid_err(hdev, "parse failed\n");
Expand Down
Loading

0 comments on commit 03090cc

Please sign in to comment.