usbkbd.c (6675c5bd2a0ec223888b42cf97bc7dc900bf31fb) usbkbd.c (e071298589418076ef0a9813677f2d7032b65baa)
1/*
2 * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik
5 *
6 * USB HIDBP Keyboard support
7 */
8

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

128 err ("can't resubmit intr, %s-%s/input0, status %d",
129 kbd->usbdev->bus->bus_name,
130 kbd->usbdev->devpath, i);
131}
132
133static int usb_kbd_event(struct input_dev *dev, unsigned int type,
134 unsigned int code, int value)
135{
1/*
2 * $Id: usbkbd.c,v 1.27 2001/12/27 10:37:41 vojtech Exp $
3 *
4 * Copyright (c) 1999-2001 Vojtech Pavlik
5 *
6 * USB HIDBP Keyboard support
7 */
8

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

128 err ("can't resubmit intr, %s-%s/input0, status %d",
129 kbd->usbdev->bus->bus_name,
130 kbd->usbdev->devpath, i);
131}
132
133static int usb_kbd_event(struct input_dev *dev, unsigned int type,
134 unsigned int code, int value)
135{
136 struct usb_kbd *kbd = dev->private;
136 struct usb_kbd *kbd = input_get_drvdata(dev);
137
138 if (type != EV_LED)
139 return -1;
140
137
138 if (type != EV_LED)
139 return -1;
140
141
142 kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3) |
143 (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_CAPSL, dev->led) << 1) |
144 (!!test_bit(LED_NUML, dev->led));
145
146 if (kbd->led->status == -EINPROGRESS)
147 return 0;
148
149 if (*(kbd->leds) == kbd->newleds)

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

170 *(kbd->leds) = kbd->newleds;
171 kbd->led->dev = kbd->usbdev;
172 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
173 err("usb_submit_urb(leds) failed");
174}
175
176static int usb_kbd_open(struct input_dev *dev)
177{
141 kbd->newleds = (!!test_bit(LED_KANA, dev->led) << 3) | (!!test_bit(LED_COMPOSE, dev->led) << 3) |
142 (!!test_bit(LED_SCROLLL, dev->led) << 2) | (!!test_bit(LED_CAPSL, dev->led) << 1) |
143 (!!test_bit(LED_NUML, dev->led));
144
145 if (kbd->led->status == -EINPROGRESS)
146 return 0;
147
148 if (*(kbd->leds) == kbd->newleds)

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

169 *(kbd->leds) = kbd->newleds;
170 kbd->led->dev = kbd->usbdev;
171 if (usb_submit_urb(kbd->led, GFP_ATOMIC))
172 err("usb_submit_urb(leds) failed");
173}
174
175static int usb_kbd_open(struct input_dev *dev)
176{
178 struct usb_kbd *kbd = dev->private;
177 struct usb_kbd *kbd = input_get_drvdata(dev);
179
180 kbd->irq->dev = kbd->usbdev;
181 if (usb_submit_urb(kbd->irq, GFP_KERNEL))
182 return -EIO;
183
184 return 0;
185}
186
187static void usb_kbd_close(struct input_dev *dev)
188{
178
179 kbd->irq->dev = kbd->usbdev;
180 if (usb_submit_urb(kbd->irq, GFP_KERNEL))
181 return -EIO;
182
183 return 0;
184}
185
186static void usb_kbd_close(struct input_dev *dev)
187{
189 struct usb_kbd *kbd = dev->private;
188 struct usb_kbd *kbd = input_get_drvdata(dev);
190
191 usb_kill_urb(kbd->irq);
192}
193
194static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
195{
196 if (!(kbd->irq = usb_alloc_urb(0, GFP_KERNEL)))
197 return -1;

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

266 le16_to_cpu(dev->descriptor.idProduct));
267
268 usb_make_path(dev, kbd->phys, sizeof(kbd->phys));
269 strlcpy(kbd->phys, "/input0", sizeof(kbd->phys));
270
271 input_dev->name = kbd->name;
272 input_dev->phys = kbd->phys;
273 usb_to_input_id(dev, &input_dev->id);
189
190 usb_kill_urb(kbd->irq);
191}
192
193static int usb_kbd_alloc_mem(struct usb_device *dev, struct usb_kbd *kbd)
194{
195 if (!(kbd->irq = usb_alloc_urb(0, GFP_KERNEL)))
196 return -1;

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

265 le16_to_cpu(dev->descriptor.idProduct));
266
267 usb_make_path(dev, kbd->phys, sizeof(kbd->phys));
268 strlcpy(kbd->phys, "/input0", sizeof(kbd->phys));
269
270 input_dev->name = kbd->name;
271 input_dev->phys = kbd->phys;
272 usb_to_input_id(dev, &input_dev->id);
274 input_dev->cdev.dev = &iface->dev;
275 input_dev->private = kbd;
273 input_dev->dev.parent = &iface->dev;
276
274
275 input_set_drvdata(input_dev, kbd);
276
277 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
278 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL) | BIT(LED_COMPOSE) | BIT(LED_KANA);
279
280 for (i = 0; i < 255; i++)
281 set_bit(usb_kbd_keycode[i], input_dev->keybit);
282 clear_bit(0, input_dev->keybit);
283
284 input_dev->event = usb_kbd_event;

--- 80 unchanged lines hidden ---
277 input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_LED) | BIT(EV_REP);
278 input_dev->ledbit[0] = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL) | BIT(LED_COMPOSE) | BIT(LED_KANA);
279
280 for (i = 0; i < 255; i++)
281 set_bit(usb_kbd_keycode[i], input_dev->keybit);
282 clear_bit(0, input_dev->keybit);
283
284 input_dev->event = usb_kbd_event;

--- 80 unchanged lines hidden ---