Lines Matching refs:kbd
115 struct usb_kbd *kbd = urb->context; in usb_kbd_irq() local
131 input_report_key(kbd->dev, usb_kbd_keycode[i + 224], (kbd->new[0] >> i) & 1); in usb_kbd_irq()
135 if (kbd->old[i] > 3 && memscan(kbd->new + 2, kbd->old[i], 6) == kbd->new + 8) { in usb_kbd_irq()
136 if (usb_kbd_keycode[kbd->old[i]]) in usb_kbd_irq()
137 input_report_key(kbd->dev, usb_kbd_keycode[kbd->old[i]], 0); in usb_kbd_irq()
141 kbd->old[i]); in usb_kbd_irq()
144 if (kbd->new[i] > 3 && memscan(kbd->old + 2, kbd->new[i], 6) == kbd->old + 8) { in usb_kbd_irq()
145 if (usb_kbd_keycode[kbd->new[i]]) in usb_kbd_irq()
146 input_report_key(kbd->dev, usb_kbd_keycode[kbd->new[i]], 1); in usb_kbd_irq()
150 kbd->new[i]); in usb_kbd_irq()
154 input_sync(kbd->dev); in usb_kbd_irq()
156 memcpy(kbd->old, kbd->new, 8); in usb_kbd_irq()
162 kbd->usbdev->bus->bus_name, in usb_kbd_irq()
163 kbd->usbdev->devpath, i); in usb_kbd_irq()
170 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_event() local
175 spin_lock_irqsave(&kbd->leds_lock, flags); in usb_kbd_event()
176 …kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3)… in usb_kbd_event()
180 if (kbd->led_urb_submitted){ in usb_kbd_event()
181 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
185 if (*(kbd->leds) == kbd->newleds){ in usb_kbd_event()
186 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
190 *(kbd->leds) = kbd->newleds; in usb_kbd_event()
192 kbd->led->dev = kbd->usbdev; in usb_kbd_event()
193 if (usb_submit_urb(kbd->led, GFP_ATOMIC)) in usb_kbd_event()
196 kbd->led_urb_submitted = true; in usb_kbd_event()
198 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_event()
206 struct usb_kbd *kbd = urb->context; in usb_kbd_led() local
212 spin_lock_irqsave(&kbd->leds_lock, flags); in usb_kbd_led()
214 if (*(kbd->leds) == kbd->newleds){ in usb_kbd_led()
215 kbd->led_urb_submitted = false; in usb_kbd_led()
216 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_led()
220 *(kbd->leds) = kbd->newleds; in usb_kbd_led()
222 kbd->led->dev = kbd->usbdev; in usb_kbd_led()
223 if (usb_submit_urb(kbd->led, GFP_ATOMIC)){ in usb_kbd_led()
225 kbd->led_urb_submitted = false; in usb_kbd_led()
227 spin_unlock_irqrestore(&kbd->leds_lock, flags); in usb_kbd_led()
233 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_open() local
235 kbd->irq->dev = kbd->usbdev; in usb_kbd_open()
236 if (usb_submit_urb(kbd->irq, GFP_KERNEL)) in usb_kbd_open()
244 struct usb_kbd *kbd = input_get_drvdata(dev); in usb_kbd_close() local
246 usb_kill_urb(kbd->irq); in usb_kbd_close()
249 static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd) in usb_kbd_alloc_mem() argument
251 if (!(kbd->irq = usb_alloc_urb(0, GFP_KERNEL))) in usb_kbd_alloc_mem()
253 if (!(kbd->led = usb_alloc_urb(0, GFP_KERNEL))) in usb_kbd_alloc_mem()
255 if (!(kbd->new = usb_alloc_coherent(dev, 8, GFP_ATOMIC, &kbd->new_dma))) in usb_kbd_alloc_mem()
257 if (!(kbd->cr = kmalloc(sizeof(struct usb_ctrlrequest), GFP_KERNEL))) in usb_kbd_alloc_mem()
259 if (!(kbd->leds = usb_alloc_coherent(dev, 1, GFP_ATOMIC, &kbd->leds_dma))) in usb_kbd_alloc_mem()
265 static void usb_kbd_free_mem(struct usb_device *dev, struct usb_kbd *kbd) in usb_kbd_free_mem() argument
267 usb_free_urb(kbd->irq); in usb_kbd_free_mem()
268 usb_free_urb(kbd->led); in usb_kbd_free_mem()
269 usb_free_coherent(dev, 8, kbd->new, kbd->new_dma); in usb_kbd_free_mem()
270 kfree(kbd->cr); in usb_kbd_free_mem()
271 usb_free_coherent(dev, 1, kbd->leds, kbd->leds_dma); in usb_kbd_free_mem()
280 struct usb_kbd *kbd; in usb_kbd_probe() local
297 kbd = kzalloc(sizeof(struct usb_kbd), GFP_KERNEL); in usb_kbd_probe()
299 if (!kbd || !input_dev) in usb_kbd_probe()
302 if (usb_kbd_alloc_mem(dev, kbd)) in usb_kbd_probe()
305 kbd->usbdev = dev; in usb_kbd_probe()
306 kbd->dev = input_dev; in usb_kbd_probe()
307 spin_lock_init(&kbd->leds_lock); in usb_kbd_probe()
310 strlcpy(kbd->name, dev->manufacturer, sizeof(kbd->name)); in usb_kbd_probe()
314 strlcat(kbd->name, " ", sizeof(kbd->name)); in usb_kbd_probe()
315 strlcat(kbd->name, dev->product, sizeof(kbd->name)); in usb_kbd_probe()
318 if (!strlen(kbd->name)) in usb_kbd_probe()
319 snprintf(kbd->name, sizeof(kbd->name), in usb_kbd_probe()
324 usb_make_path(dev, kbd->phys, sizeof(kbd->phys)); in usb_kbd_probe()
325 strlcat(kbd->phys, "/input0", sizeof(kbd->phys)); in usb_kbd_probe()
327 input_dev->name = kbd->name; in usb_kbd_probe()
328 input_dev->phys = kbd->phys; in usb_kbd_probe()
332 input_set_drvdata(input_dev, kbd); in usb_kbd_probe()
348 usb_fill_int_urb(kbd->irq, dev, pipe, in usb_kbd_probe()
349 kbd->new, (maxp > 8 ? 8 : maxp), in usb_kbd_probe()
350 usb_kbd_irq, kbd, endpoint->bInterval); in usb_kbd_probe()
351 kbd->irq->transfer_dma = kbd->new_dma; in usb_kbd_probe()
352 kbd->irq->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_kbd_probe()
354 kbd->cr->bRequestType = USB_TYPE_CLASS | USB_RECIP_INTERFACE; in usb_kbd_probe()
355 kbd->cr->bRequest = 0x09; in usb_kbd_probe()
356 kbd->cr->wValue = cpu_to_le16(0x200); in usb_kbd_probe()
357 kbd->cr->wIndex = cpu_to_le16(interface->desc.bInterfaceNumber); in usb_kbd_probe()
358 kbd->cr->wLength = cpu_to_le16(1); in usb_kbd_probe()
360 usb_fill_control_urb(kbd->led, dev, usb_sndctrlpipe(dev, 0), in usb_kbd_probe()
361 (void *) kbd->cr, kbd->leds, 1, in usb_kbd_probe()
362 usb_kbd_led, kbd); in usb_kbd_probe()
363 kbd->led->transfer_dma = kbd->leds_dma; in usb_kbd_probe()
364 kbd->led->transfer_flags |= URB_NO_TRANSFER_DMA_MAP; in usb_kbd_probe()
366 error = input_register_device(kbd->dev); in usb_kbd_probe()
370 usb_set_intfdata(iface, kbd); in usb_kbd_probe()
375 usb_kbd_free_mem(dev, kbd); in usb_kbd_probe()
378 kfree(kbd); in usb_kbd_probe()
384 struct usb_kbd *kbd = usb_get_intfdata (intf); in usb_kbd_disconnect() local
387 if (kbd) { in usb_kbd_disconnect()
388 usb_kill_urb(kbd->irq); in usb_kbd_disconnect()
389 input_unregister_device(kbd->dev); in usb_kbd_disconnect()
390 usb_kill_urb(kbd->led); in usb_kbd_disconnect()
391 usb_kbd_free_mem(interface_to_usbdev(intf), kbd); in usb_kbd_disconnect()
392 kfree(kbd); in usb_kbd_disconnect()