summaryrefslogtreecommitdiff
path: root/usr/src/dkms_source_tree/hid-ntrig.c
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 /usr/src/dkms_source_tree/hid-ntrig.c
parente78a58a7e4193245f4e7bd91784e830e096ef4c8 (diff)
Update to natty (2.6.38-7) base
Signed-off-by: Henrik Rydberg <rydberg@euromail.se>
Diffstat (limited to 'usr/src/dkms_source_tree/hid-ntrig.c')
-rw-r--r--usr/src/dkms_source_tree/hid-ntrig.c44
1 files changed, 18 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 }