Skip to content
This repository has been archived by the owner on Dec 14, 2022. It is now read-only.

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/jikos/hid

Pull HID updates from Jiri Kosina:
 "Updates for HID code

   - improveements of Logitech HID++ procotol implementation, from
     Benjamin Tissoires

   - support for composite RMI devices, from Andrew Duggan

   - new driver for BETOP controller, from Huang Bo

   - fixup for conflicting mapping in HID core between PC-101/103/104
     and PC-102/105 keyboards from David Herrmann

   - new hardware support and fixes in Wacom driver, from Ping Cheng

   - assorted small fixes and device ID additions all over the place"

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (33 commits)
  HID: wacom: add support for Cintiq 27QHD and 27QHD touch
  HID: wacom: consolidate input capability settings for pen and touch
  HID: wacom: make sure touch arbitration is applied consistently
  HID: pidff: Fix initialisation forMicrosoft Sidewinder FF Pro 2
  HID: hyperv: match wait_for_completion_timeout return type
  HID: wacom: Report ABS_MISC event for Cintiq Companion Hybrid
  HID: Use Kbuild idiom in Makefiles
  HID: do not bind to Microchip Pick16F1454
  HID: hid-lg4ff: use DEVICE_ATTR_RW macro
  HID: hid-lg4ff: fix sysfs attribute permission
  HID: wacom: peport In Range event according to the spec
  HID: wacom: process invalid Cintiq and Intuos data in wacom_intuos_inout()
  HID: rmi: Add support for the touchpad in the Razer Blade 14 laptop
  HID: rmi: Support touchpads with external buttons
  HID: rmi: Use hid_report_len to compute the size of reports
  HID: logitech-hidpp: store the name of the device in struct hidpp
  HID: microsoft: add support for Japanese Surface Type Cover 3
  HID: fixup the conflicting keyboard mappings quirk
  HID: apple: fix battery support for the 2009 ANSI wireless keyboard
  HID: fix Kconfig text
  ...
  • Loading branch information
torvalds committed Feb 11, 2015
2 parents 06cc01a + 988b7fb commit 870fd0f
Show file tree
Hide file tree
Showing 20 changed files with 643 additions and 229 deletions.
12 changes: 11 additions & 1 deletion drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,16 @@ config HID_BELKIN
---help---
Support for Belkin Flip KVM and Wireless keyboard.

config HID_BETOP_FF
tristate "Betop Production Inc. force feedback support"
depends on USB_HID
select INPUT_FF_MEMLESS
---help---
Say Y here if you want to enable force feedback support for devices by
BETOP Production Ltd.
Currently the following devices are known to be supported:
- BETOP 2185 PC & BFM MODE

config HID_CHERRY
tristate "Cherry Cymotion keyboard" if EXPERT
depends on HID
Expand Down Expand Up @@ -389,7 +399,7 @@ config HID_LOGITECH_HIDPP
Say Y if you want support for Logitech devices relying on the HID++
specification. Such devices are the various Logitech Touchpads (T650,
T651, TK820), some mice (Zone Touch mouse), or even keyboards (Solar
Keayboard).
Keyboard).

config LOGITECH_FF
bool "Logitech force feedback support"
Expand Down
50 changes: 13 additions & 37 deletions drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@
# Makefile for the HID driver
#
hid-y := hid-core.o hid-input.o

ifdef CONFIG_DEBUG_FS
hid-objs += hid-debug.o
endif
hid-$(CONFIG_DEBUG_FS) += hid-debug.o

obj-$(CONFIG_HID) += hid.o
obj-$(CONFIG_UHID) += uhid.o
Expand All @@ -15,30 +12,21 @@ obj-$(CONFIG_HID_GENERIC) += hid-generic.o
hid-$(CONFIG_HIDRAW) += hidraw.o

hid-logitech-y := hid-lg.o
ifdef CONFIG_LOGITECH_FF
hid-logitech-y += hid-lgff.o
endif
ifdef CONFIG_LOGIRUMBLEPAD2_FF
hid-logitech-y += hid-lg2ff.o
endif
ifdef CONFIG_LOGIG940_FF
hid-logitech-y += hid-lg3ff.o
endif
ifdef CONFIG_LOGIWHEELS_FF
hid-logitech-y += hid-lg4ff.o
endif
hid-logitech-$(CONFIG_LOGITECH_FF) += hid-lgff.o
hid-logitech-$(CONFIG_LOGIRUMBLEPAD2_FF) += hid-lg2ff.o
hid-logitech-$(CONFIG_LOGIG940_FF) += hid-lg3ff.o
hid-logitech-$(CONFIG_LOGIWHEELS_FF) += hid-lg4ff.o

hid-wiimote-y := hid-wiimote-core.o hid-wiimote-modules.o
ifdef CONFIG_DEBUG_FS
hid-wiimote-y += hid-wiimote-debug.o
endif
hid-wiimote-$(CONFIG_DEBUG_FS) += hid-wiimote-debug.o

obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
obj-$(CONFIG_HID_ACRUX) += hid-axff.o
obj-$(CONFIG_HID_APPLE) += hid-apple.o
obj-$(CONFIG_HID_APPLEIR) += hid-appleir.o
obj-$(CONFIG_HID_AUREAL) += hid-aureal.o
obj-$(CONFIG_HID_BELKIN) += hid-belkin.o
obj-$(CONFIG_HID_BETOP_FF) += hid-betopff.o
obj-$(CONFIG_HID_CHERRY) += hid-cherry.o
obj-$(CONFIG_HID_CHICONY) += hid-chicony.o
obj-$(CONFIG_HID_CP2112) += hid-cp2112.o
Expand Down Expand Up @@ -76,24 +64,12 @@ obj-$(CONFIG_HID_PENMOUNT) += hid-penmount.o
obj-$(CONFIG_HID_PETALYNX) += hid-petalynx.o
obj-$(CONFIG_HID_PICOLCD) += hid-picolcd.o
hid-picolcd-y += hid-picolcd_core.o
ifdef CONFIG_HID_PICOLCD_FB
hid-picolcd-y += hid-picolcd_fb.o
endif
ifdef CONFIG_HID_PICOLCD_BACKLIGHT
hid-picolcd-y += hid-picolcd_backlight.o
endif
ifdef CONFIG_HID_PICOLCD_LCD
hid-picolcd-y += hid-picolcd_lcd.o
endif
ifdef CONFIG_HID_PICOLCD_LEDS
hid-picolcd-y += hid-picolcd_leds.o
endif
ifdef CONFIG_HID_PICOLCD_CIR
hid-picolcd-y += hid-picolcd_cir.o
endif
ifdef CONFIG_DEBUG_FS
hid-picolcd-y += hid-picolcd_debugfs.o
endif
hid-picolcd-$(CONFIG_HID_PICOLCD_FB) += hid-picolcd_fb.o
hid-picolcd-$(CONFIG_HID_PICOLCD_BACKLIGHT) += hid-picolcd_backlight.o
hid-picolcd-$(CONFIG_HID_PICOLCD_LCD) += hid-picolcd_lcd.o
hid-picolcd-$(CONFIG_HID_PICOLCD_LEDS) += hid-picolcd_leds.o
hid-picolcd-$(CONFIG_HID_PICOLCD_CIR) += hid-picolcd_cir.o
hid-picolcd-$(CONFIG_DEBUG_FS) += hid-picolcd_debugfs.o

obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
Expand Down
160 changes: 160 additions & 0 deletions drivers/hid/hid-betopff.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
/*
* Force feedback support for Betop based devices
*
* The devices are distributed under various names and the same USB device ID
* can be used in both adapters and actual game controllers.
*
* 0x11c2:0x2208 "BTP2185 BFM mode Joystick"
* - tested with BTP2185 BFM Mode.
*
* 0x11C0:0x5506 "BTP2185 PC mode Joystick"
* - tested with BTP2185 PC Mode.
*
* 0x8380:0x1850 "BTP2185 V2 PC mode USB Gamepad"
* - tested with BTP2185 PC Mode with another version.
*
* 0x20bc:0x5500 "BTP2185 V2 BFM mode Joystick"
* - tested with BTP2171s.
* Copyright (c) 2014 Huang Bo <[email protected]>
*/

/*
* 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/input.h>
#include <linux/slab.h>
#include <linux/module.h>
#include <linux/hid.h>

#include "hid-ids.h"

struct betopff_device {
struct hid_report *report;
};

static int hid_betopff_play(struct input_dev *dev, void *data,
struct ff_effect *effect)
{
struct hid_device *hid = input_get_drvdata(dev);
struct betopff_device *betopff = data;
__u16 left, right;

left = effect->u.rumble.strong_magnitude;
right = effect->u.rumble.weak_magnitude;

betopff->report->field[2]->value[0] = left / 256;
betopff->report->field[3]->value[0] = right / 256;

hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);

return 0;
}

static int betopff_init(struct hid_device *hid)
{
struct betopff_device *betopff;
struct hid_report *report;
struct hid_input *hidinput =
list_first_entry(&hid->inputs, struct hid_input, list);
struct list_head *report_list =
&hid->report_enum[HID_OUTPUT_REPORT].report_list;
struct input_dev *dev = hidinput->input;
int field_count = 0;
int error;
int i, j;

if (list_empty(report_list)) {
hid_err(hid, "no output reports found\n");
return -ENODEV;
}

report = list_first_entry(report_list, struct hid_report, list);
/*
* Actually there are 4 fields for 4 Bytes as below:
* -----------------------------------------
* Byte0 Byte1 Byte2 Byte3
* 0x00 0x00 left_motor right_motor
* -----------------------------------------
* Do init them with default value.
*/
for (i = 0; i < report->maxfield; i++) {
for (j = 0; j < report->field[i]->report_count; j++) {
report->field[i]->value[j] = 0x00;
field_count++;
}
}

if (field_count < 4) {
hid_err(hid, "not enough fields in the report: %d\n",
field_count);
return -ENODEV;
}

betopff = kzalloc(sizeof(*betopff), GFP_KERNEL);
if (!betopff)
return -ENOMEM;

set_bit(FF_RUMBLE, dev->ffbit);

error = input_ff_create_memless(dev, betopff, hid_betopff_play);
if (error) {
kfree(betopff);
return error;
}

betopff->report = report;
hid_hw_request(hid, betopff->report, HID_REQ_SET_REPORT);

hid_info(hid, "Force feedback for betop devices by huangbo <[email protected]>\n");

return 0;
}

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

if (id->driver_data)
hdev->quirks |= HID_QUIRK_MULTI_INPUT;

ret = hid_parse(hdev);
if (ret) {
hid_err(hdev, "parse failed\n");
goto err;
}

ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
if (ret) {
hid_err(hdev, "hw start failed\n");
goto err;
}

betopff_init(hdev);

return 0;
err:
return ret;
}

static const struct hid_device_id betop_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ }
};
MODULE_DEVICE_TABLE(hid, betop_devices);

static struct hid_driver betop_driver = {
.name = "betop",
.id_table = betop_devices,
.probe = betop_probe,
};
module_hid_driver(betop_driver);

MODULE_LICENSE("GPL");
32 changes: 26 additions & 6 deletions drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -698,15 +698,25 @@ static void hid_scan_feature_usage(struct hid_parser *parser, u32 usage)
static void hid_scan_collection(struct hid_parser *parser, unsigned type)
{
struct hid_device *hid = parser->device;
int i;

if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
type == HID_COLLECTION_PHYSICAL)
hid->group = HID_GROUP_SENSOR_HUB;

if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
(hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 ||
hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3_JP) &&
hid->group == HID_GROUP_MULTITOUCH)
hid->group = HID_GROUP_GENERIC;

if ((parser->global.usage_page << 16) == HID_UP_GENDESK)
for (i = 0; i < parser->local.usage_index; i++)
if (parser->local.usage[i] == HID_GD_POINTER)
parser->scan_flags |= HID_SCAN_FLAG_GD_POINTER;

if ((parser->global.usage_page << 16) >= HID_UP_MSVENDOR)
parser->scan_flags |= HID_SCAN_FLAG_VENDOR_SPECIFIC;
}

static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
Expand Down Expand Up @@ -792,11 +802,14 @@ static int hid_scan_report(struct hid_device *hid)
hid->group = HID_GROUP_WACOM;
break;
case USB_VENDOR_ID_SYNAPTICS:
if ((hid->group == HID_GROUP_GENERIC) &&
(hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
/* hid-rmi should only bind to the mouse interface of
* composite USB devices */
hid->group = HID_GROUP_RMI;
if (hid->group == HID_GROUP_GENERIC)
if ((parser->scan_flags & HID_SCAN_FLAG_VENDOR_SPECIFIC)
&& (parser->scan_flags & HID_SCAN_FLAG_GD_POINTER))
/*
* hid-rmi should take care of them,
* not hid-generic
*/
hid->group = HID_GROUP_RMI;
break;
}

Expand Down Expand Up @@ -1757,6 +1770,10 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_AUREAL, USB_DEVICE_ID_AUREAL_W01RN) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BELKIN, USB_DEVICE_ID_FLIP_KVM) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185BFM, 0x2208) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185PC, 0x5506) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2PC, 0x1850) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BETOP_2185V2BFM, 0x5500) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_BTC, USB_DEVICE_ID_BTC_EMPREX_REMOTE_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_CHERRY, USB_DEVICE_ID_CHERRY_CYMOTION) },
Expand Down Expand Up @@ -1861,6 +1878,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_OFFICE_KB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3_JP) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
Expand Down Expand Up @@ -1971,6 +1989,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_NINTENDO, USB_DEVICE_ID_NINTENDO_WIIMOTE2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_RAZER, USB_DEVICE_ID_RAZER_BLADE_14) },
{ }
};

Expand Down Expand Up @@ -2328,6 +2347,7 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT1) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICKIT2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROCHIP, USB_DEVICE_ID_PICK16F1454) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100) },
{ HID_USB_DEVICE(USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20) },
Expand Down
2 changes: 1 addition & 1 deletion drivers/hid/hid-hyperv.c
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ static void mousevsc_on_channel_callback(void *context)
static int mousevsc_connect_to_vsp(struct hv_device *device)
{
int ret = 0;
int t;
unsigned long t;
struct mousevsc_dev *input_dev = hv_get_drvdata(device);
struct mousevsc_prt_msg *request;
struct mousevsc_prt_msg *response;
Expand Down
10 changes: 10 additions & 0 deletions drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,11 @@
#define USB_VENDOR_ID_BERKSHIRE 0x0c98
#define USB_DEVICE_ID_BERKSHIRE_PCWD 0x1140

#define USB_VENDOR_ID_BETOP_2185BFM 0x11c2
#define USB_VENDOR_ID_BETOP_2185PC 0x11c0
#define USB_VENDOR_ID_BETOP_2185V2PC 0x8380
#define USB_VENDOR_ID_BETOP_2185V2BFM 0x20bc

#define USB_VENDOR_ID_BTC 0x046e
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE 0x5578
#define USB_DEVICE_ID_BTC_EMPREX_REMOTE_2 0x5577
Expand Down Expand Up @@ -638,6 +643,7 @@
#define USB_DEVICE_ID_PICKIT2 0x0033
#define USB_DEVICE_ID_PICOLCD 0xc002
#define USB_DEVICE_ID_PICOLCD_BOOTLOADER 0xf002
#define USB_DEVICE_ID_PICK16F1454 0x0042

#define USB_VENDOR_ID_MICROSOFT 0x045e
#define USB_DEVICE_ID_SIDEWINDER_GV 0x003b
Expand All @@ -654,6 +660,7 @@
#define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7
#define USB_DEVICE_ID_MS_TYPE_COVER_2 0x07a9
#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc
#define USB_DEVICE_ID_MS_TYPE_COVER_3_JP 0x07dd

#define USB_VENDOR_ID_MOJO 0x8282
#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
Expand Down Expand Up @@ -768,6 +775,9 @@
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3001 0x3001
#define USB_DEVICE_ID_QUANTA_OPTICAL_TOUCH_3008 0x3008

#define USB_VENDOR_ID_RAZER 0x1532
#define USB_DEVICE_ID_RAZER_BLADE_14 0x011D

#define USB_VENDOR_ID_REALTEK 0x0bda
#define USB_DEVICE_ID_REALTEK_READER 0x0152

Expand Down
Loading

0 comments on commit 870fd0f

Please sign in to comment.