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

Pull HID updates from Jiri Kosina:
 - i2c-hid race condition fix from Jean-Baptiste Maneyrol
 - Logitech driver now supports vendor-specific HID++ protocol, allowing
   us to deliver a full multitouch support on wider range of Logitech
   touchpads.  Written by Benjamin Tissoires
 - MS Surface Pro 3 Type Cover support added by Alan Wu
 - RMI touchpad support improvements from Andrew Duggan
 - a lot of updates to Wacom driver from Jason Gerecke and Ping Cheng
 - various small fixes all over the place

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid: (56 commits)
  HID: rmi: The address of query8 must be calculated based on which query registers are present
  HID: rmi: Check for additional ACM registers appended to F11 data report
  HID: i2c-hid: prevent buffer overflow in early IRQ
  HID: logitech-hidpp: disable io in probe error path
  HID: logitech-hidpp: add boundary check for name retrieval
  HID: logitech-hidpp: check name retrieval return code
  HID: logitech-hidpp: do not return the name length
  HID: wacom: Report input events for each finger on generic devices
  HID: wacom: Initialize MT slots for generic devices at post_parse_hid
  HID: wacom: Update maximum X/Y accounding to outbound offset
  HID: wacom: Add support for DTU-1031X
  HID: wacom: add defines for new Cintiq and DTU outbound tracking
  HID: wacom: fix freeze on open when autosuspend is on
  HID: wacom: re-add accidentally dropped Lenovo PID
  HID: make hid_report_len as a static inline function in hid.h
  HID: wacom: Consult the application usage when determining field type
  HID: wacom: PAD is independent with pen/touch
  HID: multitouch: Add quirk for VTL touch panels
  HID: i2c-hid: fix race condition reading reports
  HID: wacom: Add angular resolution data to some ABS axes
  ...
This commit is contained in:
Linus Torvalds 2014-12-12 10:26:47 -08:00
commit 0349678ccd
26 changed files with 2141 additions and 434 deletions

View File

@ -371,6 +371,7 @@ config HID_LOGITECH_DJ
tristate "Logitech Unifying receivers full support" tristate "Logitech Unifying receivers full support"
depends on HIDRAW depends on HIDRAW
depends on HID_LOGITECH depends on HID_LOGITECH
select HID_LOGITECH_HIDPP
---help--- ---help---
Say Y if you want support for Logitech Unifying receivers and devices. Say Y if you want support for Logitech Unifying receivers and devices.
Unifying receivers are capable of pairing up to 6 Logitech compliant Unifying receivers are capable of pairing up to 6 Logitech compliant
@ -378,6 +379,17 @@ config HID_LOGITECH_DJ
generic USB_HID driver and all incoming events will be multiplexed generic USB_HID driver and all incoming events will be multiplexed
into a single mouse and a single keyboard device. into a single mouse and a single keyboard device.
config HID_LOGITECH_HIDPP
tristate "Logitech HID++ devices support"
depends on HID_LOGITECH
---help---
Support for Logitech devices relyingon the HID++ Logitech specification
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).
config LOGITECH_FF config LOGITECH_FF
bool "Logitech force feedback support" bool "Logitech force feedback support"
depends on HID_LOGITECH depends on HID_LOGITECH
@ -613,6 +625,13 @@ config HID_PICOLCD_CIR
---help--- ---help---
Provide access to PicoLCD's CIR interface via remote control (LIRC). Provide access to PicoLCD's CIR interface via remote control (LIRC).
config HID_PLANTRONICS
tristate "Plantronics USB HID Driver"
default !EXPERT
depends on HID
---help---
Provides HID support for Plantronics telephony devices.
config HID_PRIMAX config HID_PRIMAX
tristate "Primax non-fully HID-compliant devices" tristate "Primax non-fully HID-compliant devices"
depends on HID depends on HID
@ -629,7 +648,7 @@ config HID_ROCCAT
support for its special functionalities. support for its special functionalities.
config HID_SAITEK config HID_SAITEK
tristate "Saitek non-fully HID-compliant devices" tristate "Saitek (Mad Catz) non-fully HID-compliant devices"
depends on HID depends on HID
---help--- ---help---
Support for Saitek devices that are not fully compliant with the Support for Saitek devices that are not fully compliant with the
@ -637,6 +656,7 @@ config HID_SAITEK
Supported devices: Supported devices:
- PS1000 Dual Analog Pad - PS1000 Dual Analog Pad
- R.A.T.9 Gaming Mouse
- R.A.T.7 Gaming Mouse - R.A.T.7 Gaming Mouse
- M.M.O.7 Gaming Mouse - M.M.O.7 Gaming Mouse

View File

@ -63,6 +63,7 @@ obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o
obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o
obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o
obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o
obj-$(CONFIG_HID_LOGITECH_HIDPP) += hid-logitech-hidpp.o
obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o
obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o obj-$(CONFIG_HID_MICROSOFT) += hid-microsoft.o
obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o obj-$(CONFIG_HID_MONTEREY) += hid-monterey.o
@ -94,6 +95,7 @@ ifdef CONFIG_DEBUG_FS
hid-picolcd-y += hid-picolcd_debugfs.o hid-picolcd-y += hid-picolcd_debugfs.o
endif endif
obj-$(CONFIG_HID_PLANTRONICS) += hid-plantronics.o
obj-$(CONFIG_HID_PRIMAX) += hid-primax.o obj-$(CONFIG_HID_PRIMAX) += hid-primax.o
obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \ obj-$(CONFIG_HID_ROCCAT) += hid-roccat.o hid-roccat-common.o \
hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \ hid-roccat-arvo.o hid-roccat-isku.o hid-roccat-kone.o \

View File

@ -702,6 +702,11 @@ static void hid_scan_collection(struct hid_parser *parser, unsigned type)
if (((parser->global.usage_page << 16) == HID_UP_SENSOR) && if (((parser->global.usage_page << 16) == HID_UP_SENSOR) &&
type == HID_COLLECTION_PHYSICAL) type == HID_COLLECTION_PHYSICAL)
hid->group = HID_GROUP_SENSOR_HUB; hid->group = HID_GROUP_SENSOR_HUB;
if (hid->vendor == USB_VENDOR_ID_MICROSOFT &&
hid->product == USB_DEVICE_ID_MS_TYPE_COVER_3 &&
hid->group == HID_GROUP_MULTITOUCH)
hid->group = HID_GROUP_GENERIC;
} }
static int hid_scan_main(struct hid_parser *parser, struct hid_item *item) static int hid_scan_main(struct hid_parser *parser, struct hid_item *item)
@ -779,16 +784,6 @@ static int hid_scan_report(struct hid_device *hid)
(hid->group == HID_GROUP_MULTITOUCH)) (hid->group == HID_GROUP_MULTITOUCH))
hid->group = HID_GROUP_MULTITOUCH_WIN_8; hid->group = HID_GROUP_MULTITOUCH_WIN_8;
/*
* Vendor specific handlings
*/
if ((hid->vendor == USB_VENDOR_ID_SYNAPTICS) &&
(hid->group == HID_GROUP_GENERIC) &&
/* only bind to the mouse interface of composite USB devices */
(hid->bus != BUS_USB || hid->type == HID_TYPE_USBMOUSE))
/* hid-rmi should take care of them, not hid-generic */
hid->group = HID_GROUP_RMI;
/* /*
* Vendor specific handlings * Vendor specific handlings
*/ */
@ -796,6 +791,13 @@ static int hid_scan_report(struct hid_device *hid)
case USB_VENDOR_ID_WACOM: case USB_VENDOR_ID_WACOM:
hid->group = HID_GROUP_WACOM; hid->group = HID_GROUP_WACOM;
break; 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;
break;
} }
vfree(parser); vfree(parser);
@ -1280,12 +1282,6 @@ void hid_output_report(struct hid_report *report, __u8 *data)
} }
EXPORT_SYMBOL_GPL(hid_output_report); EXPORT_SYMBOL_GPL(hid_output_report);
static int hid_report_len(struct hid_report *report)
{
/* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
return ((report->size - 1) >> 3) + 1 + (report->id > 0);
}
/* /*
* Allocator for buffer that is going to be passed to hid_output_report() * Allocator for buffer that is going to be passed to hid_output_report()
*/ */
@ -1822,6 +1818,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_S510_RECEIVER_2) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_RECEIVER) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_T651) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_DESKTOP) }, { 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_EDGE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) }, { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_DINOVO_MINI) },
@ -1862,6 +1859,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) },
{ 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_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_OFFICE_KB) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MONTEREY, USB_DEVICE_ID_GENIUS_KB29E) }, { 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_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL) },
{ HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) }, { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, USB_DEVICE_ID_NTRIG_TOUCH_SCREEN) },
@ -1887,6 +1885,7 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) }, { HID_USB_DEVICE(USB_VENDOR_ID_ORTEK, USB_DEVICE_ID_ORTEK_WKB2000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) }, { HID_USB_DEVICE(USB_VENDOR_ID_PENMOUNT, USB_DEVICE_ID_PENMOUNT_6000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_PETALYNX, USB_DEVICE_ID_PETALYNX_MAXTER_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
{ HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) }, { HID_USB_DEVICE(USB_VENDOR_ID_PRIMAX, USB_DEVICE_ID_PRIMAX_KEYBOARD) },
#if IS_ENABLED(CONFIG_HID_ROCCAT) #if IS_ENABLED(CONFIG_HID_ROCCAT)
{ HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) },
@ -1910,10 +1909,12 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_PS1000) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7) },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9) },
#endif #endif
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_IR_REMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) }, { HID_USB_DEVICE(USB_VENDOR_ID_SAMSUNG, USB_DEVICE_ID_SAMSUNG_WIRELESS_KBD_MOUSE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SKYCABLE, USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_BUZZ_CONTROLLER) },
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) }, { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_WIRELESS_BUZZ_CONTROLLER) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) }, { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS3_BDREMOTE) },
@ -2539,7 +2540,8 @@ int hid_add_device(struct hid_device *hdev)
* Scan generic devices for group information * Scan generic devices for group information
*/ */
if (hid_ignore_special_drivers || if (hid_ignore_special_drivers ||
!hid_match_id(hdev, hid_have_special_driver)) { (!hdev->group &&
!hid_match_id(hdev, hid_have_special_driver))) {
ret = hid_scan_report(hdev); ret = hid_scan_report(hdev);
if (ret) if (ret)
hid_warn(hdev, "bad device descriptor (%d)\n", ret); hid_warn(hdev, "bad device descriptor (%d)\n", ret);

View File

@ -300,6 +300,7 @@
#define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN 0x0089
#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B 0x009b
#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103 #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103 0x0103
#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c 0x010c
#define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f #define USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F 0x016f
#define USB_VENDOR_ID_ELECOM 0x056e #define USB_VENDOR_ID_ELECOM 0x056e
@ -578,6 +579,7 @@
#define USB_VENDOR_ID_LOGITECH 0x046d #define USB_VENDOR_ID_LOGITECH 0x046d
#define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e #define USB_DEVICE_ID_LOGITECH_AUDIOHUB 0x0a0e
#define USB_DEVICE_ID_LOGITECH_T651 0xb00c
#define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101 #define USB_DEVICE_ID_LOGITECH_RECEIVER 0xc101
#define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110 #define USB_DEVICE_ID_LOGITECH_HARMONY_FIRST 0xc110
#define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f #define USB_DEVICE_ID_LOGITECH_HARMONY_LAST 0xc14f
@ -620,6 +622,7 @@
#define USB_VENDOR_ID_MADCATZ 0x0738 #define USB_VENDOR_ID_MADCATZ 0x0738
#define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540 #define USB_DEVICE_ID_MADCATZ_BEATPAD 0x4540
#define USB_DEVICE_ID_MADCATZ_RAT9 0x1709
#define USB_VENDOR_ID_MCC 0x09db #define USB_VENDOR_ID_MCC 0x09db
#define USB_DEVICE_ID_MCC_PMD1024LS 0x0076 #define USB_DEVICE_ID_MCC_PMD1024LS 0x0076
@ -649,6 +652,7 @@
#define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799 #define USB_DEVICE_ID_MS_SURFACE_PRO_2 0x0799
#define USB_DEVICE_ID_MS_TOUCH_COVER_2 0x07a7 #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_2 0x07a9
#define USB_DEVICE_ID_MS_TYPE_COVER_3 0x07dc
#define USB_VENDOR_ID_MOJO 0x8282 #define USB_VENDOR_ID_MOJO 0x8282
#define USB_DEVICE_ID_RETRO_ADAPTER 0x3201 #define USB_DEVICE_ID_RETRO_ADAPTER 0x3201
@ -716,6 +720,8 @@
#define USB_DEVICE_ID_ORTEK_PKB1700 0x1700 #define USB_DEVICE_ID_ORTEK_PKB1700 0x1700
#define USB_DEVICE_ID_ORTEK_WKB2000 0x2000 #define USB_DEVICE_ID_ORTEK_WKB2000 0x2000
#define USB_VENDOR_ID_PLANTRONICS 0x047f
#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
#define USB_DEVICE_ID_PANABOARD_UBT880 0x104d #define USB_DEVICE_ID_PANABOARD_UBT880 0x104d
@ -813,6 +819,9 @@
#define USB_VENDOR_ID_SKYCABLE 0x1223 #define USB_VENDOR_ID_SKYCABLE 0x1223
#define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07 #define USB_DEVICE_ID_SKYCABLE_WIRELESS_PRESENTER 0x3F07
#define USB_VENDOR_ID_SMK 0x0609
#define USB_DEVICE_ID_SMK_PS3_BDREMOTE 0x0306
#define USB_VENDOR_ID_SONY 0x054c #define USB_VENDOR_ID_SONY 0x054c
#define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b #define USB_DEVICE_ID_SONY_VAIO_VGX_MOUSE 0x024b
#define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374 #define USB_DEVICE_ID_SONY_VAIO_VGP_MOUSE 0x0374
@ -931,6 +940,9 @@
#define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004 #define USB_DEVICE_ID_VERNIER_CYCLOPS 0x0004
#define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006 #define USB_DEVICE_ID_VERNIER_LCSPEC 0x0006
#define USB_VENDOR_ID_VTL 0x0306
#define USB_DEVICE_ID_VTL_MULTITOUCH_FF3F 0xff3f
#define USB_VENDOR_ID_WACOM 0x056a #define USB_VENDOR_ID_WACOM 0x056a
#define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81 #define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81
#define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD #define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD

View File

@ -872,7 +872,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break; case 0x2cb: map_key_clear(KEY_KBDINPUTASSIST_ACCEPT); break;
case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break; case 0x2cc: map_key_clear(KEY_KBDINPUTASSIST_CANCEL); break;
default: goto ignore; default: map_key_clear(KEY_UNKNOWN);
} }
break; break;
@ -1215,7 +1215,7 @@ static void hidinput_led_worker(struct work_struct *work)
return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT); return hid->ll_driver->request(hid, report, HID_REQ_SET_REPORT);
/* fall back to generic raw-output-report */ /* fall back to generic raw-output-report */
len = ((report->size - 1) >> 3) + 1 + (report->id > 0); len = hid_report_len(report);
buf = hid_alloc_report_buf(report, GFP_KERNEL); buf = hid_alloc_report_buf(report, GFP_KERNEL);
if (!buf) if (!buf)
return; return;

View File

@ -62,7 +62,6 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
/* HID_UP_LNVENDOR = USB, HID_UP_MSVENDOR = BT */ /* HID_UP_LNVENDOR = USB, HID_UP_MSVENDOR = BT */
if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR || if ((usage->hid & HID_USAGE_PAGE) == HID_UP_MSVENDOR ||
(usage->hid & HID_USAGE_PAGE) == HID_UP_LNVENDOR) { (usage->hid & HID_USAGE_PAGE) == HID_UP_LNVENDOR) {
set_bit(EV_REP, hi->input->evbit);
switch (usage->hid & HID_USAGE) { switch (usage->hid & HID_USAGE) {
case 0x00f1: /* Fn-F4: Mic mute */ case 0x00f1: /* Fn-F4: Mic mute */
map_key_clear(KEY_MICMUTE); map_key_clear(KEY_MICMUTE);
@ -85,13 +84,13 @@ static int lenovo_input_mapping_cptkbd(struct hid_device *hdev,
case 0x00f8: /* Fn-F11: View open applications (3 boxes) */ case 0x00f8: /* Fn-F11: View open applications (3 boxes) */
map_key_clear(KEY_SCALE); map_key_clear(KEY_SCALE);
return 1; return 1;
case 0x00fa: /* Fn-Esc: Fn-lock toggle */ case 0x00f9: /* Fn-F12: Open My computer (6 boxes) USB-only */
map_key_clear(KEY_FN_ESC);
return 1;
case 0x00fb: /* Fn-F12: Open My computer (6 boxes) USB-only */
/* NB: This mapping is invented in raw_event below */ /* NB: This mapping is invented in raw_event below */
map_key_clear(KEY_FILE); map_key_clear(KEY_FILE);
return 1; return 1;
case 0x00fa: /* Fn-Esc: Fn-lock toggle */
map_key_clear(KEY_FN_ESC);
return 1;
} }
} }
@ -207,8 +206,8 @@ static int lenovo_raw_event(struct hid_device *hdev,
&& data[0] == 0x15 && data[0] == 0x15
&& data[1] == 0x94 && data[1] == 0x94
&& data[2] == 0x01)) { && data[2] == 0x01)) {
data[1] = 0x0; data[1] = 0x00;
data[2] = 0x4; data[2] = 0x01;
} }
return 0; return 0;

View File

@ -26,9 +26,104 @@
#include <linux/hid.h> #include <linux/hid.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/usb.h> #include <linux/usb.h>
#include <linux/kfifo.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
#include "hid-ids.h" #include "hid-ids.h"
#include "hid-logitech-dj.h"
#define DJ_MAX_PAIRED_DEVICES 6
#define DJ_MAX_NUMBER_NOTIFICATIONS 8
#define DJ_RECEIVER_INDEX 0
#define DJ_DEVICE_INDEX_MIN 1
#define DJ_DEVICE_INDEX_MAX 6
#define DJREPORT_SHORT_LENGTH 15
#define DJREPORT_LONG_LENGTH 32
#define REPORT_ID_DJ_SHORT 0x20
#define REPORT_ID_DJ_LONG 0x21
#define REPORT_ID_HIDPP_SHORT 0x10
#define REPORT_ID_HIDPP_LONG 0x11
#define HIDPP_REPORT_SHORT_LENGTH 7
#define HIDPP_REPORT_LONG_LENGTH 20
#define HIDPP_RECEIVER_INDEX 0xff
#define REPORT_TYPE_RFREPORT_FIRST 0x01
#define REPORT_TYPE_RFREPORT_LAST 0x1F
/* Command Switch to DJ mode */
#define REPORT_TYPE_CMD_SWITCH 0x80
#define CMD_SWITCH_PARAM_DEVBITFIELD 0x00
#define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01
#define TIMEOUT_NO_KEEPALIVE 0x00
/* Command to Get the list of Paired devices */
#define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81
/* Device Paired Notification */
#define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41
#define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01
#define SPFUNCTION_DEVICE_LIST_EMPTY 0x02
#define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00
#define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01
#define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02
#define DEVICE_PAIRED_RF_REPORT_TYPE 0x03
/* Device Un-Paired Notification */
#define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40
/* Connection Status Notification */
#define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42
#define CONNECTION_STATUS_PARAM_STATUS 0x00
#define STATUS_LINKLOSS 0x01
/* Error Notification */
#define REPORT_TYPE_NOTIF_ERROR 0x7F
#define NOTIF_ERROR_PARAM_ETYPE 0x00
#define ETYPE_KEEPALIVE_TIMEOUT 0x01
/* supported DJ HID && RF report types */
#define REPORT_TYPE_KEYBOARD 0x01
#define REPORT_TYPE_MOUSE 0x02
#define REPORT_TYPE_CONSUMER_CONTROL 0x03
#define REPORT_TYPE_SYSTEM_CONTROL 0x04
#define REPORT_TYPE_MEDIA_CENTER 0x08
#define REPORT_TYPE_LEDS 0x0E
/* RF Report types bitfield */
#define STD_KEYBOARD 0x00000002
#define STD_MOUSE 0x00000004
#define MULTIMEDIA 0x00000008
#define POWER_KEYS 0x00000010
#define MEDIA_CENTER 0x00000100
#define KBD_LEDS 0x00004000
struct dj_report {
u8 report_id;
u8 device_index;
u8 report_type;
u8 report_params[DJREPORT_SHORT_LENGTH - 3];
};
struct dj_receiver_dev {
struct hid_device *hdev;
struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
DJ_DEVICE_INDEX_MIN];
struct work_struct work;
struct kfifo notif_fifo;
spinlock_t lock;
bool querying_devices;
};
struct dj_device {
struct hid_device *hdev;
struct dj_receiver_dev *dj_receiver_dev;
u32 reports_supported;
u8 device_index;
};
/* Keyboard descriptor (1) */ /* Keyboard descriptor (1) */
static const char kbd_descriptor[] = { static const char kbd_descriptor[] = {
@ -156,6 +251,57 @@ static const char media_descriptor[] = {
0xc0, /* EndCollection */ 0xc0, /* EndCollection */
}; /* */ }; /* */
/* HIDPP descriptor */
static const char hidpp_descriptor[] = {
0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
0x09, 0x01, /* Usage (Vendor Usage 1) */
0xa1, 0x01, /* Collection (Application) */
0x85, 0x10, /* Report ID (16) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x06, /* Report Count (6) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x09, 0x01, /* Usage (Vendor Usage 1) */
0x81, 0x00, /* Input (Data,Arr,Abs) */
0x09, 0x01, /* Usage (Vendor Usage 1) */
0x91, 0x00, /* Output (Data,Arr,Abs) */
0xc0, /* End Collection */
0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
0x09, 0x02, /* Usage (Vendor Usage 2) */
0xa1, 0x01, /* Collection (Application) */
0x85, 0x11, /* Report ID (17) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x13, /* Report Count (19) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x09, 0x02, /* Usage (Vendor Usage 2) */
0x81, 0x00, /* Input (Data,Arr,Abs) */
0x09, 0x02, /* Usage (Vendor Usage 2) */
0x91, 0x00, /* Output (Data,Arr,Abs) */
0xc0, /* End Collection */
0x06, 0x00, 0xff, /* Usage Page (Vendor Defined Page 1) */
0x09, 0x04, /* Usage (Vendor Usage 0x04) */
0xa1, 0x01, /* Collection (Application) */
0x85, 0x20, /* Report ID (32) */
0x75, 0x08, /* Report Size (8) */
0x95, 0x0e, /* Report Count (14) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x09, 0x41, /* Usage (Vendor Usage 0x41) */
0x81, 0x00, /* Input (Data,Arr,Abs) */
0x09, 0x41, /* Usage (Vendor Usage 0x41) */
0x91, 0x00, /* Output (Data,Arr,Abs) */
0x85, 0x21, /* Report ID (33) */
0x95, 0x1f, /* Report Count (31) */
0x15, 0x00, /* Logical Minimum (0) */
0x26, 0xff, 0x00, /* Logical Maximum (255) */
0x09, 0x42, /* Usage (Vendor Usage 0x42) */
0x81, 0x00, /* Input (Data,Arr,Abs) */
0x09, 0x42, /* Usage (Vendor Usage 0x42) */
0x91, 0x00, /* Output (Data,Arr,Abs) */
0xc0, /* End Collection */
};
/* Maximum size of all defined hid reports in bytes (including report id) */ /* Maximum size of all defined hid reports in bytes (including report id) */
#define MAX_REPORT_SIZE 8 #define MAX_REPORT_SIZE 8
@ -165,7 +311,8 @@ static const char media_descriptor[] = {
sizeof(mse_descriptor) + \ sizeof(mse_descriptor) + \
sizeof(consumer_descriptor) + \ sizeof(consumer_descriptor) + \
sizeof(syscontrol_descriptor) + \ sizeof(syscontrol_descriptor) + \
sizeof(media_descriptor)) sizeof(media_descriptor) + \
sizeof(hidpp_descriptor))
/* Number of possible hid report types that can be created by this driver. /* Number of possible hid report types that can be created by this driver.
* *
@ -256,11 +403,15 @@ static void logi_dj_recv_add_djhid_device(struct dj_receiver_dev *djrcv_dev,
dj_hiddev->dev.parent = &djrcv_hdev->dev; dj_hiddev->dev.parent = &djrcv_hdev->dev;
dj_hiddev->bus = BUS_USB; dj_hiddev->bus = BUS_USB;
dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor); dj_hiddev->vendor = le16_to_cpu(usbdev->descriptor.idVendor);
dj_hiddev->product = le16_to_cpu(usbdev->descriptor.idProduct); dj_hiddev->product =
(dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB]
<< 8) |
dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB];
snprintf(dj_hiddev->name, sizeof(dj_hiddev->name), snprintf(dj_hiddev->name, sizeof(dj_hiddev->name),
"Logitech Unifying Device. Wireless PID:%02x%02x", "Logitech Unifying Device. Wireless PID:%04x",
dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_MSB], dj_hiddev->product);
dj_report->report_params[DEVICE_PAIRED_PARAM_EQUAD_ID_LSB]);
dj_hiddev->group = HID_GROUP_LOGITECH_DJ_DEVICE;
usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys)); usb_make_path(usbdev, dj_hiddev->phys, sizeof(dj_hiddev->phys));
snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index); snprintf(tmpstr, sizeof(tmpstr), ":%d", dj_report->device_index);
@ -422,6 +573,13 @@ static void logi_dj_recv_forward_report(struct dj_receiver_dev *djrcv_dev,
} }
} }
static void logi_dj_recv_forward_hidpp(struct dj_device *dj_dev, u8 *data,
int size)
{
/* We are called from atomic context (tasklet && djrcv->lock held) */
if (hid_input_report(dj_dev->hdev, HID_INPUT_REPORT, data, size, 1))
dbg_hid("hid_input_report error\n");
}
static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev, static int logi_dj_recv_send_report(struct dj_receiver_dev *djrcv_dev,
struct dj_report *dj_report) struct dj_report *dj_report)
@ -472,7 +630,9 @@ static int logi_dj_recv_query_paired_devices(struct dj_receiver_dev *djrcv_dev)
static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev, static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
unsigned timeout) unsigned timeout)
{ {
struct hid_device *hdev = djrcv_dev->hdev;
struct dj_report *dj_report; struct dj_report *dj_report;
u8 *buf;
int retval; int retval;
dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL); dj_report = kzalloc(sizeof(struct dj_report), GFP_KERNEL);
@ -484,7 +644,6 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F; dj_report->report_params[CMD_SWITCH_PARAM_DEVBITFIELD] = 0x3F;
dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout; dj_report->report_params[CMD_SWITCH_PARAM_TIMEOUT_SECONDS] = (u8)timeout;
retval = logi_dj_recv_send_report(djrcv_dev, dj_report); retval = logi_dj_recv_send_report(djrcv_dev, dj_report);
kfree(dj_report);
/* /*
* Ugly sleep to work around a USB 3.0 bug when the receiver is still * Ugly sleep to work around a USB 3.0 bug when the receiver is still
@ -493,6 +652,30 @@ static int logi_dj_recv_switch_to_dj_mode(struct dj_receiver_dev *djrcv_dev,
*/ */
msleep(50); msleep(50);
/*
* Magical bits to set up hidpp notifications when the dj devices
* are connected/disconnected.
*
* We can reuse dj_report because HIDPP_REPORT_SHORT_LENGTH is smaller
* than DJREPORT_SHORT_LENGTH.
*/
buf = (u8 *)dj_report;
memset(buf, 0, HIDPP_REPORT_SHORT_LENGTH);
buf[0] = REPORT_ID_HIDPP_SHORT;
buf[1] = 0xFF;
buf[2] = 0x80;
buf[3] = 0x00;
buf[4] = 0x00;
buf[5] = 0x09;
buf[6] = 0x00;
hid_hw_raw_request(hdev, REPORT_ID_HIDPP_SHORT, buf,
HIDPP_REPORT_SHORT_LENGTH, HID_OUTPUT_REPORT,
HID_REQ_SET_REPORT);
kfree(dj_report);
return retval; return retval;
} }
@ -509,6 +692,9 @@ static void logi_dj_ll_close(struct hid_device *hid)
dbg_hid("%s:%s\n", __func__, hid->phys); dbg_hid("%s:%s\n", __func__, hid->phys);
} }
static u8 unifying_name_query[] = {0x10, 0xff, 0x83, 0xb5, 0x40, 0x00, 0x00};
static u8 unifying_name_answer[] = {0x11, 0xff, 0x83, 0xb5};
static int logi_dj_ll_raw_request(struct hid_device *hid, static int logi_dj_ll_raw_request(struct hid_device *hid,
unsigned char reportnum, __u8 *buf, unsigned char reportnum, __u8 *buf,
size_t count, unsigned char report_type, size_t count, unsigned char report_type,
@ -519,6 +705,22 @@ static int logi_dj_ll_raw_request(struct hid_device *hid,
u8 *out_buf; u8 *out_buf;
int ret; int ret;
if ((buf[0] == REPORT_ID_HIDPP_SHORT) ||
(buf[0] == REPORT_ID_HIDPP_LONG)) {
if (count < 2)
return -EINVAL;
/* special case where we should not overwrite
* the device_index */
if (count == 7 && !memcmp(buf, unifying_name_query,
sizeof(unifying_name_query)))
buf[4] |= djdev->device_index - 1;
else
buf[1] = djdev->device_index;
return hid_hw_raw_request(djrcv_dev->hdev, reportnum, buf,
count, report_type, reqtype);
}
if (buf[0] != REPORT_TYPE_LEDS) if (buf[0] != REPORT_TYPE_LEDS)
return -EINVAL; return -EINVAL;
@ -597,6 +799,8 @@ static int logi_dj_ll_parse(struct hid_device *hid)
__func__, djdev->reports_supported); __func__, djdev->reports_supported);
} }
rdcat(rdesc, &rsize, hidpp_descriptor, sizeof(hidpp_descriptor));
retval = hid_parse_report(hid, rdesc, rsize); retval = hid_parse_report(hid, rdesc, rsize);
kfree(rdesc); kfree(rdesc);
@ -624,8 +828,7 @@ static struct hid_ll_driver logi_dj_ll_driver = {
.raw_request = logi_dj_ll_raw_request, .raw_request = logi_dj_ll_raw_request,
}; };
static int logi_dj_dj_event(struct hid_device *hdev,
static int logi_dj_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data, struct hid_report *report, u8 *data,
int size) int size)
{ {
@ -633,36 +836,24 @@ static int logi_dj_raw_event(struct hid_device *hdev,
struct dj_report *dj_report = (struct dj_report *) data; struct dj_report *dj_report = (struct dj_report *) data;
unsigned long flags; unsigned long flags;
dbg_hid("%s, size:%d\n", __func__, size); /*
* Here we receive all data coming from iface 2, there are 3 cases:
/* Here we receive all data coming from iface 2, there are 4 cases:
* *
* 1) Data should continue its normal processing i.e. data does not * 1) Data is intended for this driver i. e. data contains arrival,
* come from the DJ collection, in which case we do nothing and * departure, etc notifications, in which case we queue them for delayed
* return 0, so hid-core can continue normal processing (will forward * processing by the work queue. We return 1 to hid-core as no further
* to associated hidraw device) * processing is required from it.
* *
* 2) Data is from DJ collection, and is intended for this driver i. e. * 2) Data informs a connection change, if the change means rf link
* data contains arrival, departure, etc notifications, in which case * loss, then we must send a null report to the upper layer to discard
* we queue them for delayed processing by the work queue. We return 1 * potentially pressed keys that may be repeated forever by the input
* to hid-core as no further processing is required from it. * layer. Return 1 to hid-core as no further processing is required.
* *
* 3) Data is from DJ collection, and informs a connection change, * 3) Data is an actual input event from a paired DJ device in which
* if the change means rf link loss, then we must send a null report * case we forward it to the correct hid device (via hid_input_report()
* to the upper layer to discard potentially pressed keys that may be * ) and return 1 so hid-core does not anything else with it.
* repeated forever by the input layer. Return 1 to hid-core as no
* further processing is required.
*
* 4) Data is from DJ collection and is an actual input event from
* a paired DJ device in which case we forward it to the correct hid
* device (via hid_input_report() ) and return 1 so hid-core does not do
* anything else with it.
*/ */
/* case 1) */
if (data[0] != REPORT_ID_DJ_SHORT)
return false;
if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) || if ((dj_report->device_index < DJ_DEVICE_INDEX_MIN) ||
(dj_report->device_index > DJ_DEVICE_INDEX_MAX)) { (dj_report->device_index > DJ_DEVICE_INDEX_MAX)) {
/* /*
@ -707,6 +898,80 @@ out:
return true; return true;
} }
static int logi_dj_hidpp_event(struct hid_device *hdev,
struct hid_report *report, u8 *data,
int size)
{
struct dj_receiver_dev *djrcv_dev = hid_get_drvdata(hdev);
struct dj_report *dj_report = (struct dj_report *) data;
unsigned long flags;
u8 device_index = dj_report->device_index;
if (device_index == HIDPP_RECEIVER_INDEX) {
/* special case were the device wants to know its unifying
* name */
if (size == HIDPP_REPORT_LONG_LENGTH &&
!memcmp(data, unifying_name_answer,
sizeof(unifying_name_answer)) &&
((data[4] & 0xF0) == 0x40))
device_index = (data[4] & 0x0F) + 1;
else
return false;
}
/*
* Data is from the HID++ collection, in this case, we forward the
* data to the corresponding child dj device and return 0 to hid-core
* so he data also goes to the hidraw device of the receiver. This
* allows a user space application to implement the full HID++ routing
* via the receiver.
*/
if ((device_index < DJ_DEVICE_INDEX_MIN) ||
(device_index > DJ_DEVICE_INDEX_MAX)) {
/*
* Device index is wrong, bail out.
* This driver can ignore safely the receiver notifications,
* so ignore those reports too.
*/
dev_err(&hdev->dev, "%s: invalid device index:%d\n",
__func__, dj_report->device_index);
return false;
}
spin_lock_irqsave(&djrcv_dev->lock, flags);
if (!djrcv_dev->paired_dj_devices[device_index])
/* received an event for an unknown device, bail out */
goto out;
logi_dj_recv_forward_hidpp(djrcv_dev->paired_dj_devices[device_index],
data, size);
out:
spin_unlock_irqrestore(&djrcv_dev->lock, flags);
return false;
}
static int logi_dj_raw_event(struct hid_device *hdev,
struct hid_report *report, u8 *data,
int size)
{
dbg_hid("%s, size:%d\n", __func__, size);
switch (data[0]) {
case REPORT_ID_DJ_SHORT:
return logi_dj_dj_event(hdev, report, data, size);
case REPORT_ID_HIDPP_SHORT:
/* intentional fallthrough */
case REPORT_ID_HIDPP_LONG:
return logi_dj_hidpp_event(hdev, report, data, size);
}
return false;
}
static int logi_dj_probe(struct hid_device *hdev, static int logi_dj_probe(struct hid_device *hdev,
const struct hid_device_id *id) const struct hid_device_id *id)
{ {
@ -714,9 +979,6 @@ static int logi_dj_probe(struct hid_device *hdev,
struct dj_receiver_dev *djrcv_dev; struct dj_receiver_dev *djrcv_dev;
int retval; int retval;
if (is_dj_device((struct dj_device *)hdev->driver_data))
return -ENODEV;
dbg_hid("%s called for ifnum %d\n", __func__, dbg_hid("%s called for ifnum %d\n", __func__,
intf->cur_altsetting->desc.bInterfaceNumber); intf->cur_altsetting->desc.bInterfaceNumber);
@ -869,22 +1131,6 @@ static void logi_dj_remove(struct hid_device *hdev)
hid_set_drvdata(hdev, NULL); hid_set_drvdata(hdev, NULL);
} }
static int logi_djdevice_probe(struct hid_device *hdev,
const struct hid_device_id *id)
{
int ret;
struct dj_device *dj_dev = hdev->driver_data;
if (!is_dj_device(dj_dev))
return -ENODEV;
ret = hid_parse(hdev);
if (!ret)
ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
return ret;
}
static const struct hid_device_id logi_dj_receivers[] = { static const struct hid_device_id logi_dj_receivers[] = {
{HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, {HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER)}, USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER)},
@ -906,51 +1152,8 @@ static struct hid_driver logi_djreceiver_driver = {
#endif #endif
}; };
module_hid_driver(logi_djreceiver_driver);
static const struct hid_device_id logi_dj_devices[] = {
{HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER)},
{HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH,
USB_DEVICE_ID_LOGITECH_UNIFYING_RECEIVER_2)},
{}
};
static struct hid_driver logi_djdevice_driver = {
.name = "logitech-djdevice",
.id_table = logi_dj_devices,
.probe = logi_djdevice_probe,
};
static int __init logi_dj_init(void)
{
int retval;
dbg_hid("Logitech-DJ:%s\n", __func__);
retval = hid_register_driver(&logi_djreceiver_driver);
if (retval)
return retval;
retval = hid_register_driver(&logi_djdevice_driver);
if (retval)
hid_unregister_driver(&logi_djreceiver_driver);
return retval;
}
static void __exit logi_dj_exit(void)
{
dbg_hid("Logitech-DJ:%s\n", __func__);
hid_unregister_driver(&logi_djdevice_driver);
hid_unregister_driver(&logi_djreceiver_driver);
}
module_init(logi_dj_init);
module_exit(logi_dj_exit);
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");
MODULE_AUTHOR("Logitech"); MODULE_AUTHOR("Logitech");
MODULE_AUTHOR("Nestor Lopez Casado"); MODULE_AUTHOR("Nestor Lopez Casado");

View File

@ -1,125 +0,0 @@
#ifndef __HID_LOGITECH_DJ_H
#define __HID_LOGITECH_DJ_H
/*
* HID driver for Logitech Unifying receivers
*
* Copyright (c) 2011 Logitech
*/
/*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include <linux/kfifo.h>
#define DJ_MAX_PAIRED_DEVICES 6
#define DJ_MAX_NUMBER_NOTIFICATIONS 8
#define DJ_RECEIVER_INDEX 0
#define DJ_DEVICE_INDEX_MIN 1
#define DJ_DEVICE_INDEX_MAX 6
#define DJREPORT_SHORT_LENGTH 15
#define DJREPORT_LONG_LENGTH 32
#define REPORT_ID_DJ_SHORT 0x20
#define REPORT_ID_DJ_LONG 0x21
#define REPORT_TYPE_RFREPORT_FIRST 0x01
#define REPORT_TYPE_RFREPORT_LAST 0x1F
/* Command Switch to DJ mode */
#define REPORT_TYPE_CMD_SWITCH 0x80
#define CMD_SWITCH_PARAM_DEVBITFIELD 0x00
#define CMD_SWITCH_PARAM_TIMEOUT_SECONDS 0x01
#define TIMEOUT_NO_KEEPALIVE 0x00
/* Command to Get the list of Paired devices */
#define REPORT_TYPE_CMD_GET_PAIRED_DEVICES 0x81
/* Device Paired Notification */
#define REPORT_TYPE_NOTIF_DEVICE_PAIRED 0x41
#define SPFUNCTION_MORE_NOTIF_EXPECTED 0x01
#define SPFUNCTION_DEVICE_LIST_EMPTY 0x02
#define DEVICE_PAIRED_PARAM_SPFUNCTION 0x00
#define DEVICE_PAIRED_PARAM_EQUAD_ID_LSB 0x01
#define DEVICE_PAIRED_PARAM_EQUAD_ID_MSB 0x02
#define DEVICE_PAIRED_RF_REPORT_TYPE 0x03
/* Device Un-Paired Notification */
#define REPORT_TYPE_NOTIF_DEVICE_UNPAIRED 0x40
/* Connection Status Notification */
#define REPORT_TYPE_NOTIF_CONNECTION_STATUS 0x42
#define CONNECTION_STATUS_PARAM_STATUS 0x00
#define STATUS_LINKLOSS 0x01
/* Error Notification */
#define REPORT_TYPE_NOTIF_ERROR 0x7F
#define NOTIF_ERROR_PARAM_ETYPE 0x00
#define ETYPE_KEEPALIVE_TIMEOUT 0x01
/* supported DJ HID && RF report types */
#define REPORT_TYPE_KEYBOARD 0x01
#define REPORT_TYPE_MOUSE 0x02
#define REPORT_TYPE_CONSUMER_CONTROL 0x03
#define REPORT_TYPE_SYSTEM_CONTROL 0x04
#define REPORT_TYPE_MEDIA_CENTER 0x08
#define REPORT_TYPE_LEDS 0x0E
/* RF Report types bitfield */
#define STD_KEYBOARD 0x00000002
#define STD_MOUSE 0x00000004
#define MULTIMEDIA 0x00000008
#define POWER_KEYS 0x00000010
#define MEDIA_CENTER 0x00000100
#define KBD_LEDS 0x00004000
struct dj_report {
u8 report_id;
u8 device_index;
u8 report_type;
u8 report_params[DJREPORT_SHORT_LENGTH - 3];
};
struct dj_receiver_dev {
struct hid_device *hdev;
struct dj_device *paired_dj_devices[DJ_MAX_PAIRED_DEVICES +
DJ_DEVICE_INDEX_MIN];
struct work_struct work;
struct kfifo notif_fifo;
spinlock_t lock;
bool querying_devices;
};
struct dj_device {
struct hid_device *hdev;
struct dj_receiver_dev *dj_receiver_dev;
u32 reports_supported;
u8 device_index;
};
/**
* is_dj_device - know if the given dj_device is not the receiver.
* @dj_dev: the dj device to test
*
* This macro tests if a struct dj_device pointer is a device created
* by the bus enumarator.
*/
#define is_dj_device(dj_dev) \
(&(dj_dev)->dj_receiver_dev->hdev->dev == (dj_dev)->hdev->dev.parent)
#endif

File diff suppressed because it is too large Load Diff

View File

@ -274,6 +274,8 @@ static const struct hid_device_id ms_devices[] = {
.driver_data = MS_NOGET }, .driver_data = MS_NOGET },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500), { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500),
.driver_data = MS_DUPLICATE_USAGES }, .driver_data = MS_DUPLICATE_USAGES },
{ HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3),
.driver_data = MS_HIDINPUT },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT), { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_BT),
.driver_data = MS_PRESENTER }, .driver_data = MS_PRESENTER },

View File

@ -67,6 +67,7 @@ MODULE_LICENSE("GPL");
#define MT_QUIRK_IGNORE_DUPLICATES (1 << 10) #define MT_QUIRK_IGNORE_DUPLICATES (1 << 10)
#define MT_QUIRK_HOVERING (1 << 11) #define MT_QUIRK_HOVERING (1 << 11)
#define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12) #define MT_QUIRK_CONTACT_CNT_ACCURATE (1 << 12)
#define MT_QUIRK_FORCE_GET_FEATURE (1 << 13)
#define MT_INPUTMODE_TOUCHSCREEN 0x02 #define MT_INPUTMODE_TOUCHSCREEN 0x02
#define MT_INPUTMODE_TOUCHPAD 0x03 #define MT_INPUTMODE_TOUCHPAD 0x03
@ -150,6 +151,7 @@ static void mt_post_parse(struct mt_device *td);
#define MT_CLS_FLATFROG 0x0107 #define MT_CLS_FLATFROG 0x0107
#define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108 #define MT_CLS_GENERALTOUCH_TWOFINGERS 0x0108
#define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109 #define MT_CLS_GENERALTOUCH_PWT_TENFINGERS 0x0109
#define MT_CLS_VTL 0x0110
#define MT_DEFAULT_MAXCONTACT 10 #define MT_DEFAULT_MAXCONTACT 10
#define MT_MAX_MAXCONTACT 250 #define MT_MAX_MAXCONTACT 250
@ -255,6 +257,11 @@ static struct mt_class mt_classes[] = {
.sn_move = 2048, .sn_move = 2048,
.maxcontacts = 40, .maxcontacts = 40,
}, },
{ .name = MT_CLS_VTL,
.quirks = MT_QUIRK_ALWAYS_VALID |
MT_QUIRK_CONTACT_CNT_ACCURATE |
MT_QUIRK_FORCE_GET_FEATURE,
},
{ } { }
}; };
@ -809,6 +816,9 @@ static void mt_set_input_mode(struct hid_device *hdev)
struct mt_device *td = hid_get_drvdata(hdev); struct mt_device *td = hid_get_drvdata(hdev);
struct hid_report *r; struct hid_report *r;
struct hid_report_enum *re; struct hid_report_enum *re;
struct mt_class *cls = &td->mtclass;
char *buf;
int report_len;
if (td->inputmode < 0) if (td->inputmode < 0)
return; return;
@ -816,6 +826,18 @@ static void mt_set_input_mode(struct hid_device *hdev)
re = &(hdev->report_enum[HID_FEATURE_REPORT]); re = &(hdev->report_enum[HID_FEATURE_REPORT]);
r = re->report_id_hash[td->inputmode]; r = re->report_id_hash[td->inputmode];
if (r) { if (r) {
if (cls->quirks & MT_QUIRK_FORCE_GET_FEATURE) {
report_len = hid_report_len(r);
buf = hid_alloc_report_buf(r, GFP_KERNEL);
if (!buf) {
hid_err(hdev, "failed to allocate buffer for report\n");
return;
}
hid_hw_raw_request(hdev, r->id, buf, report_len,
HID_FEATURE_REPORT,
HID_REQ_GET_REPORT);
kfree(buf);
}
r->field[0]->value[td->inputmode_index] = td->inputmode_value; r->field[0]->value[td->inputmode_index] = td->inputmode_value;
hid_hw_request(hdev, r, HID_REQ_SET_REPORT); hid_hw_request(hdev, r, HID_REQ_SET_REPORT);
} }
@ -1281,6 +1303,11 @@ static const struct hid_device_id mt_devices[] = {
MT_USB_DEVICE(USB_VENDOR_ID_UNITEC, MT_USB_DEVICE(USB_VENDOR_ID_UNITEC,
USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) }, USB_DEVICE_ID_UNITEC_USB_TOUCH_0A19) },
/* VTL panels */
{ .driver_data = MT_CLS_VTL,
MT_USB_DEVICE(USB_VENDOR_ID_VTL,
USB_DEVICE_ID_VTL_MULTITOUCH_FF3F) },
/* Wistron panels */ /* Wistron panels */
{ .driver_data = MT_CLS_NSMU, { .driver_data = MT_CLS_NSMU,
MT_USB_DEVICE(USB_VENDOR_ID_WISTRON, MT_USB_DEVICE(USB_VENDOR_ID_WISTRON,

View File

@ -0,0 +1,55 @@
/*
* Plantronics USB HID Driver
*
* Copyright (c) 2014 JD Cole <jd.cole@plantronics.com>
* Copyright (c) 2014 Terry Junge <terry.junge@plantronics.com>
*/
/*
* 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 "hid-ids.h"
#include <linux/hid.h>
#include <linux/module.h>
static int plantronics_input_mapping(struct hid_device *hdev,
struct hid_input *hi,
struct hid_field *field,
struct hid_usage *usage,
unsigned long **bit, int *max)
{
if (field->application == HID_CP_CONSUMERCONTROL
&& (usage->hid & HID_USAGE_PAGE) == HID_UP_CONSUMER) {
hid_dbg(hdev, "usage: %08x (appl: %08x) - defaulted\n",
usage->hid, field->application);
return 0;
}
hid_dbg(hdev, "usage: %08x (appl: %08x) - ignored\n",
usage->hid, field->application);
return -1;
}
static const struct hid_device_id plantronics_devices[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_PLANTRONICS, HID_ANY_ID) },
{ }
};
MODULE_DEVICE_TABLE(hid, plantronics_devices);
static struct hid_driver plantronics_driver = {
.name = "plantronics",
.id_table = plantronics_devices,
.input_mapping = plantronics_input_mapping,
};
module_hid_driver(plantronics_driver);
MODULE_AUTHOR("JD Cole <jd.cole@plantronics.com>");
MODULE_AUTHOR("Terry Junge <terry.junge@plantronics.com>");
MODULE_DESCRIPTION("Plantronics USB HID Driver");
MODULE_LICENSE("GPL");

View File

@ -584,11 +584,15 @@ static int rmi_populate_f11(struct hid_device *hdev)
bool has_query10 = false; bool has_query10 = false;
bool has_query11; bool has_query11;
bool has_query12; bool has_query12;
bool has_query27;
bool has_query28;
bool has_query36 = false;
bool has_physical_props; bool has_physical_props;
bool has_gestures; bool has_gestures;
bool has_rel; bool has_rel;
bool has_data40 = false;
unsigned x_size, y_size; unsigned x_size, y_size;
u16 query12_offset; u16 query_offset;
if (!data->f11.query_base_addr) { if (!data->f11.query_base_addr) {
hid_err(hdev, "No 2D sensor found, giving up.\n"); hid_err(hdev, "No 2D sensor found, giving up.\n");
@ -604,6 +608,8 @@ static int rmi_populate_f11(struct hid_device *hdev)
has_query9 = !!(buf[0] & BIT(3)); has_query9 = !!(buf[0] & BIT(3));
has_query11 = !!(buf[0] & BIT(4)); has_query11 = !!(buf[0] & BIT(4));
has_query12 = !!(buf[0] & BIT(5)); has_query12 = !!(buf[0] & BIT(5));
has_query27 = !!(buf[0] & BIT(6));
has_query28 = !!(buf[0] & BIT(7));
/* query 1 to get the max number of fingers */ /* query 1 to get the max number of fingers */
ret = rmi_read(hdev, data->f11.query_base_addr + 1, buf); ret = rmi_read(hdev, data->f11.query_base_addr + 1, buf);
@ -626,43 +632,43 @@ static int rmi_populate_f11(struct hid_device *hdev)
has_rel = !!(buf[0] & BIT(3)); has_rel = !!(buf[0] & BIT(3));
has_gestures = !!(buf[0] & BIT(5)); has_gestures = !!(buf[0] & BIT(5));
/*
* At least 4 queries are guaranteed to be present in F11
* +1 for query 5 which is present since absolute events are
* reported and +1 for query 12.
*/
query_offset = 6;
if (has_rel)
++query_offset; /* query 6 is present */
if (has_gestures) { if (has_gestures) {
/* query 8 to find out if query 10 exists */ /* query 8 to find out if query 10 exists */
ret = rmi_read(hdev, data->f11.query_base_addr + 8, buf); ret = rmi_read(hdev,
data->f11.query_base_addr + query_offset + 1, buf);
if (ret) { if (ret) {
hid_err(hdev, "can not read gesture information: %d.\n", hid_err(hdev, "can not read gesture information: %d.\n",
ret); ret);
return ret; return ret;
} }
has_query10 = !!(buf[0] & BIT(2)); has_query10 = !!(buf[0] & BIT(2));
query_offset += 2; /* query 7 and 8 are present */
} }
/*
* At least 4 queries are guaranteed to be present in F11
* +1 for query 5 which is present since absolute events are
* reported and +1 for query 12.
*/
query12_offset = 6;
if (has_rel)
++query12_offset; /* query 6 is present */
if (has_gestures)
query12_offset += 2; /* query 7 and 8 are present */
if (has_query9) if (has_query9)
++query12_offset; ++query_offset;
if (has_query10) if (has_query10)
++query12_offset; ++query_offset;
if (has_query11) if (has_query11)
++query12_offset; ++query_offset;
/* query 12 to know if the physical properties are reported */ /* query 12 to know if the physical properties are reported */
if (has_query12) { if (has_query12) {
ret = rmi_read(hdev, data->f11.query_base_addr ret = rmi_read(hdev, data->f11.query_base_addr
+ query12_offset, buf); + query_offset, buf);
if (ret) { if (ret) {
hid_err(hdev, "can not get query 12: %d.\n", ret); hid_err(hdev, "can not get query 12: %d.\n", ret);
return ret; return ret;
@ -670,9 +676,10 @@ static int rmi_populate_f11(struct hid_device *hdev)
has_physical_props = !!(buf[0] & BIT(5)); has_physical_props = !!(buf[0] & BIT(5));
if (has_physical_props) { if (has_physical_props) {
query_offset += 1;
ret = rmi_read_block(hdev, ret = rmi_read_block(hdev,
data->f11.query_base_addr data->f11.query_base_addr
+ query12_offset + 1, buf, 4); + query_offset, buf, 4);
if (ret) { if (ret) {
hid_err(hdev, "can not read query 15-18: %d.\n", hid_err(hdev, "can not read query 15-18: %d.\n",
ret); ret);
@ -687,9 +694,45 @@ static int rmi_populate_f11(struct hid_device *hdev)
hid_info(hdev, "%s: size in mm: %d x %d\n", hid_info(hdev, "%s: size in mm: %d x %d\n",
__func__, data->x_size_mm, data->y_size_mm); __func__, data->x_size_mm, data->y_size_mm);
/*
* query 15 - 18 contain the size of the sensor
* and query 19 - 26 contain bezel dimensions
*/
query_offset += 12;
} }
} }
if (has_query27)
++query_offset;
if (has_query28) {
ret = rmi_read(hdev, data->f11.query_base_addr
+ query_offset, buf);
if (ret) {
hid_err(hdev, "can not get query 28: %d.\n", ret);
return ret;
}
has_query36 = !!(buf[0] & BIT(6));
}
if (has_query36) {
query_offset += 2;
ret = rmi_read(hdev, data->f11.query_base_addr
+ query_offset, buf);
if (ret) {
hid_err(hdev, "can not get query 36: %d.\n", ret);
return ret;
}
has_data40 = !!(buf[0] & BIT(5));
}
if (has_data40)
data->f11.report_size += data->max_fingers * 2;
/* /*
* retrieve the ctrl registers * retrieve the ctrl registers
* the ctrl register has a size of 20 but a fw bug split it into 16 + 4, * the ctrl register has a size of 20 but a fw bug split it into 16 + 4,

View File

@ -46,6 +46,7 @@ static void kone_profile_activated(struct kone_device *kone, uint new_profile)
static void kone_profile_report(struct kone_device *kone, uint new_profile) static void kone_profile_report(struct kone_device *kone, uint new_profile)
{ {
struct kone_roccat_report roccat_report; struct kone_roccat_report roccat_report;
roccat_report.event = kone_mouse_event_switch_profile; roccat_report.event = kone_mouse_event_switch_profile;
roccat_report.value = new_profile; roccat_report.value = new_profile;
roccat_report.key = 0; roccat_report.key = 0;
@ -163,6 +164,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
struct kone_settings const *settings) struct kone_settings const *settings)
{ {
int retval; int retval;
retval = kone_send(usb_dev, kone_command_settings, retval = kone_send(usb_dev, kone_command_settings,
settings, sizeof(struct kone_settings)); settings, sizeof(struct kone_settings));
if (retval) if (retval)
@ -387,7 +389,7 @@ static struct bin_attribute bin_attr_profile##number = { \
.read = kone_sysfs_read_profilex, \ .read = kone_sysfs_read_profilex, \
.write = kone_sysfs_write_profilex, \ .write = kone_sysfs_write_profilex, \
.private = &profile_numbers[number-1], \ .private = &profile_numbers[number-1], \
}; }
PROFILE_ATTR(1); PROFILE_ATTR(1);
PROFILE_ATTR(2); PROFILE_ATTR(2);
PROFILE_ATTR(3); PROFILE_ATTR(3);
@ -456,6 +458,7 @@ static ssize_t kone_sysfs_show_tcu(struct device *dev,
static int kone_tcu_command(struct usb_device *usb_dev, int number) static int kone_tcu_command(struct usb_device *usb_dev, int number)
{ {
unsigned char value; unsigned char value;
value = number; value = number;
return kone_send(usb_dev, kone_command_calibrate, &value, 1); return kone_send(usb_dev, kone_command_calibrate, &value, 1);
} }
@ -697,10 +700,8 @@ static int kone_init_specials(struct hid_device *hdev)
== USB_INTERFACE_PROTOCOL_MOUSE) { == USB_INTERFACE_PROTOCOL_MOUSE) {
kone = kzalloc(sizeof(*kone), GFP_KERNEL); kone = kzalloc(sizeof(*kone), GFP_KERNEL);
if (!kone) { if (!kone)
hid_err(hdev, "can't alloc device descriptor\n");
return -ENOMEM; return -ENOMEM;
}
hid_set_drvdata(hdev, kone); hid_set_drvdata(hdev, kone);
retval = kone_init_kone_device_struct(usb_dev, kone); retval = kone_init_kone_device_struct(usb_dev, kone);

View File

@ -7,7 +7,7 @@
* (This module is based on "hid-ortek".) * (This module is based on "hid-ortek".)
* Copyright (c) 2012 Andreas Hübner * Copyright (c) 2012 Andreas Hübner
* *
* R.A.T.7, M.M.O.7 (USB gaming mice): * R.A.T.7, R.A.T.9, M.M.O.7 (USB gaming mice):
* Fixes the mode button which cycles through three constantly pressed * Fixes the mode button which cycles through three constantly pressed
* buttons. All three press events are mapped to one button and the * buttons. All three press events are mapped to one button and the
* missing release event is generated immediately. * missing release event is generated immediately.
@ -179,6 +179,8 @@ static const struct hid_device_id saitek_devices[] = {
.driver_data = SAITEK_FIX_PS1000 }, .driver_data = SAITEK_FIX_PS1000 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_RAT7),
.driver_data = SAITEK_RELEASE_MODE_RAT7 }, .driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_MADCATZ, USB_DEVICE_ID_MADCATZ_RAT9),
.driver_data = SAITEK_RELEASE_MODE_RAT7 },
{ HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7), { HID_USB_DEVICE(USB_VENDOR_ID_SAITEK, USB_DEVICE_ID_SAITEK_MMO7),
.driver_data = SAITEK_RELEASE_MODE_MMO7 }, .driver_data = SAITEK_RELEASE_MODE_MMO7 },
{ } { }

View File

@ -798,6 +798,12 @@ union sixaxis_output_report_01 {
__u8 buf[36]; __u8 buf[36];
}; };
#define DS4_REPORT_0x02_SIZE 37
#define DS4_REPORT_0x05_SIZE 32
#define DS4_REPORT_0x11_SIZE 78
#define DS4_REPORT_0x81_SIZE 7
#define SIXAXIS_REPORT_0xF2_SIZE 18
static spinlock_t sony_dev_list_lock; static spinlock_t sony_dev_list_lock;
static LIST_HEAD(sony_device_list); static LIST_HEAD(sony_device_list);
static DEFINE_IDA(sony_device_id_allocator); static DEFINE_IDA(sony_device_id_allocator);
@ -811,6 +817,7 @@ struct sony_sc {
struct work_struct state_worker; struct work_struct state_worker;
struct power_supply battery; struct power_supply battery;
int device_id; int device_id;
__u8 *output_report_dmabuf;
#ifdef CONFIG_SONY_FF #ifdef CONFIG_SONY_FF
__u8 left; __u8 left;
@ -1142,9 +1149,20 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev)
static int sixaxis_set_operational_bt(struct hid_device *hdev) static int sixaxis_set_operational_bt(struct hid_device *hdev)
{ {
unsigned char buf[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 }; static const __u8 report[] = { 0xf4, 0x42, 0x03, 0x00, 0x00 };
return hid_hw_raw_request(hdev, buf[0], buf, sizeof(buf), __u8 *buf;
int ret;
buf = kmemdup(report, sizeof(report), GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = hid_hw_raw_request(hdev, buf[0], buf, sizeof(report),
HID_FEATURE_REPORT, HID_REQ_SET_REPORT); HID_FEATURE_REPORT, HID_REQ_SET_REPORT);
kfree(buf);
return ret;
} }
/* /*
@ -1153,10 +1171,19 @@ static int sixaxis_set_operational_bt(struct hid_device *hdev)
*/ */
static int dualshock4_set_operational_bt(struct hid_device *hdev) static int dualshock4_set_operational_bt(struct hid_device *hdev)
{ {
__u8 buf[37] = { 0 }; __u8 *buf;
int ret;
return hid_hw_raw_request(hdev, 0x02, buf, sizeof(buf), buf = kmalloc(DS4_REPORT_0x02_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
ret = hid_hw_raw_request(hdev, 0x02, buf, DS4_REPORT_0x02_SIZE,
HID_FEATURE_REPORT, HID_REQ_GET_REPORT); HID_FEATURE_REPORT, HID_REQ_GET_REPORT);
kfree(buf);
return ret;
} }
static void sixaxis_set_leds_from_id(int id, __u8 values[MAX_LEDS]) static void sixaxis_set_leds_from_id(int id, __u8 values[MAX_LEDS])
@ -1471,9 +1498,7 @@ error_leds:
static void sixaxis_state_worker(struct work_struct *work) static void sixaxis_state_worker(struct work_struct *work)
{ {
struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); static const union sixaxis_output_report_01 default_report = {
int n;
union sixaxis_output_report_01 report = {
.buf = { .buf = {
0x01, 0x01,
0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00,
@ -1485,20 +1510,27 @@ static void sixaxis_state_worker(struct work_struct *work)
0x00, 0x00, 0x00, 0x00, 0x00 0x00, 0x00, 0x00, 0x00, 0x00
} }
}; };
struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
struct sixaxis_output_report *report =
(struct sixaxis_output_report *)sc->output_report_dmabuf;
int n;
/* Initialize the report with default values */
memcpy(report, &default_report, sizeof(struct sixaxis_output_report));
#ifdef CONFIG_SONY_FF #ifdef CONFIG_SONY_FF
report.data.rumble.right_motor_on = sc->right ? 1 : 0; report->rumble.right_motor_on = sc->right ? 1 : 0;
report.data.rumble.left_motor_force = sc->left; report->rumble.left_motor_force = sc->left;
#endif #endif
report.data.leds_bitmap |= sc->led_state[0] << 1; report->leds_bitmap |= sc->led_state[0] << 1;
report.data.leds_bitmap |= sc->led_state[1] << 2; report->leds_bitmap |= sc->led_state[1] << 2;
report.data.leds_bitmap |= sc->led_state[2] << 3; report->leds_bitmap |= sc->led_state[2] << 3;
report.data.leds_bitmap |= sc->led_state[3] << 4; report->leds_bitmap |= sc->led_state[3] << 4;
/* Set flag for all leds off, required for 3rd party INTEC controller */ /* Set flag for all leds off, required for 3rd party INTEC controller */
if ((report.data.leds_bitmap & 0x1E) == 0) if ((report->leds_bitmap & 0x1E) == 0)
report.data.leds_bitmap |= 0x20; report->leds_bitmap |= 0x20;
/* /*
* The LEDs in the report are indexed in reverse order to their * The LEDs in the report are indexed in reverse order to their
@ -1511,28 +1543,30 @@ static void sixaxis_state_worker(struct work_struct *work)
*/ */
for (n = 0; n < 4; n++) { for (n = 0; n < 4; n++) {
if (sc->led_delay_on[n] || sc->led_delay_off[n]) { if (sc->led_delay_on[n] || sc->led_delay_off[n]) {
report.data.led[3 - n].duty_off = sc->led_delay_off[n]; report->led[3 - n].duty_off = sc->led_delay_off[n];
report.data.led[3 - n].duty_on = sc->led_delay_on[n]; report->led[3 - n].duty_on = sc->led_delay_on[n];
} }
} }
hid_hw_raw_request(sc->hdev, report.data.report_id, report.buf, hid_hw_raw_request(sc->hdev, report->report_id, (__u8 *)report,
sizeof(report), HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); sizeof(struct sixaxis_output_report),
HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
} }
static void dualshock4_state_worker(struct work_struct *work) static void dualshock4_state_worker(struct work_struct *work)
{ {
struct sony_sc *sc = container_of(work, struct sony_sc, state_worker); struct sony_sc *sc = container_of(work, struct sony_sc, state_worker);
struct hid_device *hdev = sc->hdev; struct hid_device *hdev = sc->hdev;
__u8 *buf = sc->output_report_dmabuf;
int offset; int offset;
__u8 buf[78] = { 0 };
if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
memset(buf, 0, DS4_REPORT_0x05_SIZE);
buf[0] = 0x05; buf[0] = 0x05;
buf[1] = 0xFF; buf[1] = 0xFF;
offset = 4; offset = 4;
} else { } else {
memset(buf, 0, DS4_REPORT_0x11_SIZE);
buf[0] = 0x11; buf[0] = 0x11;
buf[1] = 0xB0; buf[1] = 0xB0;
buf[3] = 0x0F; buf[3] = 0x0F;
@ -1560,12 +1594,33 @@ static void dualshock4_state_worker(struct work_struct *work)
buf[offset++] = sc->led_delay_off[3]; buf[offset++] = sc->led_delay_off[3];
if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) if (sc->quirks & DUALSHOCK4_CONTROLLER_USB)
hid_hw_output_report(hdev, buf, 32); hid_hw_output_report(hdev, buf, DS4_REPORT_0x05_SIZE);
else else
hid_hw_raw_request(hdev, 0x11, buf, 78, hid_hw_raw_request(hdev, 0x11, buf, DS4_REPORT_0x11_SIZE,
HID_OUTPUT_REPORT, HID_REQ_SET_REPORT); HID_OUTPUT_REPORT, HID_REQ_SET_REPORT);
} }
static int sony_allocate_output_report(struct sony_sc *sc)
{
if (sc->quirks & SIXAXIS_CONTROLLER)
sc->output_report_dmabuf =
kmalloc(sizeof(union sixaxis_output_report_01),
GFP_KERNEL);
else if (sc->quirks & DUALSHOCK4_CONTROLLER_BT)
sc->output_report_dmabuf = kmalloc(DS4_REPORT_0x11_SIZE,
GFP_KERNEL);
else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB)
sc->output_report_dmabuf = kmalloc(DS4_REPORT_0x05_SIZE,
GFP_KERNEL);
else
return 0;
if (!sc->output_report_dmabuf)
return -ENOMEM;
return 0;
}
#ifdef CONFIG_SONY_FF #ifdef CONFIG_SONY_FF
static int sony_play_effect(struct input_dev *dev, void *data, static int sony_play_effect(struct input_dev *dev, void *data,
struct ff_effect *effect) struct ff_effect *effect)
@ -1754,6 +1809,7 @@ static int sony_get_bt_devaddr(struct sony_sc *sc)
static int sony_check_add(struct sony_sc *sc) static int sony_check_add(struct sony_sc *sc)
{ {
__u8 *buf = NULL;
int n, ret; int n, ret;
if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) || if ((sc->quirks & DUALSHOCK4_CONTROLLER_BT) ||
@ -1769,36 +1825,44 @@ static int sony_check_add(struct sony_sc *sc)
return 0; return 0;
} }
} else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) { } else if (sc->quirks & DUALSHOCK4_CONTROLLER_USB) {
__u8 buf[7]; buf = kmalloc(DS4_REPORT_0x81_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
/* /*
* The MAC address of a DS4 controller connected via USB can be * The MAC address of a DS4 controller connected via USB can be
* retrieved with feature report 0x81. The address begins at * retrieved with feature report 0x81. The address begins at
* offset 1. * offset 1.
*/ */
ret = hid_hw_raw_request(sc->hdev, 0x81, buf, sizeof(buf), ret = hid_hw_raw_request(sc->hdev, 0x81, buf,
HID_FEATURE_REPORT, HID_REQ_GET_REPORT); DS4_REPORT_0x81_SIZE, HID_FEATURE_REPORT,
HID_REQ_GET_REPORT);
if (ret != 7) { if (ret != DS4_REPORT_0x81_SIZE) {
hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n"); hid_err(sc->hdev, "failed to retrieve feature report 0x81 with the DualShock 4 MAC address\n");
return ret < 0 ? ret : -EINVAL; ret = ret < 0 ? ret : -EINVAL;
goto out_free;
} }
memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address)); memcpy(sc->mac_address, &buf[1], sizeof(sc->mac_address));
} else if (sc->quirks & SIXAXIS_CONTROLLER_USB) { } else if (sc->quirks & SIXAXIS_CONTROLLER_USB) {
__u8 buf[18]; buf = kmalloc(SIXAXIS_REPORT_0xF2_SIZE, GFP_KERNEL);
if (!buf)
return -ENOMEM;
/* /*
* The MAC address of a Sixaxis controller connected via USB can * The MAC address of a Sixaxis controller connected via USB can
* be retrieved with feature report 0xf2. The address begins at * be retrieved with feature report 0xf2. The address begins at
* offset 4. * offset 4.
*/ */
ret = hid_hw_raw_request(sc->hdev, 0xf2, buf, sizeof(buf), ret = hid_hw_raw_request(sc->hdev, 0xf2, buf,
HID_FEATURE_REPORT, HID_REQ_GET_REPORT); SIXAXIS_REPORT_0xF2_SIZE, HID_FEATURE_REPORT,
HID_REQ_GET_REPORT);
if (ret != 18) { if (ret != SIXAXIS_REPORT_0xF2_SIZE) {
hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n"); hid_err(sc->hdev, "failed to retrieve feature report 0xf2 with the Sixaxis MAC address\n");
return ret < 0 ? ret : -EINVAL; ret = ret < 0 ? ret : -EINVAL;
goto out_free;
} }
/* /*
@ -1811,7 +1875,13 @@ static int sony_check_add(struct sony_sc *sc)
return 0; return 0;
} }
return sony_check_add_dev_list(sc); ret = sony_check_add_dev_list(sc);
out_free:
kfree(buf);
return ret;
} }
static int sony_set_device_id(struct sony_sc *sc) static int sony_set_device_id(struct sony_sc *sc)
@ -1895,6 +1965,12 @@ static int sony_probe(struct hid_device *hdev, const struct hid_device_id *id)
return ret; return ret;
} }
ret = sony_allocate_output_report(sc);
if (ret < 0) {
hid_err(hdev, "failed to allocate the output report buffer\n");
goto err_stop;
}
ret = sony_set_device_id(sc); ret = sony_set_device_id(sc);
if (ret < 0) { if (ret < 0) {
hid_err(hdev, "failed to allocate the device id\n"); hid_err(hdev, "failed to allocate the device id\n");
@ -1984,6 +2060,7 @@ err_stop:
if (sc->quirks & SONY_BATTERY_SUPPORT) if (sc->quirks & SONY_BATTERY_SUPPORT)
sony_battery_remove(sc); sony_battery_remove(sc);
sony_cancel_work_sync(sc); sony_cancel_work_sync(sc);
kfree(sc->output_report_dmabuf);
sony_remove_dev_list(sc); sony_remove_dev_list(sc);
sony_release_device_id(sc); sony_release_device_id(sc);
hid_hw_stop(hdev); hid_hw_stop(hdev);
@ -2004,6 +2081,8 @@ static void sony_remove(struct hid_device *hdev)
sony_cancel_work_sync(sc); sony_cancel_work_sync(sc);
kfree(sc->output_report_dmabuf);
sony_remove_dev_list(sc); sony_remove_dev_list(sc);
sony_release_device_id(sc); sony_release_device_id(sc);
@ -2034,6 +2113,9 @@ static const struct hid_device_id sony_devices[] = {
/* Logitech Harmony Adapter for PS3 */ /* Logitech Harmony Adapter for PS3 */
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3), { HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_PS3),
.driver_data = PS3REMOTE }, .driver_data = PS3REMOTE },
/* SMK-Link PS3 BD Remote Control */
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_SMK, USB_DEVICE_ID_SMK_PS3_BDREMOTE),
.driver_data = PS3REMOTE },
/* Sony Dualshock 4 controllers for PS4 */ /* Sony Dualshock 4 controllers for PS4 */
{ HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER), { HID_USB_DEVICE(USB_VENDOR_ID_SONY, USB_DEVICE_ID_SONY_PS4_CONTROLLER),
.driver_data = DUALSHOCK4_CONTROLLER_USB }, .driver_data = DUALSHOCK4_CONTROLLER_USB },

View File

@ -137,6 +137,7 @@ struct i2c_hid {
* descriptor. */ * descriptor. */
unsigned int bufsize; /* i2c buffer size */ unsigned int bufsize; /* i2c buffer size */
char *inbuf; /* Input buffer */ char *inbuf; /* Input buffer */
char *rawbuf; /* Raw Input buffer */
char *cmdbuf; /* Command buffer */ char *cmdbuf; /* Command buffer */
char *argsbuf; /* Command arguments buffer */ char *argsbuf; /* Command arguments buffer */
@ -369,7 +370,7 @@ static int i2c_hid_hwreset(struct i2c_client *client)
static void i2c_hid_get_input(struct i2c_hid *ihid) static void i2c_hid_get_input(struct i2c_hid *ihid)
{ {
int ret, ret_size; int ret, ret_size;
int size = le16_to_cpu(ihid->hdesc.wMaxInputLength); int size = ihid->bufsize;
ret = i2c_master_recv(ihid->client, ihid->inbuf, size); ret = i2c_master_recv(ihid->client, ihid->inbuf, size);
if (ret != size) { if (ret != size) {
@ -437,7 +438,7 @@ static void i2c_hid_init_report(struct hid_report *report, u8 *buffer,
report->id, buffer, size)) report->id, buffer, size))
return; return;
i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, ihid->inbuf); i2c_hid_dbg(ihid, "report (len=%d): %*ph\n", size, size, buffer);
ret_size = buffer[0] | (buffer[1] << 8); ret_size = buffer[0] | (buffer[1] << 8);
@ -504,9 +505,11 @@ static void i2c_hid_find_max_report(struct hid_device *hid, unsigned int type,
static void i2c_hid_free_buffers(struct i2c_hid *ihid) static void i2c_hid_free_buffers(struct i2c_hid *ihid)
{ {
kfree(ihid->inbuf); kfree(ihid->inbuf);
kfree(ihid->rawbuf);
kfree(ihid->argsbuf); kfree(ihid->argsbuf);
kfree(ihid->cmdbuf); kfree(ihid->cmdbuf);
ihid->inbuf = NULL; ihid->inbuf = NULL;
ihid->rawbuf = NULL;
ihid->cmdbuf = NULL; ihid->cmdbuf = NULL;
ihid->argsbuf = NULL; ihid->argsbuf = NULL;
ihid->bufsize = 0; ihid->bufsize = 0;
@ -522,10 +525,11 @@ static int i2c_hid_alloc_buffers(struct i2c_hid *ihid, size_t report_size)
report_size; /* report */ report_size; /* report */
ihid->inbuf = kzalloc(report_size, GFP_KERNEL); ihid->inbuf = kzalloc(report_size, GFP_KERNEL);
ihid->rawbuf = kzalloc(report_size, GFP_KERNEL);
ihid->argsbuf = kzalloc(args_len, GFP_KERNEL); ihid->argsbuf = kzalloc(args_len, GFP_KERNEL);
ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL); ihid->cmdbuf = kzalloc(sizeof(union command) + args_len, GFP_KERNEL);
if (!ihid->inbuf || !ihid->argsbuf || !ihid->cmdbuf) { if (!ihid->inbuf || !ihid->rawbuf || !ihid->argsbuf || !ihid->cmdbuf) {
i2c_hid_free_buffers(ihid); i2c_hid_free_buffers(ihid);
return -ENOMEM; return -ENOMEM;
} }
@ -552,12 +556,12 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,
ret = i2c_hid_get_report(client, ret = i2c_hid_get_report(client,
report_type == HID_FEATURE_REPORT ? 0x03 : 0x01, report_type == HID_FEATURE_REPORT ? 0x03 : 0x01,
report_number, ihid->inbuf, ask_count); report_number, ihid->rawbuf, ask_count);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret_count = ihid->inbuf[0] | (ihid->inbuf[1] << 8); ret_count = ihid->rawbuf[0] | (ihid->rawbuf[1] << 8);
if (ret_count <= 2) if (ret_count <= 2)
return 0; return 0;
@ -566,7 +570,7 @@ static int i2c_hid_get_raw_report(struct hid_device *hid,
/* The query buffer contains the size, dropping it in the reply */ /* The query buffer contains the size, dropping it in the reply */
count = min(count, ret_count - 2); count = min(count, ret_count - 2);
memcpy(buf, ihid->inbuf + 2, count); memcpy(buf, ihid->rawbuf + 2, count);
return count; return count;
} }

View File

@ -278,6 +278,7 @@ static void hid_irq_in(struct urb *urb)
usbhid->retry_delay = 0; usbhid->retry_delay = 0;
if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open) if ((hid->quirks & HID_QUIRK_ALWAYS_POLL) && !hid->open)
break; break;
if (!test_bit(HID_RESUME_RUNNING, &usbhid->iofl)) {
hid_input_report(urb->context, HID_INPUT_REPORT, hid_input_report(urb->context, HID_INPUT_REPORT,
urb->transfer_buffer, urb->transfer_buffer,
urb->actual_length, 1); urb->actual_length, 1);
@ -290,6 +291,7 @@ static void hid_irq_in(struct urb *urb)
set_bit(HID_KEYS_PRESSED, &usbhid->iofl); set_bit(HID_KEYS_PRESSED, &usbhid->iofl);
else else
clear_bit(HID_KEYS_PRESSED, &usbhid->iofl); clear_bit(HID_KEYS_PRESSED, &usbhid->iofl);
}
break; break;
case -EPIPE: /* stall */ case -EPIPE: /* stall */
usbhid_mark_busy(usbhid); usbhid_mark_busy(usbhid);
@ -338,8 +340,7 @@ static int hid_submit_out(struct hid_device *hid)
report = usbhid->out[usbhid->outtail].report; report = usbhid->out[usbhid->outtail].report;
raw_report = usbhid->out[usbhid->outtail].raw_report; raw_report = usbhid->out[usbhid->outtail].raw_report;
usbhid->urbout->transfer_buffer_length = ((report->size - 1) >> 3) + usbhid->urbout->transfer_buffer_length = hid_report_len(report);
1 + (report->id > 0);
usbhid->urbout->dev = hid_to_usb_dev(hid); usbhid->urbout->dev = hid_to_usb_dev(hid);
if (raw_report) { if (raw_report) {
memcpy(usbhid->outbuf, raw_report, memcpy(usbhid->outbuf, raw_report,
@ -688,6 +689,7 @@ int usbhid_open(struct hid_device *hid)
goto done; goto done;
} }
usbhid->intf->needs_remote_wakeup = 1; usbhid->intf->needs_remote_wakeup = 1;
set_bit(HID_RESUME_RUNNING, &usbhid->iofl);
res = hid_start_in(hid); res = hid_start_in(hid);
if (res) { if (res) {
if (res != -ENOSPC) { if (res != -ENOSPC) {
@ -701,6 +703,15 @@ int usbhid_open(struct hid_device *hid)
} }
} }
usb_autopm_put_interface(usbhid->intf); usb_autopm_put_interface(usbhid->intf);
/*
* In case events are generated while nobody was listening,
* some are released when the device is re-opened.
* Wait 50 msec for the queue to empty before allowing events
* to go through hid.
*/
msleep(50);
clear_bit(HID_RESUME_RUNNING, &usbhid->iofl);
} }
done: done:
mutex_unlock(&hid_open_mut); mutex_unlock(&hid_open_mut);

View File

@ -73,11 +73,13 @@ static const struct hid_blacklist {
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_009B, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_0103, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_010c, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL }, { USB_VENDOR_ID_ELAN, USB_DEVICE_ID_ELAN_TOUCHSCREEN_016F, HID_QUIRK_ALWAYS_POLL },
{ USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET }, { USB_VENDOR_ID_ELO, USB_DEVICE_ID_ELO_TS2700, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_FORMOSA, USB_DEVICE_ID_FORMOSA_IR_RECEIVER, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET }, { USB_VENDOR_ID_FREESCALE, USB_DEVICE_ID_FREESCALE_MX28, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET }, { USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_NOGET },
{ USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_TYPE_COVER_3, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_NEXIO, USB_DEVICE_ID_NEXIO_MULTITOUCH_PTI0750, HID_QUIRK_NO_INIT_REPORTS },
{ USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS }, { USB_VENDOR_ID_NOVATEK, USB_DEVICE_ID_NOVATEK_MOUSE, HID_QUIRK_NO_INIT_REPORTS },

View File

@ -52,6 +52,7 @@ struct usb_interface *usbhid_find_interface(int minor);
#define HID_STARTED 8 #define HID_STARTED 8
#define HID_KEYS_PRESSED 10 #define HID_KEYS_PRESSED 10
#define HID_NO_BANDWIDTH 11 #define HID_NO_BANDWIDTH 11
#define HID_RESUME_RUNNING 12
/* /*
* USB-specific HID struct, to be pointed to * USB-specific HID struct, to be pointed to

View File

@ -140,7 +140,7 @@ extern const struct hid_device_id wacom_ids[];
void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len); void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len);
void wacom_setup_device_quirks(struct wacom_features *features); void wacom_setup_device_quirks(struct wacom_features *features);
int wacom_setup_input_capabilities(struct input_dev *input_dev, int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac); struct wacom_wac *wacom_wac);
int wacom_setup_pad_input_capabilities(struct input_dev *input_dev, int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac); struct wacom_wac *wacom_wac);

View File

@ -13,6 +13,7 @@
#include "wacom_wac.h" #include "wacom_wac.h"
#include "wacom.h" #include "wacom.h"
#include <linux/input/mt.h>
#define WAC_MSG_RETRIES 5 #define WAC_MSG_RETRIES 5
@ -70,22 +71,15 @@ static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
static int wacom_open(struct input_dev *dev) static int wacom_open(struct input_dev *dev)
{ {
struct wacom *wacom = input_get_drvdata(dev); struct wacom *wacom = input_get_drvdata(dev);
int retval;
mutex_lock(&wacom->lock); return hid_hw_open(wacom->hdev);
retval = hid_hw_open(wacom->hdev);
mutex_unlock(&wacom->lock);
return retval;
} }
static void wacom_close(struct input_dev *dev) static void wacom_close(struct input_dev *dev)
{ {
struct wacom *wacom = input_get_drvdata(dev); struct wacom *wacom = input_get_drvdata(dev);
mutex_lock(&wacom->lock);
hid_hw_close(wacom->hdev); hid_hw_close(wacom->hdev);
mutex_unlock(&wacom->lock);
} }
/* /*
@ -192,9 +186,15 @@ static void wacom_usage_mapping(struct hid_device *hdev,
if (!pen && !finger) if (!pen && !finger)
return; return;
/*
* Bamboo models do not support HID_DG_CONTACTMAX.
* And, Bamboo Pen only descriptor contains touch.
*/
if (features->type != BAMBOO_PT) {
/* ISDv4 touch devices at least supports one touch point */
if (finger && !features->touch_max) if (finger && !features->touch_max)
/* touch device at least supports one touch point */
features->touch_max = 1; features->touch_max = 1;
}
switch (usage->hid) { switch (usage->hid) {
case HID_GD_X: case HID_GD_X:
@ -230,6 +230,21 @@ static void wacom_usage_mapping(struct hid_device *hdev,
wacom_wac_usage_mapping(hdev, field, usage); wacom_wac_usage_mapping(hdev, field, usage);
} }
static void wacom_post_parse_hid(struct hid_device *hdev,
struct wacom_features *features)
{
struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac;
if (features->type == HID_GENERIC) {
/* Any last-minute generic device setup */
if (features->touch_max > 1) {
input_mt_init_slots(wacom_wac->input, wacom_wac->features.touch_max,
INPUT_MT_DIRECT);
}
}
}
static void wacom_parse_hid(struct hid_device *hdev, static void wacom_parse_hid(struct hid_device *hdev,
struct wacom_features *features) struct wacom_features *features)
{ {
@ -264,6 +279,8 @@ static void wacom_parse_hid(struct hid_device *hdev,
wacom_usage_mapping(hdev, hreport->field[i], wacom_usage_mapping(hdev, hreport->field[i],
hreport->field[i]->usage + j); hreport->field[i]->usage + j);
} }
wacom_post_parse_hid(hdev, features);
} }
static int wacom_hid_set_device_mode(struct hid_device *hdev) static int wacom_hid_set_device_mode(struct hid_device *hdev)
@ -1129,7 +1146,7 @@ static void wacom_clean_inputs(struct wacom *wacom)
input_free_device(wacom->wacom_wac.input); input_free_device(wacom->wacom_wac.input);
} }
if (wacom->wacom_wac.pad_input) { if (wacom->wacom_wac.pad_input) {
if (wacom->wacom_wac.input_registered) if (wacom->wacom_wac.pad_registered)
input_unregister_device(wacom->wacom_wac.pad_input); input_unregister_device(wacom->wacom_wac.pad_input);
else else
input_free_device(wacom->wacom_wac.pad_input); input_free_device(wacom->wacom_wac.pad_input);
@ -1151,13 +1168,13 @@ static int wacom_register_inputs(struct wacom *wacom)
if (!input_dev || !pad_input_dev) if (!input_dev || !pad_input_dev)
return -EINVAL; return -EINVAL;
error = wacom_setup_input_capabilities(input_dev, wacom_wac); error = wacom_setup_pentouch_input_capabilities(input_dev, wacom_wac);
if (error) if (!error) {
return error;
error = input_register_device(input_dev); error = input_register_device(input_dev);
if (error) if (error)
return error; return error;
wacom_wac->input_registered = true;
}
error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac); error = wacom_setup_pad_input_capabilities(pad_input_dev, wacom_wac);
if (error) { if (error) {
@ -1169,22 +1186,23 @@ static int wacom_register_inputs(struct wacom *wacom)
error = input_register_device(pad_input_dev); error = input_register_device(pad_input_dev);
if (error) if (error)
goto fail_register_pad_input; goto fail_register_pad_input;
wacom_wac->pad_registered = true;
error = wacom_initialize_leds(wacom); error = wacom_initialize_leds(wacom);
if (error) if (error)
goto fail_leds; goto fail_leds;
} }
wacom_wac->input_registered = true;
return 0; return 0;
fail_leds: fail_leds:
input_unregister_device(pad_input_dev); input_unregister_device(pad_input_dev);
pad_input_dev = NULL; pad_input_dev = NULL;
wacom_wac->pad_registered = false;
fail_register_pad_input: fail_register_pad_input:
input_unregister_device(input_dev); input_unregister_device(input_dev);
wacom_wac->input = NULL; wacom_wac->input = NULL;
wacom_wac->input_registered = false;
return error; return error;
} }
@ -1321,12 +1339,6 @@ static void wacom_calculate_res(struct wacom_features *features)
features->unitExpo); features->unitExpo);
} }
static int wacom_hid_report_len(struct hid_report *report)
{
/* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
return ((report->size - 1) >> 3) + 1 + (report->id > 0);
}
static size_t wacom_compute_pktlen(struct hid_device *hdev) static size_t wacom_compute_pktlen(struct hid_device *hdev)
{ {
struct hid_report_enum *report_enum; struct hid_report_enum *report_enum;
@ -1336,7 +1348,7 @@ static size_t wacom_compute_pktlen(struct hid_device *hdev)
report_enum = hdev->report_enum + HID_INPUT_REPORT; report_enum = hdev->report_enum + HID_INPUT_REPORT;
list_for_each_entry(report, &report_enum->report_list, list) { list_for_each_entry(report, &report_enum->report_list, list) {
size_t report_size = wacom_hid_report_len(report); size_t report_size = hid_report_len(report);
if (report_size > size) if (report_size > size)
size = report_size; size = report_size;
} }

View File

@ -25,6 +25,10 @@
#define WACOM_INTUOS_RES 100 #define WACOM_INTUOS_RES 100
#define WACOM_INTUOS3_RES 200 #define WACOM_INTUOS3_RES 200
/* Newer Cintiq and DTU have an offset between tablet and screen areas */
#define WACOM_DTU_OFFSET 200
#define WACOM_CINTIQ_OFFSET 400
/* /*
* Scale factor relating reported contact size to logical contact area. * Scale factor relating reported contact size to logical contact area.
* 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo * 2^14/pi is a good approximation on Intuos5 and 3rd-gen Bamboo
@ -600,8 +604,8 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
} }
input_report_abs(input, ABS_PRESSURE, t); input_report_abs(input, ABS_PRESSURE, t);
input_report_abs(input, ABS_TILT_X, input_report_abs(input, ABS_TILT_X,
((data[7] << 1) & 0x7e) | (data[8] >> 7)); (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64);
input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64);
input_report_key(input, BTN_STYLUS, data[1] & 2); input_report_key(input, BTN_STYLUS, data[1] & 2);
input_report_key(input, BTN_STYLUS2, data[1] & 4); input_report_key(input, BTN_STYLUS2, data[1] & 4);
input_report_key(input, BTN_TOUCH, t > 10); input_report_key(input, BTN_TOUCH, t > 10);
@ -612,8 +616,8 @@ static void wacom_intuos_general(struct wacom_wac *wacom)
input_report_abs(input, ABS_WHEEL, input_report_abs(input, ABS_WHEEL,
(data[6] << 2) | ((data[7] >> 6) & 3)); (data[6] << 2) | ((data[7] >> 6) & 3));
input_report_abs(input, ABS_TILT_X, input_report_abs(input, ABS_TILT_X,
((data[7] << 1) & 0x7e) | (data[8] >> 7)); (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64);
input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64);
} }
} }
@ -915,8 +919,8 @@ static int wacom_intuos_irq(struct wacom_wac *wacom)
input_report_key(input, BTN_EXTRA, data[6] & 0x10); input_report_key(input, BTN_EXTRA, data[6] & 0x10);
input_report_abs(input, ABS_TILT_X, input_report_abs(input, ABS_TILT_X,
((data[7] << 1) & 0x7e) | (data[8] >> 7)); (((data[7] << 1) & 0x7e) | (data[8] >> 7)) - 64);
input_report_abs(input, ABS_TILT_Y, data[8] & 0x7f); input_report_abs(input, ABS_TILT_Y, (data[8] & 0x7f) - 64);
} else { } else {
/* 2D mouse packet */ /* 2D mouse packet */
input_report_key(input, BTN_LEFT, data[8] & 0x04); input_report_key(input, BTN_LEFT, data[8] & 0x04);
@ -1377,11 +1381,12 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
{ {
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->input; struct wacom_features *features = &wacom_wac->features;
unsigned touch_max = wacom_wac->features.touch_max; unsigned touch_max = wacom_wac->features.touch_max;
switch (usage->hid) { switch (usage->hid) {
case HID_GD_X: case HID_GD_X:
features->last_slot_field = usage->hid;
if (touch_max == 1) if (touch_max == 1)
wacom_map_usage(wacom, usage, field, EV_ABS, ABS_X, 4); wacom_map_usage(wacom, usage, field, EV_ABS, ABS_X, 4);
else else
@ -1389,6 +1394,7 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
ABS_MT_POSITION_X, 4); ABS_MT_POSITION_X, 4);
break; break;
case HID_GD_Y: case HID_GD_Y:
features->last_slot_field = usage->hid;
if (touch_max == 1) if (touch_max == 1)
wacom_map_usage(wacom, usage, field, EV_ABS, ABS_Y, 4); wacom_map_usage(wacom, usage, field, EV_ABS, ABS_Y, 4);
else else
@ -1396,19 +1402,48 @@ static void wacom_wac_finger_usage_mapping(struct hid_device *hdev,
ABS_MT_POSITION_Y, 4); ABS_MT_POSITION_Y, 4);
break; break;
case HID_DG_CONTACTID: case HID_DG_CONTACTID:
input_mt_init_slots(input, wacom_wac->features.touch_max, features->last_slot_field = usage->hid;
INPUT_MT_DIRECT);
break; break;
case HID_DG_INRANGE: case HID_DG_INRANGE:
features->last_slot_field = usage->hid;
break; break;
case HID_DG_INVERT: case HID_DG_INVERT:
features->last_slot_field = usage->hid;
break; break;
case HID_DG_TIPSWITCH: case HID_DG_TIPSWITCH:
features->last_slot_field = usage->hid;
wacom_map_usage(wacom, usage, field, EV_KEY, BTN_TOUCH, 0); wacom_map_usage(wacom, usage, field, EV_KEY, BTN_TOUCH, 0);
break; break;
} }
} }
static void wacom_wac_finger_slot(struct wacom_wac *wacom_wac,
struct input_dev *input)
{
struct hid_data *hid_data = &wacom_wac->hid_data;
bool mt = wacom_wac->features.touch_max > 1;
bool prox = hid_data->tipswitch &&
!wacom_wac->shared->stylus_in_proximity;
if (mt) {
int slot;
slot = input_mt_get_slot_by_key(input, hid_data->id);
input_mt_slot(input, slot);
input_mt_report_slot_state(input, MT_TOOL_FINGER, prox);
}
else {
input_report_key(input, BTN_TOUCH, prox);
}
if (prox) {
input_report_abs(input, mt ? ABS_MT_POSITION_X : ABS_X,
hid_data->x);
input_report_abs(input, mt ? ABS_MT_POSITION_Y : ABS_Y,
hid_data->y);
}
}
static int wacom_wac_finger_event(struct hid_device *hdev, static int wacom_wac_finger_event(struct hid_device *hdev,
struct hid_field *field, struct hid_usage *usage, __s32 value) struct hid_field *field, struct hid_usage *usage, __s32 value)
{ {
@ -1431,36 +1466,35 @@ static int wacom_wac_finger_event(struct hid_device *hdev,
} }
if (usage->usage_index + 1 == field->report_count) {
if (usage->hid == wacom_wac->features.last_slot_field)
wacom_wac_finger_slot(wacom_wac, wacom_wac->input);
}
return 0; return 0;
} }
static void wacom_wac_finger_mt_report(struct wacom_wac *wacom_wac, static int wacom_wac_finger_count_touches(struct hid_device *hdev)
struct input_dev *input, bool touch)
{ {
int slot; struct wacom *wacom = hid_get_drvdata(hdev);
struct hid_data *hid_data = &wacom_wac->hid_data; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->input;
unsigned touch_max = wacom_wac->features.touch_max;
int count = 0;
int i;
slot = input_mt_get_slot_by_key(input, hid_data->id); if (touch_max == 1)
return wacom_wac->hid_data.tipswitch &&
!wacom_wac->shared->stylus_in_proximity;
input_mt_slot(input, slot); for (i = 0; i < input->mt->num_slots; i++) {
input_mt_report_slot_state(input, MT_TOOL_FINGER, touch); struct input_mt_slot *ps = &input->mt->slots[i];
if (touch) { int id = input_mt_get_value(ps, ABS_MT_TRACKING_ID);
input_report_abs(input, ABS_MT_POSITION_X, hid_data->x); if (id >= 0)
input_report_abs(input, ABS_MT_POSITION_Y, hid_data->y); count++;
}
input_mt_sync_frame(input);
} }
static void wacom_wac_finger_single_touch_report(struct wacom_wac *wacom_wac, return count;
struct input_dev *input, bool touch)
{
struct hid_data *hid_data = &wacom_wac->hid_data;
if (touch) {
input_report_abs(input, ABS_X, hid_data->x);
input_report_abs(input, ABS_Y, hid_data->y);
}
input_report_key(input, BTN_TOUCH, touch);
} }
static void wacom_wac_finger_report(struct hid_device *hdev, static void wacom_wac_finger_report(struct hid_device *hdev,
@ -1469,24 +1503,23 @@ static void wacom_wac_finger_report(struct hid_device *hdev,
struct wacom *wacom = hid_get_drvdata(hdev); struct wacom *wacom = hid_get_drvdata(hdev);
struct wacom_wac *wacom_wac = &wacom->wacom_wac; struct wacom_wac *wacom_wac = &wacom->wacom_wac;
struct input_dev *input = wacom_wac->input; struct input_dev *input = wacom_wac->input;
bool touch = wacom_wac->hid_data.tipswitch &&
!wacom_wac->shared->stylus_in_proximity;
unsigned touch_max = wacom_wac->features.touch_max; unsigned touch_max = wacom_wac->features.touch_max;
if (touch_max > 1) if (touch_max > 1)
wacom_wac_finger_mt_report(wacom_wac, input, touch); input_mt_sync_frame(input);
else
wacom_wac_finger_single_touch_report(wacom_wac, input, touch);
input_sync(input); input_sync(input);
/* keep touch state for pen event */ /* keep touch state for pen event */
wacom_wac->shared->touch_down = touch; wacom_wac->shared->touch_down = wacom_wac_finger_count_touches(hdev);
} }
#define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \ #define WACOM_PEN_FIELD(f) (((f)->logical == HID_DG_STYLUS) || \
((f)->physical == HID_DG_STYLUS)) ((f)->physical == HID_DG_STYLUS) || \
((f)->application == HID_DG_PEN))
#define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \ #define WACOM_FINGER_FIELD(f) (((f)->logical == HID_DG_FINGER) || \
((f)->physical == HID_DG_FINGER)) ((f)->physical == HID_DG_FINGER) || \
((f)->application == HID_DG_TOUCHSCREEN))
void wacom_wac_usage_mapping(struct hid_device *hdev, void wacom_wac_usage_mapping(struct hid_device *hdev,
struct hid_field *field, struct hid_usage *usage) struct hid_field *field, struct hid_usage *usage)
@ -1681,7 +1714,9 @@ static int wacom_bpt_pen(struct wacom_wac *wacom)
return 0; return 0;
if (data[0] == WACOM_REPORT_USB) { if (data[0] == WACOM_REPORT_USB) {
if (features->type == INTUOSHT && features->touch_max) { if (features->type == INTUOSHT &&
wacom->shared->touch_input &&
features->touch_max) {
input_report_switch(wacom->shared->touch_input, input_report_switch(wacom->shared->touch_input,
SW_MUTE_DEVICE, data[8] & 0x40); SW_MUTE_DEVICE, data[8] & 0x40);
input_sync(wacom->shared->touch_input); input_sync(wacom->shared->touch_input);
@ -1774,6 +1809,7 @@ static int wacom_wireless_irq(struct wacom_wac *wacom, size_t len)
int pid, battery, ps_connected; int pid, battery, ps_connected;
if ((wacom->shared->type == INTUOSHT) && if ((wacom->shared->type == INTUOSHT) &&
wacom->shared->touch_input &&
wacom->shared->touch_max) { wacom->shared->touch_max) {
input_report_switch(wacom->shared->touch_input, input_report_switch(wacom->shared->touch_input,
SW_MUTE_DEVICE, data[5] & 0x40); SW_MUTE_DEVICE, data[5] & 0x40);
@ -1838,6 +1874,7 @@ void wacom_wac_irq(struct wacom_wac *wacom_wac, size_t len)
break; break;
case DTUS: case DTUS:
case DTUSX:
sync = wacom_dtus_irq(wacom_wac); sync = wacom_dtus_irq(wacom_wac);
break; break;
@ -1926,8 +1963,10 @@ static void wacom_setup_cintiq(struct wacom_wac *wacom_wac)
input_set_abs_params(input_dev, ABS_DISTANCE, input_set_abs_params(input_dev, ABS_DISTANCE,
0, wacom_wac->features.distance_max, 0, 0); 0, wacom_wac->features.distance_max, 0, 0);
input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0); input_set_abs_params(input_dev, ABS_WHEEL, 0, 1023, 0, 0);
input_set_abs_params(input_dev, ABS_TILT_X, 0, 127, 0, 0); input_set_abs_params(input_dev, ABS_TILT_X, -64, 63, 0, 0);
input_set_abs_params(input_dev, ABS_TILT_Y, 0, 127, 0, 0); input_abs_set_res(input_dev, ABS_TILT_X, 57);
input_set_abs_params(input_dev, ABS_TILT_Y, -64, 63, 0, 0);
input_abs_set_res(input_dev, ABS_TILT_Y, 57);
} }
static void wacom_setup_intuos(struct wacom_wac *wacom_wac) static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
@ -1947,6 +1986,7 @@ static void wacom_setup_intuos(struct wacom_wac *wacom_wac)
__set_bit(BTN_TOOL_LENS, input_dev->keybit); __set_bit(BTN_TOOL_LENS, input_dev->keybit);
input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_RZ, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_RZ, 287);
input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0); input_set_abs_params(input_dev, ABS_THROTTLE, -1023, 1023, 0, 0);
} }
@ -2029,7 +2069,7 @@ static void wacom_abs_set_axis(struct input_dev *input_dev,
} }
} }
int wacom_setup_input_capabilities(struct input_dev *input_dev, int wacom_setup_pentouch_input_capabilities(struct input_dev *input_dev,
struct wacom_wac *wacom_wac) struct wacom_wac *wacom_wac)
{ {
struct wacom_features *features = &wacom_wac->features; struct wacom_features *features = &wacom_wac->features;
@ -2047,9 +2087,6 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
switch (features->type) { switch (features->type) {
case WACOM_MO: case WACOM_MO:
input_set_abs_params(input_dev, ABS_WHEEL, 0, 71, 0, 0);
/* fall through */
case WACOM_G4: case WACOM_G4:
/* fall through */ /* fall through */
@ -2092,6 +2129,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case WACOM_24HD: case WACOM_24HD:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0); input_set_abs_params(input_dev, ABS_THROTTLE, 0, 71, 0, 0);
/* fall through */ /* fall through */
@ -2106,6 +2144,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case WACOM_BEE: case WACOM_BEE:
case CINTIQ: case CINTIQ:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
@ -2114,6 +2153,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case WACOM_13HD: case WACOM_13HD:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
wacom_setup_cintiq(wacom_wac); wacom_setup_cintiq(wacom_wac);
break; break;
@ -2122,6 +2162,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case INTUOS3L: case INTUOS3L:
case INTUOS3S: case INTUOS3S:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
/* fall through */ /* fall through */
case INTUOS: case INTUOS:
@ -2144,6 +2185,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
0, 0); 0, 0);
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
wacom_setup_intuos(wacom_wac); wacom_setup_intuos(wacom_wac);
} else if (features->device_type == BTN_TOOL_FINGER) { } else if (features->device_type == BTN_TOOL_FINGER) {
@ -2162,6 +2204,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case INTUOS4L: case INTUOS4L:
case INTUOS4S: case INTUOS4S:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
wacom_setup_intuos(wacom_wac); wacom_setup_intuos(wacom_wac);
__set_bit(INPUT_PROP_POINTER, input_dev->propbit); __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
@ -2196,6 +2239,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
/* fall through */ /* fall through */
case DTUS: case DTUS:
case DTUSX:
case PL: case PL:
case DTU: case DTU:
__set_bit(BTN_TOOL_PEN, input_dev->keybit); __set_bit(BTN_TOOL_PEN, input_dev->keybit);
@ -2246,6 +2290,9 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
__clear_bit(ABS_X, input_dev->absbit); __clear_bit(ABS_X, input_dev->absbit);
__clear_bit(ABS_Y, input_dev->absbit); __clear_bit(ABS_Y, input_dev->absbit);
__clear_bit(BTN_TOUCH, input_dev->keybit); __clear_bit(BTN_TOUCH, input_dev->keybit);
/* PAD is setup by wacom_setup_pad_input_capabilities later */
return 1;
} }
} else if (features->device_type == BTN_TOOL_PEN) { } else if (features->device_type == BTN_TOOL_PEN) {
__set_bit(INPUT_PROP_POINTER, input_dev->propbit); __set_bit(INPUT_PROP_POINTER, input_dev->propbit);
@ -2261,6 +2308,7 @@ int wacom_setup_input_capabilities(struct input_dev *input_dev,
case CINTIQ_HYBRID: case CINTIQ_HYBRID:
input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0); input_set_abs_params(input_dev, ABS_Z, -900, 899, 0, 0);
input_abs_set_res(input_dev, ABS_Z, 287);
__set_bit(INPUT_PROP_DIRECT, input_dev->propbit); __set_bit(INPUT_PROP_DIRECT, input_dev->propbit);
wacom_setup_cintiq(wacom_wac); wacom_setup_cintiq(wacom_wac);
@ -2303,9 +2351,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
case WACOM_G4: case WACOM_G4:
__set_bit(BTN_BACK, input_dev->keybit); __set_bit(BTN_BACK, input_dev->keybit);
__set_bit(BTN_LEFT, input_dev->keybit);
__set_bit(BTN_FORWARD, input_dev->keybit); __set_bit(BTN_FORWARD, input_dev->keybit);
__set_bit(BTN_RIGHT, input_dev->keybit);
input_set_capability(input_dev, EV_REL, REL_WHEEL); input_set_capability(input_dev, EV_REL, REL_WHEEL);
break; break;
@ -2402,7 +2448,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
case INTUOSPS: case INTUOSPS:
/* touch interface does not have the pad device */ /* touch interface does not have the pad device */
if (features->device_type != BTN_TOOL_PEN) if (features->device_type != BTN_TOOL_PEN)
return 1; return -ENODEV;
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
__set_bit(BTN_0 + i, input_dev->keybit); __set_bit(BTN_0 + i, input_dev->keybit);
@ -2446,8 +2492,10 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
case INTUOSHT: case INTUOSHT:
case BAMBOO_PT: case BAMBOO_PT:
/* pad device is on the touch interface */ /* pad device is on the touch interface */
if (features->device_type != BTN_TOOL_FINGER) if ((features->device_type != BTN_TOOL_FINGER) ||
return 1; /* Bamboo Pen only tablet does not have pad */
((features->type == BAMBOO_PT) && !features->touch_max))
return -ENODEV;
__clear_bit(ABS_MISC, input_dev->absbit); __clear_bit(ABS_MISC, input_dev->absbit);
@ -2460,7 +2508,7 @@ int wacom_setup_pad_input_capabilities(struct input_dev *input_dev,
default: default:
/* no pad supported */ /* no pad supported */
return 1; return -ENODEV;
} }
return 0; return 0;
} }
@ -2664,11 +2712,13 @@ static const struct wacom_features wacom_features_0x317 =
INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16, INTUOSPL, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, .touch_max = 16,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0xF4 = static const struct wacom_features wacom_features_0xF4 =
{ "Wacom Cintiq 24HD", 104280, 65400, 2047, 63, { "Wacom Cintiq 24HD", 104080, 65200, 2047, 63,
WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0xF8 = static const struct wacom_features wacom_features_0xF8 =
{ "Wacom Cintiq 24HD touch", 104280, 65400, 2047, 63, /* Pen */ { "Wacom Cintiq 24HD touch", 104080, 65200, 2047, 63, /* Pen */
WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, WACOM_24HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 }; .oVid = USB_VENDOR_ID_WACOM, .oPid = 0xf6 };
static const struct wacom_features wacom_features_0xF6 = static const struct wacom_features wacom_features_0xF6 =
{ "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */ { "Wacom Cintiq 24HD touch", .type = WACOM_24HDT, /* Touch */
@ -2684,8 +2734,9 @@ static const struct wacom_features wacom_features_0xC6 =
{ "Wacom Cintiq 12WX", 53020, 33440, 1023, 63, { "Wacom Cintiq 12WX", 53020, 33440, 1023, 63,
WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES }; WACOM_BEE, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES };
static const struct wacom_features wacom_features_0x304 = static const struct wacom_features wacom_features_0x304 =
{ "Wacom Cintiq 13HD", 59352, 33648, 1023, 63, { "Wacom Cintiq 13HD", 59152, 33448, 1023, 63,
WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; WACOM_13HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0xC7 = static const struct wacom_features wacom_features_0xC7 =
{ "Wacom DTU1931", 37832, 30305, 511, 0, { "Wacom DTU1931", 37832, 30305, 511, 0,
PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; PL, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
@ -2697,28 +2748,38 @@ static const struct wacom_features wacom_features_0xF0 =
{ "Wacom DTU1631", 34623, 19553, 511, 0, { "Wacom DTU1631", 34623, 19553, 511, 0,
DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; DTU, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0xFB = static const struct wacom_features wacom_features_0xFB =
{ "Wacom DTU1031", 22096, 13960, 511, 0, { "Wacom DTU1031", 21896, 13760, 511, 0,
DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; DTUS, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
static const struct wacom_features wacom_features_0x32F =
{ "Wacom DTU1031X", 22472, 12728, 511, 0,
DTUSX, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
WACOM_DTU_OFFSET, WACOM_DTU_OFFSET };
static const struct wacom_features wacom_features_0x57 = static const struct wacom_features wacom_features_0x57 =
{ "Wacom DTK2241", 95640, 54060, 2047, 63, { "Wacom DTK2241", 95640, 54060, 2047, 63,
DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0x59 = /* Pen */ static const struct wacom_features wacom_features_0x59 = /* Pen */
{ "Wacom DTH2242", 95640, 54060, 2047, 63, { "Wacom DTH2242", 95640, 54060, 2047, 63,
DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, DTK, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D }; .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5D };
static const struct wacom_features wacom_features_0x5D = /* Touch */ static const struct wacom_features wacom_features_0x5D = /* Touch */
{ "Wacom DTH2242", .type = WACOM_24HDT, { "Wacom DTH2242", .type = WACOM_24HDT,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x59, .touch_max = 10,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0xCC = static const struct wacom_features wacom_features_0xCC =
{ "Wacom Cintiq 21UX2", 87000, 65400, 2047, 63, { "Wacom Cintiq 21UX2", 86800, 65200, 2047, 63,
WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; WACOM_21UX2, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0xFA = static const struct wacom_features wacom_features_0xFA =
{ "Wacom Cintiq 22HD", 95640, 54060, 2047, 63, { "Wacom Cintiq 22HD", 95440, 53860, 2047, 63,
WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200 }; WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET };
static const struct wacom_features wacom_features_0x5B = static const struct wacom_features wacom_features_0x5B =
{ "Wacom Cintiq 22HDT", 95640, 54060, 2047, 63, { "Wacom Cintiq 22HDT", 95440, 53860, 2047, 63,
WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, WACOM_22HD, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e }; .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x5e };
static const struct wacom_features wacom_features_0x5E = static const struct wacom_features wacom_features_0x5E =
{ "Wacom Cintiq 22HDT", .type = WACOM_24HDT, { "Wacom Cintiq 22HDT", .type = WACOM_24HDT,
@ -2863,21 +2924,27 @@ static const struct wacom_features wacom_features_0x6004 =
{ "ISD-V4", 12800, 8000, 255, 0, { "ISD-V4", 12800, 8000, 255, 0,
TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES }; TABLETPC, WACOM_INTUOS_RES, WACOM_INTUOS_RES };
static const struct wacom_features wacom_features_0x307 = static const struct wacom_features wacom_features_0x307 =
{ "Wacom ISDv5 307", 59352, 33648, 2047, 63, { "Wacom ISDv5 307", 59152, 33448, 2047, 63,
CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 }; .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x309 };
static const struct wacom_features wacom_features_0x309 = static const struct wacom_features wacom_features_0x309 =
{ "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */ { "Wacom ISDv5 309", .type = WACOM_24HDT, /* Touch */
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x0307, .touch_max = 10,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0x30A = static const struct wacom_features wacom_features_0x30A =
{ "Wacom ISDv5 30A", 59352, 33648, 2047, 63, { "Wacom ISDv5 30A", 59152, 33448, 2047, 63,
CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES, 200, 200, CINTIQ_HYBRID, WACOM_INTUOS3_RES, WACOM_INTUOS3_RES,
WACOM_CINTIQ_OFFSET, WACOM_CINTIQ_OFFSET,
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C }; .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30C };
static const struct wacom_features wacom_features_0x30C = static const struct wacom_features wacom_features_0x30C =
{ "Wacom ISDv5 30C", .type = WACOM_24HDT, /* Touch */ { "Wacom ISDv5 30C", .type = WACOM_24HDT, /* Touch */
.oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10, .oVid = USB_VENDOR_ID_WACOM, .oPid = 0x30A, .touch_max = 10,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE }; .check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
static const struct wacom_features wacom_features_0x323 =
{ "Wacom Intuos P M", 21600, 13500, 1023, 31,
INTUOSHT, WACOM_INTUOS_RES, WACOM_INTUOS_RES,
.check_for_hid_type = true, .hid_type = HID_TYPE_USBNONE };
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 }; { "Wacom HID", .type = HID_GENERIC };
@ -3022,10 +3089,13 @@ const struct hid_device_id wacom_ids[] = {
{ USB_DEVICE_WACOM(0x314) }, { USB_DEVICE_WACOM(0x314) },
{ USB_DEVICE_WACOM(0x315) }, { USB_DEVICE_WACOM(0x315) },
{ USB_DEVICE_WACOM(0x317) }, { USB_DEVICE_WACOM(0x317) },
{ USB_DEVICE_WACOM(0x323) },
{ USB_DEVICE_WACOM(0x32F) },
{ USB_DEVICE_WACOM(0x4001) }, { USB_DEVICE_WACOM(0x4001) },
{ USB_DEVICE_WACOM(0x4004) }, { USB_DEVICE_WACOM(0x4004) },
{ USB_DEVICE_WACOM(0x5000) }, { USB_DEVICE_WACOM(0x5000) },
{ USB_DEVICE_WACOM(0x5002) }, { USB_DEVICE_WACOM(0x5002) },
{ USB_DEVICE_LENOVO(0x6004) },
{ USB_DEVICE_WACOM(HID_ANY_ID) }, { USB_DEVICE_WACOM(HID_ANY_ID) },
{ } { }

View File

@ -80,6 +80,7 @@ enum {
PL, PL,
DTU, DTU,
DTUS, DTUS,
DTUSX,
INTUOS, INTUOS,
INTUOS3S, INTUOS3S,
INTUOS3, INTUOS3,
@ -144,6 +145,7 @@ struct wacom_features {
int pktlen; int pktlen;
bool check_for_hid_type; bool check_for_hid_type;
int hid_type; int hid_type;
int last_slot_field;
}; };
struct wacom_shared { struct wacom_shared {
@ -183,6 +185,7 @@ struct wacom_wac {
struct input_dev *input; struct input_dev *input;
struct input_dev *pad_input; struct input_dev *pad_input;
bool input_registered; bool input_registered;
bool pad_registered;
int pid; int pid;
int battery_capacity; int battery_capacity;
int num_contacts_left; int num_contacts_left;

View File

@ -103,6 +103,9 @@ static const struct usb_device_id usb_quirk_list[] = {
{ USB_DEVICE(0x04f3, 0x009b), .driver_info = { USB_DEVICE(0x04f3, 0x009b), .driver_info =
USB_QUIRK_DEVICE_QUALIFIER }, USB_QUIRK_DEVICE_QUALIFIER },
{ USB_DEVICE(0x04f3, 0x010c), .driver_info =
USB_QUIRK_DEVICE_QUALIFIER },
{ USB_DEVICE(0x04f3, 0x016f), .driver_info = { USB_DEVICE(0x04f3, 0x016f), .driver_info =
USB_QUIRK_DEVICE_QUALIFIER }, USB_QUIRK_DEVICE_QUALIFIER },

View File

@ -234,6 +234,33 @@ struct hid_item {
#define HID_DG_BARRELSWITCH 0x000d0044 #define HID_DG_BARRELSWITCH 0x000d0044
#define HID_DG_ERASER 0x000d0045 #define HID_DG_ERASER 0x000d0045
#define HID_DG_TABLETPICK 0x000d0046 #define HID_DG_TABLETPICK 0x000d0046
#define HID_CP_CONSUMERCONTROL 0x000c0001
#define HID_CP_NUMERICKEYPAD 0x000c0002
#define HID_CP_PROGRAMMABLEBUTTONS 0x000c0003
#define HID_CP_MICROPHONE 0x000c0004
#define HID_CP_HEADPHONE 0x000c0005
#define HID_CP_GRAPHICEQUALIZER 0x000c0006
#define HID_CP_FUNCTIONBUTTONS 0x000c0036
#define HID_CP_SELECTION 0x000c0080
#define HID_CP_MEDIASELECTION 0x000c0087
#define HID_CP_SELECTDISC 0x000c00ba
#define HID_CP_PLAYBACKSPEED 0x000c00f1
#define HID_CP_PROXIMITY 0x000c0109
#define HID_CP_SPEAKERSYSTEM 0x000c0160
#define HID_CP_CHANNELLEFT 0x000c0161
#define HID_CP_CHANNELRIGHT 0x000c0162
#define HID_CP_CHANNELCENTER 0x000c0163
#define HID_CP_CHANNELFRONT 0x000c0164
#define HID_CP_CHANNELCENTERFRONT 0x000c0165
#define HID_CP_CHANNELSIDE 0x000c0166
#define HID_CP_CHANNELSURROUND 0x000c0167
#define HID_CP_CHANNELLOWFREQUENCYENHANCEMENT 0x000c0168
#define HID_CP_CHANNELTOP 0x000c0169
#define HID_CP_CHANNELUNKNOWN 0x000c016a
#define HID_CP_APPLICATIONLAUNCHBUTTONS 0x000c0180
#define HID_CP_GENERICGUIAPPLICATIONCONTROLS 0x000c0200
#define HID_DG_CONFIDENCE 0x000d0047 #define HID_DG_CONFIDENCE 0x000d0047
#define HID_DG_WIDTH 0x000d0048 #define HID_DG_WIDTH 0x000d0048
#define HID_DG_HEIGHT 0x000d0049 #define HID_DG_HEIGHT 0x000d0049
@ -312,11 +339,8 @@ struct hid_item {
* Vendor specific HID device groups * Vendor specific HID device groups
*/ */
#define HID_GROUP_RMI 0x0100 #define HID_GROUP_RMI 0x0100
/*
* Vendor specific HID device groups
*/
#define HID_GROUP_WACOM 0x0101 #define HID_GROUP_WACOM 0x0101
#define HID_GROUP_LOGITECH_DJ_DEVICE 0x0102
/* /*
* This is the global environment of the parser. This information is * This is the global environment of the parser. This information is
@ -1063,6 +1087,17 @@ static inline void hid_hw_wait(struct hid_device *hdev)
hdev->ll_driver->wait(hdev); hdev->ll_driver->wait(hdev);
} }
/**
* hid_report_len - calculate the report length
*
* @report: the report we want to know the length
*/
static inline int hid_report_len(struct hid_report *report)
{
/* equivalent to DIV_ROUND_UP(report->size, 8) + !!(report->id > 0) */
return ((report->size - 1) >> 3) + 1 + (report->id > 0);
}
int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size, int hid_report_raw_event(struct hid_device *hid, int type, u8 *data, int size,
int interrupt); int interrupt);