summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHenrik Rydberg <rydberg@euromail.se>2011-03-22 09:23:33 +0100
committerHenrik Rydberg <rydberg@euromail.se>2011-03-22 09:23:33 +0100
commit4a5a274bbed9df7acd462a9a02d8a156b8742b12 (patch)
treede763c0a0794019f1b3ecca21bb9fcd45145fad0
parente78a58a7e4193245f4e7bd91784e830e096ef4c8 (diff)
Update to natty (2.6.38-7) base
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
-rw-r--r--usr/src/dkms_source_tree/hid-ntrig.c44
-rw-r--r--usr/src/dkms_source_tree/usbhid.h106
2 files changed, 124 insertions, 26 deletions
diff --git a/usr/src/dkms_source_tree/hid-ntrig.c b/usr/src/dkms_source_tree/hid-ntrig.c
index 2d6cbc1..0fab58b 100644
--- a/usr/src/dkms_source_tree/hid-ntrig.c
+++ b/usr/src/dkms_source_tree/hid-ntrig.c
@@ -17,17 +17,12 @@
17#include <linux/device.h> 17#include <linux/device.h>
18#include <linux/hid.h> 18#include <linux/hid.h>
19#include <linux/usb.h> 19#include <linux/usb.h>
20#include "usbhid.h"
20#include <linux/module.h> 21#include <linux/module.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
22 23
23#include "hid-ids.h" 24#include "hid-ids.h"
24 25
25void usbhid_submit_report
26(struct hid_device *hid, struct hid_report *report, unsigned char dir);
27
28#define hid_to_usb_dev(hid_dev) \
29 container_of(hid_dev->dev.parent->parent, struct usb_device, dev)
30
31#define NTRIG_DUPLICATE_USAGES 0x001 26#define NTRIG_DUPLICATE_USAGES 0x001
32 27
33#define MAX_SLOTS 20 28#define MAX_SLOTS 20
@@ -100,8 +95,7 @@ static void ntrig_report_version(struct hid_device *hdev)
100 if (ret == 8) { 95 if (ret == 8) {
101 ret = ntrig_version_string(&data[2], buf); 96 ret = ntrig_version_string(&data[2], buf);
102 97
103 dev_info(&hdev->dev, 98 hid_info(hdev, "Firmware version: %s (%02x%02x %02x%02x)\n",
104 "Firmware version: %s (%02x%02x %02x%02x)\n",
105 buf, data[2], data[3], data[4], data[5]); 99 buf, data[2], data[3], data[4], data[5]);
106 } 100 }
107 101
@@ -116,7 +110,7 @@ err_free:
116 */ 110 */
117 111
118static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi, 112static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
119 struct hid_field *field, struct hid_usage *usage, 113 struct hid_field *field, struct hid_usage *usage,
120 unsigned long **bit, int *max) 114 unsigned long **bit, int *max)
121{ 115{
122 struct ntrig_data *nd = hid_get_drvdata(hdev); 116 struct ntrig_data *nd = hid_get_drvdata(hdev);
@@ -203,8 +197,8 @@ static int ntrig_input_mapping(struct hid_device *hdev, struct hid_input *hi,
203} 197}
204 198
205static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi, 199static int ntrig_input_mapped(struct hid_device *hdev, struct hid_input *hi,
206 struct hid_field *field, struct hid_usage *usage, 200 struct hid_field *field, struct hid_usage *usage,
207 unsigned long **bit, int *max) 201 unsigned long **bit, int *max)
208{ 202{
209 /* No special mappings needed for the pen and single touch */ 203 /* No special mappings needed for the pen and single touch */
210 if (field->physical) 204 if (field->physical)
@@ -336,7 +330,7 @@ static void report_frame(struct input_dev *input, struct ntrig_data *nd)
336 * and call input_mt_sync after each point if necessary 330 * and call input_mt_sync after each point if necessary
337 */ 331 */
338static int ntrig_event (struct hid_device *hid, struct hid_field *field, 332static int ntrig_event (struct hid_device *hid, struct hid_field *field,
339 struct hid_usage *usage, __s32 value) 333 struct hid_usage *usage, __s32 value)
340{ 334{
341 struct input_dev *input = field->hidinput->input; 335 struct input_dev *input = field->hidinput->input;
342 struct ntrig_data *nd = hid_get_drvdata(hid); 336 struct ntrig_data *nd = hid_get_drvdata(hid);
@@ -370,15 +364,15 @@ static int ntrig_event (struct hid_device *hid, struct hid_field *field,
370 } 364 }
371 break; 365 break;
372 case HID_DG_CONTACTCOUNT: /* End of a multitouch group */ 366 case HID_DG_CONTACTCOUNT: /* End of a multitouch group */
373 if (nd->hasmt) { 367 if (!nd->hasmt)
374 nd->nindex = 0; 368 break;
375 nd->ncol = value; 369 nd->nindex = 0;
376 /* skip pen switch events */ 370 nd->ncol = value;
377 if (nd->ncol == 1 && 371 /* skip pen switch events */
378 nd->col[0].w == 10 && nd->col[0].h == 10) 372 if (nd->ncol == 1 &&
379 break; 373 nd->col[0].w == 10 && nd->col[0].h == 10)
380 report_frame(input, nd); 374 break;
381 } 375 report_frame(input, nd);
382 break; 376 break;
383 } 377 }
384 } 378 }
@@ -403,7 +397,7 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
403 397
404 nd = kzalloc(sizeof(struct ntrig_data), GFP_KERNEL); 398 nd = kzalloc(sizeof(struct ntrig_data), GFP_KERNEL);
405 if (!nd) { 399 if (!nd) {
406 dev_err(&hdev->dev, "cannot allocate N-Trig data\n"); 400 hid_err(hdev, "cannot allocate N-Trig data\n");
407 return -ENOMEM; 401 return -ENOMEM;
408 } 402 }
409 403
@@ -411,13 +405,13 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
411 405
412 ret = hid_parse(hdev); 406 ret = hid_parse(hdev);
413 if (ret) { 407 if (ret) {
414 dev_err(&hdev->dev, "parse failed\n"); 408 hid_err(hdev, "parse failed\n");
415 goto err_free; 409 goto err_free;
416 } 410 }
417 411
418 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF); 412 ret = hid_hw_start(hdev, HID_CONNECT_DEFAULT & ~HID_CONNECT_FF);
419 if (ret) { 413 if (ret) {
420 dev_err(&hdev->dev, "hw start failed\n"); 414 hid_err(hdev, "hw start failed\n");
421 goto err_free; 415 goto err_free;
422 } 416 }
423 417
@@ -448,7 +442,6 @@ static int ntrig_probe(struct hid_device *hdev, const struct hid_device_id *id)
448 442
449 ntrig_report_version(hdev); 443 ntrig_report_version(hdev);
450 444
451
452 return 0; 445 return 0;
453err_free: 446err_free:
454 kfree(nd); 447 kfree(nd);
@@ -460,7 +453,6 @@ static void ntrig_remove(struct hid_device *hdev)
460 hid_hw_stop(hdev); 453 hid_hw_stop(hdev);
461 kfree(hid_get_drvdata(hdev)); 454 kfree(hid_get_drvdata(hdev));
462} 455}
463
464#define NTRIG_DEVICE(id) \ 456#define NTRIG_DEVICE(id) \
465 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, id), \ 457 { HID_USB_DEVICE(USB_VENDOR_ID_NTRIG, id), \
466 .driver_data = NTRIG_DUPLICATE_USAGES } 458 .driver_data = NTRIG_DUPLICATE_USAGES }
diff --git a/usr/src/dkms_source_tree/usbhid.h b/usr/src/dkms_source_tree/usbhid.h
new file mode 100644
index 0000000..1673cac
--- /dev/null
+++ b/usr/src/dkms_source_tree/usbhid.h
@@ -0,0 +1,106 @@
1#ifndef __USBHID_H
2#define __USBHID_H
3
4/*
5 * Copyright (c) 1999 Andreas Gal
6 * Copyright (c) 2000-2001 Vojtech Pavlik
7 * Copyright (c) 2006 Jiri Kosina
8 */
9
10/*
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#include <linux/types.h>
28#include <linux/slab.h>
29#include <linux/list.h>
30#include <linux/mutex.h>
31#include <linux/timer.h>
32#include <linux/wait.h>
33#include <linux/workqueue.h>
34#include <linux/input.h>
35
36/* API provided by hid-core.c for USB HID drivers */
37int usbhid_wait_io(struct hid_device* hid);
38void usbhid_close(struct hid_device *hid);
39int usbhid_open(struct hid_device *hid);
40void usbhid_init_reports(struct hid_device *hid);
41void usbhid_submit_report
42(struct hid_device *hid, struct hid_report *report, unsigned char dir);
43int usbhid_get_power(struct hid_device *hid);
44void usbhid_put_power(struct hid_device *hid);
45struct usb_interface *usbhid_find_interface(int minor);
46
47/* iofl flags */
48#define HID_CTRL_RUNNING 1
49#define HID_OUT_RUNNING 2
50#define HID_IN_RUNNING 3
51#define HID_RESET_PENDING 4
52#define HID_SUSPENDED 5
53#define HID_CLEAR_HALT 6
54#define HID_DISCONNECTED 7
55#define HID_STARTED 8
56#define HID_REPORTED_IDLE 9
57#define HID_KEYS_PRESSED 10
58#define HID_LED_ON 11
59
60/*
61 * USB-specific HID struct, to be pointed to
62 * from struct hid_device->driver_data
63 */
64
65struct usbhid_device {
66 struct hid_device *hid; /* pointer to corresponding HID dev */
67
68 struct usb_interface *intf; /* USB interface */
69 int ifnum; /* USB interface number */
70
71 unsigned int bufsize; /* URB buffer size */
72
73 struct urb *urbin; /* Input URB */
74 char *inbuf; /* Input buffer */
75 dma_addr_t inbuf_dma; /* Input buffer dma */
76
77 struct urb *urbctrl; /* Control URB */
78 struct usb_ctrlrequest *cr; /* Control request struct */
79 struct hid_control_fifo ctrl[HID_CONTROL_FIFO_SIZE]; /* Control fifo */
80 unsigned char ctrlhead, ctrltail; /* Control fifo head & tail */
81 char *ctrlbuf; /* Control buffer */
82 dma_addr_t ctrlbuf_dma; /* Control buffer dma */
83 unsigned long last_ctrl; /* record of last output for timeouts */
84
85 struct urb *urbout; /* Output URB */
86 struct hid_output_fifo out[HID_CONTROL_FIFO_SIZE]; /* Output pipe fifo */
87 unsigned char outhead, outtail; /* Output pipe fifo head & tail */
88 char *outbuf; /* Output buffer */
89 dma_addr_t outbuf_dma; /* Output buffer dma */
90 unsigned long last_out; /* record of last output for timeouts */
91
92 spinlock_t lock; /* fifo spinlock */
93 unsigned long iofl; /* I/O flags (CTRL_RUNNING, OUT_RUNNING) */
94 struct timer_list io_retry; /* Retry timer */
95 unsigned long stop_retry; /* Time to give up, in jiffies */
96 unsigned int retry_delay; /* Delay length in ms */
97 struct work_struct reset_work; /* Task context for resets */
98 wait_queue_head_t wait; /* For sleeping */
99 int ledcount; /* counting the number of active leds */
100};
101
102#define hid_to_usb_dev(hid_dev) \
103 container_of(hid_dev->dev.parent->parent, struct usb_device, dev)
104
105#endif
106