Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 08ef08ee authored by Alan Stern's avatar Alan Stern Committed by Jiri Kosina
Browse files

HID: automatically call usbhid_set_leds in usbhid driver



This patch (as1146c) makes usbhid automatically call usbhid_set_leds()
for any device that supports the keyboard boot protocol.

In theory this should be perfectly safe.  BIOSes send the LED output
report as part of their normal device initialization, so any keyboard
device supporting the boot protocol has to be able to handle it.

As a side effect, the hid-dell and hid-bright drivers are no longer
needed, and the Logitech keyboard driver can be removed from hid-lg.

CC: Mauro Carvalho Chehab <mchehab@redhat.com>
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarJiri Kosina <jkosina@suse.cz>
parent efc7ce18
Loading
Loading
Loading
Loading
+0 −15
Original line number Diff line number Diff line
@@ -107,13 +107,6 @@ config HID_BELKIN
	---help---
	Support for Belkin Flip KVM and Wireless keyboard.

config HID_BRIGHT
	tristate "Bright" if EMBEDDED
	depends on USB_HID
	default y
	---help---
	Support for Bright ABNT-2 keyboard.

config HID_CHERRY
	tristate "Cherry" if EMBEDDED
	depends on USB_HID
@@ -135,14 +128,6 @@ config HID_CYPRESS
	---help---
	Support for cypress mouse and barcode readers.

config HID_DELL
	tristate "Dell" if EMBEDDED
	depends on USB_HID
	default y
	---help---
	Support for quirky Dell HID hardware that require
	special LED handling (W7658 and SK8115 models)

config HID_EZKEY
	tristate "Ezkey" if EMBEDDED
	depends on USB_HID
+0 −2
Original line number Diff line number Diff line
@@ -23,11 +23,9 @@ endif
obj-$(CONFIG_HID_A4TECH)	+= hid-a4tech.o
obj-$(CONFIG_HID_APPLE)		+= hid-apple.o
obj-$(CONFIG_HID_BELKIN)	+= hid-belkin.o
obj-$(CONFIG_HID_BRIGHT)	+= hid-bright.o
obj-$(CONFIG_HID_CHERRY)	+= hid-cherry.o
obj-$(CONFIG_HID_CHICONY)	+= hid-chicony.o
obj-$(CONFIG_HID_CYPRESS)	+= hid-cypress.o
obj-$(CONFIG_HID_DELL)		+= hid-dell.o
obj-$(CONFIG_HID_EZKEY)		+= hid-ezkey.o
obj-$(CONFIG_HID_GYRATION)	+= hid-gyration.o
obj-$(CONFIG_HID_LOGITECH)	+= hid-logitech.o

drivers/hid/hid-bright.c

deleted100644 → 0
+0 −71
Original line number Diff line number Diff line
/*
 *  HID driver for some bright "special" devices
 *
 *  Copyright (c) 2008 Mauro Carvalho Chehab <mchehab@redhat.com>
 *
 * Based on hid-dell driver
 */

/*
 * 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 the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 */

#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>

#include "hid-ids.h"

static int bright_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
	int ret;

	ret = hid_parse(hdev);
	if (ret) {
		dev_err(&hdev->dev, "parse failed\n");
		goto err_free;
	}

	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
	if (ret) {
		dev_err(&hdev->dev, "hw start failed\n");
		goto err_free;
	}

	usbhid_set_leds(hdev);

	return 0;
err_free:
	return ret;
}

static const struct hid_device_id bright_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
	{ }
};
MODULE_DEVICE_TABLE(hid, bright_devices);

static struct hid_driver bright_driver = {
	.name = "bright",
	.id_table = bright_devices,
	.probe = bright_probe,
};

static int bright_init(void)
{
	return hid_register_driver(&bright_driver);
}

static void bright_exit(void)
{
	hid_unregister_driver(&bright_driver);
}

module_init(bright_init);
module_exit(bright_exit);
MODULE_LICENSE("GPL");

HID_COMPAT_LOAD_DRIVER(bright);
+0 −5
Original line number Diff line number Diff line
@@ -1256,16 +1256,12 @@ static const struct hid_device_id hid_blacklist[] = {
	{ 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_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_BRIGHT, USB_DEVICE_ID_BRIGHT_ABNT2) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CHICONY, USB_DEVICE_ID_CHICONY_TACTICAL_PAD) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_1) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_BARCODE_2) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_EZKEY, USB_DEVICE_ID_BTC_8193) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PSX_ADAPTOR) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_GAMERON, USB_DEVICE_ID_GAMERON_DUAL_PCS_ADAPTOR) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_GREENASIA, 0x0003) },
@@ -1279,7 +1275,6 @@ static const struct hid_device_id hid_blacklist[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_EDGE) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_ELITE_KBD) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_CORDLESS_DESKTOP_LX500) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_EXTREME_3D) },

drivers/hid/hid-dell.c

deleted100644 → 0
+0 −76
Original line number Diff line number Diff line
/*
 *  HID driver for some dell "special" devices
 *
 *  Copyright (c) 1999 Andreas Gal
 *  Copyright (c) 2000-2005 Vojtech Pavlik <vojtech@suse.cz>
 *  Copyright (c) 2005 Michael Haboustak <mike-@cinci.rr.com> for Concept2, Inc
 *  Copyright (c) 2006-2007 Jiri Kosina
 *  Copyright (c) 2007 Paul Walmsley
 *  Copyright (c) 2008 Jiri Slaby
 */

/*
 * 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 the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 */

#include <linux/device.h>
#include <linux/hid.h>
#include <linux/module.h>

#include "hid-ids.h"

static int dell_probe(struct hid_device *hdev, const struct hid_device_id *id)
{
	int ret;

	ret = hid_parse(hdev);
	if (ret) {
		dev_err(&hdev->dev, "parse failed\n");
		goto err_free;
	}

	ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
	if (ret) {
		dev_err(&hdev->dev, "hw start failed\n");
		goto err_free;
	}

	usbhid_set_leds(hdev);

	return 0;
err_free:
	return ret;
}

static const struct hid_device_id dell_devices[] = {
	{ HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_SK8115) },
	{ HID_USB_DEVICE(USB_VENDOR_ID_GENERIC_13BA, USB_DEVICE_ID_GENERIC_13BA_KBD_MOUSE) },
	{ }
};
MODULE_DEVICE_TABLE(hid, dell_devices);

static struct hid_driver dell_driver = {
	.name = "dell",
	.id_table = dell_devices,
	.probe = dell_probe,
};

static int dell_init(void)
{
	return hid_register_driver(&dell_driver);
}

static void dell_exit(void)
{
	hid_unregister_driver(&dell_driver);
}

module_init(dell_init);
module_exit(dell_exit);
MODULE_LICENSE("GPL");

HID_COMPAT_LOAD_DRIVER(dell);
Loading