diff options
author | Paul Mackerras <paulus@samba.org> | 2005-10-30 21:37:12 -0500 |
---|---|---|
committer | Paul Mackerras <paulus@samba.org> | 2005-10-30 21:37:12 -0500 |
commit | 23fd07750a789a66fe88cf173d52a18f1a387da4 (patch) | |
tree | 06fdd6df35fdb835abdaa9b754d62f6b84b97250 /drivers/usb/media | |
parent | bd787d438a59266af3c9f6351644c85ef1dd21fe (diff) | |
parent | ed28f96ac1960f30f818374d65be71d2fdf811b0 (diff) |
Merge ../linux-2.6 by hand
Diffstat (limited to 'drivers/usb/media')
-rw-r--r-- | drivers/usb/media/dabusb.c | 3 | ||||
-rw-r--r-- | drivers/usb/media/konicawc.c | 89 |
2 files changed, 62 insertions, 30 deletions
diff --git a/drivers/usb/media/dabusb.c b/drivers/usb/media/dabusb.c index 6ca2fae99d2d..27b23c55bbc7 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/usb/media/dabusb.c | |||
@@ -707,9 +707,8 @@ static struct file_operations dabusb_fops = | |||
707 | }; | 707 | }; |
708 | 708 | ||
709 | static struct usb_class_driver dabusb_class = { | 709 | static struct usb_class_driver dabusb_class = { |
710 | .name = "usb/dabusb%d", | 710 | .name = "dabusb%d", |
711 | .fops = &dabusb_fops, | 711 | .fops = &dabusb_fops, |
712 | .mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, | ||
713 | .minor_base = DABUSB_MINOR, | 712 | .minor_base = DABUSB_MINOR, |
714 | }; | 713 | }; |
715 | 714 | ||
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c index 20ac9e1069d4..9fe2c2710d13 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/usb/media/konicawc.c | |||
@@ -119,7 +119,7 @@ struct konicawc { | |||
119 | int yplanesz; /* Number of bytes in the Y plane */ | 119 | int yplanesz; /* Number of bytes in the Y plane */ |
120 | unsigned int buttonsts:1; | 120 | unsigned int buttonsts:1; |
121 | #ifdef CONFIG_INPUT | 121 | #ifdef CONFIG_INPUT |
122 | struct input_dev input; | 122 | struct input_dev *input; |
123 | char input_physname[64]; | 123 | char input_physname[64]; |
124 | #endif | 124 | #endif |
125 | }; | 125 | }; |
@@ -218,6 +218,57 @@ static void konicawc_adjust_picture(struct uvd *uvd) | |||
218 | konicawc_camera_on(uvd); | 218 | konicawc_camera_on(uvd); |
219 | } | 219 | } |
220 | 220 | ||
221 | #ifdef CONFIG_INPUT | ||
222 | |||
223 | static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev) | ||
224 | { | ||
225 | struct input_dev *input_dev; | ||
226 | |||
227 | usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); | ||
228 | strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); | ||
229 | |||
230 | cam->input = input_dev = input_allocate_device(); | ||
231 | if (!input_dev) { | ||
232 | warn("Not enough memory for camera's input device\n"); | ||
233 | return; | ||
234 | } | ||
235 | |||
236 | input_dev->name = "Konicawc snapshot button"; | ||
237 | input_dev->phys = cam->input_physname; | ||
238 | usb_to_input_id(dev, &input_dev->id); | ||
239 | input_dev->cdev.dev = &dev->dev; | ||
240 | |||
241 | input_dev->evbit[0] = BIT(EV_KEY); | ||
242 | input_dev->keybit[LONG(BTN_0)] = BIT(BTN_0); | ||
243 | |||
244 | input_dev->private = cam; | ||
245 | |||
246 | input_register_device(cam->input); | ||
247 | } | ||
248 | |||
249 | static void konicawc_unregister_input(struct konicawc *cam) | ||
250 | { | ||
251 | if (cam->input) { | ||
252 | input_unregister_device(cam->input); | ||
253 | cam->input = NULL; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | static void konicawc_report_buttonstat(struct konicawc *cam) | ||
258 | { | ||
259 | if (cam->input) { | ||
260 | input_report_key(cam->input, BTN_0, cam->buttonsts); | ||
261 | input_sync(cam->input); | ||
262 | } | ||
263 | } | ||
264 | |||
265 | #else | ||
266 | |||
267 | static inline void konicawc_register_input(struct konicawc *cam, struct usb_device *dev) { } | ||
268 | static inline void konicawc_unregister_input(struct konicawc *cam) { } | ||
269 | static inline void konicawc_report_buttonstat(struct konicawc *cam) { } | ||
270 | |||
271 | #endif /* CONFIG_INPUT */ | ||
221 | 272 | ||
222 | static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct urb *stsurb) | 273 | static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct urb *stsurb) |
223 | { | 274 | { |
@@ -273,10 +324,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
273 | if(button != cam->buttonsts) { | 324 | if(button != cam->buttonsts) { |
274 | DEBUG(2, "button: %sclicked", button ? "" : "un"); | 325 | DEBUG(2, "button: %sclicked", button ? "" : "un"); |
275 | cam->buttonsts = button; | 326 | cam->buttonsts = button; |
276 | #ifdef CONFIG_INPUT | 327 | konicawc_report_buttonstat(cam); |
277 | input_report_key(&cam->input, BTN_0, cam->buttonsts); | ||
278 | input_sync(&cam->input); | ||
279 | #endif | ||
280 | } | 328 | } |
281 | 329 | ||
282 | if(sts == 0x01) { /* drop frame */ | 330 | if(sts == 0x01) { /* drop frame */ |
@@ -645,9 +693,9 @@ static int konicawc_set_video_mode(struct uvd *uvd, struct video_window *vw) | |||
645 | RingQueue_Flush(&uvd->dp); | 693 | RingQueue_Flush(&uvd->dp); |
646 | cam->lastframe = -2; | 694 | cam->lastframe = -2; |
647 | if(uvd->curframe != -1) { | 695 | if(uvd->curframe != -1) { |
648 | uvd->frame[uvd->curframe].curline = 0; | 696 | uvd->frame[uvd->curframe].curline = 0; |
649 | uvd->frame[uvd->curframe].seqRead_Length = 0; | 697 | uvd->frame[uvd->curframe].seqRead_Length = 0; |
650 | uvd->frame[uvd->curframe].seqRead_Index = 0; | 698 | uvd->frame[uvd->curframe].seqRead_Index = 0; |
651 | } | 699 | } |
652 | 700 | ||
653 | konicawc_start_data(uvd); | 701 | konicawc_start_data(uvd); |
@@ -718,7 +766,6 @@ static void konicawc_configure_video(struct uvd *uvd) | |||
718 | DEBUG(1, "setting initial values"); | 766 | DEBUG(1, "setting initial values"); |
719 | } | 767 | } |
720 | 768 | ||
721 | |||
722 | static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id *devid) | 769 | static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id *devid) |
723 | { | 770 | { |
724 | struct usb_device *dev = interface_to_usbdev(intf); | 771 | struct usb_device *dev = interface_to_usbdev(intf); |
@@ -839,21 +886,8 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id | |||
839 | err("usbvideo_RegisterVideoDevice() failed."); | 886 | err("usbvideo_RegisterVideoDevice() failed."); |
840 | uvd = NULL; | 887 | uvd = NULL; |
841 | } | 888 | } |
842 | #ifdef CONFIG_INPUT | 889 | |
843 | /* Register input device for button */ | 890 | konicawc_register_input(cam, dev); |
844 | memset(&cam->input, 0, sizeof(struct input_dev)); | ||
845 | cam->input.name = "Konicawc snapshot button"; | ||
846 | cam->input.private = cam; | ||
847 | cam->input.evbit[0] = BIT(EV_KEY); | ||
848 | cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); | ||
849 | usb_to_input_id(dev, &cam->input.id); | ||
850 | input_register_device(&cam->input); | ||
851 | |||
852 | usb_make_path(dev, cam->input_physname, 56); | ||
853 | strcat(cam->input_physname, "/input0"); | ||
854 | cam->input.phys = cam->input_physname; | ||
855 | info("konicawc: %s on %s\n", cam->input.name, cam->input.phys); | ||
856 | #endif | ||
857 | } | 891 | } |
858 | 892 | ||
859 | if (uvd) { | 893 | if (uvd) { |
@@ -869,10 +903,9 @@ static void konicawc_free_uvd(struct uvd *uvd) | |||
869 | int i; | 903 | int i; |
870 | struct konicawc *cam = (struct konicawc *)uvd->user_data; | 904 | struct konicawc *cam = (struct konicawc *)uvd->user_data; |
871 | 905 | ||
872 | #ifdef CONFIG_INPUT | 906 | konicawc_unregister_input(cam); |
873 | input_unregister_device(&cam->input); | 907 | |
874 | #endif | 908 | for (i = 0; i < USBVIDEO_NUMSBUF; i++) { |
875 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | ||
876 | usb_free_urb(cam->sts_urb[i]); | 909 | usb_free_urb(cam->sts_urb[i]); |
877 | cam->sts_urb[i] = NULL; | 910 | cam->sts_urb[i] = NULL; |
878 | } | 911 | } |