HID: roccat: add support for IskuFX
authorStefan Achatz <erazor_de@users.sourceforge.net>
Sun, 10 Mar 2013 11:33:02 +0000 (12:33 +0100)
committerJiri Kosina <jkosina@suse.cz>
Thu, 14 Mar 2013 10:50:49 +0000 (11:50 +0100)
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>
Documentation/ABI/testing/sysfs-driver-hid-roccat-isku
drivers/hid/hid-ids.h
drivers/hid/hid-roccat-isku.c
drivers/hid/hid-roccat-isku.h

index 9eca5a182e64df28a22187ae05ff829b53de8f52..c601d0f2ac4608ef98672e1400c4ec3c594c0794 100644 (file)
@@ -101,7 +101,8 @@ Date:               June 2011
 Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
 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/<busnum>-<devnum>:<config num>.<interface num>/<hid-bus>:<vendor-id>:<product-id>.<num>/isku/roccatisku<minor>/talkfx
+Date:          February 2013
+Contact:       Stefan Achatz <erazor_de@users.sourceforge.net>
+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
index 007ee7441e343df8fe58f6fe923c1c46f6f725a0..a2e767b3d5d2bf66c5495ed454c57b9c289b046b 100644 (file)
 #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
index 1219998a02d66e98ca11cecf0c740044b6801deb..8023751d525766ae16b32f8a8943f8c5f9b0796e 100644 (file)
@@ -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");
index cf6896c838679d7ec5527a7cb94037e16c1fd78a..53056860d4d859f53f391f7081191c3821376a2b 100644 (file)
@@ -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,
 };