Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 256802
b: refs/heads/master
c: 6dc1418
h: refs/heads/master
v: v3
  • Loading branch information
Tomoki Sekiyama authored and Jiri Kosina committed Jun 7, 2011
1 parent a3c2ef4 commit 7305545
Show file tree
Hide file tree
Showing 18 changed files with 128 additions and 166 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 901e64dbdb5998b9248c372a401c921bbdf662f6
refs/heads/master: 6dc1418e13144162e8bc4858789010d8f0e1e65c
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,6 @@ Description: The mouse has a tracking- and a distance-control-unit. These
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>/koneplus/roccatkoneplus<minor>/talk
Date: May 2011
Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
Description: Used to active some easy* functions of the mouse from outside.
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>/koneplus/roccatkoneplus<minor>/tcu
Date: October 2010
Contact: Stefan Achatz <erazor_de@users.sourceforge.net>
Expand Down
17 changes: 10 additions & 7 deletions trunk/drivers/hid/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -434,48 +434,51 @@ config HID_QUANTA
config HID_ROCCAT
tristate "Roccat special event support"
depends on USB_HID
select HID_ROCCAT_COMMON
---help---
Support for Roccat special events.
Say Y here if you have a Roccat mouse or keyboard and want OSD or
macro execution support.

config HID_ROCCAT_COMMON
tristate
depends on HID_ROCCAT

config HID_ROCCAT_ARVO
tristate "Roccat Arvo keyboard support"
depends on USB_HID
depends on HID_ROCCAT
select HID_ROCCAT
select HID_ROCCAT_COMMON
---help---
Support for Roccat Arvo keyboard.

config HID_ROCCAT_KONE
tristate "Roccat Kone Mouse support"
depends on USB_HID
depends on HID_ROCCAT
select HID_ROCCAT
select HID_ROCCAT_COMMON
---help---
Support for Roccat Kone mouse.

config HID_ROCCAT_KONEPLUS
tristate "Roccat Kone[+] mouse support"
depends on USB_HID
depends on HID_ROCCAT
select HID_ROCCAT
select HID_ROCCAT_COMMON
---help---
Support for Roccat Kone[+] mouse.

config HID_ROCCAT_KOVAPLUS
tristate "Roccat Kova[+] mouse support"
depends on USB_HID
depends on HID_ROCCAT
select HID_ROCCAT
select HID_ROCCAT_COMMON
---help---
Support for Roccat Kova[+] mouse.

config HID_ROCCAT_PYRA
tristate "Roccat Pyra mouse support"
depends on USB_HID
depends on HID_ROCCAT
select HID_ROCCAT
select HID_ROCCAT_COMMON
---help---
Support for Roccat Pyra mouse.

Expand Down
6 changes: 5 additions & 1 deletion trunk/drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1769,7 +1769,6 @@ static const struct hid_device_id hid_ignore_list[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1006) },
{ HID_USB_DEVICE(USB_VENDOR_ID_GTCO, USB_DEVICE_ID_GTCO_1007) },
{ HID_USB_DEVICE(USB_VENDOR_ID_IMATION, USB_DEVICE_ID_DISC_STAKKA) },
{ HID_USB_DEVICE(USB_VENDOR_ID_JESS, USB_DEVICE_ID_JESS_YUREX) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KBGEAR, USB_DEVICE_ID_KBGEAR_JAMSTUDIO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KWORLD, USB_DEVICE_ID_KWORLD_RADIO_FM700) },
{ HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_GPEN_560) },
Expand Down Expand Up @@ -1910,6 +1909,11 @@ static bool hid_ignore(struct hid_device *hdev)
hdev->product <= USB_DEVICE_ID_HANWANG_TABLET_LAST)
return true;
break;
case USB_VENDOR_ID_JESS:
if (hdev->product == USB_DEVICE_ID_JESS_YUREX &&
hdev->type == HID_TYPE_USBNONE)
return true;
break;
}

if (hdev->type == HID_TYPE_USBMOUSE &&
Expand Down
21 changes: 9 additions & 12 deletions trunk/drivers/hid/hid-roccat-arvo.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ static ssize_t arvo_sysfs_show_mode_key(struct device *dev,
int retval;

mutex_lock(&arvo->arvo_lock);
retval = roccat_common_receive(usb_dev, ARVO_COMMAND_MODE_KEY,
retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_MODE_KEY,
&temp_buf, sizeof(struct arvo_mode_key));
mutex_unlock(&arvo->arvo_lock);
if (retval)
Expand Down Expand Up @@ -67,7 +67,7 @@ static ssize_t arvo_sysfs_set_mode_key(struct device *dev,
temp_buf.state = state;

mutex_lock(&arvo->arvo_lock);
retval = roccat_common_send(usb_dev, ARVO_COMMAND_MODE_KEY,
retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_MODE_KEY,
&temp_buf, sizeof(struct arvo_mode_key));
mutex_unlock(&arvo->arvo_lock);
if (retval)
Expand All @@ -87,7 +87,7 @@ static ssize_t arvo_sysfs_show_key_mask(struct device *dev,
int retval;

mutex_lock(&arvo->arvo_lock);
retval = roccat_common_receive(usb_dev, ARVO_COMMAND_KEY_MASK,
retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_KEY_MASK,
&temp_buf, sizeof(struct arvo_key_mask));
mutex_unlock(&arvo->arvo_lock);
if (retval)
Expand Down Expand Up @@ -115,7 +115,7 @@ static ssize_t arvo_sysfs_set_key_mask(struct device *dev,
temp_buf.key_mask = key_mask;

mutex_lock(&arvo->arvo_lock);
retval = roccat_common_send(usb_dev, ARVO_COMMAND_KEY_MASK,
retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_KEY_MASK,
&temp_buf, sizeof(struct arvo_key_mask));
mutex_unlock(&arvo->arvo_lock);
if (retval)
Expand All @@ -130,7 +130,7 @@ static int arvo_get_actual_profile(struct usb_device *usb_dev)
struct arvo_actual_profile temp_buf;
int retval;

retval = roccat_common_receive(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE,
retval = roccat_common_receive(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE,
&temp_buf, sizeof(struct arvo_actual_profile));

if (retval)
Expand Down Expand Up @@ -163,14 +163,11 @@ static ssize_t arvo_sysfs_set_actual_profile(struct device *dev,
if (retval)
return retval;

if (profile < 1 || profile > 5)
return -EINVAL;

temp_buf.command = ARVO_COMMAND_ACTUAL_PROFILE;
temp_buf.actual_profile = profile;

mutex_lock(&arvo->arvo_lock);
retval = roccat_common_send(usb_dev, ARVO_COMMAND_ACTUAL_PROFILE,
retval = roccat_common_send(usb_dev, ARVO_USB_COMMAND_ACTUAL_PROFILE,
&temp_buf, sizeof(struct arvo_actual_profile));
if (!retval) {
arvo->actual_profile = profile;
Expand Down Expand Up @@ -228,15 +225,15 @@ static ssize_t arvo_sysfs_write_button(struct file *fp,
loff_t off, size_t count)
{
return arvo_sysfs_write(fp, kobj, buf, off, count,
sizeof(struct arvo_button), ARVO_COMMAND_BUTTON);
sizeof(struct arvo_button), ARVO_USB_COMMAND_BUTTON);
}

static ssize_t arvo_sysfs_read_info(struct file *fp,
struct kobject *kobj, struct bin_attribute *attr, char *buf,
loff_t off, size_t count)
{
return arvo_sysfs_read(fp, kobj, buf, off, count,
sizeof(struct arvo_info), ARVO_COMMAND_INFO);
sizeof(struct arvo_info), ARVO_USB_COMMAND_INFO);
}


Expand Down Expand Up @@ -402,7 +399,7 @@ static int arvo_raw_event(struct hid_device *hdev,
if (size != 3)
return 0;

if (arvo && arvo->roccat_claimed)
if (arvo->roccat_claimed)
arvo_report_to_chrdev(arvo, data);

return 0;
Expand Down
13 changes: 13 additions & 0 deletions trunk/drivers/hid/hid-roccat-arvo.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,19 @@ enum arvo_commands {
ARVO_COMMAND_ACTUAL_PROFILE = 0x7,
};

enum arvo_usb_commands {
ARVO_USB_COMMAND_MODE_KEY = 0x303,
/*
* read/write
* Read uses both index bytes as profile/key indexes
* Write has index 0, profile/key is determined by payload
*/
ARVO_USB_COMMAND_BUTTON = 0x304,
ARVO_USB_COMMAND_INFO = 0x305,
ARVO_USB_COMMAND_KEY_MASK = 0x306,
ARVO_USB_COMMAND_ACTUAL_PROFILE = 0x307,
};

struct arvo_special_report {
uint8_t unknown1; /* always 0x01 */
uint8_t event;
Expand Down
20 changes: 6 additions & 14 deletions trunk/drivers/hid/hid-roccat-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,10 @@
* any later version.
*/

#include <linux/hid.h>
#include <linux/slab.h>
#include "hid-roccat-common.h"

static inline uint16_t roccat_common_feature_report(uint8_t report_id)
{
return 0x300 | report_id;
}

int roccat_common_receive(struct usb_device *usb_dev, uint report_id,
int roccat_common_receive(struct usb_device *usb_dev, uint usb_command,
void *data, uint size)
{
char *buf;
Expand All @@ -31,18 +25,17 @@ int roccat_common_receive(struct usb_device *usb_dev, uint report_id,
return -ENOMEM;

len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
HID_REQ_GET_REPORT,
USB_REQ_CLEAR_FEATURE,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
roccat_common_feature_report(report_id),
0, buf, size, USB_CTRL_SET_TIMEOUT);
usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);

memcpy(data, buf, size);
kfree(buf);
return ((len < 0) ? len : ((len != size) ? -EIO : 0));
}
EXPORT_SYMBOL_GPL(roccat_common_receive);

int roccat_common_send(struct usb_device *usb_dev, uint report_id,
int roccat_common_send(struct usb_device *usb_dev, uint usb_command,
void const *data, uint size)
{
char *buf;
Expand All @@ -55,10 +48,9 @@ int roccat_common_send(struct usb_device *usb_dev, uint report_id,
memcpy(buf, data, size);

len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
HID_REQ_SET_REPORT,
USB_REQ_SET_CONFIGURATION,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
roccat_common_feature_report(report_id),
0, buf, size, USB_CTRL_SET_TIMEOUT);
usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);

kfree(buf);
return ((len < 0) ? len : ((len != size) ? -EIO : 0));
Expand Down
4 changes: 2 additions & 2 deletions trunk/drivers/hid/hid-roccat-common.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
#include <linux/usb.h>
#include <linux/types.h>

int roccat_common_receive(struct usb_device *usb_dev, uint report_id,
int roccat_common_receive(struct usb_device *usb_dev, uint usb_command,
void *data, uint size);
int roccat_common_send(struct usb_device *usb_dev, uint report_id,
int roccat_common_send(struct usb_device *usb_dev, uint usb_command,
void const *data, uint size);

#endif
56 changes: 6 additions & 50 deletions trunk/drivers/hid/hid-roccat-kone.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,47 +37,6 @@

static uint profile_numbers[5] = {0, 1, 2, 3, 4};

static int kone_receive(struct usb_device *usb_dev, uint usb_command,
void *data, uint size)
{
char *buf;
int len;

buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;

len = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
HID_REQ_GET_REPORT,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_IN,
usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);

memcpy(data, buf, size);
kfree(buf);
return ((len < 0) ? len : ((len != size) ? -EIO : 0));
}

static int kone_send(struct usb_device *usb_dev, uint usb_command,
void const *data, uint size)
{
char *buf;
int len;

buf = kmalloc(size, GFP_KERNEL);
if (buf == NULL)
return -ENOMEM;

memcpy(buf, data, size);

len = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
HID_REQ_SET_REPORT,
USB_TYPE_CLASS | USB_RECIP_INTERFACE | USB_DIR_OUT,
usb_command, 0, buf, size, USB_CTRL_SET_TIMEOUT);

kfree(buf);
return ((len < 0) ? len : ((len != size) ? -EIO : 0));
}

/* kone_class is used for creating sysfs attributes via roccat char device */
static struct class *kone_class;

Expand Down Expand Up @@ -109,7 +68,7 @@ static int kone_check_write(struct usb_device *usb_dev)
*/
msleep(80);

retval = kone_receive(usb_dev,
retval = roccat_common_receive(usb_dev,
kone_command_confirm_write, &data, 1);
if (retval)
return retval;
Expand Down Expand Up @@ -137,7 +96,7 @@ static int kone_check_write(struct usb_device *usb_dev)
static int kone_get_settings(struct usb_device *usb_dev,
struct kone_settings *buf)
{
return kone_receive(usb_dev, kone_command_settings, buf,
return roccat_common_receive(usb_dev, kone_command_settings, buf,
sizeof(struct kone_settings));
}

Expand All @@ -150,7 +109,7 @@ static int kone_set_settings(struct usb_device *usb_dev,
struct kone_settings const *settings)
{
int retval;
retval = kone_send(usb_dev, kone_command_settings,
retval = roccat_common_send(usb_dev, kone_command_settings,
settings, sizeof(struct kone_settings));
if (retval)
return retval;
Expand Down Expand Up @@ -223,7 +182,7 @@ static int kone_get_weight(struct usb_device *usb_dev, int *result)
int retval;
uint8_t data;

retval = kone_receive(usb_dev, kone_command_weight, &data, 1);
retval = roccat_common_receive(usb_dev, kone_command_weight, &data, 1);

if (retval)
return retval;
Expand All @@ -242,7 +201,7 @@ static int kone_get_firmware_version(struct usb_device *usb_dev, int *result)
int retval;
uint16_t data;

retval = kone_receive(usb_dev, kone_command_firmware_version,
retval = roccat_common_receive(usb_dev, kone_command_firmware_version,
&data, 2);
if (retval)
return retval;
Expand Down Expand Up @@ -425,7 +384,7 @@ static int kone_tcu_command(struct usb_device *usb_dev, int number)
{
unsigned char value;
value = number;
return kone_send(usb_dev, kone_command_calibrate, &value, 1);
return roccat_common_send(usb_dev, kone_command_calibrate, &value, 1);
}

/*
Expand Down Expand Up @@ -832,9 +791,6 @@ static int kone_raw_event(struct hid_device *hdev, struct hid_report *report,
if (size != sizeof(struct kone_mouse_event))
return 0;

if (kone == NULL)
return 0;

/*
* Firmware 1.38 introduced new behaviour for tilt and special buttons.
* Pressed button is reported in each movement event.
Expand Down
2 changes: 1 addition & 1 deletion trunk/drivers/hid/hid-roccat-kone.h
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ enum kone_mouse_events {
/* osd events are thought to be display on screen */
kone_mouse_event_osd_dpi = 0xa0,
kone_mouse_event_osd_profile = 0xb0,
/* TODO clarify meaning and occurence of kone_mouse_event_calibration */
/* TODO clarify meaning and occurrence of kone_mouse_event_calibration */
kone_mouse_event_calibration = 0xc0,
kone_mouse_event_call_overlong_macro = 0xe0,
/* switch events notify if user changed values with mousebutton click */
Expand Down
Loading

0 comments on commit 7305545

Please sign in to comment.