From fdc5663c1b686caaaeff01f1b0918489536f7d7d Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Tue, 5 Mar 2013 09:49:01 +0100 Subject: HID: Kconfig: fix "-- help---" Signed-off-by: Paul Bolle Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 5f07d85c418..49e29391cb9 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -738,7 +738,7 @@ config HID_SENSOR_HUB depends on USB_HID && GENERIC_HARDIRQS select MFD_CORE default n - -- help--- + ---help--- Support for HID Sensor framework. This creates a MFD instance for a sensor hub and identifies all the sensors connected to it. Each sensor is registered as a MFD cell, so that sensor specific -- cgit v1.2.3 From 8936aa31cd5fd0bea828416a3c07efd303269a45 Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Sun, 10 Mar 2013 12:32:44 +0100 Subject: HID: roccat: add support for Roccat Kone Pure gaming mouse Userland-tools can already be found at http://sourceforge.net/projects/roccat Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- .../ABI/testing/sysfs-driver-hid-roccat-konepure | 105 +++++++ drivers/hid/Makefile | 4 +- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-roccat-konepure.c | 304 +++++++++++++++++++++ drivers/hid/hid-roccat-konepure.h | 72 +++++ 6 files changed, 485 insertions(+), 2 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure create mode 100644 drivers/hid/hid-roccat-konepure.c create mode 100644 drivers/hid/hid-roccat-konepure.h diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure b/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure new file mode 100644 index 00000000000..41a9b7fbfc7 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-konepure @@ -0,0 +1,105 @@ +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/actual_profile +Date: December 2012 +Contact: Stefan Achatz +Description: The mouse can store 5 profiles which can be switched by the + press of a button. actual_profile holds number of actual profile. + This value is persistent, so its value determines the profile + that's active when the mouse is powered on next time. + When written, the mouse activates the set profile immediately. + The data has to be 3 bytes long. + The mouse will reject invalid data. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/control +Date: December 2012 +Contact: Stefan Achatz +Description: When written, this file lets one select which data from which + profile will be read next. The data has to be 3 bytes long. + This file is writeonly. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/info +Date: December 2012 +Contact: Stefan Achatz +Description: When read, this file returns general data like firmware version. + When written, the device can be reset. + The data is 6 bytes long. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/macro +Date: December 2012 +Contact: Stefan Achatz +Description: The mouse can store a macro with max 500 key/button strokes + internally. + When written, this file lets one set the sequence for a specific + button for a specific profile. Button and profile numbers are + included in written data. The data has to be 2082 bytes long. + This file is writeonly. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/profile_buttons +Date: December 2012 +Contact: Stefan Achatz +Description: The mouse can store 5 profiles which can be switched by the + press of a button. A profile is split in settings and buttons. + profile_buttons holds information about button layout. + When written, this file lets one write the respective profile + buttons back to the mouse. The data has to be 59 bytes long. + The mouse will reject invalid data. + Which profile to write is determined by the profile number + contained in the data. + Before reading this file, control has to be written to select + which profile to read. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/profile_settings +Date: December 2012 +Contact: Stefan Achatz +Description: The mouse can store 5 profiles which can be switched by the + press of a button. A profile is split in settings and buttons. + profile_settings holds information like resolution, sensitivity + and light effects. + When written, this file lets one write the respective profile + settings back to the mouse. The data has to be 31 bytes long. + The mouse will reject invalid data. + Which profile to write is determined by the profile number + contained in the data. + Before reading this file, control has to be written to select + which profile to read. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/sensor +Date: December 2012 +Contact: Stefan Achatz +Description: The mouse has a tracking- and a distance-control-unit. These + can be activated/deactivated and the lift-off distance can be + set. The data has to be 6 bytes long. + This file is writeonly. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/talk +Date: December 2012 +Contact: Stefan Achatz +Description: Used to active some easy* functions of the mouse from outside. + The data has to be 16 bytes long. + This file is writeonly. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/tcu +Date: December 2012 +Contact: Stefan Achatz +Description: When written a calibration process for the tracking control unit + can be initiated/cancelled. Also lets one read/write sensor + registers. + The data has to be 4 bytes long. +Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./konepure/roccatkonepure/tcu_image +Date: December 2012 +Contact: Stefan Achatz +Description: When read the mouse returns a 30x30 pixel image of the + sampled underground. This works only in the course of a + calibration process initiated with tcu. + The returned data is 1028 bytes in size. + This file is readonly. +Users: http://roccat.sourceforge.net diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index 72d1b0bc0a9..273515197c3 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile @@ -94,8 +94,8 @@ obj-$(CONFIG_HID_PRIMAX) += hid-primax.o obj-$(CONFIG_HID_PS3REMOTE) += hid-ps3remote.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-koneplus.o hid-roccat-kovaplus.o hid-roccat-lua.o \ - hid-roccat-pyra.o hid-roccat-savu.o + hid-roccat-koneplus.o hid-roccat-konepure.o hid-roccat-kovaplus.o \ + hid-roccat-lua.o hid-roccat-pyra.o hid-roccat-savu.o obj-$(CONFIG_HID_SAITEK) += hid-saitek.o obj-$(CONFIG_HID_SAMSUNG) += hid-samsung.o obj-$(CONFIG_HID_SMARTJOYPLUS) += hid-sjoy.o diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 512b01c04ea..733d7e05970 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1687,6 +1687,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ARVO) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPLUS) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_LUA) }, { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_PYRA_WIRED) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 92e47e5c956..007ee7441e3 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -689,6 +689,7 @@ #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced #define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 +#define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe #define USB_DEVICE_ID_ROCCAT_KONEXTD 0x2e22 #define USB_DEVICE_ID_ROCCAT_KOVAPLUS 0x2d50 #define USB_DEVICE_ID_ROCCAT_LUA 0x2c2e diff --git a/drivers/hid/hid-roccat-konepure.c b/drivers/hid/hid-roccat-konepure.c new file mode 100644 index 00000000000..c79d0b06c14 --- /dev/null +++ b/drivers/hid/hid-roccat-konepure.c @@ -0,0 +1,304 @@ +/* + * Roccat KonePure driver for Linux + * + * Copyright (c) 2012 Stefan Achatz + */ + +/* + * 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. + */ + +/* + * Roccat KonePure is a smaller version of KoneXTD with less buttons and lights. + */ + +#include +#include +#include +#include +#include +#include +#include "hid-ids.h" +#include "hid-roccat-common.h" +#include "hid-roccat-konepure.h" + +static struct class *konepure_class; + +static ssize_t konepure_sysfs_read(struct file *fp, struct kobject *kobj, + char *buf, loff_t off, size_t count, + size_t real_size, uint command) +{ + struct device *dev = + container_of(kobj, struct device, kobj)->parent->parent; + struct konepure_device *konepure = hid_get_drvdata(dev_get_drvdata(dev)); + struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); + int retval; + + if (off >= real_size) + return 0; + + if (off != 0 || count != real_size) + return -EINVAL; + + mutex_lock(&konepure->konepure_lock); + retval = roccat_common2_receive(usb_dev, command, buf, real_size); + mutex_unlock(&konepure->konepure_lock); + + return retval ? retval : real_size; +} + +static ssize_t konepure_sysfs_write(struct file *fp, struct kobject *kobj, + void const *buf, loff_t off, size_t count, + size_t real_size, uint command) +{ + struct device *dev = + container_of(kobj, struct device, kobj)->parent->parent; + struct konepure_device *konepure = hid_get_drvdata(dev_get_drvdata(dev)); + struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); + int retval; + + if (off != 0 || count != real_size) + return -EINVAL; + + mutex_lock(&konepure->konepure_lock); + retval = roccat_common2_send_with_status(usb_dev, command, + (void *)buf, real_size); + mutex_unlock(&konepure->konepure_lock); + + return retval ? retval : real_size; +} + +#define KONEPURE_SYSFS_W(thingy, THINGY) \ +static ssize_t konepure_sysfs_write_ ## thingy(struct file *fp, \ + struct kobject *kobj, struct bin_attribute *attr, char *buf, \ + loff_t off, size_t count) \ +{ \ + return konepure_sysfs_write(fp, kobj, buf, off, count, \ + KONEPURE_SIZE_ ## THINGY, KONEPURE_COMMAND_ ## THINGY); \ +} + +#define KONEPURE_SYSFS_R(thingy, THINGY) \ +static ssize_t konepure_sysfs_read_ ## thingy(struct file *fp, \ + struct kobject *kobj, struct bin_attribute *attr, char *buf, \ + loff_t off, size_t count) \ +{ \ + return konepure_sysfs_read(fp, kobj, buf, off, count, \ + KONEPURE_SIZE_ ## THINGY, KONEPURE_COMMAND_ ## THINGY); \ +} + +#define KONEPURE_SYSFS_RW(thingy, THINGY) \ +KONEPURE_SYSFS_W(thingy, THINGY) \ +KONEPURE_SYSFS_R(thingy, THINGY) + +#define KONEPURE_BIN_ATTRIBUTE_RW(thingy, THINGY) \ +{ \ + .attr = { .name = #thingy, .mode = 0660 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .read = konepure_sysfs_read_ ## thingy, \ + .write = konepure_sysfs_write_ ## thingy \ +} + +#define KONEPURE_BIN_ATTRIBUTE_R(thingy, THINGY) \ +{ \ + .attr = { .name = #thingy, .mode = 0440 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .read = konepure_sysfs_read_ ## thingy, \ +} + +#define KONEPURE_BIN_ATTRIBUTE_W(thingy, THINGY) \ +{ \ + .attr = { .name = #thingy, .mode = 0220 }, \ + .size = KONEPURE_SIZE_ ## THINGY, \ + .write = konepure_sysfs_write_ ## thingy \ +} + +KONEPURE_SYSFS_RW(actual_profile, ACTUAL_PROFILE) +KONEPURE_SYSFS_W(control, CONTROL) +KONEPURE_SYSFS_RW(info, INFO) +KONEPURE_SYSFS_W(talk, TALK) +KONEPURE_SYSFS_W(macro, MACRO) +KONEPURE_SYSFS_RW(sensor, SENSOR) +KONEPURE_SYSFS_RW(tcu, TCU) +KONEPURE_SYSFS_R(tcu_image, TCU_IMAGE) +KONEPURE_SYSFS_RW(profile_settings, PROFILE_SETTINGS) +KONEPURE_SYSFS_RW(profile_buttons, PROFILE_BUTTONS) + +static struct bin_attribute konepure_bin_attributes[] = { + KONEPURE_BIN_ATTRIBUTE_RW(actual_profile, ACTUAL_PROFILE), + KONEPURE_BIN_ATTRIBUTE_W(control, CONTROL), + KONEPURE_BIN_ATTRIBUTE_RW(info, INFO), + KONEPURE_BIN_ATTRIBUTE_W(talk, TALK), + KONEPURE_BIN_ATTRIBUTE_W(macro, MACRO), + KONEPURE_BIN_ATTRIBUTE_RW(sensor, SENSOR), + KONEPURE_BIN_ATTRIBUTE_RW(tcu, TCU), + KONEPURE_BIN_ATTRIBUTE_R(tcu_image, TCU_IMAGE), + KONEPURE_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS), + KONEPURE_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS), + __ATTR_NULL +}; + +static int konepure_init_konepure_device_struct(struct usb_device *usb_dev, + struct konepure_device *konepure) +{ + mutex_init(&konepure->konepure_lock); + + return 0; +} + +static int konepure_init_specials(struct hid_device *hdev) +{ + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + struct usb_device *usb_dev = interface_to_usbdev(intf); + struct konepure_device *konepure; + int retval; + + if (intf->cur_altsetting->desc.bInterfaceProtocol + != USB_INTERFACE_PROTOCOL_MOUSE) { + hid_set_drvdata(hdev, NULL); + return 0; + } + + konepure = kzalloc(sizeof(*konepure), GFP_KERNEL); + if (!konepure) { + hid_err(hdev, "can't alloc device descriptor\n"); + return -ENOMEM; + } + hid_set_drvdata(hdev, konepure); + + retval = konepure_init_konepure_device_struct(usb_dev, konepure); + if (retval) { + hid_err(hdev, "couldn't init struct konepure_device\n"); + goto exit_free; + } + + retval = roccat_connect(konepure_class, hdev, + sizeof(struct konepure_mouse_report_button)); + if (retval < 0) { + hid_err(hdev, "couldn't init char dev\n"); + } else { + konepure->chrdev_minor = retval; + konepure->roccat_claimed = 1; + } + + return 0; +exit_free: + kfree(konepure); + return retval; +} + +static void konepure_remove_specials(struct hid_device *hdev) +{ + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + struct konepure_device *konepure; + + if (intf->cur_altsetting->desc.bInterfaceProtocol + != USB_INTERFACE_PROTOCOL_MOUSE) + return; + + konepure = hid_get_drvdata(hdev); + if (konepure->roccat_claimed) + roccat_disconnect(konepure->chrdev_minor); + kfree(konepure); +} + +static int konepure_probe(struct hid_device *hdev, + const struct hid_device_id *id) +{ + int retval; + + retval = hid_parse(hdev); + if (retval) { + hid_err(hdev, "parse failed\n"); + goto exit; + } + + retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT); + if (retval) { + hid_err(hdev, "hw start failed\n"); + goto exit; + } + + retval = konepure_init_specials(hdev); + if (retval) { + hid_err(hdev, "couldn't install mouse\n"); + goto exit_stop; + } + + return 0; + +exit_stop: + hid_hw_stop(hdev); +exit: + return retval; +} + +static void konepure_remove(struct hid_device *hdev) +{ + konepure_remove_specials(hdev); + hid_hw_stop(hdev); +} + +static int konepure_raw_event(struct hid_device *hdev, + struct hid_report *report, u8 *data, int size) +{ + struct usb_interface *intf = to_usb_interface(hdev->dev.parent); + struct konepure_device *konepure = hid_get_drvdata(hdev); + + if (intf->cur_altsetting->desc.bInterfaceProtocol + != USB_INTERFACE_PROTOCOL_MOUSE) + return 0; + + if (data[0] != KONEPURE_MOUSE_REPORT_NUMBER_BUTTON) + return 0; + + if (konepure != NULL && konepure->roccat_claimed) + roccat_report_event(konepure->chrdev_minor, data); + + return 0; +} + +static const struct hid_device_id konepure_devices[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KONEPURE) }, + { } +}; + +MODULE_DEVICE_TABLE(hid, konepure_devices); + +static struct hid_driver konepure_driver = { + .name = "konepure", + .id_table = konepure_devices, + .probe = konepure_probe, + .remove = konepure_remove, + .raw_event = konepure_raw_event +}; + +static int __init konepure_init(void) +{ + int retval; + + konepure_class = class_create(THIS_MODULE, "konepure"); + if (IS_ERR(konepure_class)) + return PTR_ERR(konepure_class); + konepure_class->dev_bin_attrs = konepure_bin_attributes; + + retval = hid_register_driver(&konepure_driver); + if (retval) + class_destroy(konepure_class); + return retval; +} + +static void __exit konepure_exit(void) +{ + hid_unregister_driver(&konepure_driver); + class_destroy(konepure_class); +} + +module_init(konepure_init); +module_exit(konepure_exit); + +MODULE_AUTHOR("Stefan Achatz"); +MODULE_DESCRIPTION("USB Roccat KonePure driver"); +MODULE_LICENSE("GPL v2"); diff --git a/drivers/hid/hid-roccat-konepure.h b/drivers/hid/hid-roccat-konepure.h new file mode 100644 index 00000000000..2cd24e93dfd --- /dev/null +++ b/drivers/hid/hid-roccat-konepure.h @@ -0,0 +1,72 @@ +#ifndef __HID_ROCCAT_KONEPURE_H +#define __HID_ROCCAT_KONEPURE_H + +/* + * Copyright (c) 2012 Stefan Achatz + */ + +/* + * 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 + +enum { + KONEPURE_SIZE_ACTUAL_PROFILE = 0x03, + KONEPURE_SIZE_CONTROL = 0x03, + KONEPURE_SIZE_FIRMWARE_WRITE = 0x0402, + KONEPURE_SIZE_INFO = 0x06, + KONEPURE_SIZE_MACRO = 0x0822, + KONEPURE_SIZE_PROFILE_SETTINGS = 0x1f, + KONEPURE_SIZE_PROFILE_BUTTONS = 0x3b, + KONEPURE_SIZE_SENSOR = 0x06, + KONEPURE_SIZE_TALK = 0x10, + KONEPURE_SIZE_TCU = 0x04, + KONEPURE_SIZE_TCU_IMAGE = 0x0404, +}; + +enum konepure_control_requests { + KONEPURE_CONTROL_REQUEST_GENERAL = 0x80, + KONEPURE_CONTROL_REQUEST_BUTTONS = 0x90, +}; + +enum konepure_commands { + KONEPURE_COMMAND_CONTROL = 0x04, + KONEPURE_COMMAND_ACTUAL_PROFILE = 0x05, + KONEPURE_COMMAND_PROFILE_SETTINGS = 0x06, + KONEPURE_COMMAND_PROFILE_BUTTONS = 0x07, + KONEPURE_COMMAND_MACRO = 0x08, + KONEPURE_COMMAND_INFO = 0x09, + KONEPURE_COMMAND_TCU = 0x0c, + KONEPURE_COMMAND_TCU_IMAGE = 0x0c, + KONEPURE_COMMAND_E = 0x0e, + KONEPURE_COMMAND_SENSOR = 0x0f, + KONEPURE_COMMAND_TALK = 0x10, + KONEPURE_COMMAND_FIRMWARE_WRITE = 0x1b, + KONEPURE_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, +}; + +enum { + KONEPURE_MOUSE_REPORT_NUMBER_BUTTON = 3, +}; + +struct konepure_mouse_report_button { + uint8_t report_number; /* always KONEPURE_MOUSE_REPORT_NUMBER_BUTTON */ + uint8_t zero; + uint8_t type; + uint8_t data1; + uint8_t data2; + uint8_t zero2; + uint8_t unknown[2]; +} __packed; + +struct konepure_device { + int roccat_claimed; + int chrdev_minor; + struct mutex konepure_lock; +}; + +#endif -- cgit v1.2.3 From ce7169652532a95bebbf2f02cd330a4e66f171ae Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Sun, 10 Mar 2013 12:33:02 +0100 Subject: HID: roccat: add support for IskuFX Extending isku module with one additional and one changed sysfs attr. IskuFX has larger light sysfs attr. Made the code size tolerant so both devices can be handled. Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- Documentation/ABI/testing/sysfs-driver-hid-roccat-isku | 12 +++++++++++- drivers/hid/hid-ids.h | 1 + drivers/hid/hid-roccat-isku.c | 17 ++++++++++------- drivers/hid/hid-roccat-isku.h | 4 +++- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-hid-roccat-isku b/Documentation/ABI/testing/sysfs-driver-hid-roccat-isku index 9eca5a182e6..c601d0f2ac4 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-roccat-isku +++ b/Documentation/ABI/testing/sysfs-driver-hid-roccat-isku @@ -101,7 +101,8 @@ Date: June 2011 Contact: Stefan Achatz Description: When written, this file lets one set the backlight intensity for a specific profile. Profile number is included in written data. - The data has to be 10 bytes long. + The data has to be 10 bytes long for Isku, IskuFX needs 16 bytes + of data. Before reading this file, control has to be written to select which profile to read. Users: http://roccat.sourceforge.net @@ -141,3 +142,12 @@ Description: When written, this file lets one trigger easyshift functionality The data has to be 16 bytes long. This file is writeonly. Users: http://roccat.sourceforge.net + +What: /sys/bus/usb/devices/-:./::./isku/roccatisku/talkfx +Date: February 2013 +Contact: Stefan Achatz +Description: When written, this file lets one trigger temporary color schemes + from the host. + The data has to be 16 bytes long. + This file is writeonly. +Users: http://roccat.sourceforge.net diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 007ee7441e3..a2e767b3d5d 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -687,6 +687,7 @@ #define USB_VENDOR_ID_ROCCAT 0x1e7d #define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 #define USB_DEVICE_ID_ROCCAT_ISKU 0x319c +#define USB_DEVICE_ID_ROCCAT_ISKUFX 0x3264 #define USB_DEVICE_ID_ROCCAT_KONE 0x2ced #define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 #define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c index 1219998a02d..8023751d525 100644 --- a/drivers/hid/hid-roccat-isku.c +++ b/drivers/hid/hid-roccat-isku.c @@ -130,14 +130,14 @@ static ssize_t isku_sysfs_read(struct file *fp, struct kobject *kobj, if (off >= real_size) return 0; - if (off != 0 || count != real_size) + if (off != 0 || count > real_size) return -EINVAL; mutex_lock(&isku->isku_lock); - retval = isku_receive(usb_dev, command, buf, real_size); + retval = isku_receive(usb_dev, command, buf, count); mutex_unlock(&isku->isku_lock); - return retval ? retval : real_size; + return retval ? retval : count; } static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, @@ -150,15 +150,15 @@ static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); int retval; - if (off != 0 || count != real_size) + if (off != 0 || count > real_size) return -EINVAL; mutex_lock(&isku->isku_lock); retval = roccat_common2_send_with_status(usb_dev, command, - (void *)buf, real_size); + (void *)buf, count); mutex_unlock(&isku->isku_lock); - return retval ? retval : real_size; + return retval ? retval : count; } #define ISKU_SYSFS_W(thingy, THINGY) \ @@ -216,6 +216,7 @@ ISKU_SYSFS_RW(light, LIGHT) ISKU_SYSFS_RW(key_mask, KEY_MASK) ISKU_SYSFS_RW(last_set, LAST_SET) ISKU_SYSFS_W(talk, TALK) +ISKU_SYSFS_W(talkfx, TALKFX) ISKU_SYSFS_R(info, INFO) ISKU_SYSFS_W(control, CONTROL) ISKU_SYSFS_W(reset, RESET) @@ -232,6 +233,7 @@ static struct bin_attribute isku_bin_attributes[] = { ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), ISKU_BIN_ATTR_RW(last_set, LAST_SET), ISKU_BIN_ATTR_W(talk, TALK), + ISKU_BIN_ATTR_W(talkfx, TALKFX), ISKU_BIN_ATTR_R(info, INFO), ISKU_BIN_ATTR_W(control, CONTROL), ISKU_BIN_ATTR_W(reset, RESET), @@ -405,6 +407,7 @@ static int isku_raw_event(struct hid_device *hdev, static const struct hid_device_id isku_devices[] = { { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, + { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) }, { } }; @@ -443,5 +446,5 @@ module_init(isku_init); module_exit(isku_exit); MODULE_AUTHOR("Stefan Achatz"); -MODULE_DESCRIPTION("USB Roccat Isku driver"); +MODULE_DESCRIPTION("USB Roccat Isku/FX driver"); MODULE_LICENSE("GPL v2"); diff --git a/drivers/hid/hid-roccat-isku.h b/drivers/hid/hid-roccat-isku.h index cf6896c8386..53056860d4d 100644 --- a/drivers/hid/hid-roccat-isku.h +++ b/drivers/hid/hid-roccat-isku.h @@ -25,10 +25,11 @@ enum { ISKU_SIZE_KEYS_MACRO = 0x23, ISKU_SIZE_KEYS_CAPSLOCK = 0x06, ISKU_SIZE_LAST_SET = 0x14, - ISKU_SIZE_LIGHT = 0x0a, + ISKU_SIZE_LIGHT = 0x10, ISKU_SIZE_MACRO = 0x823, ISKU_SIZE_RESET = 0x03, ISKU_SIZE_TALK = 0x10, + ISKU_SIZE_TALKFX = 0x10, }; enum { @@ -59,6 +60,7 @@ enum isku_commands { ISKU_COMMAND_LAST_SET = 0x14, ISKU_COMMAND_15 = 0x15, ISKU_COMMAND_TALK = 0x16, + ISKU_COMMAND_TALKFX = 0x17, ISKU_COMMAND_FIRMWARE_WRITE = 0x1b, ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, }; -- cgit v1.2.3 From 02060045cd93b886381b02ec816e312f19d5e505 Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Sun, 10 Mar 2013 12:33:04 +0100 Subject: HID: roccat: fix comments on chardevice Fixed parameter documentation. Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- drivers/hid/hid-roccat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-roccat.c b/drivers/hid/hid-roccat.c index d7437ef5c69..b59b3df9ca9 100644 --- a/drivers/hid/hid-roccat.c +++ b/drivers/hid/hid-roccat.c @@ -242,7 +242,6 @@ static int roccat_release(struct inode *inode, struct file *file) * roccat_report_event() - output data to readers * @minor: minor device number returned by roccat_connect() * @data: pointer to data - * @len: size of data * * Return value is zero on success, a negative error code on failure. * @@ -290,6 +289,7 @@ EXPORT_SYMBOL_GPL(roccat_report_event); * @class: the class thats used to create the device. Meant to hold device * specific sysfs attributes. * @hid: the hid device the char device should be connected to. + * @report_size: size of reports * * Return value is minor device number in Range [0, ROCCAT_MAX_DEVICES] on * success, a negative error code on failure. -- cgit v1.2.3 From bb64469af5908d89766b116d91c0691fe3c9237a Mon Sep 17 00:00:00 2001 From: Wei Yongjun Date: Fri, 15 Mar 2013 23:07:02 +0800 Subject: HID: steelseries: use module_hid_driver() to simplify the code module_hid_driver() makes the code simpler by eliminating boilerplate code.. Signed-off-by: Wei Yongjun Signed-off-by: Jiri Kosina --- drivers/hid/hid-steelseries.c | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) diff --git a/drivers/hid/hid-steelseries.c b/drivers/hid/hid-steelseries.c index 2ed995cda44..136d156d0a4 100644 --- a/drivers/hid/hid-steelseries.c +++ b/drivers/hid/hid-steelseries.c @@ -378,16 +378,5 @@ static struct hid_driver steelseries_srws1_driver = { .report_fixup = steelseries_srws1_report_fixup }; -static int __init steelseries_srws1_init(void) -{ - return hid_register_driver(&steelseries_srws1_driver); -} - -static void __exit steelseries_srws1_exit(void) -{ - hid_unregister_driver(&steelseries_srws1_driver); -} - -module_init(steelseries_srws1_init); -module_exit(steelseries_srws1_exit); +module_hid_driver(steelseries_srws1_driver); MODULE_LICENSE("GPL"); -- cgit v1.2.3 From 4e55467efbc7e52e9e0d8c797c72e6b45c5ee270 Mon Sep 17 00:00:00 2001 From: Paul Bolle Date: Mon, 25 Mar 2013 20:52:01 +0100 Subject: HID: fix ifdef comment for "CONFIG_HID_PICOLCD_CIR" Signed-off-by: Paul Bolle Signed-off-by: Jiri Kosina --- drivers/hid/hid-picolcd.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-picolcd.h b/drivers/hid/hid-picolcd.h index 020cef69f6a..88c7c934c60 100644 --- a/drivers/hid/hid-picolcd.h +++ b/drivers/hid/hid-picolcd.h @@ -302,7 +302,7 @@ static inline int picolcd_init_cir(struct picolcd_data *data, struct hid_report static inline void picolcd_exit_cir(struct picolcd_data *data) { } -#endif /* CONFIG_HID_PICOLCD_LIRC */ +#endif /* CONFIG_HID_PICOLCD_CIR */ int picolcd_reset(struct hid_device *hdev); struct picolcd_pending *picolcd_send_and_wait(struct hid_device *hdev, -- cgit v1.2.3 From f37130533f68711fd6bae2c79950b8e72002bad6 Mon Sep 17 00:00:00 2001 From: Jiri Kosina Date: Wed, 27 Mar 2013 17:29:18 +0100 Subject: HID: hidraw: warn if userspace headers are outdated Put a warning into sample hidraw code in samples/hidraw/hid-example.c in case the userspace headers are missing the necessary defines and need to be updated. Signed-off-by: Jiri Kosina --- samples/hidraw/hid-example.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/samples/hidraw/hid-example.c b/samples/hidraw/hid-example.c index 816e2dcda7c..512a7e50bca 100644 --- a/samples/hidraw/hid-example.c +++ b/samples/hidraw/hid-example.c @@ -17,10 +17,9 @@ /* * Ugly hack to work around failing compilation on systems that don't * yet populate new version of hidraw.h to userspace. - * - * If you need this, please have your distro update the kernel headers. */ #ifndef HIDIOCSFEATURE +#warning Please have your distro update the userspace kernel headers #define HIDIOCSFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x06, len) #define HIDIOCGFEATURE(len) _IOC(_IOC_WRITE|_IOC_READ, 'H', 0x07, len) #endif -- cgit v1.2.3 From 3a7f134f3061c242659a92fd8ddcfe53aaeaec22 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Thu, 4 Apr 2013 22:32:12 +0200 Subject: HID: hid-lenovo-tpkbd: remove doubled hid_get_drvdata In pointer_press_speed_show, we do data_pointer = hid_get_drvdata(hdev); twice in a row. Remove one of those. Signed-off-by: Jiri Slaby Signed-off-by: Jiri Kosina --- drivers/hid/hid-lenovo-tpkbd.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo-tpkbd.c index 956c3b135f6..c842ece2be3 100644 --- a/drivers/hid/hid-lenovo-tpkbd.c +++ b/drivers/hid/hid-lenovo-tpkbd.c @@ -228,8 +228,6 @@ static ssize_t pointer_press_speed_show(struct device *dev, struct hid_device *hdev = container_of(dev, struct hid_device, dev); struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); - data_pointer = hid_get_drvdata(hdev); - return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_speed); } -- cgit v1.2.3 From b42065f31704686e69002343403f45fff863a120 Mon Sep 17 00:00:00 2001 From: Stefan Achatz Date: Sun, 7 Apr 2013 07:08:44 +0200 Subject: HID: roccat: added media key support for Kone Kone now reports media key events through it's chardev to userspace. Signed-off-by: Stefan Achatz Signed-off-by: Jiri Kosina --- drivers/hid/hid-roccat-kone.c | 3 ++- drivers/hid/hid-roccat-kone.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-roccat-kone.c b/drivers/hid/hid-roccat-kone.c index 9ce2d0b615a..7fae070788f 100644 --- a/drivers/hid/hid-roccat-kone.c +++ b/drivers/hid/hid-roccat-kone.c @@ -818,8 +818,9 @@ static void kone_report_to_chrdev(struct kone_device const *kone, (uint8_t *)&roccat_report); break; case kone_mouse_event_call_overlong_macro: + case kone_mouse_event_multimedia: if (event->value == kone_keystroke_action_press) { - roccat_report.event = kone_mouse_event_call_overlong_macro; + roccat_report.event = event->event; roccat_report.value = kone->actual_profile; roccat_report.key = event->macro_key; roccat_report_event(kone->chrdev_minor, diff --git a/drivers/hid/hid-roccat-kone.h b/drivers/hid/hid-roccat-kone.h index 64abb5b8a59..52c6167d023 100644 --- a/drivers/hid/hid-roccat-kone.h +++ b/drivers/hid/hid-roccat-kone.h @@ -169,6 +169,7 @@ enum kone_mouse_events { /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ kone_mouse_event_calibration = 0xc0, kone_mouse_event_call_overlong_macro = 0xe0, + kone_mouse_event_multimedia = 0xe1, /* switch events notify if user changed values with mousebutton click */ kone_mouse_event_switch_dpi = 0xf0, kone_mouse_event_switch_profile = 0xf1 -- cgit v1.2.3 From cdfee4ff4158361239e67ae2fab8c1e5d8a4ec05 Mon Sep 17 00:00:00 2001 From: David King Date: Sat, 20 Apr 2013 20:13:52 +0100 Subject: HID: clarify Magic Mouse Kconfig description The Magic Mouse driver also supports the Magic Trackpad, so mention it in the KConfig description for the driver. Signed-off-by: David King Signed-off-by: Jiri Kosina --- drivers/hid/Kconfig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 49e29391cb9..edb15c8741d 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -373,13 +373,13 @@ config LOGIWHEELS_FF - Logitech Formula Force EX config HID_MAGICMOUSE - tristate "Apple MagicMouse multi-touch support" + tristate "Apple Magic Mouse/Trackpad multi-touch support" depends on BT_HIDP ---help--- - Support for the Apple Magic Mouse multi-touch. + Support for the Apple Magic Mouse/Trackpad multi-touch. Say Y here if you want support for the multi-touch features of the - Apple Wireless "Magic" Mouse. + Apple Wireless "Magic" Mouse and the Apple Wireless "Magic" Trackpad. config HID_MICROSOFT tristate "Microsoft non-fully HID-compliant devices" if EXPERT -- cgit v1.2.3 From d856501413e5d72eeb76e1c35e26458e80c27447 Mon Sep 17 00:00:00 2001 From: Chen Gang Date: Sun, 7 Apr 2013 12:55:44 +0800 Subject: HID: icade: u16 which never < 0 from is u16 which never < 0. Signed-off-by: Chen Gang Signed-off-by: Jiri Kosina --- drivers/hid/hid-icade.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hid/hid-icade.c b/drivers/hid/hid-icade.c index 09dcc04595f..76b5a757078 100644 --- a/drivers/hid/hid-icade.c +++ b/drivers/hid/hid-icade.c @@ -159,7 +159,7 @@ static const struct icade_key icade_usage_table[30] = { static const struct icade_key *icade_find_translation(u16 from) { - if (from < 0 || from > ICADE_MAX_USAGE) + if (from > ICADE_MAX_USAGE) return NULL; return &icade_usage_table[from]; } -- cgit v1.2.3 From 89759e20d9571e0496c7e12fc4a3ce2a5233f18e Mon Sep 17 00:00:00 2001 From: Adam Jiang Date: Mon, 29 Apr 2013 13:27:31 +0900 Subject: HID: Add PID for Japanese version of NE4K keyboard This patche adds PID of Japanese Natual Ergonomic Keyboard 4000. HID NE4K driver depends on this PID for determining its quirks. F14-F18 keys would not work without the patch. Signed-off-by: Adam Jiang Signed-off-by: Jiri Kosina --- drivers/hid/hid-core.c | 1 + drivers/hid/hid-ids.h | 1 + drivers/hid/hid-microsoft.c | 2 ++ 3 files changed, 4 insertions(+) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index ff75cabf739..f4e1c34ec11 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -1654,6 +1654,7 @@ static const struct hid_device_id hid_have_special_driver[] = { { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_SIDEWINDER_GV) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K) }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB) }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_DIGITAL_MEDIA_3K) }, diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h index 6e5c2ffa8d9..89ef50c52da 100644 --- a/drivers/hid/hid-ids.h +++ b/drivers/hid/hid-ids.h @@ -575,6 +575,7 @@ #define USB_DEVICE_ID_SIDEWINDER_GV 0x003b #define USB_DEVICE_ID_WIRELESS_OPTICAL_DESKTOP_3_0 0x009d #define USB_DEVICE_ID_MS_NE4K 0x00db +#define USB_DEVICE_ID_MS_NE4K_JP 0x00dc #define USB_DEVICE_ID_MS_LK6K 0x00f9 #define USB_DEVICE_ID_MS_PRESENTER_8K_BT 0x0701 #define USB_DEVICE_ID_MS_PRESENTER_8K_USB 0x0713 diff --git a/drivers/hid/hid-microsoft.c b/drivers/hid/hid-microsoft.c index 29d27f65a11..551795b7da1 100644 --- a/drivers/hid/hid-microsoft.c +++ b/drivers/hid/hid-microsoft.c @@ -195,6 +195,8 @@ static const struct hid_device_id ms_devices[] = { .driver_data = MS_HIDINPUT }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K), .driver_data = MS_ERGONOMY }, + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_NE4K_JP), + .driver_data = MS_ERGONOMY }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_LK6K), .driver_data = MS_ERGONOMY | MS_RDESC }, { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_PRESENTER_8K_USB), -- cgit v1.2.3