From 73055456e3995b73d0cfbb2c442e27e82e254154 Mon Sep 17 00:00:00 2001 From: Tomoki Sekiyama Date: Mon, 23 May 2011 15:45:44 -0700 Subject: [PATCH] --- yaml --- r: 256802 b: refs/heads/master c: 6dc1418e13144162e8bc4858789010d8f0e1e65c h: refs/heads/master v: v3 --- [refs] | 2 +- .../testing/sysfs-driver-hid-roccat-koneplus | 8 --- trunk/drivers/hid/Kconfig | 17 +++--- trunk/drivers/hid/hid-core.c | 6 +- trunk/drivers/hid/hid-roccat-arvo.c | 21 +++---- trunk/drivers/hid/hid-roccat-arvo.h | 13 +++++ trunk/drivers/hid/hid-roccat-common.c | 20 ++----- trunk/drivers/hid/hid-roccat-common.h | 4 +- trunk/drivers/hid/hid-roccat-kone.c | 56 ++----------------- trunk/drivers/hid/hid-roccat-kone.h | 2 +- trunk/drivers/hid/hid-roccat-koneplus.c | 49 +++++----------- trunk/drivers/hid/hid-roccat-koneplus.h | 23 +++++--- trunk/drivers/hid/hid-roccat-kovaplus.c | 25 ++++----- trunk/drivers/hid/hid-roccat-kovaplus.h | 9 +++ trunk/drivers/hid/hid-roccat-pyra.c | 25 +++++---- trunk/drivers/hid/hid-roccat-pyra.h | 9 +++ trunk/drivers/hid/usbhid/hid-core.c | 2 + trunk/include/linux/hid.h | 3 +- 18 files changed, 128 insertions(+), 166 deletions(-) diff --git a/[refs] b/[refs] index f1947b251b49..7e53b78a8c5f 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 901e64dbdb5998b9248c372a401c921bbdf662f6 +refs/heads/master: 6dc1418e13144162e8bc4858789010d8f0e1e65c diff --git a/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus b/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus index 65e6e5dd67e8..c1b53b8bc2ae 100644 --- a/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus +++ b/trunk/Documentation/ABI/testing/sysfs-driver-hid-roccat-koneplus @@ -92,14 +92,6 @@ Description: The mouse has a tracking- and a distance-control-unit. These This file is writeonly. Users: http://roccat.sourceforge.net -What: /sys/bus/usb/devices/-:./::./koneplus/roccatkoneplus/talk -Date: May 2011 -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/-:./::./koneplus/roccatkoneplus/tcu Date: October 2010 Contact: Stefan Achatz diff --git a/trunk/drivers/hid/Kconfig b/trunk/drivers/hid/Kconfig index 14ba3e2cbd3b..67d2a7585934 100644 --- a/trunk/drivers/hid/Kconfig +++ b/trunk/drivers/hid/Kconfig @@ -434,7 +434,6 @@ config HID_QUANTA config HID_ROCCAT tristate "Roccat special event support" depends on USB_HID - select HID_ROCCAT_COMMON ---help--- Support for Roccat special events. Say Y here if you have a Roccat mouse or keyboard and want OSD or @@ -442,40 +441,44 @@ config HID_ROCCAT config HID_ROCCAT_COMMON tristate - depends on HID_ROCCAT config HID_ROCCAT_ARVO tristate "Roccat Arvo keyboard support" depends on USB_HID - depends on HID_ROCCAT + select HID_ROCCAT + select HID_ROCCAT_COMMON ---help--- Support for Roccat Arvo keyboard. config HID_ROCCAT_KONE tristate "Roccat Kone Mouse support" depends on USB_HID - depends on HID_ROCCAT + select HID_ROCCAT + select HID_ROCCAT_COMMON ---help--- Support for Roccat Kone mouse. config HID_ROCCAT_KONEPLUS tristate "Roccat Kone[+] mouse support" depends on USB_HID - depends on HID_ROCCAT + select HID_ROCCAT + select HID_ROCCAT_COMMON ---help--- Support for Roccat Kone[+] mouse. config HID_ROCCAT_KOVAPLUS tristate "Roccat Kova[+] mouse support" depends on USB_HID - depends on HID_ROCCAT + select HID_ROCCAT + select HID_ROCCAT_COMMON ---help--- Support for Roccat Kova[+] mouse. config HID_ROCCAT_PYRA tristate "Roccat Pyra mouse support" depends on USB_HID - depends on HID_ROCCAT + select HID_ROCCAT + select HID_ROCCAT_COMMON ---help--- Support for Roccat Pyra mouse. diff --git a/trunk/drivers/hid/hid-core.c b/trunk/drivers/hid/hid-core.c index c957c4b4fe70..9d6495d19e02 100644 --- a/trunk/drivers/hid/hid-core.c +++ b/trunk/drivers/hid/hid-core.c @@ -1769,7 +1769,6 @@ static const struct hid_device_id hid_ignore_list[] = { { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) }, { HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) }, { HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) }, - { HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_YUREX) }, { HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) }, { HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) }, { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) }, @@ -1910,6 +1909,11 @@ static bool hid_ignore(struct hid_device *hdev) hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST) return true; break; + case USB_VENDOR_ID_JESS: + if (hdev->product == USB_DEVICE_ID_JESS_YUREX && + hdev->type == HID_TYPE_USBNONE) + return true; + break; } if (hdev->type == HID_TYPE_USBMOUSE && diff --git a/trunk/drivers/hid/hid-roccat-arvo.c b/trunk/drivers/hid/hid-roccat-arvo.c index 093bfad00b02..2307471d96dc 100644 --- a/trunk/drivers/hid/hid-roccat-arvo.c +++ b/trunk/drivers/hid/hid-roccat-arvo.c @@ -39,7 +39,7 @@ static ssize_t arvo_sysfs_show_mode_key(struct device *dev, int retval; mutex_lock(&arvo->arvo_lock); - retval = roccat_common_receive(usb_dev, ARVO_COMMAND_MODE_KEY, + retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_MODE_KEY, &temp_buf, sizeof(struct arvo_mode_key)); mutex_unlock(&arvo->arvo_lock); if (retval) @@ -67,7 +67,7 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev, temp_buf.state = state; mutex_lock(&arvo->arvo_lock); - retval = roccat_common_send(usb_dev, ARVO_COMMAND_MODE_KEY, + retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_MODE_KEY, &temp_buf, sizeof(struct arvo_mode_key)); mutex_unlock(&arvo->arvo_lock); if (retval) @@ -87,7 +87,7 @@ static ssize_t arvo_sysfs_show_key_mask(struct device *dev, int retval; mutex_lock(&arvo->arvo_lock); - retval = roccat_common_receive(usb_dev, ARVO_COMMAND_KEY_MASK, + retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_KEY_MASK, &temp_buf, sizeof(struct arvo_key_mask)); mutex_unlock(&arvo->arvo_lock); if (retval) @@ -115,7 +115,7 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev, temp_buf.key_mask = key_mask; mutex_lock(&arvo->arvo_lock); - retval = roccat_common_send(usb_dev, ARVO_COMMAND_KEY_MASK, + retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_KEY_MASK, &temp_buf, sizeof(struct arvo_key_mask)); mutex_unlock(&arvo->arvo_lock); if (retval) @@ -130,7 +130,7 @@ static int arvo_get_actual_profile(struct usb_device *usb_dev) struct arvo_actual_profile temp_buf; int retval; - retval = roccat_common_receive(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, + retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE, &temp_buf, sizeof(struct arvo_actual_profile)); if (retval) @@ -163,14 +163,11 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev, if (retval) return retval; - if (profile < 1 || profile > 5) - return -EINVAL; - temp_buf.command = ARVO_COMMAND_ACTUAL_PROFILE; temp_buf.actual_profile = profile; mutex_lock(&arvo->arvo_lock); - retval = roccat_common_send(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE, + retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE, &temp_buf, sizeof(struct arvo_actual_profile)); if (!retval) { arvo->actual_profile = profile; @@ -228,7 +225,7 @@ static ssize_t arvo_sysfs_write_button(struct file *fp, loff_t off, size_t count) { return arvo_sysfs_write(fp, kobj, buf, off, count, - sizeof(struct arvo_button), ARVO_COMMAND_BUTTON); + sizeof(struct arvo_button), ARVO_USB_COMMAND_BUTTON); } static ssize_t arvo_sysfs_read_info(struct file *fp, @@ -236,7 +233,7 @@ static ssize_t arvo_sysfs_read_info(struct file *fp, loff_t off, size_t count) { return arvo_sysfs_read(fp, kobj, buf, off, count, - sizeof(struct arvo_info), ARVO_COMMAND_INFO); + sizeof(struct arvo_info), ARVO_USB_COMMAND_INFO); } @@ -402,7 +399,7 @@ static int arvo_raw_event(struct hid_device *hdev, if (size != 3) return 0; - if (arvo && arvo->roccat_claimed) + if (arvo->roccat_claimed) arvo_report_to_chrdev(arvo, data); return 0; diff --git a/trunk/drivers/hid/hid-roccat-arvo.h b/trunk/drivers/hid/hid-roccat-arvo.h index ce8415e4f009..d284a781c99e 100644 --- a/trunk/drivers/hid/hid-roccat-arvo.h +++ b/trunk/drivers/hid/hid-roccat-arvo.h @@ -46,6 +46,19 @@ enum arvo_commands { ARVO_COMMAND_ACTUAL_PROFILE = 0x7, }; +enum arvo_usb_commands { + ARVO_USB_COMMAND_MODE_KEY = 0x303, + /* + * read/write + * Read uses both index bytes as profile/key indexes + * Write has index 0, profile/key is determined by payload + */ + ARVO_USB_COMMAND_BUTTON = 0x304, + ARVO_USB_COMMAND_INFO = 0x305, + ARVO_USB_COMMAND_KEY_MASK = 0x306, + ARVO_USB_COMMAND_ACTUAL_PROFILE = 0x307, +}; + struct arvo_special_report { uint8_t unknown1; /* always 0x01 */ uint8_t event; diff --git a/trunk/drivers/hid/hid-roccat-common.c b/trunk/drivers/hid/hid-roccat-common.c index edf898dee28b..13b1eb0c8c65 100644 --- a/trunk/drivers/hid/hid-roccat-common.c +++ b/trunk/drivers/hid/hid-roccat-common.c @@ -11,16 +11,10 @@ * any later version. */ -#include #include #include "hid-roccat-common.h" -static inline uint16_t roccat_common_feature_report(uint8_t report_id) -{ - return 0x300 | report_id; -} - -int roccat_common_receive(struct usb_device *usb_dev, uint report_id, +int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, void *data, uint size) { char *buf; @@ -31,10 +25,9 @@ int roccat_common_receive(struct usb_device *usb_dev, uint report_id, return -ENOMEM; len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - HID_REQ_GET_REPORT, + USB_REQ_CLEAR_FEATURE, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - roccat_common_feature_report(report_id), - 0, buf, size, USB_CTRL_SET_TIMEOUT); + usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); memcpy(data, buf, size); kfree(buf); @@ -42,7 +35,7 @@ int roccat_common_receive(struct usb_device *usb_dev, uint report_id, } EXPORT_SYMBOL_GPL(roccat_common_receive); -int roccat_common_send(struct usb_device *usb_dev, uint report_id, +int roccat_common_send(struct usb_device *usb_dev, uint usb_command, void const *data, uint size) { char *buf; @@ -55,10 +48,9 @@ int roccat_common_send(struct usb_device *usb_dev, uint report_id, memcpy(buf, data, size); len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - HID_REQ_SET_REPORT, + USB_REQ_SET_CONFIGURATION, USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - roccat_common_feature_report(report_id), - 0, buf, size, USB_CTRL_SET_TIMEOUT); + usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); kfree(buf); return ((len < 0) ? len : ((len != size) ? -EIO : 0)); diff --git a/trunk/drivers/hid/hid-roccat-common.h b/trunk/drivers/hid/hid-roccat-common.h index 9a5bc61f9699..fe45fae05bb9 100644 --- a/trunk/drivers/hid/hid-roccat-common.h +++ b/trunk/drivers/hid/hid-roccat-common.h @@ -15,9 +15,9 @@ #include #include -int roccat_common_receive(struct usb_device *usb_dev, uint report_id, +int roccat_common_receive(struct usb_device *usb_dev, uint usb_command, void *data, uint size); -int roccat_common_send(struct usb_device *usb_dev, uint report_id, +int roccat_common_send(struct usb_device *usb_dev, uint usb_command, void const *data, uint size); #endif diff --git a/trunk/drivers/hid/hid-roccat-kone.c b/trunk/drivers/hid/hid-roccat-kone.c index 2b8f3a31ffb3..a57838d15267 100644 --- a/trunk/drivers/hid/hid-roccat-kone.c +++ b/trunk/drivers/hid/hid-roccat-kone.c @@ -37,47 +37,6 @@ static uint profile_numbers[5] = {0, 1, 2, 3, 4}; -static int kone_receive(struct usb_device *usb_dev, uint usb_command, - void *data, uint size) -{ - char *buf; - int len; - - buf = kmalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0), - HID_REQ_GET_REPORT, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN, - usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); - - memcpy(data, buf, size); - kfree(buf); - return ((len < 0) ? len : ((len != size) ? -EIO : 0)); -} - -static int kone_send(struct usb_device *usb_dev, uint usb_command, - void const *data, uint size) -{ - char *buf; - int len; - - buf = kmalloc(size, GFP_KERNEL); - if (buf == NULL) - return -ENOMEM; - - memcpy(buf, data, size); - - len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0), - HID_REQ_SET_REPORT, - USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT, - usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT); - - kfree(buf); - return ((len < 0) ? len : ((len != size) ? -EIO : 0)); -} - /* kone_class is used for creating sysfs attributes via roccat char device */ static struct class *kone_class; @@ -109,7 +68,7 @@ static int kone_check_write(struct usb_device *usb_dev) */ msleep(80); - retval = kone_receive(usb_dev, + retval = roccat_common_receive(usb_dev, kone_command_confirm_write, &data, 1); if (retval) return retval; @@ -137,7 +96,7 @@ static int kone_check_write(struct usb_device *usb_dev) static int kone_get_settings(struct usb_device *usb_dev, struct kone_settings *buf) { - return kone_receive(usb_dev, kone_command_settings, buf, + return roccat_common_receive(usb_dev, kone_command_settings, buf, sizeof(struct kone_settings)); } @@ -150,7 +109,7 @@ static int kone_set_settings(struct usb_device *usb_dev, struct kone_settings const *settings) { int retval; - retval = kone_send(usb_dev, kone_command_settings, + retval = roccat_common_send(usb_dev, kone_command_settings, settings, sizeof(struct kone_settings)); if (retval) return retval; @@ -223,7 +182,7 @@ static int kone_get_weight(struct usb_device *usb_dev, int *result) int retval; uint8_t data; - retval = kone_receive(usb_dev, kone_command_weight, &data, 1); + retval = roccat_common_receive(usb_dev, kone_command_weight, &data, 1); if (retval) return retval; @@ -242,7 +201,7 @@ static int kone_get_firmware_version(struct usb_device *usb_dev, int *result) int retval; uint16_t data; - retval = kone_receive(usb_dev, kone_command_firmware_version, + retval = roccat_common_receive(usb_dev, kone_command_firmware_version, &data, 2); if (retval) return retval; @@ -425,7 +384,7 @@ static int kone_tcu_command(struct usb_device *usb_dev, int number) { unsigned char value; value = number; - return kone_send(usb_dev, kone_command_calibrate, &value, 1); + return roccat_common_send(usb_dev, kone_command_calibrate, &value, 1); } /* @@ -832,9 +791,6 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report, if (size != sizeof(struct kone_mouse_event)) return 0; - if (kone == NULL) - return 0; - /* * Firmware 1.38 introduced new behaviour for tilt and special buttons. * Pressed button is reported in each movement event. diff --git a/trunk/drivers/hid/hid-roccat-kone.h b/trunk/drivers/hid/hid-roccat-kone.h index 64abb5b8a59a..4109a028e138 100644 --- a/trunk/drivers/hid/hid-roccat-kone.h +++ b/trunk/drivers/hid/hid-roccat-kone.h @@ -166,7 +166,7 @@ enum kone_mouse_events { /* osd events are thought to be display on screen */ kone_mouse_event_osd_dpi = 0xa0, kone_mouse_event_osd_profile = 0xb0, - /* TODO clarify meaning and occurence of kone_mouse_event_calibration */ + /* TODO clarify meaning and occurrence of kone_mouse_event_calibration */ kone_mouse_event_calibration = 0xc0, kone_mouse_event_call_overlong_macro = 0xe0, /* switch events notify if user changed values with mousebutton click */ diff --git a/trunk/drivers/hid/hid-roccat-koneplus.c b/trunk/drivers/hid/hid-roccat-koneplus.c index 59e47770fa10..5b640a7a15a7 100644 --- a/trunk/drivers/hid/hid-roccat-koneplus.c +++ b/trunk/drivers/hid/hid-roccat-koneplus.c @@ -50,7 +50,7 @@ static int koneplus_send_control(struct usb_device *usb_dev, uint value, control.value = value; control.request = request; - return roccat_common_send(usb_dev, KONEPLUS_COMMAND_CONTROL, + return roccat_common_send(usb_dev, KONEPLUS_USB_COMMAND_CONTROL, &control, sizeof(struct koneplus_control)); } @@ -60,7 +60,7 @@ static int koneplus_receive_control_status(struct usb_device *usb_dev) struct koneplus_control control; do { - retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_CONTROL, + retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_CONTROL, &control, sizeof(struct koneplus_control)); /* check if we get a completely wrong answer */ @@ -120,7 +120,7 @@ static int koneplus_select_profile(struct usb_device *usb_dev, uint number, static int koneplus_get_info(struct usb_device *usb_dev, struct koneplus_info *buf) { - return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_INFO, + return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_INFO, buf, sizeof(struct koneplus_info)); } @@ -134,14 +134,14 @@ static int koneplus_get_profile_settings(struct usb_device *usb_dev, if (retval) return retval; - return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS, + return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_SETTINGS, buf, sizeof(struct koneplus_profile_settings)); } static int koneplus_set_profile_settings(struct usb_device *usb_dev, struct koneplus_profile_settings const *settings) { - return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_SETTINGS, + return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_SETTINGS, settings, sizeof(struct koneplus_profile_settings)); } @@ -155,14 +155,14 @@ static int koneplus_get_profile_buttons(struct usb_device *usb_dev, if (retval) return retval; - return roccat_common_receive(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS, + return roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_BUTTONS, buf, sizeof(struct koneplus_profile_buttons)); } static int koneplus_set_profile_buttons(struct usb_device *usb_dev, struct koneplus_profile_buttons const *buttons) { - return koneplus_send(usb_dev, KONEPLUS_COMMAND_PROFILE_BUTTONS, + return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_PROFILE_BUTTONS, buttons, sizeof(struct koneplus_profile_buttons)); } @@ -172,7 +172,7 @@ static int koneplus_get_actual_profile(struct usb_device *usb_dev) struct koneplus_actual_profile buf; int retval; - retval = roccat_common_receive(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE, + retval = roccat_common_receive(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE, &buf, sizeof(struct koneplus_actual_profile)); return retval ? retval : buf.actual_profile; @@ -187,7 +187,7 @@ static int koneplus_set_actual_profile(struct usb_device *usb_dev, buf.size = sizeof(struct koneplus_actual_profile); buf.actual_profile = new_profile; - return koneplus_send(usb_dev, KONEPLUS_COMMAND_ACTUAL_PROFILE, + return koneplus_send(usb_dev, KONEPLUS_USB_COMMAND_ACTUAL_PROFILE, &buf, sizeof(struct koneplus_actual_profile)); } @@ -240,20 +240,12 @@ static ssize_t koneplus_sysfs_write(struct file *fp, struct kobject *kobj, return real_size; } -static ssize_t koneplus_sysfs_write_talk(struct file *fp, - struct kobject *kobj, struct bin_attribute *attr, char *buf, - loff_t off, size_t count) -{ - return koneplus_sysfs_write(fp, kobj, buf, off, count, - sizeof(struct koneplus_talk), KONEPLUS_COMMAND_TALK); -} - static ssize_t koneplus_sysfs_write_macro(struct file *fp, struct kobject *kobj, struct bin_attribute *attr, char *buf, loff_t off, size_t count) { return koneplus_sysfs_write(fp, kobj, buf, off, count, - sizeof(struct koneplus_macro), KONEPLUS_COMMAND_MACRO); + sizeof(struct koneplus_macro), KONEPLUS_USB_COMMAND_MACRO); } static ssize_t koneplus_sysfs_read_sensor(struct file *fp, @@ -261,7 +253,7 @@ static ssize_t koneplus_sysfs_read_sensor(struct file *fp, loff_t off, size_t count) { return koneplus_sysfs_read(fp, kobj, buf, off, count, - sizeof(struct koneplus_sensor), KONEPLUS_COMMAND_SENSOR); + sizeof(struct koneplus_sensor), KONEPLUS_USB_COMMAND_SENSOR); } static ssize_t koneplus_sysfs_write_sensor(struct file *fp, @@ -269,7 +261,7 @@ static ssize_t koneplus_sysfs_write_sensor(struct file *fp, loff_t off, size_t count) { return koneplus_sysfs_write(fp, kobj, buf, off, count, - sizeof(struct koneplus_sensor), KONEPLUS_COMMAND_SENSOR); + sizeof(struct koneplus_sensor), KONEPLUS_USB_COMMAND_SENSOR); } static ssize_t koneplus_sysfs_write_tcu(struct file *fp, @@ -277,7 +269,7 @@ static ssize_t koneplus_sysfs_write_tcu(struct file *fp, loff_t off, size_t count) { return koneplus_sysfs_write(fp, kobj, buf, off, count, - sizeof(struct koneplus_tcu), KONEPLUS_COMMAND_TCU); + sizeof(struct koneplus_tcu), KONEPLUS_USB_COMMAND_TCU); } static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp, @@ -285,7 +277,7 @@ static ssize_t koneplus_sysfs_read_tcu_image(struct file *fp, loff_t off, size_t count) { return koneplus_sysfs_read(fp, kobj, buf, off, count, - sizeof(struct koneplus_tcu_image), KONEPLUS_COMMAND_TCU); + sizeof(struct koneplus_tcu_image), KONEPLUS_USB_COMMAND_TCU); } static ssize_t koneplus_sysfs_read_profilex_settings(struct file *fp, @@ -431,9 +423,6 @@ static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev, if (retval) return retval; - if (profile > 4) - return -EINVAL; - mutex_lock(&koneplus->koneplus_lock); retval = koneplus_set_actual_profile(usb_dev, profile); @@ -442,7 +431,7 @@ static ssize_t koneplus_sysfs_set_actual_profile(struct device *dev, return retval; } - koneplus_profile_activated(koneplus, profile); + koneplus->actual_profile = profile; roccat_report.type = KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE; roccat_report.data1 = profile + 1; @@ -568,11 +557,6 @@ static struct bin_attribute koneplus_bin_attributes[] = { .size = sizeof(struct koneplus_macro), .write = koneplus_sysfs_write_macro }, - { - .attr = { .name = "talk", .mode = 0220 }, - .size = sizeof(struct koneplus_talk), - .write = koneplus_sysfs_write_talk - }, __ATTR_NULL }; @@ -754,9 +738,6 @@ static int koneplus_raw_event(struct hid_device *hdev, != USB_INTERFACE_PROTOCOL_MOUSE) return 0; - if (koneplus == NULL) - return 0; - koneplus_keep_values_up_to_date(koneplus, data); if (koneplus->roccat_claimed) diff --git a/trunk/drivers/hid/hid-roccat-koneplus.h b/trunk/drivers/hid/hid-roccat-koneplus.h index c03332a4fa9a..c57a376ab8ae 100644 --- a/trunk/drivers/hid/hid-roccat-koneplus.h +++ b/trunk/drivers/hid/hid-roccat-koneplus.h @@ -14,12 +14,6 @@ #include -struct koneplus_talk { - uint8_t command; /* KONEPLUS_COMMAND_TALK */ - uint8_t size; /* always 0x10 */ - uint8_t data[14]; -} __packed; - /* * case 1: writes request 80 and reads value 1 * @@ -143,14 +137,26 @@ enum koneplus_commands { KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7, KONEPLUS_COMMAND_MACRO = 0x8, KONEPLUS_COMMAND_INFO = 0x9, - KONEPLUS_COMMAND_TCU = 0xc, KONEPLUS_COMMAND_E = 0xe, KONEPLUS_COMMAND_SENSOR = 0xf, - KONEPLUS_COMMAND_TALK = 0x10, KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b, KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, }; +enum koneplus_usb_commands { + KONEPLUS_USB_COMMAND_CONTROL = 0x304, + KONEPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305, + KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306, + KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307, + KONEPLUS_USB_COMMAND_MACRO = 0x308, + KONEPLUS_USB_COMMAND_INFO = 0x309, + KONEPLUS_USB_COMMAND_TCU = 0x30c, + KONEPLUS_USB_COMMAND_E = 0x30e, + KONEPLUS_USB_COMMAND_SENSOR = 0x30f, + KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b, + KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c, +}; + enum koneplus_mouse_report_numbers { KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1, KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2, @@ -187,7 +193,6 @@ enum koneplus_mouse_report_button_types { * data2 = action */ KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0, - KONEPLUS_MOUSE_REPORT_TALK = 0xff, }; enum koneplus_mouse_report_button_action { diff --git a/trunk/drivers/hid/hid-roccat-kovaplus.c b/trunk/drivers/hid/hid-roccat-kovaplus.c index 1f8336e3f584..984be2f8967e 100644 --- a/trunk/drivers/hid/hid-roccat-kovaplus.c +++ b/trunk/drivers/hid/hid-roccat-kovaplus.c @@ -58,7 +58,7 @@ static int kovaplus_send_control(struct usb_device *usb_dev, uint value, control.value = value; control.request = request; - retval = roccat_common_send(usb_dev, KOVAPLUS_COMMAND_CONTROL, + retval = roccat_common_send(usb_dev, KOVAPLUS_USB_COMMAND_CONTROL, &control, sizeof(struct kovaplus_control)); return retval; @@ -70,7 +70,7 @@ static int kovaplus_receive_control_status(struct usb_device *usb_dev) struct kovaplus_control control; do { - retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_CONTROL, + retval = roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_CONTROL, &control, sizeof(struct kovaplus_control)); /* check if we get a completely wrong answer */ @@ -90,7 +90,7 @@ static int kovaplus_receive_control_status(struct usb_device *usb_dev) if (control.value == KOVAPLUS_CONTROL_REQUEST_STATUS_OVERLOAD) return -EINVAL; - hid_err(usb_dev, "roccat_common_receive_control_status: " + hid_err(usb_dev, "kovaplus_receive_control_status: " "unknown response value 0x%x\n", control.value); return -EINVAL; } while (1); @@ -119,7 +119,7 @@ static int kovaplus_select_profile(struct usb_device *usb_dev, uint number, static int kovaplus_get_info(struct usb_device *usb_dev, struct kovaplus_info *buf) { - return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_INFO, + return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_INFO, buf, sizeof(struct kovaplus_info)); } @@ -133,14 +133,14 @@ static int kovaplus_get_profile_settings(struct usb_device *usb_dev, if (retval) return retval; - return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS, + return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS, buf, sizeof(struct kovaplus_profile_settings)); } static int kovaplus_set_profile_settings(struct usb_device *usb_dev, struct kovaplus_profile_settings const *settings) { - return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS, + return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS, settings, sizeof(struct kovaplus_profile_settings)); } @@ -154,14 +154,14 @@ static int kovaplus_get_profile_buttons(struct usb_device *usb_dev, if (retval) return retval; - return roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS, + return roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS, buf, sizeof(struct kovaplus_profile_buttons)); } static int kovaplus_set_profile_buttons(struct usb_device *usb_dev, struct kovaplus_profile_buttons const *buttons) { - return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS, + return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS, buttons, sizeof(struct kovaplus_profile_buttons)); } @@ -171,7 +171,7 @@ static int kovaplus_get_actual_profile(struct usb_device *usb_dev) struct kovaplus_actual_profile buf; int retval; - retval = roccat_common_receive(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE, + retval = roccat_common_receive(usb_dev, KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE, &buf, sizeof(struct kovaplus_actual_profile)); return retval ? retval : buf.actual_profile; @@ -186,7 +186,7 @@ static int kovaplus_set_actual_profile(struct usb_device *usb_dev, buf.size = sizeof(struct kovaplus_actual_profile); buf.actual_profile = new_profile; - return kovaplus_send(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE, + return kovaplus_send(usb_dev, KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE, &buf, sizeof(struct kovaplus_actual_profile)); } @@ -337,7 +337,7 @@ static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev, mutex_lock(&kovaplus->kovaplus_lock); retval = kovaplus_set_actual_profile(usb_dev, profile); - kovaplus_profile_activated(kovaplus, profile); + kovaplus->actual_profile = profile; mutex_unlock(&kovaplus->kovaplus_lock); if (retval) return retval; @@ -662,9 +662,6 @@ static int kovaplus_raw_event(struct hid_device *hdev, != USB_INTERFACE_PROTOCOL_MOUSE) return 0; - if (kovaplus == NULL) - return 0; - kovaplus_keep_values_up_to_date(kovaplus, data); if (kovaplus->roccat_claimed) diff --git a/trunk/drivers/hid/hid-roccat-kovaplus.h b/trunk/drivers/hid/hid-roccat-kovaplus.h index fb2aed44a8e0..ce40607d21c7 100644 --- a/trunk/drivers/hid/hid-roccat-kovaplus.h +++ b/trunk/drivers/hid/hid-roccat-kovaplus.h @@ -83,6 +83,15 @@ enum kovaplus_commands { KOVAPLUS_COMMAND_A = 0xa, }; +enum kovaplus_usb_commands { + KOVAPLUS_USB_COMMAND_CONTROL = 0x304, + KOVAPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305, + KOVAPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306, + KOVAPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307, + KOVAPLUS_USB_COMMAND_INFO = 0x309, + KOVAPLUS_USB_COMMAND_A = 0x30a, +}; + enum kovaplus_mouse_report_numbers { KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1, KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2, diff --git a/trunk/drivers/hid/hid-roccat-pyra.c b/trunk/drivers/hid/hid-roccat-pyra.c index 8140776bd8c5..38280c055a19 100644 --- a/trunk/drivers/hid/hid-roccat-pyra.c +++ b/trunk/drivers/hid/hid-roccat-pyra.c @@ -53,7 +53,7 @@ static int pyra_send_control(struct usb_device *usb_dev, int value, control.value = value; control.request = request; - return roccat_common_send(usb_dev, PYRA_COMMAND_CONTROL, + return roccat_common_send(usb_dev, PYRA_USB_COMMAND_CONTROL, &control, sizeof(struct pyra_control)); } @@ -64,7 +64,7 @@ static int pyra_receive_control_status(struct usb_device *usb_dev) do { msleep(10); - retval = roccat_common_receive(usb_dev, PYRA_COMMAND_CONTROL, + retval = roccat_common_receive(usb_dev, PYRA_USB_COMMAND_CONTROL, &control, sizeof(struct pyra_control)); /* requested too early, try again */ @@ -89,7 +89,7 @@ static int pyra_get_profile_settings(struct usb_device *usb_dev, PYRA_CONTROL_REQUEST_PROFILE_SETTINGS); if (retval) return retval; - return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, + return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, buf, sizeof(struct pyra_profile_settings)); } @@ -101,20 +101,20 @@ static int pyra_get_profile_buttons(struct usb_device *usb_dev, PYRA_CONTROL_REQUEST_PROFILE_BUTTONS); if (retval) return retval; - return roccat_common_receive(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, + return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, buf, sizeof(struct pyra_profile_buttons)); } static int pyra_get_settings(struct usb_device *usb_dev, struct pyra_settings *buf) { - return roccat_common_receive(usb_dev, PYRA_COMMAND_SETTINGS, + return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_SETTINGS, buf, sizeof(struct pyra_settings)); } static int pyra_get_info(struct usb_device *usb_dev, struct pyra_info *buf) { - return roccat_common_receive(usb_dev, PYRA_COMMAND_INFO, + return roccat_common_receive(usb_dev, PYRA_USB_COMMAND_INFO, buf, sizeof(struct pyra_info)); } @@ -131,22 +131,26 @@ static int pyra_send(struct usb_device *usb_dev, uint command, static int pyra_set_profile_settings(struct usb_device *usb_dev, struct pyra_profile_settings const *settings) { - return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_SETTINGS, settings, + return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_SETTINGS, settings, sizeof(struct pyra_profile_settings)); } static int pyra_set_profile_buttons(struct usb_device *usb_dev, struct pyra_profile_buttons const *buttons) { - return pyra_send(usb_dev, PYRA_COMMAND_PROFILE_BUTTONS, buttons, + return pyra_send(usb_dev, PYRA_USB_COMMAND_PROFILE_BUTTONS, buttons, sizeof(struct pyra_profile_buttons)); } static int pyra_set_settings(struct usb_device *usb_dev, struct pyra_settings const *settings) { - return pyra_send(usb_dev, PYRA_COMMAND_SETTINGS, settings, + int retval; + retval = roccat_common_send(usb_dev, PYRA_USB_COMMAND_SETTINGS, settings, sizeof(struct pyra_settings)); + if (retval) + return retval; + return pyra_receive_control_status(usb_dev); } static ssize_t pyra_sysfs_read_profilex_settings(struct file *fp, @@ -637,9 +641,6 @@ static int pyra_raw_event(struct hid_device *hdev, struct hid_report *report, != USB_INTERFACE_PROTOCOL_MOUSE) return 0; - if (pyra == NULL) - return 0; - pyra_keep_values_up_to_date(pyra, data); if (pyra->roccat_claimed) diff --git a/trunk/drivers/hid/hid-roccat-pyra.h b/trunk/drivers/hid/hid-roccat-pyra.h index 0442d7fa2dcf..14cbbe1621e0 100644 --- a/trunk/drivers/hid/hid-roccat-pyra.h +++ b/trunk/drivers/hid/hid-roccat-pyra.h @@ -83,6 +83,15 @@ enum pyra_commands { PYRA_COMMAND_B = 0xb }; +enum pyra_usb_commands { + PYRA_USB_COMMAND_CONTROL = 0x304, + PYRA_USB_COMMAND_SETTINGS = 0x305, + PYRA_USB_COMMAND_PROFILE_SETTINGS = 0x306, + PYRA_USB_COMMAND_PROFILE_BUTTONS = 0x307, + PYRA_USB_COMMAND_INFO = 0x309, + PYRA_USB_COMMAND_B = 0x30b /* writes 3 bytes */ +}; + enum pyra_mouse_report_numbers { PYRA_MOUSE_REPORT_NUMBER_HID = 1, PYRA_MOUSE_REPORT_NUMBER_AUDIO = 2, diff --git a/trunk/drivers/hid/usbhid/hid-core.c b/trunk/drivers/hid/usbhid/hid-core.c index 38c261a40c74..ad978f5748d3 100644 --- a/trunk/drivers/hid/usbhid/hid-core.c +++ b/trunk/drivers/hid/usbhid/hid-core.c @@ -1191,6 +1191,8 @@ static int usbhid_probe(struct usb_interface *intf, const struct usb_device_id * if (intf->cur_altsetting->desc.bInterfaceProtocol == USB_INTERFACE_PROTOCOL_MOUSE) hid->type = HID_TYPE_USBMOUSE; + else if (intf->cur_altsetting->desc.bInterfaceProtocol == 0) + hid->type = HID_TYPE_USBNONE; if (dev->manufacturer) strlcpy(hid->name, dev->manufacturer, sizeof(hid->name)); diff --git a/trunk/include/linux/hid.h b/trunk/include/linux/hid.h index 42f7e2fb501f..9cf8e7ae7450 100644 --- a/trunk/include/linux/hid.h +++ b/trunk/include/linux/hid.h @@ -453,7 +453,8 @@ struct hid_input { enum hid_type { HID_TYPE_OTHER = 0, - HID_TYPE_USBMOUSE + HID_TYPE_USBMOUSE, + HID_TYPE_USBNONE }; struct hid_driver;