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/hid-roccat-isku.c | |
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/hid-roccat-isku.c')
-rw-r--r-- | drivers/hid/hid-roccat-isku.c | 17 |
1 files changed, 10 insertions, 7 deletions
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"); |