28 #include <linux/kernel.h>
29 #include <linux/slab.h>
30 #include <linux/module.h>
37 #define DRIVER_VERSION "v3.2"
38 #define DRIVER_DESC "USB Acecad Flair tablet driver"
39 #define DRIVER_LICENSE "GPL"
46 #define USB_VENDOR_ID_ACECAD 0x0460
47 #define USB_DEVICE_ID_FLAIR 0x0004
48 #define USB_DEVICE_ID_302 0x0008
62 static void usb_acecad_irq(
struct urb *
urb)
66 struct input_dev *
dev = acecad->
input;
70 switch (urb->status) {
78 dev_dbg(&intf->dev,
"%s - urb shutting down with status: %d\n",
79 __func__, urb->status);
82 dev_dbg(&intf->dev,
"%s - nonzero urb status received: %d\n",
83 __func__, urb->status);
87 prox = (data[0] & 0x04) >> 2;
91 int x = data[1] | (data[2] << 8);
92 int y = data[3] | (data[4] << 8);
94 int pressure = data[5] | (data[6] << 8);
95 int touch = data[0] & 0x01;
96 int stylus = (data[0] & 0x10) >> 4;
97 int stylus2 = (data[0] & 0x20) >> 5;
98 input_report_abs(dev,
ABS_X, x);
99 input_report_abs(dev,
ABS_Y, y);
113 "can't resubmit intr, %s-%s/input0, status %d\n",
114 acecad->
usbdev->bus->bus_name,
115 acecad->
usbdev->devpath, status);
118 static int usb_acecad_open(
struct input_dev *dev)
120 struct usb_acecad *acecad = input_get_drvdata(dev);
129 static void usb_acecad_close(
struct input_dev *dev)
131 struct usb_acecad *acecad = input_get_drvdata(dev);
138 struct usb_device *dev = interface_to_usbdev(intf);
139 struct usb_host_interface *
interface = intf->cur_altsetting;
142 struct input_dev *input_dev;
151 if (!usb_endpoint_is_int_in(endpoint))
155 maxp = usb_maxpacket(dev, pipe, usb_pipeout(pipe));
158 input_dev = input_allocate_device();
159 if (!acecad || !input_dev) {
178 acecad->
input = input_dev;
180 if (dev->manufacturer)
184 if (dev->manufacturer)
189 usb_make_path(dev, acecad->
phys,
sizeof(acecad->
phys));
192 input_dev->name = acecad->
name;
193 input_dev->phys = acecad->
phys;
194 usb_to_input_id(dev, &input_dev->id);
195 input_dev->dev.parent = &intf->dev;
197 input_set_drvdata(input_dev, acecad);
199 input_dev->open = usb_acecad_open;
200 input_dev->close = usb_acecad_close;
207 switch (id->driver_info) {
209 input_set_abs_params(input_dev,
ABS_X, 0, 5000, 4, 0);
210 input_set_abs_params(input_dev,
ABS_Y, 0, 3750, 4, 0);
211 input_set_abs_params(input_dev,
ABS_PRESSURE, 0, 512, 0, 0);
214 "USB Acecad Flair Tablet %04x:%04x",
220 input_set_abs_params(input_dev,
ABS_X, 0, 53000, 4, 0);
221 input_set_abs_params(input_dev,
ABS_Y, 0, 2250, 4, 0);
222 input_set_abs_params(input_dev,
ABS_PRESSURE, 0, 1024, 0, 0);
225 "USB Acecad 302 Tablet %04x:%04x",
231 usb_fill_int_urb(acecad->
irq, dev, pipe,
232 acecad->
data, maxp > 8 ? 8 : maxp,
233 usb_acecad_irq, acecad, endpoint->
bInterval);
235 acecad->
irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP;
237 err = input_register_device(acecad->
input);
241 usb_set_intfdata(intf, acecad);
247 fail1: input_free_device(input_dev);
252 static void usb_acecad_disconnect(
struct usb_interface *intf)
254 struct usb_acecad *acecad = usb_get_intfdata(intf);
256 usb_set_intfdata(intf,
NULL);
258 input_unregister_device(acecad->
input);
272 static struct usb_driver usb_acecad_driver = {
273 .name =
"usb_acecad",
274 .probe = usb_acecad_probe,
275 .disconnect = usb_acecad_disconnect,
276 .id_table = usb_acecad_id_table,