hid-ntrig.c (48a732dfaa77a4dfec803aa8f248373998704f76) hid-ntrig.c (d881427253da011495f4193663d809d0e9dfa215)
1/*
2 * HID driver for N-Trig touchscreens
3 *
4 * Copyright (c) 2008-2010 Rafi Rubin
5 * Copyright (c) 2009-2010 Stephane Chatty
6 *
7 */
8

--- 104 unchanged lines hidden (view full) ---

113static inline int ntrig_get_mode(struct hid_device *hdev)
114{
115 struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT].
116 report_id_hash[0x0d];
117
118 if (!report)
119 return -EINVAL;
120
1/*
2 * HID driver for N-Trig touchscreens
3 *
4 * Copyright (c) 2008-2010 Rafi Rubin
5 * Copyright (c) 2009-2010 Stephane Chatty
6 *
7 */
8

--- 104 unchanged lines hidden (view full) ---

113static inline int ntrig_get_mode(struct hid_device *hdev)
114{
115 struct hid_report *report = hdev->report_enum[HID_FEATURE_REPORT].
116 report_id_hash[0x0d];
117
118 if (!report)
119 return -EINVAL;
120
121 usbhid_submit_report(hdev, report, USB_DIR_IN);
121 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
122 usbhid_wait_io(hdev);
123 return (int)report->field[0]->value[0];
124}
125
126static inline void ntrig_set_mode(struct hid_device *hdev, const int mode)
127{
128 struct hid_report *report;
129 __u8 mode_commands[4] = { 0xe, 0xf, 0x1b, 0x10 };
130
131 if (mode < 0 || mode > 3)
132 return;
133
134 report = hdev->report_enum[HID_FEATURE_REPORT].
135 report_id_hash[mode_commands[mode]];
136
137 if (!report)
138 return;
139
122 usbhid_wait_io(hdev);
123 return (int)report->field[0]->value[0];
124}
125
126static inline void ntrig_set_mode(struct hid_device *hdev, const int mode)
127{
128 struct hid_report *report;
129 __u8 mode_commands[4] = { 0xe, 0xf, 0x1b, 0x10 };
130
131 if (mode < 0 || mode > 3)
132 return;
133
134 report = hdev->report_enum[HID_FEATURE_REPORT].
135 report_id_hash[mode_commands[mode]];
136
137 if (!report)
138 return;
139
140 usbhid_submit_report(hdev, report, USB_DIR_IN);
140 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
141}
142
143static void ntrig_report_version(struct hid_device *hdev)
144{
145 int ret;
146 char buf[20];
147 struct usb_device *usb_dev = hid_to_usb_dev(hdev);
148 unsigned char *data = kmalloc(8, GFP_KERNEL);

--- 784 unchanged lines hidden (view full) ---

933 }
934
935 /* This is needed for devices with more recent firmware versions */
936 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
937 if (report) {
938 /* Let the device settle to ensure the wakeup message gets
939 * through */
940 usbhid_wait_io(hdev);
141}
142
143static void ntrig_report_version(struct hid_device *hdev)
144{
145 int ret;
146 char buf[20];
147 struct usb_device *usb_dev = hid_to_usb_dev(hdev);
148 unsigned char *data = kmalloc(8, GFP_KERNEL);

--- 784 unchanged lines hidden (view full) ---

933 }
934
935 /* This is needed for devices with more recent firmware versions */
936 report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[0x0a];
937 if (report) {
938 /* Let the device settle to ensure the wakeup message gets
939 * through */
940 usbhid_wait_io(hdev);
941 usbhid_submit_report(hdev, report, USB_DIR_IN);
941 hid_hw_request(hdev, report, HID_REQ_GET_REPORT);
942
943 /*
944 * Sanity check: if the current mode is invalid reset it to
945 * something reasonable.
946 */
947 if (ntrig_get_mode(hdev) >= 4)
948 ntrig_set_mode(hdev, 3);
949 }

--- 82 unchanged lines hidden ---
942
943 /*
944 * Sanity check: if the current mode is invalid reset it to
945 * something reasonable.
946 */
947 if (ntrig_get_mode(hdev) >= 4)
948 ntrig_set_mode(hdev, 3);
949 }

--- 82 unchanged lines hidden ---