aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Achatz <erazor_de@users.sourceforge.net>2013-03-10 07:33:02 -0400
committerJiri Kosina <jkosina@suse.cz>2013-03-14 06:50:49 -0400
commitce7169652532a95bebbf2f02cd330a4e66f171ae (patch)
tree65203ca2717df64f45fd92b7b964df20a9e7f830
parent8936aa31cd5fd0bea828416a3c07efd303269a45 (diff)
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 <erazor_de@users.sourceforge.net> Signed-off-by: Jiri Kosina <jkosina@suse.cz>
-rw-r--r--Documentation/ABI/testing/sysfs-driver-hid-roccat-isku12
-rw-r--r--drivers/hid/hid-ids.h1
-rw-r--r--drivers/hid/hid-roccat-isku.c17
-rw-r--r--drivers/hid/hid-roccat-isku.h4
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 9eca5a182e64..c601d0f2ac46 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
101Contact: Stefan Achatz <erazor_de@users.sourceforge.net> 101Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
102Description: When written, this file lets one set the backlight intensity for 102Description: When written, this file lets one set the backlight intensity for
103 a specific profile. Profile number is included in written data. 103 a specific profile. Profile number is included in written data.
104 The data has to be 10 bytes long. 104 The data has to be 10 bytes long for Isku, IskuFX needs 16 bytes
105 of data.
105 Before reading this file, control has to be written to select 106 Before reading this file, control has to be written to select
106 which profile to read. 107 which profile to read.
107Users: http://roccat.sourceforge.net 108Users: http://roccat.sourceforge.net
@@ -141,3 +142,12 @@ Description: When written, this file lets one trigger easyshift functionality
141 The data has to be 16 bytes long. 142 The data has to be 16 bytes long.
142 This file is writeonly. 143 This file is writeonly.
143Users: http://roccat.sourceforge.net 144Users: http://roccat.sourceforge.net
145
146What: /sys/bus/usb/devices/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/isku/roccatisku<minor>/talkfx
147Date: February 2013
148Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
149Description: When written, this file lets one trigger temporary color schemes
150 from the host.
151 The data has to be 16 bytes long.
152 This file is writeonly.
153Users: http://roccat.sourceforge.net
diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h
index 007ee7441e34..a2e767b3d5d2 100644
--- a/drivers/hid/hid-ids.h
+++ b/drivers/hid/hid-ids.h
@@ -687,6 +687,7 @@
687#define USB_VENDOR_ID_ROCCAT 0x1e7d 687#define USB_VENDOR_ID_ROCCAT 0x1e7d
688#define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4 688#define USB_DEVICE_ID_ROCCAT_ARVO 0x30d4
689#define USB_DEVICE_ID_ROCCAT_ISKU 0x319c 689#define USB_DEVICE_ID_ROCCAT_ISKU 0x319c
690#define USB_DEVICE_ID_ROCCAT_ISKUFX 0x3264
690#define USB_DEVICE_ID_ROCCAT_KONE 0x2ced 691#define USB_DEVICE_ID_ROCCAT_KONE 0x2ced
691#define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51 692#define USB_DEVICE_ID_ROCCAT_KONEPLUS 0x2d51
692#define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe 693#define USB_DEVICE_ID_ROCCAT_KONEPURE 0x2dbe
diff --git a/drivers/hid/hid-roccat-isku.c b/drivers/hid/hid-roccat-isku.c
index 1219998a02d6..8023751d5257 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,
130 if (off >= real_size) 130 if (off >= real_size)
131 return 0; 131 return 0;
132 132
133 if (off != 0 || count != real_size) 133 if (off != 0 || count > real_size)
134 return -EINVAL; 134 return -EINVAL;
135 135
136 mutex_lock(&isku->isku_lock); 136 mutex_lock(&isku->isku_lock);
137 retval = isku_receive(usb_dev, command, buf, real_size); 137 retval = isku_receive(usb_dev, command, buf, count);
138 mutex_unlock(&isku->isku_lock); 138 mutex_unlock(&isku->isku_lock);
139 139
140 return retval ? retval : real_size; 140 return retval ? retval : count;
141} 141}
142 142
143static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, 143static 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,
150 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev)); 150 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
151 int retval; 151 int retval;
152 152
153 if (off != 0 || count != real_size) 153 if (off != 0 || count > real_size)
154 return -EINVAL; 154 return -EINVAL;
155 155
156 mutex_lock(&isku->isku_lock); 156 mutex_lock(&isku->isku_lock);
157 retval = roccat_common2_send_with_status(usb_dev, command, 157 retval = roccat_common2_send_with_status(usb_dev, command,
158 (void *)buf, real_size); 158 (void *)buf, count);
159 mutex_unlock(&isku->isku_lock); 159 mutex_unlock(&isku->isku_lock);
160 160
161 return retval ? retval : real_size; 161 return retval ? retval : count;
162} 162}
163 163
164#define ISKU_SYSFS_W(thingy, THINGY) \ 164#define ISKU_SYSFS_W(thingy, THINGY) \
@@ -216,6 +216,7 @@ ISKU_SYSFS_RW(light, LIGHT)
216ISKU_SYSFS_RW(key_mask, KEY_MASK) 216ISKU_SYSFS_RW(key_mask, KEY_MASK)
217ISKU_SYSFS_RW(last_set, LAST_SET) 217ISKU_SYSFS_RW(last_set, LAST_SET)
218ISKU_SYSFS_W(talk, TALK) 218ISKU_SYSFS_W(talk, TALK)
219ISKU_SYSFS_W(talkfx, TALKFX)
219ISKU_SYSFS_R(info, INFO) 220ISKU_SYSFS_R(info, INFO)
220ISKU_SYSFS_W(control, CONTROL) 221ISKU_SYSFS_W(control, CONTROL)
221ISKU_SYSFS_W(reset, RESET) 222ISKU_SYSFS_W(reset, RESET)
@@ -232,6 +233,7 @@ static struct bin_attribute isku_bin_attributes[] = {
232 ISKU_BIN_ATTR_RW(key_mask, KEY_MASK), 233 ISKU_BIN_ATTR_RW(key_mask, KEY_MASK),
233 ISKU_BIN_ATTR_RW(last_set, LAST_SET), 234 ISKU_BIN_ATTR_RW(last_set, LAST_SET),
234 ISKU_BIN_ATTR_W(talk, TALK), 235 ISKU_BIN_ATTR_W(talk, TALK),
236 ISKU_BIN_ATTR_W(talkfx, TALKFX),
235 ISKU_BIN_ATTR_R(info, INFO), 237 ISKU_BIN_ATTR_R(info, INFO),
236 ISKU_BIN_ATTR_W(control, CONTROL), 238 ISKU_BIN_ATTR_W(control, CONTROL),
237 ISKU_BIN_ATTR_W(reset, RESET), 239 ISKU_BIN_ATTR_W(reset, RESET),
@@ -405,6 +407,7 @@ static int isku_raw_event(struct hid_device *hdev,
405 407
406static const struct hid_device_id isku_devices[] = { 408static const struct hid_device_id isku_devices[] = {
407 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) }, 409 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKU) },
410 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_ISKUFX) },
408 { } 411 { }
409}; 412};
410 413
@@ -443,5 +446,5 @@ module_init(isku_init);
443module_exit(isku_exit); 446module_exit(isku_exit);
444 447
445MODULE_AUTHOR("Stefan Achatz"); 448MODULE_AUTHOR("Stefan Achatz");
446MODULE_DESCRIPTION("USB Roccat Isku driver"); 449MODULE_DESCRIPTION("USB Roccat Isku/FX driver");
447MODULE_LICENSE("GPL v2"); 450MODULE_LICENSE("GPL v2");
diff --git a/drivers/hid/hid-roccat-isku.h b/drivers/hid/hid-roccat-isku.h
index cf6896c83867..53056860d4d8 100644
--- a/drivers/hid/hid-roccat-isku.h
+++ b/drivers/hid/hid-roccat-isku.h
@@ -25,10 +25,11 @@ enum {
25 ISKU_SIZE_KEYS_MACRO = 0x23, 25 ISKU_SIZE_KEYS_MACRO = 0x23,
26 ISKU_SIZE_KEYS_CAPSLOCK = 0x06, 26 ISKU_SIZE_KEYS_CAPSLOCK = 0x06,
27 ISKU_SIZE_LAST_SET = 0x14, 27 ISKU_SIZE_LAST_SET = 0x14,
28 ISKU_SIZE_LIGHT = 0x0a, 28 ISKU_SIZE_LIGHT = 0x10,
29 ISKU_SIZE_MACRO = 0x823, 29 ISKU_SIZE_MACRO = 0x823,
30 ISKU_SIZE_RESET = 0x03, 30 ISKU_SIZE_RESET = 0x03,
31 ISKU_SIZE_TALK = 0x10, 31 ISKU_SIZE_TALK = 0x10,
32 ISKU_SIZE_TALKFX = 0x10,
32}; 33};
33 34
34enum { 35enum {
@@ -59,6 +60,7 @@ enum isku_commands {
59 ISKU_COMMAND_LAST_SET = 0x14, 60 ISKU_COMMAND_LAST_SET = 0x14,
60 ISKU_COMMAND_15 = 0x15, 61 ISKU_COMMAND_15 = 0x15,
61 ISKU_COMMAND_TALK = 0x16, 62 ISKU_COMMAND_TALK = 0x16,
63 ISKU_COMMAND_TALKFX = 0x17,
62 ISKU_COMMAND_FIRMWARE_WRITE = 0x1b, 64 ISKU_COMMAND_FIRMWARE_WRITE = 0x1b,
63 ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c, 65 ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
64}; 66};