Lines Matching refs:kbd
102 struct usb_kbd *kbd = urb->context; in usb_kbd_irq() local
118 input_report_key(kbd->dev, usb_kbd_keycode[i + 224], (kbd->new[0] >> i) & 1); in usb_kbd_irq()
122 if (kbd->old[i] > 3 && memscan(kbd->new + 2, kbd->old[i], 6) == kbd->new + 8) { in usb_kbd_irq()
123 if (usb_kbd_keycode[kbd->old[i]]) in usb_kbd_irq()
124 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); in usb_kbd_irq()
128 kbd->old[i]); in usb_kbd_irq()
131 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { in usb_kbd_irq()
132 if (usb_kbd_keycode[kbd->new[i]]) in usb_kbd_irq()
133 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); in usb_kbd_irq()
137 kbd->new[i]); in usb_kbd_irq()
141 input_sync(kbd->dev); in usb_kbd_irq()
143 memcpy(kbd->old, kbd->new, 8); in usb_kbd_irq()
149 kbd->usbdev->bus->bus_name, in usb_kbd_irq()
150 kbd->usbdev->devpath, i); in usb_kbd_irq()
157 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_event() local
162 spin_lock_irqsave(&kbd->leds_lock, flags); in usb_kbd_event()
163 …kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3)… in usb_kbd_event()
167 if (kbd->led_urb_submitted){ in usb_kbd_event()
168 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
172 if (*(kbd->leds) == kbd->newleds){ in usb_kbd_event()
173 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
177 *(kbd->leds) = kbd->newleds; in usb_kbd_event()
179 kbd->led->dev = kbd->usbdev; in usb_kbd_event()
180 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) in usb_kbd_event()
183 kbd->led_urb_submitted = true; in usb_kbd_event()
185 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
193 struct usb_kbd *kbd = urb->context; in usb_kbd_led() local
199 spin_lock_irqsave(&kbd->leds_lock, flags); in usb_kbd_led()
201 if (*(kbd->leds) == kbd->newleds){ in usb_kbd_led()
202 kbd->led_urb_submitted = false; in usb_kbd_led()
203 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_led()
207 *(kbd->leds) = kbd->newleds; in usb_kbd_led()
209 kbd->led->dev = kbd->usbdev; in usb_kbd_led()
210 if (usb_submit_urb(kbd->led, GFP_ATOMIC)){ in usb_kbd_led()
212 kbd->led_urb_submitted = false; in usb_kbd_led()
214 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_led()
220 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_open() local
222 kbd->irq->dev = kbd->usbdev; in usb_kbd_open()
223 if (usb_submit_urb(kbd->irq, GFP_KERNEL)) in usb_kbd_open()
231 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_close() local
233 usb_kill_urb(kbd->irq); in usb_kbd_close()
236 static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) in usb_kbd_alloc_mem() argument
238 if (!(kbd->irq = usb_alloc_urb(0, GFP_KERNEL))) in usb_kbd_alloc_mem()
240 if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL))) in usb_kbd_alloc_mem()
242 if (!(kbd->new = usb_alloc_coherent(dev, 8, GFP_KERNEL, &kbd->new_dma))) in usb_kbd_alloc_mem()
244 if (!(kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL))) in usb_kbd_alloc_mem()
246 if (!(kbd->leds = usb_alloc_coherent(dev, 1, GFP_KERNEL, &kbd->leds_dma))) in usb_kbd_alloc_mem()
252 static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) in usb_kbd_free_mem() argument
254 usb_free_urb(kbd->irq); in usb_kbd_free_mem()
255 usb_free_urb(kbd->led); in usb_kbd_free_mem()
256 usb_free_coherent(dev, 8, kbd->new, kbd->new_dma); in usb_kbd_free_mem()
257 kfree(kbd->cr); in usb_kbd_free_mem()
258 usb_free_coherent(dev, 1, kbd->leds, kbd->leds_dma); in usb_kbd_free_mem()
267 struct usb_kbd *kbd; in usb_kbd_probe() local
284 kbd = kzalloc(sizeof(struct usb_kbd), GFP_KERNEL); in usb_kbd_probe()
286 if (!kbd || !input_dev) in usb_kbd_probe()
289 if (usb_kbd_alloc_mem(dev, kbd)) in usb_kbd_probe()
292 kbd->usbdev = dev; in usb_kbd_probe()
293 kbd->dev = input_dev; in usb_kbd_probe()
294 spin_lock_init(&kbd->leds_lock); in usb_kbd_probe()
297 strscpy(kbd->name, dev->manufacturer, sizeof(kbd->name)); in usb_kbd_probe()
301 strlcat(kbd->name, " ", sizeof(kbd->name)); in usb_kbd_probe()
302 strlcat(kbd->name, dev->product, sizeof(kbd->name)); in usb_kbd_probe()
305 if (!strlen(kbd->name)) in usb_kbd_probe()
306 snprintf(kbd->name, sizeof(kbd->name), in usb_kbd_probe()
311 usb_make_path(dev, kbd->phys, sizeof(kbd->phys)); in usb_kbd_probe()
312 strlcat(kbd->phys, "/input0", sizeof(kbd->phys)); in usb_kbd_probe()
314 input_dev->name = kbd->name; in usb_kbd_probe()
315 input_dev->phys = kbd->phys; in usb_kbd_probe()
319 input_set_drvdata(input_dev, kbd); in usb_kbd_probe()
335 usb_fill_int_urb(kbd->irq, dev, pipe, in usb_kbd_probe()
336 kbd->new, (maxp > 8 ? 8 : maxp), in usb_kbd_probe()
337 usb_kbd_irq, kbd, endpoint->bInterval); in usb_kbd_probe()
338 kbd->irq->transfer_dma = kbd->new_dma; in usb_kbd_probe()
339 kbd->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_kbd_probe()
341 kbd->cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE; in usb_kbd_probe()
342 kbd->cr->bRequest = 0x09; in usb_kbd_probe()
343 kbd->cr->wValue = cpu_to_le16(0x200); in usb_kbd_probe()
344 kbd->cr->wIndex = cpu_to_le16(interface->desc.bInterfaceNumber); in usb_kbd_probe()
345 kbd->cr->wLength = cpu_to_le16(1); in usb_kbd_probe()
347 usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0), in usb_kbd_probe()
348 (void *) kbd->cr, kbd->leds, 1, in usb_kbd_probe()
349 usb_kbd_led, kbd); in usb_kbd_probe()
350 kbd->led->transfer_dma = kbd->leds_dma; in usb_kbd_probe()
351 kbd->led->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_kbd_probe()
353 error = input_register_device(kbd->dev); in usb_kbd_probe()
357 usb_set_intfdata(iface, kbd); in usb_kbd_probe()
362 usb_kbd_free_mem(dev, kbd); in usb_kbd_probe()
365 kfree(kbd); in usb_kbd_probe()
371 struct usb_kbd *kbd = usb_get_intfdata (intf); in usb_kbd_disconnect() local
374 if (kbd) { in usb_kbd_disconnect()
375 usb_kill_urb(kbd->irq); in usb_kbd_disconnect()
376 input_unregister_device(kbd->dev); in usb_kbd_disconnect()
377 usb_kill_urb(kbd->led); in usb_kbd_disconnect()
378 usb_kbd_free_mem(interface_to_usbdev(intf), kbd); in usb_kbd_disconnect()
379 kfree(kbd); in usb_kbd_disconnect()