Lines Matching +full:event +full:- +full:prox
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2001-2005 Edouard TISSERANT <edouard.tisserant@wanadoo.fr>
4 * Copyright (c) 2004-2005 Stephane VOLTZ <svoltz@numericable.fr>
9 * v3.2 - Added sysfs support
41 struct usb_acecad *acecad = urb->context; in usb_acecad_irq()
42 unsigned char *data = acecad->data; in usb_acecad_irq()
43 struct input_dev *dev = acecad->input; in usb_acecad_irq()
44 struct usb_interface *intf = acecad->intf; in usb_acecad_irq()
46 int prox, status; in usb_acecad_irq() local
48 switch (urb->status) { in usb_acecad_irq()
52 case -ECONNRESET: in usb_acecad_irq()
53 case -ENOENT: in usb_acecad_irq()
54 case -ESHUTDOWN: in usb_acecad_irq()
56 dev_dbg(&intf->dev, "%s - urb shutting down with status: %d\n", in usb_acecad_irq()
57 __func__, urb->status); in usb_acecad_irq()
60 dev_dbg(&intf->dev, "%s - nonzero urb status received: %d\n", in usb_acecad_irq()
61 __func__, urb->status); in usb_acecad_irq()
65 prox = (data[0] & 0x04) >> 2; in usb_acecad_irq()
66 input_report_key(dev, BTN_TOOL_PEN, prox); in usb_acecad_irq()
68 if (prox) { in usb_acecad_irq()
84 /* event termination */ in usb_acecad_irq()
90 dev_err(&intf->dev, in usb_acecad_irq()
91 "can't resubmit intr, %s-%s/input0, status %d\n", in usb_acecad_irq()
92 udev->bus->bus_name, in usb_acecad_irq()
93 udev->devpath, status); in usb_acecad_irq()
100 acecad->irq->dev = interface_to_usbdev(acecad->intf); in usb_acecad_open()
101 if (usb_submit_urb(acecad->irq, GFP_KERNEL)) in usb_acecad_open()
102 return -EIO; in usb_acecad_open()
111 usb_kill_urb(acecad->irq); in usb_acecad_close()
117 struct usb_host_interface *interface = intf->cur_altsetting; in usb_acecad_probe()
124 if (interface->desc.bNumEndpoints != 1) in usb_acecad_probe()
125 return -ENODEV; in usb_acecad_probe()
127 endpoint = &interface->endpoint[0].desc; in usb_acecad_probe()
130 return -ENODEV; in usb_acecad_probe()
132 pipe = usb_rcvintpipe(dev, endpoint->bEndpointAddress); in usb_acecad_probe()
138 err = -ENOMEM; in usb_acecad_probe()
142 acecad->data = usb_alloc_coherent(dev, 8, GFP_KERNEL, &acecad->data_dma); in usb_acecad_probe()
143 if (!acecad->data) { in usb_acecad_probe()
144 err= -ENOMEM; in usb_acecad_probe()
148 acecad->irq = usb_alloc_urb(0, GFP_KERNEL); in usb_acecad_probe()
149 if (!acecad->irq) { in usb_acecad_probe()
150 err = -ENOMEM; in usb_acecad_probe()
154 acecad->intf = intf; in usb_acecad_probe()
155 acecad->input = input_dev; in usb_acecad_probe()
157 if (dev->manufacturer) in usb_acecad_probe()
158 strlcpy(acecad->name, dev->manufacturer, sizeof(acecad->name)); in usb_acecad_probe()
160 if (dev->product) { in usb_acecad_probe()
161 if (dev->manufacturer) in usb_acecad_probe()
162 strlcat(acecad->name, " ", sizeof(acecad->name)); in usb_acecad_probe()
163 strlcat(acecad->name, dev->product, sizeof(acecad->name)); in usb_acecad_probe()
166 usb_make_path(dev, acecad->phys, sizeof(acecad->phys)); in usb_acecad_probe()
167 strlcat(acecad->phys, "/input0", sizeof(acecad->phys)); in usb_acecad_probe()
169 input_dev->name = acecad->name; in usb_acecad_probe()
170 input_dev->phys = acecad->phys; in usb_acecad_probe()
171 usb_to_input_id(dev, &input_dev->id); in usb_acecad_probe()
172 input_dev->dev.parent = &intf->dev; in usb_acecad_probe()
176 input_dev->open = usb_acecad_open; in usb_acecad_probe()
177 input_dev->close = usb_acecad_close; in usb_acecad_probe()
179 input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_ABS); in usb_acecad_probe()
180 input_dev->keybit[BIT_WORD(BTN_DIGI)] = BIT_MASK(BTN_TOOL_PEN) | in usb_acecad_probe()
184 switch (id->driver_info) { in usb_acecad_probe()
189 if (!strlen(acecad->name)) in usb_acecad_probe()
190 snprintf(acecad->name, sizeof(acecad->name), in usb_acecad_probe()
192 le16_to_cpu(dev->descriptor.idVendor), in usb_acecad_probe()
193 le16_to_cpu(dev->descriptor.idProduct)); in usb_acecad_probe()
200 if (!strlen(acecad->name)) in usb_acecad_probe()
201 snprintf(acecad->name, sizeof(acecad->name), in usb_acecad_probe()
203 le16_to_cpu(dev->descriptor.idVendor), in usb_acecad_probe()
204 le16_to_cpu(dev->descriptor.idProduct)); in usb_acecad_probe()
208 usb_fill_int_urb(acecad->irq, dev, pipe, in usb_acecad_probe()
209 acecad->data, maxp > 8 ? 8 : maxp, in usb_acecad_probe()
210 usb_acecad_irq, acecad, endpoint->bInterval); in usb_acecad_probe()
211 acecad->irq->transfer_dma = acecad->data_dma; in usb_acecad_probe()
212 acecad->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_acecad_probe()
214 err = input_register_device(acecad->input); in usb_acecad_probe()
222 fail3: usb_free_urb(acecad->irq); in usb_acecad_probe()
223 fail2: usb_free_coherent(dev, 8, acecad->data, acecad->data_dma); in usb_acecad_probe()
236 input_unregister_device(acecad->input); in usb_acecad_disconnect()
237 usb_free_urb(acecad->irq); in usb_acecad_disconnect()
238 usb_free_coherent(udev, 8, acecad->data, acecad->data_dma); in usb_acecad_disconnect()