2 * Roccat Kone driver for Linux
4 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
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)
15 * Roccat Kone is a gamer mouse which consists of a mouse part and a keyboard
16 * part. The keyboard part enables the mouse to execute stored macros with mixed
17 * key- and button-events.
19 * TODO implement on-the-fly polling-rate change
20 * The windows driver has the ability to change the polling rate of the
21 * device on the press of a mousebutton.
22 * Is it possible to remove and reinstall the urb in raw-event- or any
23 * other handler, or to defer this action to be executed somewhere else?
25 * TODO is it possible to overwrite group for sysfs attributes via udev?
28 #include <linux/device.h>
29 #include <linux/input.h>
30 #include <linux/hid.h>
31 #include <linux/module.h>
32 #include <linux/slab.h>
33 #include <linux/hid-roccat.h>
35 #include "hid-roccat-common.h"
36 #include "hid-roccat-kone.h"
38 static uint profile_numbers
[5] = {0, 1, 2, 3, 4};
40 /* kone_class is used for creating sysfs attributes via roccat char device */
41 static struct class *kone_class
;
43 static void kone_set_settings_checksum(struct kone_settings
*settings
)
45 uint16_t checksum
= 0;
46 unsigned char *address
= (unsigned char *)settings
;
49 for (i
= 0; i
< sizeof(struct kone_settings
) - 2; ++i
, ++address
)
51 settings
->checksum
= cpu_to_le16(checksum
);
55 * Checks success after writing data to mouse
56 * On success returns 0
57 * On failure returns errno
59 static int kone_check_write(struct usb_device
*usb_dev
)
66 * Mouse needs 50 msecs until it says ok, but there are
67 * 30 more msecs needed for next write to work.
71 retval
= roccat_common_receive(usb_dev
,
72 kone_command_confirm_write
, &data
, 1);
77 * value of 3 seems to mean something like
78 * "not finished yet, but it looks good"
79 * So check again after a moment.
83 if (data
== 1) /* everything alright */
87 hid_err(usb_dev
, "got retval %d when checking write\n", data
);
92 * Reads settings from mouse and stores it in @buf
93 * On success returns 0
94 * On failure returns errno
96 static int kone_get_settings(struct usb_device
*usb_dev
,
97 struct kone_settings
*buf
)
99 return roccat_common_receive(usb_dev
, kone_command_settings
, buf
,
100 sizeof(struct kone_settings
));
104 * Writes settings from @buf to mouse
105 * On success returns 0
106 * On failure returns errno
108 static int kone_set_settings(struct usb_device
*usb_dev
,
109 struct kone_settings
const *settings
)
112 retval
= roccat_common_send(usb_dev
, kone_command_settings
,
113 settings
, sizeof(struct kone_settings
));
116 return kone_check_write(usb_dev
);
120 * Reads profile data from mouse and stores it in @buf
121 * @number: profile number to read
122 * On success returns 0
123 * On failure returns errno
125 static int kone_get_profile(struct usb_device
*usb_dev
,
126 struct kone_profile
*buf
, int number
)
130 if (number
< 1 || number
> 5)
133 len
= usb_control_msg(usb_dev
, usb_rcvctrlpipe(usb_dev
, 0),
134 USB_REQ_CLEAR_FEATURE
,
135 USB_TYPE_CLASS
| USB_RECIP_INTERFACE
| USB_DIR_IN
,
136 kone_command_profile
, number
, buf
,
137 sizeof(struct kone_profile
), USB_CTRL_SET_TIMEOUT
);
139 if (len
!= sizeof(struct kone_profile
))
146 * Writes profile data to mouse.
147 * @number: profile number to write
148 * On success returns 0
149 * On failure returns errno
151 static int kone_set_profile(struct usb_device
*usb_dev
,
152 struct kone_profile
const *profile
, int number
)
156 if (number
< 1 || number
> 5)
159 len
= usb_control_msg(usb_dev
, usb_sndctrlpipe(usb_dev
, 0),
160 USB_REQ_SET_CONFIGURATION
,
161 USB_TYPE_CLASS
| USB_RECIP_INTERFACE
| USB_DIR_OUT
,
162 kone_command_profile
, number
, (void *)profile
,
163 sizeof(struct kone_profile
),
164 USB_CTRL_SET_TIMEOUT
);
166 if (len
!= sizeof(struct kone_profile
))
169 if (kone_check_write(usb_dev
))
176 * Reads value of "fast-clip-weight" and stores it in @result
177 * On success returns 0
178 * On failure returns errno
180 static int kone_get_weight(struct usb_device
*usb_dev
, int *result
)
185 retval
= roccat_common_receive(usb_dev
, kone_command_weight
, &data
, 1);
195 * Reads firmware_version of mouse and stores it in @result
196 * On success returns 0
197 * On failure returns errno
199 static int kone_get_firmware_version(struct usb_device
*usb_dev
, int *result
)
204 retval
= roccat_common_receive(usb_dev
, kone_command_firmware_version
,
209 *result
= le16_to_cpu(data
);
213 static ssize_t
kone_sysfs_read_settings(struct file
*fp
, struct kobject
*kobj
,
214 struct bin_attribute
*attr
, char *buf
,
215 loff_t off
, size_t count
) {
217 container_of(kobj
, struct device
, kobj
)->parent
->parent
;
218 struct kone_device
*kone
= hid_get_drvdata(dev_get_drvdata(dev
));
220 if (off
>= sizeof(struct kone_settings
))
223 if (off
+ count
> sizeof(struct kone_settings
))
224 count
= sizeof(struct kone_settings
) - off
;
226 mutex_lock(&kone
->kone_lock
);
227 memcpy(buf
, ((char const *)&kone
->settings
) + off
, count
);
228 mutex_unlock(&kone
->kone_lock
);
234 * Writing settings automatically activates startup_profile.
235 * This function keeps values in kone_device up to date and assumes that in
236 * case of error the old data is still valid
238 static ssize_t
kone_sysfs_write_settings(struct file
*fp
, struct kobject
*kobj
,
239 struct bin_attribute
*attr
, char *buf
,
240 loff_t off
, size_t count
) {
242 container_of(kobj
, struct device
, kobj
)->parent
->parent
;
243 struct kone_device
*kone
= hid_get_drvdata(dev_get_drvdata(dev
));
244 struct usb_device
*usb_dev
= interface_to_usbdev(to_usb_interface(dev
));
245 int retval
= 0, difference
;
247 /* I need to get my data in one piece */
248 if (off
!= 0 || count
!= sizeof(struct kone_settings
))
251 mutex_lock(&kone
->kone_lock
);
252 difference
= memcmp(buf
, &kone
->settings
, sizeof(struct kone_settings
));
254 retval
= kone_set_settings(usb_dev
,
255 (struct kone_settings
const *)buf
);
257 memcpy(&kone
->settings
, buf
,
258 sizeof(struct kone_settings
));
260 mutex_unlock(&kone
->kone_lock
);
266 * If we get here, treat settings as okay and update actual values
267 * according to startup_profile
269 kone
->actual_profile
= kone
->settings
.startup_profile
;
270 kone
->actual_dpi
= kone
->profiles
[kone
->actual_profile
- 1].startup_dpi
;
272 return sizeof(struct kone_settings
);
275 static ssize_t
kone_sysfs_read_profilex(struct file
*fp
,
276 struct kobject
*kobj
, struct bin_attribute
*attr
,
277 char *buf
, loff_t off
, size_t count
) {
279 container_of(kobj
, struct device
, kobj
)->parent
->parent
;
280 struct kone_device
*kone
= hid_get_drvdata(dev_get_drvdata(dev
));
282 if (off
>= sizeof(struct kone_profile
))
285 if (off
+ count
> sizeof(struct kone_profile
))
286 count
= sizeof(struct kone_profile
) - off
;
288 mutex_lock(&kone
->kone_lock
);
289 memcpy(buf
, ((char const *)&kone
->profiles
[*(uint
*)(attr
->private)]) + off
, count
);
290 mutex_unlock(&kone
->kone_lock
);
295 /* Writes data only if different to stored data */
296 static ssize_t
kone_sysfs_write_profilex(struct file
*fp
,
297 struct kobject
*kobj
, struct bin_attribute
*attr
,
298 char *buf
, loff_t off
, size_t count
) {
300 container_of(kobj
, struct device
, kobj
)->parent
->parent
;
301 struct kone_device
*kone
= hid_get_drvdata(dev_get_drvdata(dev
));
302 struct usb_device
*usb_dev
= interface_to_usbdev(to_usb_interface(dev
));
303 struct kone_profile
*profile
;
304 int retval
= 0, difference
;
306 /* I need to get my data in one piece */
307 if (off
!= 0 || count
!= sizeof(struct kone_profile
))
310 profile
= &kone
->profiles
[*(uint
*)(attr
->private)];
312 mutex_lock(&kone
->kone_lock
);
313 difference
= memcmp(buf
, profile
, sizeof(struct kone_profile
));
315 retval
= kone_set_profile(usb_dev
,
316 (struct kone_profile
const *)buf
,
317 *(uint
*)(attr
->private) + 1);
319 memcpy(profile
, buf
, sizeof(struct kone_profile
));
321 mutex_unlock(&kone
->kone_lock
);
326 return sizeof(struct kone_profile
);
329 static ssize_t
kone_sysfs_show_actual_profile(struct device
*dev
,
330 struct device_attribute
*attr
, char *buf
)
332 struct kone_device
*kone
=
333 hid_get_drvdata(dev_get_drvdata(dev
->parent
->parent
));
334 return snprintf(buf
, PAGE_SIZE
, "%d\n", kone
->actual_profile
);
337 static ssize_t
kone_sysfs_show_actual_dpi(struct device
*dev
,
338 struct device_attribute
*attr
, char *buf
)
340 struct kone_device
*kone
=
341 hid_get_drvdata(dev_get_drvdata(dev
->parent
->parent
));
342 return snprintf(buf
, PAGE_SIZE
, "%d\n", kone
->actual_dpi
);
345 /* weight is read each time, since we don't get informed when it's changed */
346 static ssize_t
kone_sysfs_show_weight(struct device
*dev
,
347 struct device_attribute
*attr
, char *buf
)
349 struct kone_device
*kone
;
350 struct usb_device
*usb_dev
;
354 dev
= dev
->parent
->parent
;
355 kone
= hid_get_drvdata(dev_get_drvdata(dev
));
356 usb_dev
= interface_to_usbdev(to_usb_interface(dev
));
358 mutex_lock(&kone
->kone_lock
);
359 retval
= kone_get_weight(usb_dev
, &weight
);
360 mutex_unlock(&kone
->kone_lock
);
364 return snprintf(buf
, PAGE_SIZE
, "%d\n", weight
);
367 static ssize_t
kone_sysfs_show_firmware_version(struct device
*dev
,
368 struct device_attribute
*attr
, char *buf
)
370 struct kone_device
*kone
=
371 hid_get_drvdata(dev_get_drvdata(dev
->parent
->parent
));
372 return snprintf(buf
, PAGE_SIZE
, "%d\n", kone
->firmware_version
);
375 static ssize_t
kone_sysfs_show_tcu(struct device
*dev
,
376 struct device_attribute
*attr
, char *buf
)
378 struct kone_device
*kone
=
379 hid_get_drvdata(dev_get_drvdata(dev
->parent
->parent
));
380 return snprintf(buf
, PAGE_SIZE
, "%d\n", kone
->settings
.tcu
);
383 static int kone_tcu_command(struct usb_device
*usb_dev
, int number
)
387 return roccat_common_send(usb_dev
, kone_command_calibrate
, &value
, 1);
391 * Calibrating the tcu is the only action that changes settings data inside the
392 * mouse, so this data needs to be reread
394 static ssize_t
kone_sysfs_set_tcu(struct device
*dev
,
395 struct device_attribute
*attr
, char const *buf
, size_t size
)
397 struct kone_device
*kone
;
398 struct usb_device
*usb_dev
;
402 dev
= dev
->parent
->parent
;
403 kone
= hid_get_drvdata(dev_get_drvdata(dev
));
404 usb_dev
= interface_to_usbdev(to_usb_interface(dev
));
406 retval
= strict_strtoul(buf
, 10, &state
);
410 if (state
!= 0 && state
!= 1)
413 mutex_lock(&kone
->kone_lock
);
415 if (state
== 1) { /* state activate */
416 retval
= kone_tcu_command(usb_dev
, 1);
419 retval
= kone_tcu_command(usb_dev
, 2);
422 ssleep(5); /* tcu needs this time for calibration */
423 retval
= kone_tcu_command(usb_dev
, 3);
426 retval
= kone_tcu_command(usb_dev
, 0);
429 retval
= kone_tcu_command(usb_dev
, 4);
433 * Kone needs this time to settle things.
434 * Reading settings too early will result in invalid data.
435 * Roccat's driver waits 1 sec, maybe this time could be
441 /* calibration changes values in settings, so reread */
442 retval
= kone_get_settings(usb_dev
, &kone
->settings
);
444 goto exit_no_settings
;
446 /* only write settings back if activation state is different */
447 if (kone
->settings
.tcu
!= state
) {
448 kone
->settings
.tcu
= state
;
449 kone_set_settings_checksum(&kone
->settings
);
451 retval
= kone_set_settings(usb_dev
, &kone
->settings
);
453 hid_err(usb_dev
, "couldn't set tcu state\n");
455 * try to reread valid settings into buffer overwriting
458 retval
= kone_get_settings(usb_dev
, &kone
->settings
);
460 goto exit_no_settings
;
467 hid_err(usb_dev
, "couldn't read settings\n");
469 mutex_unlock(&kone
->kone_lock
);
473 static ssize_t
kone_sysfs_show_startup_profile(struct device
*dev
,
474 struct device_attribute
*attr
, char *buf
)
476 struct kone_device
*kone
=
477 hid_get_drvdata(dev_get_drvdata(dev
->parent
->parent
));
478 return snprintf(buf
, PAGE_SIZE
, "%d\n", kone
->settings
.startup_profile
);
481 static ssize_t
kone_sysfs_set_startup_profile(struct device
*dev
,
482 struct device_attribute
*attr
, char const *buf
, size_t size
)
484 struct kone_device
*kone
;
485 struct usb_device
*usb_dev
;
487 unsigned long new_startup_profile
;
489 dev
= dev
->parent
->parent
;
490 kone
= hid_get_drvdata(dev_get_drvdata(dev
));
491 usb_dev
= interface_to_usbdev(to_usb_interface(dev
));
493 retval
= strict_strtoul(buf
, 10, &new_startup_profile
);
497 if (new_startup_profile
< 1 || new_startup_profile
> 5)
500 mutex_lock(&kone
->kone_lock
);
502 kone
->settings
.startup_profile
= new_startup_profile
;
503 kone_set_settings_checksum(&kone
->settings
);
505 retval
= kone_set_settings(usb_dev
, &kone
->settings
);
507 mutex_unlock(&kone
->kone_lock
);
512 /* changing the startup profile immediately activates this profile */
513 kone
->actual_profile
= new_startup_profile
;
514 kone
->actual_dpi
= kone
->profiles
[kone
->actual_profile
- 1].startup_dpi
;
519 static struct device_attribute kone_attributes
[] = {
521 * Read actual dpi settings.
522 * Returns raw value for further processing. Refer to enum
523 * kone_polling_rates to get real value.
525 __ATTR(actual_dpi
, 0440, kone_sysfs_show_actual_dpi
, NULL
),
526 __ATTR(actual_profile
, 0440, kone_sysfs_show_actual_profile
, NULL
),
529 * The mouse can be equipped with one of four supplied weights from 5
530 * to 20 grams which are recognized and its value can be read out.
531 * This returns the raw value reported by the mouse for easy evaluation
532 * by software. Refer to enum kone_weights to get corresponding real
535 __ATTR(weight
, 0440, kone_sysfs_show_weight
, NULL
),
538 * Prints firmware version stored in mouse as integer.
539 * The raw value reported by the mouse is returned for easy evaluation,
540 * to get the real version number the decimal point has to be shifted 2
541 * positions to the left. E.g. a value of 138 means 1.38.
543 __ATTR(firmware_version
, 0440,
544 kone_sysfs_show_firmware_version
, NULL
),
547 * Prints state of Tracking Control Unit as number where 0 = off and
548 * 1 = on. Writing 0 deactivates tcu and writing 1 calibrates and
551 __ATTR(tcu
, 0660, kone_sysfs_show_tcu
, kone_sysfs_set_tcu
),
553 /* Prints and takes the number of the profile the mouse starts with */
554 __ATTR(startup_profile
, 0660,
555 kone_sysfs_show_startup_profile
,
556 kone_sysfs_set_startup_profile
),
560 static struct bin_attribute kone_bin_attributes
[] = {
562 .attr
= { .name
= "settings", .mode
= 0660 },
563 .size
= sizeof(struct kone_settings
),
564 .read
= kone_sysfs_read_settings
,
565 .write
= kone_sysfs_write_settings
568 .attr
= { .name
= "profile1", .mode
= 0660 },
569 .size
= sizeof(struct kone_profile
),
570 .read
= kone_sysfs_read_profilex
,
571 .write
= kone_sysfs_write_profilex
,
572 .private = &profile_numbers
[0]
575 .attr
= { .name
= "profile2", .mode
= 0660 },
576 .size
= sizeof(struct kone_profile
),
577 .read
= kone_sysfs_read_profilex
,
578 .write
= kone_sysfs_write_profilex
,
579 .private = &profile_numbers
[1]
582 .attr
= { .name
= "profile3", .mode
= 0660 },
583 .size
= sizeof(struct kone_profile
),
584 .read
= kone_sysfs_read_profilex
,
585 .write
= kone_sysfs_write_profilex
,
586 .private = &profile_numbers
[2]
589 .attr
= { .name
= "profile4", .mode
= 0660 },
590 .size
= sizeof(struct kone_profile
),
591 .read
= kone_sysfs_read_profilex
,
592 .write
= kone_sysfs_write_profilex
,
593 .private = &profile_numbers
[3]
596 .attr
= { .name
= "profile5", .mode
= 0660 },
597 .size
= sizeof(struct kone_profile
),
598 .read
= kone_sysfs_read_profilex
,
599 .write
= kone_sysfs_write_profilex
,
600 .private = &profile_numbers
[4]
605 static int kone_init_kone_device_struct(struct usb_device
*usb_dev
,
606 struct kone_device
*kone
)
611 mutex_init(&kone
->kone_lock
);
613 for (i
= 0; i
< 5; ++i
) {
614 retval
= kone_get_profile(usb_dev
, &kone
->profiles
[i
], i
+ 1);
619 retval
= kone_get_settings(usb_dev
, &kone
->settings
);
623 retval
= kone_get_firmware_version(usb_dev
, &kone
->firmware_version
);
627 kone
->actual_profile
= kone
->settings
.startup_profile
;
628 kone
->actual_dpi
= kone
->profiles
[kone
->actual_profile
].startup_dpi
;
634 * Since IGNORE_MOUSE quirk moved to hid-apple, there is no way to bind only to
635 * mousepart if usb_hid is compiled into the kernel and kone is compiled as
637 * Secial behaviour is bound only to mousepart since only mouseevents contain
638 * additional notifications.
640 static int kone_init_specials(struct hid_device
*hdev
)
642 struct usb_interface
*intf
= to_usb_interface(hdev
->dev
.parent
);
643 struct usb_device
*usb_dev
= interface_to_usbdev(intf
);
644 struct kone_device
*kone
;
647 if (intf
->cur_altsetting
->desc
.bInterfaceProtocol
648 == USB_INTERFACE_PROTOCOL_MOUSE
) {
650 kone
= kzalloc(sizeof(*kone
), GFP_KERNEL
);
652 hid_err(hdev
, "can't alloc device descriptor\n");
655 hid_set_drvdata(hdev
, kone
);
657 retval
= kone_init_kone_device_struct(usb_dev
, kone
);
659 hid_err(hdev
, "couldn't init struct kone_device\n");
663 retval
= roccat_connect(kone_class
, hdev
,
664 sizeof(struct kone_roccat_report
));
666 hid_err(hdev
, "couldn't init char dev\n");
667 /* be tolerant about not getting chrdev */
669 kone
->roccat_claimed
= 1;
670 kone
->chrdev_minor
= retval
;
673 hid_set_drvdata(hdev
, NULL
);
682 static void kone_remove_specials(struct hid_device
*hdev
)
684 struct usb_interface
*intf
= to_usb_interface(hdev
->dev
.parent
);
685 struct kone_device
*kone
;
687 if (intf
->cur_altsetting
->desc
.bInterfaceProtocol
688 == USB_INTERFACE_PROTOCOL_MOUSE
) {
689 kone
= hid_get_drvdata(hdev
);
690 if (kone
->roccat_claimed
)
691 roccat_disconnect(kone
->chrdev_minor
);
692 kfree(hid_get_drvdata(hdev
));
696 static int kone_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
700 retval
= hid_parse(hdev
);
702 hid_err(hdev
, "parse failed\n");
706 retval
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
708 hid_err(hdev
, "hw start failed\n");
712 retval
= kone_init_specials(hdev
);
714 hid_err(hdev
, "couldn't install mouse\n");
726 static void kone_remove(struct hid_device
*hdev
)
728 kone_remove_specials(hdev
);
732 /* handle special events and keep actual profile and dpi values up to date */
733 static void kone_keep_values_up_to_date(struct kone_device
*kone
,
734 struct kone_mouse_event
const *event
)
736 switch (event
->event
) {
737 case kone_mouse_event_switch_profile
:
738 case kone_mouse_event_osd_profile
:
739 kone
->actual_profile
= event
->value
;
740 kone
->actual_dpi
= kone
->profiles
[kone
->actual_profile
- 1].
743 case kone_mouse_event_switch_dpi
:
744 case kone_mouse_event_osd_dpi
:
745 kone
->actual_dpi
= event
->value
;
750 static void kone_report_to_chrdev(struct kone_device
const *kone
,
751 struct kone_mouse_event
const *event
)
753 struct kone_roccat_report roccat_report
;
755 switch (event
->event
) {
756 case kone_mouse_event_switch_profile
:
757 case kone_mouse_event_switch_dpi
:
758 case kone_mouse_event_osd_profile
:
759 case kone_mouse_event_osd_dpi
:
760 roccat_report
.event
= event
->event
;
761 roccat_report
.value
= event
->value
;
762 roccat_report
.key
= 0;
763 roccat_report_event(kone
->chrdev_minor
,
764 (uint8_t *)&roccat_report
);
766 case kone_mouse_event_call_overlong_macro
:
767 if (event
->value
== kone_keystroke_action_press
) {
768 roccat_report
.event
= kone_mouse_event_call_overlong_macro
;
769 roccat_report
.value
= kone
->actual_profile
;
770 roccat_report
.key
= event
->macro_key
;
771 roccat_report_event(kone
->chrdev_minor
,
772 (uint8_t *)&roccat_report
);
780 * Is called for keyboard- and mousepart.
781 * Only mousepart gets informations about special events in its extended event
784 static int kone_raw_event(struct hid_device
*hdev
, struct hid_report
*report
,
787 struct kone_device
*kone
= hid_get_drvdata(hdev
);
788 struct kone_mouse_event
*event
= (struct kone_mouse_event
*)data
;
790 /* keyboard events are always processed by default handler */
791 if (size
!= sizeof(struct kone_mouse_event
))
795 * Firmware 1.38 introduced new behaviour for tilt and special buttons.
796 * Pressed button is reported in each movement event.
797 * Workaround sends only one event per press.
799 if (memcmp(&kone
->last_mouse_event
.tilt
, &event
->tilt
, 5))
800 memcpy(&kone
->last_mouse_event
, event
,
801 sizeof(struct kone_mouse_event
));
803 memset(&event
->tilt
, 0, 5);
805 kone_keep_values_up_to_date(kone
, event
);
807 if (kone
->roccat_claimed
)
808 kone_report_to_chrdev(kone
, event
);
810 return 0; /* always do further processing */
813 static const struct hid_device_id kone_devices
[] = {
814 { HID_USB_DEVICE(USB_VENDOR_ID_ROCCAT
, USB_DEVICE_ID_ROCCAT_KONE
) },
818 MODULE_DEVICE_TABLE(hid
, kone_devices
);
820 static struct hid_driver kone_driver
= {
822 .id_table
= kone_devices
,
824 .remove
= kone_remove
,
825 .raw_event
= kone_raw_event
828 static int __init
kone_init(void)
832 /* class name has to be same as driver name */
833 kone_class
= class_create(THIS_MODULE
, "kone");
834 if (IS_ERR(kone_class
))
835 return PTR_ERR(kone_class
);
836 kone_class
->dev_attrs
= kone_attributes
;
837 kone_class
->dev_bin_attrs
= kone_bin_attributes
;
839 retval
= hid_register_driver(&kone_driver
);
841 class_destroy(kone_class
);
845 static void __exit
kone_exit(void)
847 hid_unregister_driver(&kone_driver
);
848 class_destroy(kone_class
);
851 module_init(kone_init
);
852 module_exit(kone_exit
);
854 MODULE_AUTHOR("Stefan Achatz");
855 MODULE_DESCRIPTION("USB Roccat Kone driver");
856 MODULE_LICENSE("GPL v2");