ARM: fix put_user() for gcc-8
[linux/fpc-iii.git] / drivers / hid / hid-roccat-kovaplus.c
blob1073c0d1fae596d306b92abd0b7ebb76f5af9cbd
1 /*
2 * Roccat Kova[+] driver for Linux
4 * Copyright (c) 2011 Stefan Achatz <erazor_de@users.sourceforge.net>
5 */
7 /*
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
11 * any later version.
15 * Roccat Kova[+] is a bigger version of the Pyra with two more side buttons.
18 #include <linux/device.h>
19 #include <linux/input.h>
20 #include <linux/hid.h>
21 #include <linux/module.h>
22 #include <linux/slab.h>
23 #include <linux/hid-roccat.h>
24 #include "hid-ids.h"
25 #include "hid-roccat-common.h"
26 #include "hid-roccat-kovaplus.h"
28 static uint profile_numbers[5] = {0, 1, 2, 3, 4};
30 static struct class *kovaplus_class;
32 static uint kovaplus_convert_event_cpi(uint value)
34 return (value == 7 ? 4 : (value == 4 ? 3 : value));
37 static void kovaplus_profile_activated(struct kovaplus_device *kovaplus,
38 uint new_profile_index)
40 if (new_profile_index >= ARRAY_SIZE(kovaplus->profile_settings))
41 return;
42 kovaplus->actual_profile = new_profile_index;
43 kovaplus->actual_cpi = kovaplus->profile_settings[new_profile_index].cpi_startup_level;
44 kovaplus->actual_x_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_x;
45 kovaplus->actual_y_sensitivity = kovaplus->profile_settings[new_profile_index].sensitivity_y;
48 static int kovaplus_send_control(struct usb_device *usb_dev, uint value,
49 enum kovaplus_control_requests request)
51 int retval;
52 struct roccat_common2_control control;
54 if ((request == KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS ||
55 request == KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS) &&
56 value > 4)
57 return -EINVAL;
59 control.command = ROCCAT_COMMON_COMMAND_CONTROL;
60 control.value = value;
61 control.request = request;
63 retval = roccat_common2_send(usb_dev, ROCCAT_COMMON_COMMAND_CONTROL,
64 &control, sizeof(struct roccat_common2_control));
66 return retval;
69 static int kovaplus_select_profile(struct usb_device *usb_dev, uint number,
70 enum kovaplus_control_requests request)
72 return kovaplus_send_control(usb_dev, number, request);
75 static int kovaplus_get_profile_settings(struct usb_device *usb_dev,
76 struct kovaplus_profile_settings *buf, uint number)
78 int retval;
80 retval = kovaplus_select_profile(usb_dev, number,
81 KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS);
82 if (retval)
83 return retval;
85 return roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_SETTINGS,
86 buf, KOVAPLUS_SIZE_PROFILE_SETTINGS);
89 static int kovaplus_get_profile_buttons(struct usb_device *usb_dev,
90 struct kovaplus_profile_buttons *buf, int number)
92 int retval;
94 retval = kovaplus_select_profile(usb_dev, number,
95 KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS);
96 if (retval)
97 return retval;
99 return roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_PROFILE_BUTTONS,
100 buf, KOVAPLUS_SIZE_PROFILE_BUTTONS);
103 /* retval is 0-4 on success, < 0 on error */
104 static int kovaplus_get_actual_profile(struct usb_device *usb_dev)
106 struct kovaplus_actual_profile buf;
107 int retval;
109 retval = roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_ACTUAL_PROFILE,
110 &buf, sizeof(struct kovaplus_actual_profile));
112 return retval ? retval : buf.actual_profile;
115 static int kovaplus_set_actual_profile(struct usb_device *usb_dev,
116 int new_profile)
118 struct kovaplus_actual_profile buf;
120 buf.command = KOVAPLUS_COMMAND_ACTUAL_PROFILE;
121 buf.size = sizeof(struct kovaplus_actual_profile);
122 buf.actual_profile = new_profile;
124 return roccat_common2_send_with_status(usb_dev,
125 KOVAPLUS_COMMAND_ACTUAL_PROFILE,
126 &buf, sizeof(struct kovaplus_actual_profile));
129 static ssize_t kovaplus_sysfs_read(struct file *fp, struct kobject *kobj,
130 char *buf, loff_t off, size_t count,
131 size_t real_size, uint command)
133 struct device *dev =
134 container_of(kobj, struct device, kobj)->parent->parent;
135 struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev));
136 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
137 int retval;
139 if (off >= real_size)
140 return 0;
142 if (off != 0 || count != real_size)
143 return -EINVAL;
145 mutex_lock(&kovaplus->kovaplus_lock);
146 retval = roccat_common2_receive(usb_dev, command, buf, real_size);
147 mutex_unlock(&kovaplus->kovaplus_lock);
149 if (retval)
150 return retval;
152 return real_size;
155 static ssize_t kovaplus_sysfs_write(struct file *fp, struct kobject *kobj,
156 void const *buf, loff_t off, size_t count,
157 size_t real_size, uint command)
159 struct device *dev =
160 container_of(kobj, struct device, kobj)->parent->parent;
161 struct kovaplus_device *kovaplus = hid_get_drvdata(dev_get_drvdata(dev));
162 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
163 int retval;
165 if (off != 0 || count != real_size)
166 return -EINVAL;
168 mutex_lock(&kovaplus->kovaplus_lock);
169 retval = roccat_common2_send_with_status(usb_dev, command,
170 buf, real_size);
171 mutex_unlock(&kovaplus->kovaplus_lock);
173 if (retval)
174 return retval;
176 return real_size;
179 #define KOVAPLUS_SYSFS_W(thingy, THINGY) \
180 static ssize_t kovaplus_sysfs_write_ ## thingy(struct file *fp, \
181 struct kobject *kobj, struct bin_attribute *attr, char *buf, \
182 loff_t off, size_t count) \
184 return kovaplus_sysfs_write(fp, kobj, buf, off, count, \
185 KOVAPLUS_SIZE_ ## THINGY, KOVAPLUS_COMMAND_ ## THINGY); \
188 #define KOVAPLUS_SYSFS_R(thingy, THINGY) \
189 static ssize_t kovaplus_sysfs_read_ ## thingy(struct file *fp, \
190 struct kobject *kobj, struct bin_attribute *attr, char *buf, \
191 loff_t off, size_t count) \
193 return kovaplus_sysfs_read(fp, kobj, buf, off, count, \
194 KOVAPLUS_SIZE_ ## THINGY, KOVAPLUS_COMMAND_ ## THINGY); \
197 #define KOVAPLUS_SYSFS_RW(thingy, THINGY) \
198 KOVAPLUS_SYSFS_W(thingy, THINGY) \
199 KOVAPLUS_SYSFS_R(thingy, THINGY)
201 #define KOVAPLUS_BIN_ATTRIBUTE_RW(thingy, THINGY) \
202 KOVAPLUS_SYSFS_RW(thingy, THINGY); \
203 static struct bin_attribute bin_attr_##thingy = { \
204 .attr = { .name = #thingy, .mode = 0660 }, \
205 .size = KOVAPLUS_SIZE_ ## THINGY, \
206 .read = kovaplus_sysfs_read_ ## thingy, \
207 .write = kovaplus_sysfs_write_ ## thingy \
210 #define KOVAPLUS_BIN_ATTRIBUTE_W(thingy, THINGY) \
211 KOVAPLUS_SYSFS_W(thingy, THINGY); \
212 static struct bin_attribute bin_attr_##thingy = { \
213 .attr = { .name = #thingy, .mode = 0220 }, \
214 .size = KOVAPLUS_SIZE_ ## THINGY, \
215 .write = kovaplus_sysfs_write_ ## thingy \
217 KOVAPLUS_BIN_ATTRIBUTE_W(control, CONTROL);
218 KOVAPLUS_BIN_ATTRIBUTE_RW(info, INFO);
219 KOVAPLUS_BIN_ATTRIBUTE_RW(profile_settings, PROFILE_SETTINGS);
220 KOVAPLUS_BIN_ATTRIBUTE_RW(profile_buttons, PROFILE_BUTTONS);
222 static ssize_t kovaplus_sysfs_read_profilex_settings(struct file *fp,
223 struct kobject *kobj, struct bin_attribute *attr, char *buf,
224 loff_t off, size_t count)
226 struct device *dev =
227 container_of(kobj, struct device, kobj)->parent->parent;
228 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
229 ssize_t retval;
231 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private),
232 KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS);
233 if (retval)
234 return retval;
236 return kovaplus_sysfs_read(fp, kobj, buf, off, count,
237 KOVAPLUS_SIZE_PROFILE_SETTINGS,
238 KOVAPLUS_COMMAND_PROFILE_SETTINGS);
241 static ssize_t kovaplus_sysfs_read_profilex_buttons(struct file *fp,
242 struct kobject *kobj, struct bin_attribute *attr, char *buf,
243 loff_t off, size_t count)
245 struct device *dev =
246 container_of(kobj, struct device, kobj)->parent->parent;
247 struct usb_device *usb_dev = interface_to_usbdev(to_usb_interface(dev));
248 ssize_t retval;
250 retval = kovaplus_select_profile(usb_dev, *(uint *)(attr->private),
251 KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS);
252 if (retval)
253 return retval;
255 return kovaplus_sysfs_read(fp, kobj, buf, off, count,
256 KOVAPLUS_SIZE_PROFILE_BUTTONS,
257 KOVAPLUS_COMMAND_PROFILE_BUTTONS);
260 #define PROFILE_ATTR(number) \
261 static struct bin_attribute bin_attr_profile##number##_settings = { \
262 .attr = { .name = "profile" #number "_settings", .mode = 0440 }, \
263 .size = KOVAPLUS_SIZE_PROFILE_SETTINGS, \
264 .read = kovaplus_sysfs_read_profilex_settings, \
265 .private = &profile_numbers[number-1], \
266 }; \
267 static struct bin_attribute bin_attr_profile##number##_buttons = { \
268 .attr = { .name = "profile" #number "_buttons", .mode = 0440 }, \
269 .size = KOVAPLUS_SIZE_PROFILE_BUTTONS, \
270 .read = kovaplus_sysfs_read_profilex_buttons, \
271 .private = &profile_numbers[number-1], \
273 PROFILE_ATTR(1);
274 PROFILE_ATTR(2);
275 PROFILE_ATTR(3);
276 PROFILE_ATTR(4);
277 PROFILE_ATTR(5);
279 static ssize_t kovaplus_sysfs_show_actual_profile(struct device *dev,
280 struct device_attribute *attr, char *buf)
282 struct kovaplus_device *kovaplus =
283 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
284 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_profile);
287 static ssize_t kovaplus_sysfs_set_actual_profile(struct device *dev,
288 struct device_attribute *attr, char const *buf, size_t size)
290 struct kovaplus_device *kovaplus;
291 struct usb_device *usb_dev;
292 unsigned long profile;
293 int retval;
294 struct kovaplus_roccat_report roccat_report;
296 dev = dev->parent->parent;
297 kovaplus = hid_get_drvdata(dev_get_drvdata(dev));
298 usb_dev = interface_to_usbdev(to_usb_interface(dev));
300 retval = kstrtoul(buf, 10, &profile);
301 if (retval)
302 return retval;
304 if (profile >= 5)
305 return -EINVAL;
307 mutex_lock(&kovaplus->kovaplus_lock);
308 retval = kovaplus_set_actual_profile(usb_dev, profile);
309 if (retval) {
310 mutex_unlock(&kovaplus->kovaplus_lock);
311 return retval;
314 kovaplus_profile_activated(kovaplus, profile);
316 roccat_report.type = KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1;
317 roccat_report.profile = profile + 1;
318 roccat_report.button = 0;
319 roccat_report.data1 = profile + 1;
320 roccat_report.data2 = 0;
321 roccat_report_event(kovaplus->chrdev_minor,
322 (uint8_t const *)&roccat_report);
324 mutex_unlock(&kovaplus->kovaplus_lock);
326 return size;
328 static DEVICE_ATTR(actual_profile, 0660,
329 kovaplus_sysfs_show_actual_profile,
330 kovaplus_sysfs_set_actual_profile);
332 static ssize_t kovaplus_sysfs_show_actual_cpi(struct device *dev,
333 struct device_attribute *attr, char *buf)
335 struct kovaplus_device *kovaplus =
336 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
337 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_cpi);
339 static DEVICE_ATTR(actual_cpi, 0440, kovaplus_sysfs_show_actual_cpi, NULL);
341 static ssize_t kovaplus_sysfs_show_actual_sensitivity_x(struct device *dev,
342 struct device_attribute *attr, char *buf)
344 struct kovaplus_device *kovaplus =
345 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
346 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_x_sensitivity);
348 static DEVICE_ATTR(actual_sensitivity_x, 0440,
349 kovaplus_sysfs_show_actual_sensitivity_x, NULL);
351 static ssize_t kovaplus_sysfs_show_actual_sensitivity_y(struct device *dev,
352 struct device_attribute *attr, char *buf)
354 struct kovaplus_device *kovaplus =
355 hid_get_drvdata(dev_get_drvdata(dev->parent->parent));
356 return snprintf(buf, PAGE_SIZE, "%d\n", kovaplus->actual_y_sensitivity);
358 static DEVICE_ATTR(actual_sensitivity_y, 0440,
359 kovaplus_sysfs_show_actual_sensitivity_y, NULL);
361 static ssize_t kovaplus_sysfs_show_firmware_version(struct device *dev,
362 struct device_attribute *attr, char *buf)
364 struct kovaplus_device *kovaplus;
365 struct usb_device *usb_dev;
366 struct kovaplus_info info;
368 dev = dev->parent->parent;
369 kovaplus = hid_get_drvdata(dev_get_drvdata(dev));
370 usb_dev = interface_to_usbdev(to_usb_interface(dev));
372 mutex_lock(&kovaplus->kovaplus_lock);
373 roccat_common2_receive(usb_dev, KOVAPLUS_COMMAND_INFO,
374 &info, KOVAPLUS_SIZE_INFO);
375 mutex_unlock(&kovaplus->kovaplus_lock);
377 return snprintf(buf, PAGE_SIZE, "%d\n", info.firmware_version);
379 static DEVICE_ATTR(firmware_version, 0440,
380 kovaplus_sysfs_show_firmware_version, NULL);
382 static struct attribute *kovaplus_attrs[] = {
383 &dev_attr_actual_cpi.attr,
384 &dev_attr_firmware_version.attr,
385 &dev_attr_actual_profile.attr,
386 &dev_attr_actual_sensitivity_x.attr,
387 &dev_attr_actual_sensitivity_y.attr,
388 NULL,
391 static struct bin_attribute *kovaplus_bin_attributes[] = {
392 &bin_attr_control,
393 &bin_attr_info,
394 &bin_attr_profile_settings,
395 &bin_attr_profile_buttons,
396 &bin_attr_profile1_settings,
397 &bin_attr_profile2_settings,
398 &bin_attr_profile3_settings,
399 &bin_attr_profile4_settings,
400 &bin_attr_profile5_settings,
401 &bin_attr_profile1_buttons,
402 &bin_attr_profile2_buttons,
403 &bin_attr_profile3_buttons,
404 &bin_attr_profile4_buttons,
405 &bin_attr_profile5_buttons,
406 NULL,
409 static const struct attribute_group kovaplus_group = {
410 .attrs = kovaplus_attrs,
411 .bin_attrs = kovaplus_bin_attributes,
414 static const struct attribute_group *kovaplus_groups[] = {
415 &kovaplus_group,
416 NULL,
419 static int kovaplus_init_kovaplus_device_struct(struct usb_device *usb_dev,
420 struct kovaplus_device *kovaplus)
422 int retval, i;
423 static uint wait = 70; /* device will freeze with just 60 */
425 mutex_init(&kovaplus->kovaplus_lock);
427 for (i = 0; i < 5; ++i) {
428 msleep(wait);
429 retval = kovaplus_get_profile_settings(usb_dev,
430 &kovaplus->profile_settings[i], i);
431 if (retval)
432 return retval;
434 msleep(wait);
435 retval = kovaplus_get_profile_buttons(usb_dev,
436 &kovaplus->profile_buttons[i], i);
437 if (retval)
438 return retval;
441 msleep(wait);
442 retval = kovaplus_get_actual_profile(usb_dev);
443 if (retval < 0)
444 return retval;
445 kovaplus_profile_activated(kovaplus, retval);
447 return 0;
450 static int kovaplus_init_specials(struct hid_device *hdev)
452 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
453 struct usb_device *usb_dev = interface_to_usbdev(intf);
454 struct kovaplus_device *kovaplus;
455 int retval;
457 if (intf->cur_altsetting->desc.bInterfaceProtocol
458 == USB_INTERFACE_PROTOCOL_MOUSE) {
460 kovaplus = kzalloc(sizeof(*kovaplus), GFP_KERNEL);
461 if (!kovaplus) {
462 hid_err(hdev, "can't alloc device descriptor\n");
463 return -ENOMEM;
465 hid_set_drvdata(hdev, kovaplus);
467 retval = kovaplus_init_kovaplus_device_struct(usb_dev, kovaplus);
468 if (retval) {
469 hid_err(hdev, "couldn't init struct kovaplus_device\n");
470 goto exit_free;
473 retval = roccat_connect(kovaplus_class, hdev,
474 sizeof(struct kovaplus_roccat_report));
475 if (retval < 0) {
476 hid_err(hdev, "couldn't init char dev\n");
477 } else {
478 kovaplus->chrdev_minor = retval;
479 kovaplus->roccat_claimed = 1;
482 } else {
483 hid_set_drvdata(hdev, NULL);
486 return 0;
487 exit_free:
488 kfree(kovaplus);
489 return retval;
492 static void kovaplus_remove_specials(struct hid_device *hdev)
494 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
495 struct kovaplus_device *kovaplus;
497 if (intf->cur_altsetting->desc.bInterfaceProtocol
498 == USB_INTERFACE_PROTOCOL_MOUSE) {
499 kovaplus = hid_get_drvdata(hdev);
500 if (kovaplus->roccat_claimed)
501 roccat_disconnect(kovaplus->chrdev_minor);
502 kfree(kovaplus);
506 static int kovaplus_probe(struct hid_device *hdev,
507 const struct hid_device_id *id)
509 int retval;
511 retval = hid_parse(hdev);
512 if (retval) {
513 hid_err(hdev, "parse failed\n");
514 goto exit;
517 retval = hid_hw_start(hdev, HID_CONNECT_DEFAULT);
518 if (retval) {
519 hid_err(hdev, "hw start failed\n");
520 goto exit;
523 retval = kovaplus_init_specials(hdev);
524 if (retval) {
525 hid_err(hdev, "couldn't install mouse\n");
526 goto exit_stop;
529 return 0;
531 exit_stop:
532 hid_hw_stop(hdev);
533 exit:
534 return retval;
537 static void kovaplus_remove(struct hid_device *hdev)
539 kovaplus_remove_specials(hdev);
540 hid_hw_stop(hdev);
543 static void kovaplus_keep_values_up_to_date(struct kovaplus_device *kovaplus,
544 u8 const *data)
546 struct kovaplus_mouse_report_button const *button_report;
548 if (data[0] != KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON)
549 return;
551 button_report = (struct kovaplus_mouse_report_button const *)data;
553 switch (button_report->type) {
554 case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1:
555 kovaplus_profile_activated(kovaplus, button_report->data1 - 1);
556 break;
557 case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI:
558 kovaplus->actual_cpi = kovaplus_convert_event_cpi(button_report->data1);
559 break;
560 case KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY:
561 kovaplus->actual_x_sensitivity = button_report->data1;
562 kovaplus->actual_y_sensitivity = button_report->data2;
563 break;
564 default:
565 break;
569 static void kovaplus_report_to_chrdev(struct kovaplus_device const *kovaplus,
570 u8 const *data)
572 struct kovaplus_roccat_report roccat_report;
573 struct kovaplus_mouse_report_button const *button_report;
575 if (data[0] != KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON)
576 return;
578 button_report = (struct kovaplus_mouse_report_button const *)data;
580 if (button_report->type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2)
581 return;
583 roccat_report.type = button_report->type;
584 roccat_report.profile = kovaplus->actual_profile + 1;
586 if (roccat_report.type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MACRO ||
587 roccat_report.type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SHORTCUT ||
588 roccat_report.type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH ||
589 roccat_report.type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER)
590 roccat_report.button = button_report->data1;
591 else
592 roccat_report.button = 0;
594 if (roccat_report.type == KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI)
595 roccat_report.data1 = kovaplus_convert_event_cpi(button_report->data1);
596 else
597 roccat_report.data1 = button_report->data1;
599 roccat_report.data2 = button_report->data2;
601 roccat_report_event(kovaplus->chrdev_minor,
602 (uint8_t const *)&roccat_report);
605 static int kovaplus_raw_event(struct hid_device *hdev,
606 struct hid_report *report, u8 *data, int size)
608 struct usb_interface *intf = to_usb_interface(hdev->dev.parent);
609 struct kovaplus_device *kovaplus = hid_get_drvdata(hdev);
611 if (intf->cur_altsetting->desc.bInterfaceProtocol
612 != USB_INTERFACE_PROTOCOL_MOUSE)
613 return 0;
615 if (kovaplus == NULL)
616 return 0;
618 kovaplus_keep_values_up_to_date(kovaplus, data);
620 if (kovaplus->roccat_claimed)
621 kovaplus_report_to_chrdev(kovaplus, data);
623 return 0;
626 static const struct hid_device_id kovaplus_devices[] = {
627 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT, USB_DEVICE_ID_ROCCAT_KOVAPLUS) },
631 MODULE_DEVICE_TABLE(hid, kovaplus_devices);
633 static struct hid_driver kovaplus_driver = {
634 .name = "kovaplus",
635 .id_table = kovaplus_devices,
636 .probe = kovaplus_probe,
637 .remove = kovaplus_remove,
638 .raw_event = kovaplus_raw_event
641 static int __init kovaplus_init(void)
643 int retval;
645 kovaplus_class = class_create(THIS_MODULE, "kovaplus");
646 if (IS_ERR(kovaplus_class))
647 return PTR_ERR(kovaplus_class);
648 kovaplus_class->dev_groups = kovaplus_groups;
650 retval = hid_register_driver(&kovaplus_driver);
651 if (retval)
652 class_destroy(kovaplus_class);
653 return retval;
656 static void __exit kovaplus_exit(void)
658 hid_unregister_driver(&kovaplus_driver);
659 class_destroy(kovaplus_class);
662 module_init(kovaplus_init);
663 module_exit(kovaplus_exit);
665 MODULE_AUTHOR("Stefan Achatz");
666 MODULE_DESCRIPTION("USB Roccat Kova[+] driver");
667 MODULE_LICENSE("GPL v2");