提交 05f091ab 编写于 作者: D Dmitry Torokhov

Input: whitespace fixes in drivers/usb/input

Signed-off-by: NDmitry Torokhov <dtor@mail.ru>
上级 ab0c3443
/* /*
* Native support for the Aiptek HyperPen USB Tablets * Native support for the Aiptek HyperPen USB Tablets
* (4000U/5000U/6000U/8000U/12000U) * (4000U/5000U/6000U/8000U/12000U)
* *
* Copyright (c) 2001 Chris Atenasio <chris@crud.net> * Copyright (c) 2001 Chris Atenasio <chris@crud.net>
* Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net> * Copyright (c) 2002-2004 Bryan W. Headley <bwheadley@earthlink.net>
* *
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
* - Added support for the sysfs interface, deprecating the * - Added support for the sysfs interface, deprecating the
* procfs interface for 2.5.x kernel. Also added support for * procfs interface for 2.5.x kernel. Also added support for
* Wheel command. Bryan W. Headley July-15-2003. * Wheel command. Bryan W. Headley July-15-2003.
* v1.2 - Reworked jitter timer as a kernel thread. * v1.2 - Reworked jitter timer as a kernel thread.
* Bryan W. Headley November-28-2003/Jan-10-2004. * Bryan W. Headley November-28-2003/Jan-10-2004.
* v1.3 - Repaired issue of kernel thread going nuts on single-processor * v1.3 - Repaired issue of kernel thread going nuts on single-processor
* machines, introduced programmableDelay as a command line * machines, introduced programmableDelay as a command line
...@@ -49,10 +49,10 @@ ...@@ -49,10 +49,10 @@
* NOTE: * NOTE:
* This kernel driver is augmented by the "Aiptek" XFree86 input * This kernel driver is augmented by the "Aiptek" XFree86 input
* driver for your X server, as well as the Gaiptek GUI Front-end * driver for your X server, as well as the Gaiptek GUI Front-end
* "Tablet Manager". * "Tablet Manager".
* These three products are highly interactive with one another, * These three products are highly interactive with one another,
* so therefore it's easier to document them all as one subsystem. * so therefore it's easier to document them all as one subsystem.
* Please visit the project's "home page", located at, * Please visit the project's "home page", located at,
* http://aiptektablet.sourceforge.net. * http://aiptektablet.sourceforge.net.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
...@@ -156,7 +156,7 @@ ...@@ -156,7 +156,7 @@
* Command/Data Description Return Bytes Return Value * Command/Data Description Return Bytes Return Value
* 0x10/0x00 SwitchToMouse 0 * 0x10/0x00 SwitchToMouse 0
* 0x10/0x01 SwitchToTablet 0 * 0x10/0x01 SwitchToTablet 0
* 0x18/0x04 SetResolution 0 * 0x18/0x04 SetResolution 0
* 0x12/0xFF AutoGainOn 0 * 0x12/0xFF AutoGainOn 0
* 0x17/0x00 FilterOn 0 * 0x17/0x00 FilterOn 0
* 0x01/0x00 GetXExtension 2 MaxX * 0x01/0x00 GetXExtension 2 MaxX
...@@ -247,7 +247,7 @@ ...@@ -247,7 +247,7 @@
#define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2 #define AIPTEK_DIAGNOSTIC_SENDING_ABSOLUTE_IN_RELATIVE 2
#define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3 #define AIPTEK_DIAGNOSTIC_TOOL_DISALLOWED 3
/* Time to wait (in ms) to help mask hand jittering /* Time to wait (in ms) to help mask hand jittering
* when pressing the stylus buttons. * when pressing the stylus buttons.
*/ */
#define AIPTEK_JITTER_DELAY_DEFAULT 50 #define AIPTEK_JITTER_DELAY_DEFAULT 50
...@@ -791,7 +791,7 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs) ...@@ -791,7 +791,7 @@ static void aiptek_irq(struct urb *urb, struct pt_regs *regs)
* specific Aiptek model numbers, because there has been overlaps, * specific Aiptek model numbers, because there has been overlaps,
* use, and reuse of id's in existing models. Certain models have * use, and reuse of id's in existing models. Certain models have
* been known to use more than one ID, indicative perhaps of * been known to use more than one ID, indicative perhaps of
* manufacturing revisions. In any event, we consider these * manufacturing revisions. In any event, we consider these
* IDs to not be model-specific nor unique. * IDs to not be model-specific nor unique.
*/ */
static const struct usb_device_id aiptek_ids[] = { static const struct usb_device_id aiptek_ids[] = {
...@@ -840,7 +840,7 @@ static void aiptek_close(struct input_dev *inputdev) ...@@ -840,7 +840,7 @@ static void aiptek_close(struct input_dev *inputdev)
} }
/*********************************************************************** /***********************************************************************
* aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x, * aiptek_set_report and aiptek_get_report() are borrowed from Linux 2.4.x,
* where they were known as usb_set_report and usb_get_report. * where they were known as usb_set_report and usb_get_report.
*/ */
static int static int
......
此差异已折叠。
...@@ -232,7 +232,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign ...@@ -232,7 +232,7 @@ static int hid_add_field(struct hid_parser *parser, unsigned report_type, unsign
report->size += parser->global.report_size * parser->global.report_count; report->size += parser->global.report_size * parser->global.report_count;
if (!parser->local.usage_index) /* Ignore padding fields */ if (!parser->local.usage_index) /* Ignore padding fields */
return 0; return 0;
usages = max_t(int, parser->local.usage_index, parser->global.report_count); usages = max_t(int, parser->local.usage_index, parser->global.report_count);
...@@ -1622,7 +1622,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf) ...@@ -1622,7 +1622,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
/* Change the polling interval of mice. */ /* Change the polling interval of mice. */
if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0) if (hid->collection->usage == HID_GD_MOUSE && hid_mousepoll_interval > 0)
interval = hid_mousepoll_interval; interval = hid_mousepoll_interval;
if (endpoint->bEndpointAddress & USB_DIR_IN) { if (endpoint->bEndpointAddress & USB_DIR_IN) {
if (hid->urbin) if (hid->urbin)
continue; continue;
......
...@@ -67,7 +67,7 @@ static const struct hid_usage_entry hid_usage_table[] = { ...@@ -67,7 +67,7 @@ static const struct hid_usage_entry hid_usage_table[] = {
{0, 0x44, "Vbry"}, {0, 0x44, "Vbry"},
{0, 0x45, "Vbrz"}, {0, 0x45, "Vbrz"},
{0, 0x46, "Vno"}, {0, 0x46, "Vno"},
{0, 0x80, "SystemControl"}, {0, 0x80, "SystemControl"},
{0, 0x81, "SystemPowerDown"}, {0, 0x81, "SystemPowerDown"},
{0, 0x82, "SystemSleep"}, {0, 0x82, "SystemSleep"},
{0, 0x83, "SystemWakeUp"}, {0, 0x83, "SystemWakeUp"},
...@@ -347,7 +347,7 @@ __inline__ static void tab(int n) { ...@@ -347,7 +347,7 @@ __inline__ static void tab(int n) {
static void hid_dump_field(struct hid_field *field, int n) { static void hid_dump_field(struct hid_field *field, int n) {
int j; int j;
if (field->physical) { if (field->physical) {
tab(n); tab(n);
printk("Physical("); printk("Physical(");
...@@ -408,7 +408,7 @@ static void hid_dump_field(struct hid_field *field, int n) { ...@@ -408,7 +408,7 @@ static void hid_dump_field(struct hid_field *field, int n) {
printk("%s", units[sys][i]); printk("%s", units[sys][i]);
if(nibble != 1) { if(nibble != 1) {
/* This is a _signed_ nibble(!) */ /* This is a _signed_ nibble(!) */
int val = nibble & 0x7; int val = nibble & 0x7;
if(nibble & 0x08) if(nibble & 0x08)
val = -((0x7 & ~val) +1); val = -((0x7 & ~val) +1);
...@@ -443,7 +443,7 @@ static void __attribute__((unused)) hid_dump_device(struct hid_device *device) { ...@@ -443,7 +443,7 @@ static void __attribute__((unused)) hid_dump_device(struct hid_device *device) {
struct list_head *list; struct list_head *list;
unsigned i,k; unsigned i,k;
static char *table[] = {"INPUT", "OUTPUT", "FEATURE"}; static char *table[] = {"INPUT", "OUTPUT", "FEATURE"};
for (i = 0; i < HID_REPORT_TYPES; i++) { for (i = 0; i < HID_REPORT_TYPES; i++) {
report_enum = device->report_enum + i; report_enum = device->report_enum + i;
list = report_enum->report_list.next; list = report_enum->report_list.next;
...@@ -664,8 +664,8 @@ static char *keys[KEY_MAX + 1] = { ...@@ -664,8 +664,8 @@ static char *keys[KEY_MAX + 1] = {
static char *relatives[REL_MAX + 1] = { static char *relatives[REL_MAX + 1] = {
[REL_X] = "X", [REL_Y] = "Y", [REL_X] = "X", [REL_Y] = "Y",
[REL_Z] = "Z", [REL_HWHEEL] = "HWheel", [REL_Z] = "Z", [REL_HWHEEL] = "HWheel",
[REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel", [REL_DIAL] = "Dial", [REL_WHEEL] = "Wheel",
[REL_MISC] = "Misc", [REL_MISC] = "Misc",
}; };
static char *absolutes[ABS_MAX + 1] = { static char *absolutes[ABS_MAX + 1] = {
...@@ -690,9 +690,9 @@ static char *misc[MSC_MAX + 1] = { ...@@ -690,9 +690,9 @@ static char *misc[MSC_MAX + 1] = {
}; };
static char *leds[LED_MAX + 1] = { static char *leds[LED_MAX + 1] = {
[LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock", [LED_NUML] = "NumLock", [LED_CAPSL] = "CapsLock",
[LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose", [LED_SCROLLL] = "ScrollLock", [LED_COMPOSE] = "Compose",
[LED_KANA] = "Kana", [LED_SLEEP] = "Sleep", [LED_KANA] = "Kana", [LED_SLEEP] = "Sleep",
[LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute", [LED_SUSPEND] = "Suspend", [LED_MUTE] = "Mute",
[LED_MISC] = "Misc", [LED_MISC] = "Misc",
}; };
......
...@@ -164,7 +164,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -164,7 +164,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case HID_GD_X: case HID_GD_Y: case HID_GD_Z: case HID_GD_X: case HID_GD_Y: case HID_GD_Z:
case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ: case HID_GD_RX: case HID_GD_RY: case HID_GD_RZ:
case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL: case HID_GD_SLIDER: case HID_GD_DIAL: case HID_GD_WHEEL:
if (field->flags & HID_MAIN_ITEM_RELATIVE) if (field->flags & HID_MAIN_ITEM_RELATIVE)
map_rel(usage->hid & 0xf); map_rel(usage->hid & 0xf);
else else
map_abs(usage->hid & 0xf); map_abs(usage->hid & 0xf);
...@@ -297,7 +297,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -297,7 +297,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
case HID_UP_MSVENDOR: case HID_UP_MSVENDOR:
goto ignore; goto ignore;
case HID_UP_PID: case HID_UP_PID:
set_bit(EV_FF, input->evbit); set_bit(EV_FF, input->evbit);
...@@ -349,7 +349,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -349,7 +349,7 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
goto ignore; goto ignore;
if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) && if ((device->quirks & (HID_QUIRK_2WHEEL_MOUSE_HACK_7 | HID_QUIRK_2WHEEL_MOUSE_HACK_5)) &&
(usage->type == EV_REL) && (usage->code == REL_WHEEL)) (usage->type == EV_REL) && (usage->code == REL_WHEEL))
set_bit(REL_HWHEEL, bit); set_bit(REL_HWHEEL, bit);
if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005)) if (((device->quirks & HID_QUIRK_2WHEEL_MOUSE_HACK_5) && (usage->hid == 0x00090005))
...@@ -365,11 +365,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel ...@@ -365,11 +365,11 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel
a = field->logical_minimum = 0; a = field->logical_minimum = 0;
b = field->logical_maximum = 255; b = field->logical_maximum = 255;
} }
if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK) if (field->application == HID_GD_GAMEPAD || field->application == HID_GD_JOYSTICK)
input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4); input_set_abs_params(input, usage->code, a, b, (b - a) >> 8, (b - a) >> 4);
else input_set_abs_params(input, usage->code, a, b, 0, 0); else input_set_abs_params(input, usage->code, a, b, 0, 0);
} }
if (usage->hat_min < usage->hat_max || usage->hat_dir) { if (usage->hat_min < usage->hat_max || usage->hat_dir) {
...@@ -420,7 +420,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct ...@@ -420,7 +420,7 @@ void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct
return; return;
} }
if (usage->hat_min < usage->hat_max || usage->hat_dir) { if (usage->hat_min < usage->hat_max || usage->hat_dir) {
int hat_dir = usage->hat_dir; int hat_dir = usage->hat_dir;
if (!hat_dir) if (!hat_dir)
hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1; hat_dir = (value - usage->hat_min) * 8 / (usage->hat_max - usage->hat_min + 1) + 1;
...@@ -551,7 +551,7 @@ int hidinput_connect(struct hid_device *hid) ...@@ -551,7 +551,7 @@ int hidinput_connect(struct hid_device *hid)
for (i = 0; i < hid->maxcollection; i++) for (i = 0; i < hid->maxcollection; i++)
if (hid->collection[i].type == HID_COLLECTION_APPLICATION || if (hid->collection[i].type == HID_COLLECTION_APPLICATION ||
hid->collection[i].type == HID_COLLECTION_PHYSICAL) hid->collection[i].type == HID_COLLECTION_PHYSICAL)
if (IS_INPUT_APPLICATION(hid->collection[i].usage)) if (IS_INPUT_APPLICATION(hid->collection[i].usage))
break; break;
if (i == hid->maxcollection) if (i == hid->maxcollection)
...@@ -592,7 +592,7 @@ int hidinput_connect(struct hid_device *hid) ...@@ -592,7 +592,7 @@ int hidinput_connect(struct hid_device *hid)
for (j = 0; j < report->field[i]->maxusage; j++) for (j = 0; j < report->field[i]->maxusage; j++)
hidinput_configure_usage(hidinput, report->field[i], hidinput_configure_usage(hidinput, report->field[i],
report->field[i]->usage + j); report->field[i]->usage + j);
if (hid->quirks & HID_QUIRK_MULTI_INPUT) { if (hid->quirks & HID_QUIRK_MULTI_INPUT) {
/* This will leave hidinput NULL, so that it /* This will leave hidinput NULL, so that it
* allocates another one if we have more inputs on * allocates another one if we have more inputs on
......
...@@ -94,7 +94,7 @@ struct lgff_device { ...@@ -94,7 +94,7 @@ struct lgff_device {
isn't really necessary */ isn't really necessary */
unsigned long flags[1]; /* Contains various information about the unsigned long flags[1]; /* Contains various information about the
state of the driver for this device */ state of the driver for this device */
struct timer_list timer; struct timer_list timer;
}; };
...@@ -234,7 +234,7 @@ static struct hid_report* hid_lgff_duplicate_report(struct hid_report* report) ...@@ -234,7 +234,7 @@ static struct hid_report* hid_lgff_duplicate_report(struct hid_report* report)
kfree(ret); kfree(ret);
return NULL; return NULL;
} }
memset(ret->field[0]->value, 0, sizeof(s32[8])); memset(ret->field[0]->value, 0, sizeof(s32[8]));
return ret; return ret;
} }
...@@ -295,11 +295,11 @@ static int hid_lgff_event(struct hid_device *hid, struct input_dev* input, ...@@ -295,11 +295,11 @@ static int hid_lgff_event(struct hid_device *hid, struct input_dev* input,
unsigned long flags; unsigned long flags;
if (type != EV_FF) return -EINVAL; if (type != EV_FF) return -EINVAL;
if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES; if (!LGFF_CHECK_OWNERSHIP(code, lgff)) return -EACCES;
if (value < 0) return -EINVAL; if (value < 0) return -EINVAL;
spin_lock_irqsave(&lgff->lock, flags); spin_lock_irqsave(&lgff->lock, flags);
if (value > 0) { if (value > 0) {
if (test_bit(EFFECT_STARTED, effect->flags)) { if (test_bit(EFFECT_STARTED, effect->flags)) {
spin_unlock_irqrestore(&lgff->lock, flags); spin_unlock_irqrestore(&lgff->lock, flags);
...@@ -345,7 +345,7 @@ static int hid_lgff_flush(struct input_dev *dev, struct file *file) ...@@ -345,7 +345,7 @@ static int hid_lgff_flush(struct input_dev *dev, struct file *file)
and perform ioctls on the same fd all at the same time */ and perform ioctls on the same fd all at the same time */
if ( current->pid == lgff->effects[i].owner if ( current->pid == lgff->effects[i].owner
&& test_bit(EFFECT_USED, lgff->effects[i].flags)) { && test_bit(EFFECT_USED, lgff->effects[i].flags)) {
if (hid_lgff_erase(dev, i)) if (hid_lgff_erase(dev, i))
warn("erase effect %d failed", i); warn("erase effect %d failed", i);
} }
...@@ -378,7 +378,7 @@ static int hid_lgff_upload_effect(struct input_dev* input, ...@@ -378,7 +378,7 @@ static int hid_lgff_upload_effect(struct input_dev* input,
struct lgff_effect new; struct lgff_effect new;
int id; int id;
unsigned long flags; unsigned long flags;
dbg("ioctl rumble"); dbg("ioctl rumble");
if (!test_bit(effect->type, input->ffbit)) return -EINVAL; if (!test_bit(effect->type, input->ffbit)) return -EINVAL;
...@@ -441,7 +441,7 @@ static void hid_lgff_timer(unsigned long timer_data) ...@@ -441,7 +441,7 @@ static void hid_lgff_timer(unsigned long timer_data)
spin_lock_irqsave(&lgff->lock, flags); spin_lock_irqsave(&lgff->lock, flags);
for (i=0; i<LGFF_EFFECTS; ++i) { for (i=0; i<LGFF_EFFECTS; ++i) {
struct lgff_effect* effect = lgff->effects +i; struct lgff_effect* effect = lgff->effects +i;
if (test_bit(EFFECT_PLAYING, effect->flags)) { if (test_bit(EFFECT_PLAYING, effect->flags)) {
...@@ -491,7 +491,7 @@ static void hid_lgff_timer(unsigned long timer_data) ...@@ -491,7 +491,7 @@ static void hid_lgff_timer(unsigned long timer_data)
set_bit(EFFECT_PLAYING, lgff->effects[i].flags); set_bit(EFFECT_PLAYING, lgff->effects[i].flags);
} }
} }
} }
#define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff #define CLAMP(x) if (x < 0) x = 0; if (x > 0xff) x = 0xff
...@@ -524,5 +524,5 @@ static void hid_lgff_timer(unsigned long timer_data) ...@@ -524,5 +524,5 @@ static void hid_lgff_timer(unsigned long timer_data)
add_timer(&lgff->timer); add_timer(&lgff->timer);
} }
spin_unlock_irqrestore(&lgff->lock, flags); spin_unlock_irqrestore(&lgff->lock, flags);
} }
...@@ -118,7 +118,7 @@ struct hid_item { ...@@ -118,7 +118,7 @@ struct hid_item {
#define HID_MAIN_ITEM_CONSTANT 0x001 #define HID_MAIN_ITEM_CONSTANT 0x001
#define HID_MAIN_ITEM_VARIABLE 0x002 #define HID_MAIN_ITEM_VARIABLE 0x002
#define HID_MAIN_ITEM_RELATIVE 0x004 #define HID_MAIN_ITEM_RELATIVE 0x004
#define HID_MAIN_ITEM_WRAP 0x008 #define HID_MAIN_ITEM_WRAP 0x008
#define HID_MAIN_ITEM_NONLINEAR 0x010 #define HID_MAIN_ITEM_NONLINEAR 0x010
#define HID_MAIN_ITEM_NO_PREFERRED 0x020 #define HID_MAIN_ITEM_NO_PREFERRED 0x020
#define HID_MAIN_ITEM_NULL_STATE 0x040 #define HID_MAIN_ITEM_NULL_STATE 0x040
...@@ -172,14 +172,14 @@ struct hid_item { ...@@ -172,14 +172,14 @@ struct hid_item {
#define HID_USAGE_PAGE 0xffff0000 #define HID_USAGE_PAGE 0xffff0000
#define HID_UP_UNDEFINED 0x00000000 #define HID_UP_UNDEFINED 0x00000000
#define HID_UP_GENDESK 0x00010000 #define HID_UP_GENDESK 0x00010000
#define HID_UP_KEYBOARD 0x00070000 #define HID_UP_KEYBOARD 0x00070000
#define HID_UP_LED 0x00080000 #define HID_UP_LED 0x00080000
#define HID_UP_BUTTON 0x00090000 #define HID_UP_BUTTON 0x00090000
#define HID_UP_ORDINAL 0x000a0000 #define HID_UP_ORDINAL 0x000a0000
#define HID_UP_CONSUMER 0x000c0000 #define HID_UP_CONSUMER 0x000c0000
#define HID_UP_DIGITIZER 0x000d0000 #define HID_UP_DIGITIZER 0x000d0000
#define HID_UP_PID 0x000f0000 #define HID_UP_PID 0x000f0000
#define HID_UP_HPVENDOR 0xff7f0000 #define HID_UP_HPVENDOR 0xff7f0000
#define HID_UP_MSVENDOR 0xff000000 #define HID_UP_MSVENDOR 0xff000000
...@@ -406,7 +406,7 @@ struct hid_device { /* device report descriptor */ ...@@ -406,7 +406,7 @@ struct hid_device { /* device report descriptor */
dma_addr_t outbuf_dma; /* Output buffer dma */ dma_addr_t outbuf_dma; /* Output buffer dma */
spinlock_t outlock; /* Output fifo spinlock */ spinlock_t outlock; /* Output fifo spinlock */
unsigned claimed; /* Claimed by hidinput, hiddev? */ unsigned claimed; /* Claimed by hidinput, hiddev? */
unsigned quirks; /* Various quirks the device can pull on us */ unsigned quirks; /* Various quirks the device can pull on us */
struct list_head inputs; /* The list of inputs */ struct list_head inputs; /* The list of inputs */
......
...@@ -95,7 +95,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) ...@@ -95,7 +95,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
return NULL; return NULL;
rinfo->report_id = ((struct hid_report *) list)->id; rinfo->report_id = ((struct hid_report *) list)->id;
break; break;
case HID_REPORT_ID_NEXT: case HID_REPORT_ID_NEXT:
list = (struct list_head *) list = (struct list_head *)
report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK]; report_enum->report_id_hash[rinfo->report_id & HID_REPORT_ID_MASK];
...@@ -106,7 +106,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo) ...@@ -106,7 +106,7 @@ hiddev_lookup_report(struct hid_device *hid, struct hiddev_report_info *rinfo)
return NULL; return NULL;
rinfo->report_id = ((struct hid_report *) list)->id; rinfo->report_id = ((struct hid_report *) list)->id;
break; break;
default: default:
return NULL; return NULL;
} }
...@@ -158,7 +158,7 @@ static void hiddev_send_event(struct hid_device *hid, ...@@ -158,7 +158,7 @@ static void hiddev_send_event(struct hid_device *hid,
if (uref->field_index != HID_FIELD_INDEX_NONE || if (uref->field_index != HID_FIELD_INDEX_NONE ||
(list->flags & HIDDEV_FLAG_REPORT) != 0) { (list->flags & HIDDEV_FLAG_REPORT) != 0) {
list->buffer[list->head] = *uref; list->buffer[list->head] = *uref;
list->head = (list->head + 1) & list->head = (list->head + 1) &
(HIDDEV_BUFFER_SIZE - 1); (HIDDEV_BUFFER_SIZE - 1);
kill_fasync(&list->fasync, SIGIO, POLL_IN); kill_fasync(&list->fasync, SIGIO, POLL_IN);
} }
...@@ -179,9 +179,9 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field, ...@@ -179,9 +179,9 @@ void hiddev_hid_event(struct hid_device *hid, struct hid_field *field,
unsigned type = field->report_type; unsigned type = field->report_type;
struct hiddev_usage_ref uref; struct hiddev_usage_ref uref;
uref.report_type = uref.report_type =
(type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
uref.report_id = field->report->id; uref.report_id = field->report->id;
uref.field_index = field->index; uref.field_index = field->index;
...@@ -199,9 +199,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report) ...@@ -199,9 +199,9 @@ void hiddev_report_event(struct hid_device *hid, struct hid_report *report)
struct hiddev_usage_ref uref; struct hiddev_usage_ref uref;
memset(&uref, 0, sizeof(uref)); memset(&uref, 0, sizeof(uref));
uref.report_type = uref.report_type =
(type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT : (type == HID_INPUT_REPORT) ? HID_REPORT_TYPE_INPUT :
((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT : ((type == HID_OUTPUT_REPORT) ? HID_REPORT_TYPE_OUTPUT :
((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0)); ((type == HID_FEATURE_REPORT) ? HID_REPORT_TYPE_FEATURE:0));
uref.report_id = report->id; uref.report_id = report->id;
uref.field_index = HID_FIELD_INDEX_NONE; uref.field_index = HID_FIELD_INDEX_NONE;
...@@ -236,7 +236,7 @@ static int hiddev_release(struct inode * inode, struct file * file) ...@@ -236,7 +236,7 @@ static int hiddev_release(struct inode * inode, struct file * file)
*listptr = (*listptr)->next; *listptr = (*listptr)->next;
if (!--list->hiddev->open) { if (!--list->hiddev->open) {
if (list->hiddev->exist) if (list->hiddev->exist)
hid_close(list->hiddev->hid); hid_close(list->hiddev->hid);
else else
kfree(list->hiddev); kfree(list->hiddev);
...@@ -303,7 +303,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun ...@@ -303,7 +303,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
if (list->head == list->tail) { if (list->head == list->tail) {
add_wait_queue(&list->hiddev->wait, &wait); add_wait_queue(&list->hiddev->wait, &wait);
set_current_state(TASK_INTERRUPTIBLE); set_current_state(TASK_INTERRUPTIBLE);
while (list->head == list->tail) { while (list->head == list->tail) {
if (file->f_flags & O_NONBLOCK) { if (file->f_flags & O_NONBLOCK) {
retval = -EAGAIN; retval = -EAGAIN;
...@@ -317,7 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun ...@@ -317,7 +317,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
retval = -EIO; retval = -EIO;
break; break;
} }
schedule(); schedule();
} }
...@@ -329,7 +329,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun ...@@ -329,7 +329,7 @@ static ssize_t hiddev_read(struct file * file, char __user * buffer, size_t coun
return retval; return retval;
while (list->head != list->tail && while (list->head != list->tail &&
retval + event_size <= count) { retval + event_size <= count) {
if ((list->flags & HIDDEV_FLAG_UREF) == 0) { if ((list->flags & HIDDEV_FLAG_UREF) == 0) {
if (list->buffer[list->tail].field_index != if (list->buffer[list->tail].field_index !=
...@@ -405,10 +405,10 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -405,10 +405,10 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return -EINVAL; return -EINVAL;
for (i = 0; i < hid->maxcollection; i++) for (i = 0; i < hid->maxcollection; i++)
if (hid->collection[i].type == if (hid->collection[i].type ==
HID_COLLECTION_APPLICATION && arg-- == 0) HID_COLLECTION_APPLICATION && arg-- == 0)
break; break;
if (i == hid->maxcollection) if (i == hid->maxcollection)
return -EINVAL; return -EINVAL;
...@@ -562,7 +562,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -562,7 +562,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
if (!uref_multi) if (!uref_multi)
return -ENOMEM; return -ENOMEM;
uref = &uref_multi->uref; uref = &uref_multi->uref;
if (copy_from_user(uref, user_arg, sizeof(*uref))) if (copy_from_user(uref, user_arg, sizeof(*uref)))
goto fault; goto fault;
rinfo.report_type = uref->report_type; rinfo.report_type = uref->report_type;
...@@ -595,7 +595,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -595,7 +595,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return -ENOMEM; return -ENOMEM;
uref = &uref_multi->uref; uref = &uref_multi->uref;
if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) { if (cmd == HIDIOCGUSAGES || cmd == HIDIOCSUSAGES) {
if (copy_from_user(uref_multi, user_arg, if (copy_from_user(uref_multi, user_arg,
sizeof(*uref_multi))) sizeof(*uref_multi)))
goto fault; goto fault;
} else { } else {
...@@ -603,7 +603,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -603,7 +603,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
goto fault; goto fault;
} }
if (cmd != HIDIOCGUSAGE && if (cmd != HIDIOCGUSAGE &&
cmd != HIDIOCGUSAGES && cmd != HIDIOCGUSAGES &&
uref->report_type == HID_REPORT_TYPE_INPUT) uref->report_type == HID_REPORT_TYPE_INPUT)
goto inval; goto inval;
...@@ -651,16 +651,16 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -651,16 +651,16 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
return field->usage[uref->usage_index].collection_index; return field->usage[uref->usage_index].collection_index;
case HIDIOCGUSAGES: case HIDIOCGUSAGES:
for (i = 0; i < uref_multi->num_values; i++) for (i = 0; i < uref_multi->num_values; i++)
uref_multi->values[i] = uref_multi->values[i] =
field->value[uref->usage_index + i]; field->value[uref->usage_index + i];
if (copy_to_user(user_arg, uref_multi, if (copy_to_user(user_arg, uref_multi,
sizeof(*uref_multi))) sizeof(*uref_multi)))
goto fault; goto fault;
goto goodreturn; goto goodreturn;
case HIDIOCSUSAGES: case HIDIOCSUSAGES:
for (i = 0; i < uref_multi->num_values; i++) for (i = 0; i < uref_multi->num_values; i++)
field->value[uref->usage_index + i] = field->value[uref->usage_index + i] =
uref_multi->values[i]; uref_multi->values[i];
goto goodreturn; goto goodreturn;
} }
...@@ -670,7 +670,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd ...@@ -670,7 +670,7 @@ static int hiddev_ioctl(struct inode *inode, struct file *file, unsigned int cmd
fault: fault:
kfree(uref_multi); kfree(uref_multi);
return -EFAULT; return -EFAULT;
inval: inval:
kfree(uref_multi); kfree(uref_multi);
return -EINVAL; return -EINVAL;
...@@ -734,7 +734,7 @@ static struct usb_class_driver hiddev_class = { ...@@ -734,7 +734,7 @@ static struct usb_class_driver hiddev_class = {
.name = "usb/hid/hiddev%d", .name = "usb/hid/hiddev%d",
.fops = &hiddev_fops, .fops = &hiddev_fops,
.mode = S_IFCHR | S_IRUGO | S_IWUSR, .mode = S_IFCHR | S_IRUGO | S_IWUSR,
.minor_base = HIDDEV_MINOR_BASE, .minor_base = HIDDEV_MINOR_BASE,
}; };
/* /*
...@@ -747,7 +747,7 @@ int hiddev_connect(struct hid_device *hid) ...@@ -747,7 +747,7 @@ int hiddev_connect(struct hid_device *hid)
int retval; int retval;
for (i = 0; i < hid->maxcollection; i++) for (i = 0; i < hid->maxcollection; i++)
if (hid->collection[i].type == if (hid->collection[i].type ==
HID_COLLECTION_APPLICATION && HID_COLLECTION_APPLICATION &&
!IS_INPUT_APPLICATION(hid->collection[i].usage)) !IS_INPUT_APPLICATION(hid->collection[i].usage))
break; break;
...@@ -755,11 +755,11 @@ int hiddev_connect(struct hid_device *hid) ...@@ -755,11 +755,11 @@ int hiddev_connect(struct hid_device *hid)
if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0) if (i == hid->maxcollection && (hid->quirks & HID_QUIRK_HIDDEV) == 0)
return -1; return -1;
if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL))) if (!(hiddev = kmalloc(sizeof(struct hiddev), GFP_KERNEL)))
return -1; return -1;
memset(hiddev, 0, sizeof(struct hiddev)); memset(hiddev, 0, sizeof(struct hiddev));
retval = usb_register_dev(hid->intf, &hiddev_class); retval = usb_register_dev(hid->intf, &hiddev_class);
if (retval) { if (retval) {
err("Not able to get a minor for this device."); err("Not able to get a minor for this device.");
kfree(hiddev); kfree(hiddev);
...@@ -768,12 +768,12 @@ int hiddev_connect(struct hid_device *hid) ...@@ -768,12 +768,12 @@ int hiddev_connect(struct hid_device *hid)
init_waitqueue_head(&hiddev->wait); init_waitqueue_head(&hiddev->wait);
hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev; hiddev_table[hid->intf->minor - HIDDEV_MINOR_BASE] = hiddev;
hiddev->hid = hid; hiddev->hid = hid;
hiddev->exist = 1; hiddev->exist = 1;
hid->minor = hid->intf->minor; hid->minor = hid->intf->minor;
hid->hiddev = hiddev; hid->hiddev = hiddev;
return 0; return 0;
...@@ -818,7 +818,7 @@ void hiddev_disconnect(struct hid_device *hid) ...@@ -818,7 +818,7 @@ void hiddev_disconnect(struct hid_device *hid)
/* We never attach in this manner, and rely on HID to connect us. This /* We never attach in this manner, and rely on HID to connect us. This
* is why there is no disconnect routine defined in the usb_driver either. * is why there is no disconnect routine defined in the usb_driver either.
*/ */
static int hiddev_usbd_probe(struct usb_interface *intf, static int hiddev_usbd_probe(struct usb_interface *intf,
const struct usb_device_id *hiddev_info) const struct usb_device_id *hiddev_info)
{ {
return -ENODEV; return -ENODEV;
......
...@@ -18,14 +18,14 @@ ...@@ -18,14 +18,14 @@
* Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>. * Based upon original work by Chris Collins <xfire-itmtouch@xware.cx>.
* *
* Kudos to ITM for providing me with the datasheet for the panel, * Kudos to ITM for providing me with the datasheet for the panel,
* even though it was a day later than I had finished writing this * even though it was a day later than I had finished writing this
* driver. * driver.
* *
* It has meant that I've been able to correct my interpretation of the * It has meant that I've been able to correct my interpretation of the
* protocol packets however. * protocol packets however.
* *
* CC -- 2003/9/29 * CC -- 2003/9/29
* *
* History * History
* 1.0 & 1.1 2003 (CC) vojtech@suse.cz * 1.0 & 1.1 2003 (CC) vojtech@suse.cz
* Original version for 2.4.x kernels * Original version for 2.4.x kernels
...@@ -33,10 +33,10 @@ ...@@ -33,10 +33,10 @@
* 1.2 02/03/2005 (HCE) hc@mivu.no * 1.2 02/03/2005 (HCE) hc@mivu.no
* Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints. * Complete rewrite to support Linux 2.6.10, thanks to mtouchusb.c for hints.
* Unfortunately no calibration support at this time. * Unfortunately no calibration support at this time.
* *
* 1.2.1 09/03/2005 (HCE) hc@mivu.no * 1.2.1 09/03/2005 (HCE) hc@mivu.no
* Code cleanup and adjusting syntax to start matching kernel standards * Code cleanup and adjusting syntax to start matching kernel standards
* *
*****************************************************************************/ *****************************************************************************/
#include <linux/config.h> #include <linux/config.h>
...@@ -71,7 +71,7 @@ MODULE_DESCRIPTION( DRIVER_DESC ); ...@@ -71,7 +71,7 @@ MODULE_DESCRIPTION( DRIVER_DESC );
MODULE_LICENSE( DRIVER_LICENSE ); MODULE_LICENSE( DRIVER_LICENSE );
struct itmtouch_dev { struct itmtouch_dev {
struct usb_device *usbdev; /* usb device */ struct usb_device *usbdev; /* usb device */
struct input_dev inputdev; /* input device */ struct input_dev inputdev; /* input device */
struct urb *readurb; /* urb */ struct urb *readurb; /* urb */
char rbuf[ITM_BUFSIZE]; /* data */ char rbuf[ITM_BUFSIZE]; /* data */
...@@ -121,7 +121,7 @@ static void itmtouch_irq(struct urb *urb, struct pt_regs *regs) ...@@ -121,7 +121,7 @@ static void itmtouch_irq(struct urb *urb, struct pt_regs *regs)
input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F)); input_report_abs(dev, ABS_X, (data[0] & 0x1F) << 7 | (data[3] & 0x7F));
input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F)); input_report_abs(dev, ABS_Y, (data[1] & 0x1F) << 7 | (data[4] & 0x7F));
} }
input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F)); input_report_abs(dev, ABS_PRESSURE, (data[2] & 1) << 7 | (data[5] & 0x7F));
input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20); input_report_key(dev, BTN_TOUCH, ~data[7] & 0x20);
input_sync(dev); input_sync(dev);
...@@ -142,8 +142,7 @@ static int itmtouch_open(struct input_dev *input) ...@@ -142,8 +142,7 @@ static int itmtouch_open(struct input_dev *input)
itmtouch->readurb->dev = itmtouch->usbdev; itmtouch->readurb->dev = itmtouch->usbdev;
if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) if (usb_submit_urb(itmtouch->readurb, GFP_KERNEL)) {
{
itmtouch->users--; itmtouch->users--;
return -EIO; return -EIO;
} }
...@@ -178,13 +177,13 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -178,13 +177,13 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
} }
itmtouch->usbdev = udev; itmtouch->usbdev = udev;
itmtouch->inputdev.private = itmtouch; itmtouch->inputdev.private = itmtouch;
itmtouch->inputdev.open = itmtouch_open; itmtouch->inputdev.open = itmtouch_open;
itmtouch->inputdev.close = itmtouch_close; itmtouch->inputdev.close = itmtouch_close;
usb_make_path(udev, path, PATH_SIZE); usb_make_path(udev, path, PATH_SIZE);
itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); itmtouch->inputdev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE); itmtouch->inputdev.absbit[0] = BIT(ABS_X) | BIT(ABS_Y) | BIT(ABS_PRESSURE);
itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH); itmtouch->inputdev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
...@@ -194,12 +193,12 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -194,12 +193,12 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
itmtouch->inputdev.id.bustype = BUS_USB; itmtouch->inputdev.id.bustype = BUS_USB;
itmtouch->inputdev.id.vendor = udev->descriptor.idVendor; itmtouch->inputdev.id.vendor = udev->descriptor.idVendor;
itmtouch->inputdev.id.product = udev->descriptor.idProduct; itmtouch->inputdev.id.product = udev->descriptor.idProduct;
itmtouch->inputdev.id.version = udev->descriptor.bcdDevice; itmtouch->inputdev.id.version = udev->descriptor.bcdDevice;
itmtouch->inputdev.dev = &intf->dev; itmtouch->inputdev.dev = &intf->dev;
if (!strlen(itmtouch->name)) if (!strlen(itmtouch->name))
sprintf(itmtouch->name, "USB ITM touchscreen"); sprintf(itmtouch->name, "USB ITM touchscreen");
/* device limits */ /* device limits */
/* as specified by the ITM datasheet, X and Y are 12bit, /* as specified by the ITM datasheet, X and Y are 12bit,
* Z (pressure) is 8 bit. However, the fields are defined up * Z (pressure) is 8 bit. However, the fields are defined up
...@@ -212,26 +211,20 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -212,26 +211,20 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
/* initialise the URB so we can read from the transport stream */ /* initialise the URB so we can read from the transport stream */
pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress); pipe = usb_rcvintpipe(itmtouch->usbdev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe)); maxp = usb_maxpacket(udev, pipe, usb_pipeout(pipe));
if (maxp > ITM_BUFSIZE) if (maxp > ITM_BUFSIZE)
maxp = ITM_BUFSIZE; maxp = ITM_BUFSIZE;
itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL); itmtouch->readurb = usb_alloc_urb(0, GFP_KERNEL);
if (!itmtouch->readurb) { if (!itmtouch->readurb) {
dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__); dbg("%s - usb_alloc_urb failed: itmtouch->readurb", __FUNCTION__);
kfree(itmtouch); kfree(itmtouch);
return -ENOMEM; return -ENOMEM;
} }
usb_fill_int_urb(itmtouch->readurb, usb_fill_int_urb(itmtouch->readurb, itmtouch->usbdev, pipe, itmtouch->rbuf,
itmtouch->usbdev, maxp, itmtouch_irq, itmtouch, endpoint->bInterval);
pipe,
itmtouch->rbuf,
maxp,
itmtouch_irq,
itmtouch,
endpoint->bInterval);
input_register_device(&itmtouch->inputdev); input_register_device(&itmtouch->inputdev);
...@@ -242,7 +235,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id ...@@ -242,7 +235,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id
} }
static void itmtouch_disconnect(struct usb_interface *intf) static void itmtouch_disconnect(struct usb_interface *intf)
{ {
struct itmtouch_dev *itmtouch = usb_get_intfdata(intf); struct itmtouch_dev *itmtouch = usb_get_intfdata(intf);
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
...@@ -258,11 +251,11 @@ static void itmtouch_disconnect(struct usb_interface *intf) ...@@ -258,11 +251,11 @@ static void itmtouch_disconnect(struct usb_interface *intf)
MODULE_DEVICE_TABLE(usb, itmtouch_ids); MODULE_DEVICE_TABLE(usb, itmtouch_ids);
static struct usb_driver itmtouch_driver = { static struct usb_driver itmtouch_driver = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.name = "itmtouch", .name = "itmtouch",
.probe = itmtouch_probe, .probe = itmtouch_probe,
.disconnect = itmtouch_disconnect, .disconnect = itmtouch_disconnect,
.id_table = itmtouch_ids, .id_table = itmtouch_ids,
}; };
static int __init itmtouch_init(void) static int __init itmtouch_init(void)
......
...@@ -79,12 +79,12 @@ static void kbtab_irq(struct urb *urb, struct pt_regs *regs) ...@@ -79,12 +79,12 @@ static void kbtab_irq(struct urb *urb, struct pt_regs *regs)
/*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/ /*input_report_key(dev, BTN_TOUCH , data[0] & 0x01);*/
input_report_key(dev, BTN_RIGHT, data[0] & 0x02); input_report_key(dev, BTN_RIGHT, data[0] & 0x02);
if( -1 == kb_pressure_click){ if (-1 == kb_pressure_click) {
input_report_abs(dev, ABS_PRESSURE, kbtab->pressure); input_report_abs(dev, ABS_PRESSURE, kbtab->pressure);
} else { } else {
input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0); input_report_key(dev, BTN_LEFT, (kbtab->pressure > kb_pressure_click) ? 1 : 0);
}; };
input_sync(dev); input_sync(dev);
exit: exit:
...@@ -161,7 +161,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -161,7 +161,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i
kbtab->dev.absmax[ABS_X] = 0x2000; kbtab->dev.absmax[ABS_X] = 0x2000;
kbtab->dev.absmax[ABS_Y] = 0x1750; kbtab->dev.absmax[ABS_Y] = 0x1750;
kbtab->dev.absmax[ABS_PRESSURE] = 0xff; kbtab->dev.absmax[ABS_PRESSURE] = 0xff;
kbtab->dev.absfuzz[ABS_X] = 4; kbtab->dev.absfuzz[ABS_X] = 4;
kbtab->dev.absfuzz[ABS_Y] = 4; kbtab->dev.absfuzz[ABS_Y] = 4;
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
* back to the host when polled by the USB controller. * back to the host when polled by the USB controller.
* *
* Testing with the knob I have has shown that it measures approximately 94 "clicks" * Testing with the knob I have has shown that it measures approximately 94 "clicks"
* for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was * for one full rotation. Testing with my High Speed Rotation Actuator (ok, it was
* a variable speed cordless electric drill) has shown that the device can measure * a variable speed cordless electric drill) has shown that the device can measure
* speeds of up to 7 clicks either clockwise or anticlockwise between pollings from * speeds of up to 7 clicks either clockwise or anticlockwise between pollings from
* the host. If it counts more than 7 clicks before it is polled, it will wrap back * the host. If it counts more than 7 clicks before it is polled, it will wrap back
...@@ -120,9 +120,9 @@ static void powermate_irq(struct urb *urb, struct pt_regs *regs) ...@@ -120,9 +120,9 @@ static void powermate_irq(struct urb *urb, struct pt_regs *regs)
/* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */ /* Decide if we need to issue a control message and do so. Must be called with pm->lock taken */
static void powermate_sync_state(struct powermate_device *pm) static void powermate_sync_state(struct powermate_device *pm)
{ {
if (pm->requires_update == 0) if (pm->requires_update == 0)
return; /* no updates are required */ return; /* no updates are required */
if (pm->config->status == -EINPROGRESS) if (pm->config->status == -EINPROGRESS)
return; /* an update is already in progress; it'll issue this update when it completes */ return; /* an update is already in progress; it'll issue this update when it completes */
if (pm->requires_update & UPDATE_PULSE_ASLEEP){ if (pm->requires_update & UPDATE_PULSE_ASLEEP){
...@@ -142,7 +142,7 @@ static void powermate_sync_state(struct powermate_device *pm) ...@@ -142,7 +142,7 @@ static void powermate_sync_state(struct powermate_device *pm)
2: multiply the speed 2: multiply the speed
the argument only has an effect for operations 0 and 2, and ranges between the argument only has an effect for operations 0 and 2, and ranges between
1 (least effect) to 255 (maximum effect). 1 (least effect) to 255 (maximum effect).
thus, several states are equivalent and are coalesced into one state. thus, several states are equivalent and are coalesced into one state.
we map this onto a range from 0 to 510, with: we map this onto a range from 0 to 510, with:
...@@ -151,7 +151,7 @@ static void powermate_sync_state(struct powermate_device *pm) ...@@ -151,7 +151,7 @@ static void powermate_sync_state(struct powermate_device *pm)
256 -- 510 -- use multiple (510 = fastest). 256 -- 510 -- use multiple (510 = fastest).
Only values of 'arg' quite close to 255 are particularly useful/spectacular. Only values of 'arg' quite close to 255 are particularly useful/spectacular.
*/ */
if (pm->pulse_speed < 255){ if (pm->pulse_speed < 255){
op = 0; // divide op = 0; // divide
arg = 255 - pm->pulse_speed; arg = 255 - pm->pulse_speed;
...@@ -199,14 +199,14 @@ static void powermate_config_complete(struct urb *urb, struct pt_regs *regs) ...@@ -199,14 +199,14 @@ static void powermate_config_complete(struct urb *urb, struct pt_regs *regs)
if (urb->status) if (urb->status)
printk(KERN_ERR "powermate: config urb returned %d\n", urb->status); printk(KERN_ERR "powermate: config urb returned %d\n", urb->status);
spin_lock_irqsave(&pm->lock, flags); spin_lock_irqsave(&pm->lock, flags);
powermate_sync_state(pm); powermate_sync_state(pm);
spin_unlock_irqrestore(&pm->lock, flags); spin_unlock_irqrestore(&pm->lock, flags);
} }
/* Set the LED up as described and begin the sync with the hardware if required */ /* Set the LED up as described and begin the sync with the hardware if required */
static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed, static void powermate_pulse_led(struct powermate_device *pm, int static_brightness, int pulse_speed,
int pulse_table, int pulse_asleep, int pulse_awake) int pulse_table, int pulse_asleep, int pulse_awake)
{ {
unsigned long flags; unsigned long flags;
...@@ -229,7 +229,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne ...@@ -229,7 +229,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
/* mark state updates which are required */ /* mark state updates which are required */
if (static_brightness != pm->static_brightness){ if (static_brightness != pm->static_brightness){
pm->static_brightness = static_brightness; pm->static_brightness = static_brightness;
pm->requires_update |= UPDATE_STATIC_BRIGHTNESS; pm->requires_update |= UPDATE_STATIC_BRIGHTNESS;
} }
if (pulse_asleep != pm->pulse_asleep){ if (pulse_asleep != pm->pulse_asleep){
pm->pulse_asleep = pulse_asleep; pm->pulse_asleep = pulse_asleep;
...@@ -246,7 +246,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne ...@@ -246,7 +246,7 @@ static void powermate_pulse_led(struct powermate_device *pm, int static_brightne
} }
powermate_sync_state(pm); powermate_sync_state(pm);
spin_unlock_irqrestore(&pm->lock, flags); spin_unlock_irqrestore(&pm->lock, flags);
} }
...@@ -257,19 +257,19 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig ...@@ -257,19 +257,19 @@ static int powermate_input_event(struct input_dev *dev, unsigned int type, unsig
struct powermate_device *pm = dev->private; struct powermate_device *pm = dev->private;
if (type == EV_MSC && code == MSC_PULSELED){ if (type == EV_MSC && code == MSC_PULSELED){
/* /*
bits 0- 7: 8 bits: LED brightness bits 0- 7: 8 bits: LED brightness
bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster. bits 8-16: 9 bits: pulsing speed modifier (0 ... 510); 0-254 = slower, 255 = standard, 256-510 = faster.
bits 17-18: 2 bits: pulse table (0, 1, 2 valid) bits 17-18: 2 bits: pulse table (0, 1, 2 valid)
bit 19: 1 bit : pulse whilst asleep? bit 19: 1 bit : pulse whilst asleep?
bit 20: 1 bit : pulse constantly? bit 20: 1 bit : pulse constantly?
*/ */
int static_brightness = command & 0xFF; // bits 0-7 int static_brightness = command & 0xFF; // bits 0-7
int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16 int pulse_speed = (command >> 8) & 0x1FF; // bits 8-16
int pulse_table = (command >> 17) & 0x3; // bits 17-18 int pulse_table = (command >> 17) & 0x3; // bits 17-18
int pulse_asleep = (command >> 19) & 0x1; // bit 19 int pulse_asleep = (command >> 19) & 0x1; // bit 19
int pulse_awake = (command >> 20) & 0x1; // bit 20 int pulse_awake = (command >> 20) & 0x1; // bit 20
powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake); powermate_pulse_led(pm, static_brightness, pulse_speed, pulse_table, pulse_asleep, pulse_awake);
} }
...@@ -378,7 +378,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -378,7 +378,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
switch (le16_to_cpu(udev->descriptor.idProduct)) { switch (le16_to_cpu(udev->descriptor.idProduct)) {
case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break; case POWERMATE_PRODUCT_NEW: pm->input.name = pm_name_powermate; break;
case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break; case POWERMATE_PRODUCT_OLD: pm->input.name = pm_name_soundknob; break;
default: default:
pm->input.name = pm_name_soundknob; pm->input.name = pm_name_soundknob;
printk(KERN_WARNING "powermate: unknown product id %04x\n", printk(KERN_WARNING "powermate: unknown product id %04x\n",
le16_to_cpu(udev->descriptor.idProduct)); le16_to_cpu(udev->descriptor.idProduct));
...@@ -402,11 +402,11 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i ...@@ -402,11 +402,11 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i
usb_make_path(udev, path, 64); usb_make_path(udev, path, 64);
snprintf(pm->phys, 64, "%s/input0", path); snprintf(pm->phys, 64, "%s/input0", path);
printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys); printk(KERN_INFO "input: %s on %s\n", pm->input.name, pm->input.phys);
/* force an update of everything */ /* force an update of everything */
pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS; pm->requires_update = UPDATE_PULSE_ASLEEP | UPDATE_PULSE_AWAKE | UPDATE_PULSE_MODE | UPDATE_STATIC_BRIGHTNESS;
powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters powermate_pulse_led(pm, 0x80, 255, 0, 1, 0); // set default pulse parameters
usb_set_intfdata(intf, pm); usb_set_intfdata(intf, pm);
return 0; return 0;
} }
......
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
...@@ -166,7 +166,7 @@ static void usb_kbd_led(struct urb *urb, struct pt_regs *regs) ...@@ -166,7 +166,7 @@ static void usb_kbd_led(struct urb *urb, struct pt_regs *regs)
if (urb->status) if (urb->status)
warn("led urb status %d received", urb->status); warn("led urb status %d received", urb->status);
if (*(kbd->leds) == kbd->newleds) if (*(kbd->leds) == kbd->newleds)
return; return;
...@@ -230,7 +230,7 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) ...@@ -230,7 +230,7 @@ static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd)
usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma); usb_buffer_free(dev, 1, kbd->leds, kbd->leds_dma);
} }
static int usb_kbd_probe(struct usb_interface *iface, static int usb_kbd_probe(struct usb_interface *iface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct usb_device * dev = interface_to_usbdev(iface); struct usb_device * dev = interface_to_usbdev(iface);
...@@ -272,7 +272,7 @@ static int usb_kbd_probe(struct usb_interface *iface, ...@@ -272,7 +272,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
for (i = 0; i < 255; i++) for (i = 0; i < 255; i++)
set_bit(usb_kbd_keycode[i], kbd->dev.keybit); set_bit(usb_kbd_keycode[i], kbd->dev.keybit);
clear_bit(0, kbd->dev.keybit); clear_bit(0, kbd->dev.keybit);
kbd->dev.private = kbd; kbd->dev.private = kbd;
kbd->dev.event = usb_kbd_event; kbd->dev.event = usb_kbd_event;
kbd->dev.open = usb_kbd_open; kbd->dev.open = usb_kbd_open;
...@@ -294,7 +294,7 @@ static int usb_kbd_probe(struct usb_interface *iface, ...@@ -294,7 +294,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
sprintf(kbd->phys, "%s/input0", path); sprintf(kbd->phys, "%s/input0", path);
kbd->dev.name = kbd->name; kbd->dev.name = kbd->name;
kbd->dev.phys = kbd->phys; kbd->dev.phys = kbd->phys;
kbd->dev.id.bustype = BUS_USB; kbd->dev.id.bustype = BUS_USB;
kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor);
kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct);
...@@ -329,7 +329,7 @@ static int usb_kbd_probe(struct usb_interface *iface, ...@@ -329,7 +329,7 @@ static int usb_kbd_probe(struct usb_interface *iface,
static void usb_kbd_disconnect(struct usb_interface *intf) static void usb_kbd_disconnect(struct usb_interface *intf)
{ {
struct usb_kbd *kbd = usb_get_intfdata (intf); struct usb_kbd *kbd = usb_get_intfdata (intf);
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (kbd) { if (kbd) {
usb_kill_urb(kbd->irq); usb_kill_urb(kbd->irq);
......
...@@ -9,18 +9,18 @@ ...@@ -9,18 +9,18 @@
/* /*
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* *
* Should you need to contact me, the author, you can do so either by * Should you need to contact me, the author, you can do so either by
* e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail: * e-mail - mail your message to <vojtech@ucw.cz>, or by paper mail:
* Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic * Vojtech Pavlik, Simunkova 1594, Prague 8, 182 00 Czech Republic
...@@ -132,19 +132,19 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_ ...@@ -132,19 +132,19 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
interface = intf->cur_altsetting; interface = intf->cur_altsetting;
if (interface->desc.bNumEndpoints != 1) if (interface->desc.bNumEndpoints != 1)
return -ENODEV; return -ENODEV;
endpoint = &interface->endpoint[0].desc; endpoint = &interface->endpoint[0].desc;
if (!(endpoint->bEndpointAddress & 0x80)) if (!(endpoint->bEndpointAddress & 0x80))
return -ENODEV; return -ENODEV;
if ((endpoint->bmAttributes & 3) != 3) if ((endpoint->bmAttributes & 3) != 3)
return -ENODEV; return -ENODEV;
pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress);
maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe)); maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL))) if (!(mouse = kmalloc(sizeof(struct usb_mouse), GFP_KERNEL)))
return -ENOMEM; return -ENOMEM;
memset(mouse, 0, sizeof(struct usb_mouse)); memset(mouse, 0, sizeof(struct usb_mouse));
...@@ -209,7 +209,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_ ...@@ -209,7 +209,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_
static void usb_mouse_disconnect(struct usb_interface *intf) static void usb_mouse_disconnect(struct usb_interface *intf)
{ {
struct usb_mouse *mouse = usb_get_intfdata (intf); struct usb_mouse *mouse = usb_get_intfdata (intf);
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (mouse) { if (mouse) {
usb_kill_urb(mouse->irq); usb_kill_urb(mouse->irq);
...@@ -238,7 +238,7 @@ static struct usb_driver usb_mouse_driver = { ...@@ -238,7 +238,7 @@ static struct usb_driver usb_mouse_driver = {
static int __init usb_mouse_init(void) static int __init usb_mouse_init(void)
{ {
int retval = usb_register(&usb_mouse_driver); int retval = usb_register(&usb_mouse_driver);
if (retval == 0) if (retval == 0)
info(DRIVER_VERSION ":" DRIVER_DESC); info(DRIVER_VERSION ":" DRIVER_DESC);
return retval; return retval;
} }
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
* v0.4 (sm) - Support for more Intuos models, menustrip * v0.4 (sm) - Support for more Intuos models, menustrip
* relative mode, proximity. * relative mode, proximity.
* v0.5 (vp) - Big cleanup, nifty features removed, * v0.5 (vp) - Big cleanup, nifty features removed,
* they belong in userspace * they belong in userspace
* v1.8 (vp) - Submit URB only when operating, moved to CVS, * v1.8 (vp) - Submit URB only when operating, moved to CVS,
* use input_report_key instead of report_btn and * use input_report_key instead of report_btn and
* other cleanups * other cleanups
...@@ -149,7 +149,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs) ...@@ -149,7 +149,7 @@ static void wacom_pl_irq(struct urb *urb, struct pt_regs *regs)
prox = data[1] & 0x40; prox = data[1] & 0x40;
input_regs(dev, regs); input_regs(dev, regs);
if (prox) { if (prox) {
pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1)); pressure = (signed char)((data[7] << 1) | ((data[4] >> 2) & 1));
...@@ -545,7 +545,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) ...@@ -545,7 +545,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
/* process general packets */ /* process general packets */
wacom_intuos_general(urb); wacom_intuos_general(urb);
if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */ if ((data[1] & 0xbc) == 0xa8 || (data[1] & 0xbe) == 0xb0) { /* 4D mouse or Lens cursor packets */
if (data[1] & 0x02) { /* Rotation packet */ if (data[1] & 0x02) { /* Rotation packet */
...@@ -555,7 +555,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) ...@@ -555,7 +555,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
} else { } else {
if ((data[1] & 0x10) == 0) { /* 4D mouse packets */ if ((data[1] & 0x10) == 0) { /* 4D mouse packets */
input_report_key(dev, BTN_LEFT, data[8] & 0x01); input_report_key(dev, BTN_LEFT, data[8] & 0x01);
input_report_key(dev, BTN_MIDDLE, data[8] & 0x02); input_report_key(dev, BTN_MIDDLE, data[8] & 0x02);
...@@ -567,11 +567,11 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) ...@@ -567,11 +567,11 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t); input_report_abs(dev, ABS_THROTTLE, (data[8] & 0x08) ? -t : t);
} else { } else {
if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */ if (wacom->tool[idx] == BTN_TOOL_MOUSE) { /* 2D mouse packets */
input_report_key(dev, BTN_LEFT, data[8] & 0x04); input_report_key(dev, BTN_LEFT, data[8] & 0x04);
input_report_key(dev, BTN_MIDDLE, data[8] & 0x08); input_report_key(dev, BTN_MIDDLE, data[8] & 0x08);
input_report_key(dev, BTN_RIGHT, data[8] & 0x10); input_report_key(dev, BTN_RIGHT, data[8] & 0x10);
input_report_rel(dev, REL_WHEEL, input_report_rel(dev, REL_WHEEL,
(-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1))); (-(__u32)(data[8] & 0x01) + (__u32)((data[8] & 0x02) >> 1)));
} }
else { /* Lens cursor packets */ else { /* Lens cursor packets */
...@@ -584,7 +584,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs) ...@@ -584,7 +584,7 @@ static void wacom_intuos_irq(struct urb *urb, struct pt_regs *regs)
} }
} }
} }
input_report_key(dev, wacom->tool[idx], 1); input_report_key(dev, wacom->tool[idx], 1);
input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]); input_event(dev, EV_MSC, MSC_SERIAL, wacom->serial[idx]);
input_sync(dev); input_sync(dev);
...@@ -705,20 +705,20 @@ static struct wacom_features wacom_features[] = { ...@@ -705,20 +705,20 @@ static struct wacom_features wacom_features[] = {
{ "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq }, { "Wacom Penpartner", 7, 5040, 3780, 255, 32, 0, wacom_penpartner_irq },
{ "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire2 4x5", 8, 10206, 7422, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire2 5x7", 8, 13918, 10206, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire3", 8, 10208, 7424, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq }, { "Wacom Graphire3 6x8", 8, 16704, 12064, 511, 32, 1, wacom_graphire_irq },
{ "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos 12x12", 10, 30480, 31680, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos 12x18", 10, 45720, 31680, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq }, { "Wacom PL400", 8, 5408, 4056, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq }, { "Wacom PL500", 8, 6144, 4608, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq }, { "Wacom PL600", 8, 6126, 4604, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq }, { "Wacom PL600SX", 8, 6260, 5016, 255, 32, 3, wacom_pl_irq },
{ "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq }, { "Wacom PL550", 8, 6144, 4608, 511, 32, 3, wacom_pl_irq },
{ "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq }, { "Wacom PL800", 8, 7220, 5780, 511, 32, 3, wacom_pl_irq },
{ "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 4x5", 10, 12700, 10600, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
{ "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 9x12", 10, 30480, 24060, 1023, 15, 2, wacom_intuos_irq },
...@@ -730,7 +730,7 @@ static struct wacom_features wacom_features[] = { ...@@ -730,7 +730,7 @@ static struct wacom_features wacom_features[] = {
{ "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq }, { "Wacom Intuos3 6x8", 10, 40640, 30480, 1023, 15, 4, wacom_intuos3_irq },
{ "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq }, { "Wacom Intuos3 9x12", 10, 60960, 45720, 1023, 15, 4, wacom_intuos3_irq },
{ "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq }, { "Wacom Intuos2 6x8", 10, 20320, 16240, 1023, 15, 2, wacom_intuos_irq },
{ } { }
}; };
static struct usb_device_id wacom_ids[] = { static struct usb_device_id wacom_ids[] = {
...@@ -828,7 +828,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -828,7 +828,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
wacom->dev.relbit[0] |= BIT(REL_WHEEL); wacom->dev.relbit[0] |= BIT(REL_WHEEL);
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE); wacom->dev.absbit[0] |= BIT(ABS_DISTANCE);
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE); wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE);
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2); wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_STYLUS2);
break; break;
case 4: /* new functions for Intuos3 */ case 4: /* new functions for Intuos3 */
...@@ -842,13 +842,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i ...@@ -842,13 +842,13 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
wacom->dev.mscbit[0] |= BIT(MSC_SERIAL); wacom->dev.mscbit[0] |= BIT(MSC_SERIAL);
wacom->dev.relbit[0] |= BIT(REL_WHEEL); wacom->dev.relbit[0] |= BIT(REL_WHEEL);
wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA); wacom->dev.keybit[LONG(BTN_LEFT)] |= BIT(BTN_LEFT) | BIT(BTN_RIGHT) | BIT(BTN_MIDDLE) | BIT(BTN_SIDE) | BIT(BTN_EXTRA);
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH) wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_TOOL_RUBBER) | BIT(BTN_TOOL_MOUSE) | BIT(BTN_TOOL_BRUSH)
| BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2); | BIT(BTN_TOOL_PENCIL) | BIT(BTN_TOOL_AIRBRUSH) | BIT(BTN_TOOL_LENS) | BIT(BTN_STYLUS2);
wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE); wacom->dev.absbit[0] |= BIT(ABS_DISTANCE) | BIT(ABS_WHEEL) | BIT(ABS_TILT_X) | BIT(ABS_TILT_Y) | BIT(ABS_RZ) | BIT(ABS_THROTTLE);
break; break;
case 3: case 3:
wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER); wacom->dev.keybit[LONG(BTN_DIGI)] |= BIT(BTN_STYLUS2) | BIT(BTN_TOOL_RUBBER);
break; break;
} }
......
...@@ -104,11 +104,11 @@ MODULE_DEVICE_TABLE (usb, xpad_table); ...@@ -104,11 +104,11 @@ MODULE_DEVICE_TABLE (usb, xpad_table);
struct usb_xpad { struct usb_xpad {
struct input_dev dev; /* input device interface */ struct input_dev dev; /* input device interface */
struct usb_device *udev; /* usb device */ struct usb_device *udev; /* usb device */
struct urb *irq_in; /* urb for interrupt in report */ struct urb *irq_in; /* urb for interrupt in report */
unsigned char *idata; /* input data */ unsigned char *idata; /* input data */
dma_addr_t idata_dma; dma_addr_t idata_dma;
char phys[65]; /* physical device path */ char phys[65]; /* physical device path */
int open_count; /* reference count */ int open_count; /* reference count */
}; };
...@@ -128,35 +128,35 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d ...@@ -128,35 +128,35 @@ static void xpad_process_packet(struct usb_xpad *xpad, u16 cmd, unsigned char *d
struct input_dev *dev = &xpad->dev; struct input_dev *dev = &xpad->dev;
input_regs(dev, regs); input_regs(dev, regs);
/* left stick */ /* left stick */
input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12])); input_report_abs(dev, ABS_X, (__s16) (((__s16)data[13] << 8) | data[12]));
input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14])); input_report_abs(dev, ABS_Y, (__s16) (((__s16)data[15] << 8) | data[14]));
/* right stick */ /* right stick */
input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16])); input_report_abs(dev, ABS_RX, (__s16) (((__s16)data[17] << 8) | data[16]));
input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18])); input_report_abs(dev, ABS_RY, (__s16) (((__s16)data[19] << 8) | data[18]));
/* triggers left/right */ /* triggers left/right */
input_report_abs(dev, ABS_Z, data[10]); input_report_abs(dev, ABS_Z, data[10]);
input_report_abs(dev, ABS_RZ, data[11]); input_report_abs(dev, ABS_RZ, data[11]);
/* digital pad */ /* digital pad */
input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04)); input_report_abs(dev, ABS_HAT0X, !!(data[2] & 0x08) - !!(data[2] & 0x04));
input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01)); input_report_abs(dev, ABS_HAT0Y, !!(data[2] & 0x02) - !!(data[2] & 0x01));
/* start/back buttons and stick press left/right */ /* start/back buttons and stick press left/right */
input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4); input_report_key(dev, BTN_START, (data[2] & 0x10) >> 4);
input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5); input_report_key(dev, BTN_BACK, (data[2] & 0x20) >> 5);
input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6); input_report_key(dev, BTN_THUMBL, (data[2] & 0x40) >> 6);
input_report_key(dev, BTN_THUMBR, data[2] >> 7); input_report_key(dev, BTN_THUMBR, data[2] >> 7);
/* "analog" buttons A, B, X, Y */ /* "analog" buttons A, B, X, Y */
input_report_key(dev, BTN_A, data[4]); input_report_key(dev, BTN_A, data[4]);
input_report_key(dev, BTN_B, data[5]); input_report_key(dev, BTN_B, data[5]);
input_report_key(dev, BTN_X, data[6]); input_report_key(dev, BTN_X, data[6]);
input_report_key(dev, BTN_Y, data[7]); input_report_key(dev, BTN_Y, data[7]);
/* "analog" buttons black, white */ /* "analog" buttons black, white */
input_report_key(dev, BTN_C, data[8]); input_report_key(dev, BTN_C, data[8]);
input_report_key(dev, BTN_Z, data[9]); input_report_key(dev, BTN_Z, data[9]);
...@@ -168,7 +168,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs) ...@@ -168,7 +168,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs)
{ {
struct usb_xpad *xpad = urb->context; struct usb_xpad *xpad = urb->context;
int retval; int retval;
switch (urb->status) { switch (urb->status) {
case 0: case 0:
/* success */ /* success */
...@@ -183,7 +183,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs) ...@@ -183,7 +183,7 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs)
dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status); dbg("%s - nonzero urb status received: %d", __FUNCTION__, urb->status);
goto exit; goto exit;
} }
xpad_process_packet(xpad, 0, xpad->idata, regs); xpad_process_packet(xpad, 0, xpad->idata, regs);
exit: exit:
...@@ -196,23 +196,23 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs) ...@@ -196,23 +196,23 @@ static void xpad_irq_in(struct urb *urb, struct pt_regs *regs)
static int xpad_open (struct input_dev *dev) static int xpad_open (struct input_dev *dev)
{ {
struct usb_xpad *xpad = dev->private; struct usb_xpad *xpad = dev->private;
if (xpad->open_count++) if (xpad->open_count++)
return 0; return 0;
xpad->irq_in->dev = xpad->udev; xpad->irq_in->dev = xpad->udev;
if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) { if (usb_submit_urb(xpad->irq_in, GFP_KERNEL)) {
xpad->open_count--; xpad->open_count--;
return -EIO; return -EIO;
} }
return 0; return 0;
} }
static void xpad_close (struct input_dev *dev) static void xpad_close (struct input_dev *dev)
{ {
struct usb_xpad *xpad = dev->private; struct usb_xpad *xpad = dev->private;
if (!--xpad->open_count) if (!--xpad->open_count)
usb_kill_urb(xpad->irq_in); usb_kill_urb(xpad->irq_in);
} }
...@@ -224,19 +224,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -224,19 +224,19 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
struct usb_endpoint_descriptor *ep_irq_in; struct usb_endpoint_descriptor *ep_irq_in;
char path[64]; char path[64];
int i; int i;
for (i = 0; xpad_device[i].idVendor; i++) { for (i = 0; xpad_device[i].idVendor; i++) {
if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) && if ((le16_to_cpu(udev->descriptor.idVendor) == xpad_device[i].idVendor) &&
(le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct)) (le16_to_cpu(udev->descriptor.idProduct) == xpad_device[i].idProduct))
break; break;
} }
if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) { if ((xpad = kmalloc (sizeof(struct usb_xpad), GFP_KERNEL)) == NULL) {
err("cannot allocate memory for new pad"); err("cannot allocate memory for new pad");
return -ENOMEM; return -ENOMEM;
} }
memset(xpad, 0, sizeof(struct usb_xpad)); memset(xpad, 0, sizeof(struct usb_xpad));
xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN, xpad->idata = usb_buffer_alloc(udev, XPAD_PKT_LEN,
SLAB_ATOMIC, &xpad->idata_dma); SLAB_ATOMIC, &xpad->idata_dma);
if (!xpad->idata) { if (!xpad->idata) {
...@@ -251,18 +251,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -251,18 +251,18 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
kfree(xpad); kfree(xpad);
return -ENOMEM; return -ENOMEM;
} }
ep_irq_in = &intf->cur_altsetting->endpoint[0].desc; ep_irq_in = &intf->cur_altsetting->endpoint[0].desc;
usb_fill_int_urb(xpad->irq_in, udev, usb_fill_int_urb(xpad->irq_in, udev,
usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress), usb_rcvintpipe(udev, ep_irq_in->bEndpointAddress),
xpad->idata, XPAD_PKT_LEN, xpad_irq_in, xpad->idata, XPAD_PKT_LEN, xpad_irq_in,
xpad, ep_irq_in->bInterval); xpad, ep_irq_in->bInterval);
xpad->irq_in->transfer_dma = xpad->idata_dma; xpad->irq_in->transfer_dma = xpad->idata_dma;
xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; xpad->irq_in->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
xpad->udev = udev; xpad->udev = udev;
xpad->dev.id.bustype = BUS_USB; xpad->dev.id.bustype = BUS_USB;
xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor);
xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct);
...@@ -273,21 +273,21 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -273,21 +273,21 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
xpad->dev.phys = xpad->phys; xpad->dev.phys = xpad->phys;
xpad->dev.open = xpad_open; xpad->dev.open = xpad_open;
xpad->dev.close = xpad_close; xpad->dev.close = xpad_close;
usb_make_path(udev, path, 64); usb_make_path(udev, path, 64);
snprintf(xpad->phys, 64, "%s/input0", path); snprintf(xpad->phys, 64, "%s/input0", path);
xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); xpad->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
for (i = 0; xpad_btn[i] >= 0; i++) for (i = 0; xpad_btn[i] >= 0; i++)
set_bit(xpad_btn[i], xpad->dev.keybit); set_bit(xpad_btn[i], xpad->dev.keybit);
for (i = 0; xpad_abs[i] >= 0; i++) { for (i = 0; xpad_abs[i] >= 0; i++) {
signed short t = xpad_abs[i]; signed short t = xpad_abs[i];
set_bit(t, xpad->dev.absbit); set_bit(t, xpad->dev.absbit);
switch (t) { switch (t) {
case ABS_X: case ABS_X:
case ABS_Y: case ABS_Y:
...@@ -310,11 +310,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -310,11 +310,11 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
break; break;
} }
} }
input_register_device(&xpad->dev); input_register_device(&xpad->dev);
printk(KERN_INFO "input: %s on %s", xpad->dev.name, path); printk(KERN_INFO "input: %s on %s", xpad->dev.name, path);
usb_set_intfdata(intf, xpad); usb_set_intfdata(intf, xpad);
return 0; return 0;
} }
...@@ -322,7 +322,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id ...@@ -322,7 +322,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id
static void xpad_disconnect(struct usb_interface *intf) static void xpad_disconnect(struct usb_interface *intf)
{ {
struct usb_xpad *xpad = usb_get_intfdata (intf); struct usb_xpad *xpad = usb_get_intfdata (intf);
usb_set_intfdata(intf, NULL); usb_set_intfdata(intf, NULL);
if (xpad) { if (xpad) {
usb_kill_urb(xpad->irq_in); usb_kill_urb(xpad->irq_in);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册