HID: lenovo-tpkbd: remove usb dependency
lenovo tpkbd currently relies on the usb interface number to detect if it is dealing with the touchpad interface or not. As the report descriptors of the interface 0 does not contain the button 3, we can use this to remove the need to check for usb. Signed-off-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
This commit is contained in:
parent
01ab35f14a
commit
0c5218362b
@ -322,7 +322,7 @@ config HID_LCPOWER
|
|||||||
|
|
||||||
config HID_LENOVO_TPKBD
|
config HID_LENOVO_TPKBD
|
||||||
tristate "Lenovo ThinkPad USB Keyboard with TrackPoint"
|
tristate "Lenovo ThinkPad USB Keyboard with TrackPoint"
|
||||||
depends on USB_HID
|
depends on HID
|
||||||
select NEW_LEDS
|
select NEW_LEDS
|
||||||
select LEDS_CLASS
|
select LEDS_CLASS
|
||||||
---help---
|
---help---
|
||||||
|
@ -14,11 +14,9 @@
|
|||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/sysfs.h>
|
#include <linux/sysfs.h>
|
||||||
#include <linux/device.h>
|
#include <linux/device.h>
|
||||||
#include <linux/usb.h>
|
|
||||||
#include <linux/hid.h>
|
#include <linux/hid.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/leds.h>
|
#include <linux/leds.h>
|
||||||
#include "usbhid/usbhid.h"
|
|
||||||
|
|
||||||
#include "hid-ids.h"
|
#include "hid-ids.h"
|
||||||
|
|
||||||
@ -41,10 +39,9 @@ static int tpkbd_input_mapping(struct hid_device *hdev,
|
|||||||
struct hid_input *hi, struct hid_field *field,
|
struct hid_input *hi, struct hid_field *field,
|
||||||
struct hid_usage *usage, unsigned long **bit, int *max)
|
struct hid_usage *usage, unsigned long **bit, int *max)
|
||||||
{
|
{
|
||||||
struct usbhid_device *uhdev;
|
if (usage->hid == (HID_UP_BUTTON | 0x0010)) {
|
||||||
|
/* mark the device as pointer */
|
||||||
uhdev = (struct usbhid_device *) hdev->driver_data;
|
hid_set_drvdata(hdev, (void *)1);
|
||||||
if (uhdev->ifnum == 1 && usage->hid == (HID_UP_BUTTON | 0x0010)) {
|
|
||||||
map_key_clear(KEY_MICMUTE);
|
map_key_clear(KEY_MICMUTE);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -398,7 +395,6 @@ static int tpkbd_probe(struct hid_device *hdev,
|
|||||||
const struct hid_device_id *id)
|
const struct hid_device_id *id)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
struct usbhid_device *uhdev;
|
|
||||||
|
|
||||||
ret = hid_parse(hdev);
|
ret = hid_parse(hdev);
|
||||||
if (ret) {
|
if (ret) {
|
||||||
@ -412,9 +408,8 @@ static int tpkbd_probe(struct hid_device *hdev,
|
|||||||
goto err;
|
goto err;
|
||||||
}
|
}
|
||||||
|
|
||||||
uhdev = (struct usbhid_device *) hdev->driver_data;
|
if (hid_get_drvdata(hdev)) {
|
||||||
|
hid_set_drvdata(hdev, NULL);
|
||||||
if (uhdev->ifnum == 1) {
|
|
||||||
ret = tpkbd_probe_tp(hdev);
|
ret = tpkbd_probe_tp(hdev);
|
||||||
if (ret)
|
if (ret)
|
||||||
goto err_hid;
|
goto err_hid;
|
||||||
@ -442,10 +437,7 @@ static void tpkbd_remove_tp(struct hid_device *hdev)
|
|||||||
|
|
||||||
static void tpkbd_remove(struct hid_device *hdev)
|
static void tpkbd_remove(struct hid_device *hdev)
|
||||||
{
|
{
|
||||||
struct usbhid_device *uhdev;
|
if (hid_get_drvdata(hdev))
|
||||||
|
|
||||||
uhdev = (struct usbhid_device *) hdev->driver_data;
|
|
||||||
if (uhdev->ifnum == 1)
|
|
||||||
tpkbd_remove_tp(hdev);
|
tpkbd_remove_tp(hdev);
|
||||||
|
|
||||||
hid_hw_stop(hdev);
|
hid_hw_stop(hdev);
|
||||||
|
Loading…
Reference in New Issue
Block a user