diff options
author | Stefan Achatz <erazor_de@users.sourceforge.net> | 2013-03-10 07:33:02 -0400 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2013-03-14 06:50:49 -0400 |
commit | ce7169652532a95bebbf2f02cd330a4e66f171ae (patch) | |
tree | 65203ca2717df64f45fd92b7b964df20a9e7f830 /drivers/hid | |
parent | 8936aa31cd5fd0bea828416a3c07efd303269a45 (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>
Diffstat (limited to 'drivers/hid')
-rw-r--r-- | drivers/hid/hid-ids.h | 1 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-isku.c | 17 | ||||
-rw-r--r-- | drivers/hid/hid-roccat-isku.h | 4 |
3 files changed, 14 insertions, 8 deletions
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 | ||
143 | static ssize_t isku_sysfs_write(struct file *fp, struct kobject *kobj, | 143 | 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, | |||
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) | |||
216 | ISKU_SYSFS_RW(key_mask, KEY_MASK) | 216 | ISKU_SYSFS_RW(key_mask, KEY_MASK) |
217 | ISKU_SYSFS_RW(last_set, LAST_SET) | 217 | ISKU_SYSFS_RW(last_set, LAST_SET) |
218 | ISKU_SYSFS_W(talk, TALK) | 218 | ISKU_SYSFS_W(talk, TALK) |
219 | ISKU_SYSFS_W(talkfx, TALKFX) | ||
219 | ISKU_SYSFS_R(info, INFO) | 220 | ISKU_SYSFS_R(info, INFO) |
220 | ISKU_SYSFS_W(control, CONTROL) | 221 | ISKU_SYSFS_W(control, CONTROL) |
221 | ISKU_SYSFS_W(reset, RESET) | 222 | ISKU_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 | ||
406 | static const struct hid_device_id isku_devices[] = { | 408 | static 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); | |||
443 | module_exit(isku_exit); | 446 | module_exit(isku_exit); |
444 | 447 | ||
445 | MODULE_AUTHOR("Stefan Achatz"); | 448 | MODULE_AUTHOR("Stefan Achatz"); |
446 | MODULE_DESCRIPTION("USB Roccat Isku driver"); | 449 | MODULE_DESCRIPTION("USB Roccat Isku/FX driver"); |
447 | MODULE_LICENSE("GPL v2"); | 450 | MODULE_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 | ||
34 | enum { | 35 | enum { |
@@ -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 | }; |