Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 282331
b: refs/heads/master
c: 192a1ac
h: refs/heads/master
i:
  282329: 76e661b
  282327: 39af6b2
v: v3
  • Loading branch information
David Herrmann authored and Jiri Kosina committed Nov 22, 2011
1 parent d72eef8 commit 5cc80bc
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 160 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: 78761ff9bc4e944e0b4e5df1e7eedcfdbb1a9a1a
refs/heads/master: 192a1acfbd600fea8a596b7d92572b70131b7738
2 changes: 2 additions & 0 deletions trunk/drivers/hid/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ ifdef CONFIG_LOGIWHEELS_FF
hid-logitech-y += hid-lg4ff.o
endif

hid-wiimote-y := hid-wiimote-core.o

obj-$(CONFIG_HID_A4TECH) += hid-a4tech.o
obj-$(CONFIG_HID_ACRUX) += hid-axff.o
obj-$(CONFIG_HID_APPLE) += hid-apple.o
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/hid/hid-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1544,7 +1544,6 @@ static const struct hid_device_id hid_have_special_driver[] = {
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_DUAL_BOX_PRO) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WISEGROUP_LTD, USB_DEVICE_ID_SUPER_JOY_BOX_5_PRO) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_SLIM_TABLET_12_1_INCH) },
{ HID_USB_DEVICE(USB_VENDOR_ID_WALTOP, USB_DEVICE_ID_WALTOP_MEDIA_TABLET_10_6_INCH) },
Expand Down
1 change: 0 additions & 1 deletion trunk/drivers/hid/hid-ids.h
Original file line number Diff line number Diff line change
Expand Up @@ -679,7 +679,6 @@

#define USB_VENDOR_ID_WACOM 0x056a
#define USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH 0x81
#define USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH 0x00BD

#define USB_VENDOR_ID_WALTOP 0x172f
#define USB_DEVICE_ID_WALTOP_SLIM_TABLET_5_8_INCH 0x0032
Expand Down
179 changes: 22 additions & 157 deletions trunk/drivers/hid/hid-wacom.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
* Copyright (c) 2008 Jiri Slaby <jirislaby@gmail.com>
* Copyright (c) 2006 Andrew Zabolotny <zap@homelink.ru>
* Copyright (c) 2009 Bastien Nocera <hadess@hadess.net>
* Copyright (c) 2011 Przemysław Firszt <przemo@firszt.eu>
*/

/*
Expand All @@ -34,7 +33,6 @@
struct wacom_data {
__u16 tool;
unsigned char butstate;
__u8 features;
unsigned char high_speed;
#ifdef CONFIG_HID_WACOM_POWER_SUPPLY
int battery_capacity;
Expand Down Expand Up @@ -109,19 +107,6 @@ static int wacom_ac_get_property(struct power_supply *psy,
}
#endif

static void wacom_set_features(struct hid_device *hdev)
{
int ret;
__u8 rep_data[2];

/*set high speed, tablet mode*/
rep_data[0] = 0x03;
rep_data[1] = 0x20;
ret = hdev->hid_output_raw_report(hdev, rep_data, 2,
HID_FEATURE_REPORT);
return;
}

static void wacom_poke(struct hid_device *hdev, u8 speed)
{
struct wacom_data *wdata = hid_get_drvdata(hdev);
Expand Down Expand Up @@ -192,13 +177,26 @@ static ssize_t wacom_store_speed(struct device *dev,
static DEVICE_ATTR(speed, S_IRUGO | S_IWUSR | S_IWGRP,
wacom_show_speed, wacom_store_speed);

static int wacom_gr_parse_report(struct hid_device *hdev,
struct wacom_data *wdata,
struct input_dev *input, unsigned char *data)
static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *raw_data, int size)
{
struct wacom_data *wdata = hid_get_drvdata(hdev);
struct hid_input *hidinput;
struct input_dev *input;
unsigned char *data = (unsigned char *) raw_data;
int tool, x, y, rw;

if (!(hdev->claimed & HID_CLAIMED_INPUT))
return 0;

tool = 0;
hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
input = hidinput->input;

/* Check if this is a tablet report */
if (data[0] != 0x03)
return 0;

/* Get X & Y positions */
x = le16_to_cpu(*(__le16 *) &data[2]);
y = le16_to_cpu(*(__le16 *) &data[4]);
Expand Down Expand Up @@ -306,121 +304,6 @@ static int wacom_gr_parse_report(struct hid_device *hdev,
return 1;
}

static void wacom_i4_parse_pen_report(struct wacom_data *wdata,
struct input_dev *input, unsigned char *data)
{
__u16 x, y, pressure;
__u32 id;

switch (data[1]) {
case 0x80: /* Out of proximity report */
wdata->tool = 0;
input_report_key(input, BTN_TOUCH, 0);
input_report_abs(input, ABS_PRESSURE, 0);
input_report_key(input, wdata->tool, 0);
input_sync(input);
break;
case 0xC2: /* Tool report */
id = ((data[2] << 4) | (data[3] >> 4) |
((data[7] & 0x0f) << 20) |
((data[8] & 0xf0) << 12)) & 0xfffff;

switch (id) {
case 0x802:
wdata->tool = BTN_TOOL_PEN;
break;
case 0x80A:
wdata->tool = BTN_TOOL_RUBBER;
break;
}
break;
default: /* Position/pressure report */
x = data[2] << 9 | data[3] << 1 | ((data[9] & 0x02) >> 1);
y = data[4] << 9 | data[5] << 1 | (data[9] & 0x01);
pressure = (data[6] << 3) | ((data[7] & 0xC0) >> 5)
| (data[1] & 0x01);

input_report_key(input, BTN_TOUCH, pressure > 1);

input_report_key(input, BTN_STYLUS, data[1] & 0x02);
input_report_key(input, BTN_STYLUS2, data[1] & 0x04);
input_report_key(input, wdata->tool, 1);
input_report_abs(input, ABS_X, x);
input_report_abs(input, ABS_Y, y);
input_report_abs(input, ABS_PRESSURE, pressure);
input_sync(input);
break;
}

return;
}

static void wacom_i4_parse_report(struct hid_device *hdev,
struct wacom_data *wdata,
struct input_dev *input, unsigned char *data)
{
switch (data[0]) {
case 0x00: /* Empty report */
break;
case 0x02: /* Pen report */
wacom_i4_parse_pen_report(wdata, input, data);
break;
case 0x03: /* Features Report */
wdata->features = data[2];
break;
case 0x0C: /* Button report */
break;
default:
hid_err(hdev, "Unknown report: %d,%d\n", data[0], data[1]);
break;
}
}

static int wacom_raw_event(struct hid_device *hdev, struct hid_report *report,
u8 *raw_data, int size)
{
struct wacom_data *wdata = hid_get_drvdata(hdev);
struct hid_input *hidinput;
struct input_dev *input;
unsigned char *data = (unsigned char *) raw_data;
int i;

if (!(hdev->claimed & HID_CLAIMED_INPUT))
return 0;

hidinput = list_entry(hdev->inputs.next, struct hid_input, list);
input = hidinput->input;

/* Check if this is a tablet report */
if (data[0] != 0x03)
return 0;

switch (hdev->product) {
case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
return wacom_gr_parse_report(hdev, wdata, input, data);
break;
case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
i = 1;

switch (data[0]) {
case 0x04:
wacom_i4_parse_report(hdev, wdata, input, data + i);
i += 10;
/* fall through */
case 0x03:
wacom_i4_parse_report(hdev, wdata, input, data + i);
i += 10;
wacom_i4_parse_report(hdev, wdata, input, data + i);
break;
default:
hid_err(hdev, "Unknown report: %d,%d size:%d\n",
data[0], data[1], size);
return 0;
}
}
return 1;
}

static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
struct hid_field *field, struct hid_usage *usage, unsigned long **bit,
int *max)
Expand Down Expand Up @@ -455,19 +338,10 @@ static int wacom_input_mapped(struct hid_device *hdev, struct hid_input *hi,
__set_bit(BTN_TOOL_RUBBER, input->keybit);
__set_bit(BTN_TOOL_MOUSE, input->keybit);

switch (hdev->product) {
case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);
break;
case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
input_set_abs_params(input, ABS_X, 0, 40640, 4, 0);
input_set_abs_params(input, ABS_Y, 0, 25400, 4, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 2047, 0, 0);
break;
}
input_set_abs_params(input, ABS_X, 0, 16704, 4, 0);
input_set_abs_params(input, ABS_Y, 0, 12064, 4, 0);
input_set_abs_params(input, ABS_PRESSURE, 0, 511, 0, 0);
input_set_abs_params(input, ABS_DISTANCE, 0, 32, 0, 0);

return 0;
}
Expand Down Expand Up @@ -504,16 +378,8 @@ static int wacom_probe(struct hid_device *hdev,
hid_warn(hdev,
"can't create sysfs speed attribute err: %d\n", ret);

switch (hdev->product) {
case USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH:
/* Set Wacom mode 2 with high reporting speed */
wacom_poke(hdev, 1);
break;
case USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH:
wdata->features = 0;
wacom_set_features(hdev);
break;
}
/* Set Wacom mode 2 with high reporting speed */
wacom_poke(hdev, 1);

#ifdef CONFIG_HID_WACOM_POWER_SUPPLY
wdata->battery.properties = wacom_battery_props;
Expand Down Expand Up @@ -575,7 +441,6 @@ static void wacom_remove(struct hid_device *hdev)

static const struct hid_device_id wacom_devices[] = {
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_GRAPHIRE_BLUETOOTH) },
{ HID_BLUETOOTH_DEVICE(USB_VENDOR_ID_WACOM, USB_DEVICE_ID_WACOM_INTUOS4_BLUETOOTH) },

{ }
};
Expand Down
File renamed without changes.

0 comments on commit 5cc80bc

Please sign in to comment.