diff options
Diffstat (limited to 'drivers/media/video/se401.c')
-rw-r--r-- | drivers/media/video/se401.c | 216 |
1 files changed, 108 insertions, 108 deletions
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index f03ea7f8959..a846ebc78cd 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) | 4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) |
5 | * | 5 | * |
6 | * Still somewhat based on the Linux ov511 driver. | 6 | * Still somewhat based on the Linux ov511 driver. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
10 | * Free Software Foundation; either version 2 of the License, or (at your | 10 | * Free Software Foundation; either version 2 of the License, or (at your |
@@ -114,16 +114,16 @@ static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req, | |||
114 | unsigned short value, unsigned char *cp, int size) | 114 | unsigned short value, unsigned char *cp, int size) |
115 | { | 115 | { |
116 | return usb_control_msg ( | 116 | return usb_control_msg ( |
117 | se401->dev, | 117 | se401->dev, |
118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), | 118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), |
119 | req, | 119 | req, |
120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
121 | value, | 121 | value, |
122 | 0, | 122 | 0, |
123 | cp, | 123 | cp, |
124 | size, | 124 | size, |
125 | 1000 | 125 | 1000 |
126 | ); | 126 | ); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | 129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, |
@@ -140,30 +140,30 @@ static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | |||
140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
141 | param, | 141 | param, |
142 | selector, | 142 | selector, |
143 | NULL, | 143 | NULL, |
144 | 0, | 144 | 0, |
145 | 1000 | 145 | 1000 |
146 | ); | 146 | ); |
147 | } | 147 | } |
148 | 148 | ||
149 | static unsigned short se401_get_feature(struct usb_se401 *se401, | 149 | static unsigned short se401_get_feature(struct usb_se401 *se401, |
150 | unsigned short selector) | 150 | unsigned short selector) |
151 | { | 151 | { |
152 | /* For 'set' the selecetor should be in index, not sure if the spec is | 152 | /* For 'set' the selecetor should be in index, not sure if the spec is |
153 | wrong here to.... | 153 | wrong here to.... |
154 | */ | 154 | */ |
155 | unsigned char cp[2]; | 155 | unsigned char cp[2]; |
156 | usb_control_msg ( | 156 | usb_control_msg ( |
157 | se401->dev, | 157 | se401->dev, |
158 | usb_rcvctrlpipe(se401->dev, 0), | 158 | usb_rcvctrlpipe(se401->dev, 0), |
159 | SE401_REQ_GET_EXT_FEATURE, | 159 | SE401_REQ_GET_EXT_FEATURE, |
160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
161 | 0, | 161 | 0, |
162 | selector, | 162 | selector, |
163 | cp, | 163 | cp, |
164 | 2, | 164 | 2, |
165 | 1000 | 165 | 1000 |
166 | ); | 166 | ); |
167 | return cp[0]+cp[1]*256; | 167 | return cp[0]+cp[1]*256; |
168 | } | 168 | } |
169 | 169 | ||
@@ -183,14 +183,14 @@ static int se401_send_pict(struct usb_se401 *se401) | |||
183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ | 183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ |
184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ | 184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ |
185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ | 185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) | 190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) |
191 | { | 191 | { |
192 | int integration=brightness<<5; | 192 | int integration=brightness<<5; |
193 | 193 | ||
194 | if (flickerless==50) { | 194 | if (flickerless==50) { |
195 | integration=integration-integration%106667; | 195 | integration=integration-integration%106667; |
196 | } | 196 | } |
@@ -255,11 +255,11 @@ static void se401_auto_resetlevel(struct usb_se401 *se401) | |||
255 | /* For some reason this normally read-only register doesn't get reset | 255 | /* For some reason this normally read-only register doesn't get reset |
256 | to zero after reading them just once... | 256 | to zero after reading them just once... |
257 | */ | 257 | */ |
258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); | 258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); |
259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); | 260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); |
261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + | 262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + |
263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + | 264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + |
265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
@@ -287,12 +287,12 @@ static void se401_button_irq(struct urb *urb, struct pt_regs *regs) | |||
287 | { | 287 | { |
288 | struct usb_se401 *se401 = urb->context; | 288 | struct usb_se401 *se401 = urb->context; |
289 | int status; | 289 | int status; |
290 | 290 | ||
291 | if (!se401->dev) { | 291 | if (!se401->dev) { |
292 | info("ohoh: device vapourished"); | 292 | info("ohoh: device vapourished"); |
293 | return; | 293 | return; |
294 | } | 294 | } |
295 | 295 | ||
296 | switch (urb->status) { | 296 | switch (urb->status) { |
297 | case 0: | 297 | case 0: |
298 | /* success */ | 298 | /* success */ |
@@ -368,7 +368,7 @@ static void se401_video_irq(struct urb *urb, struct pt_regs *regs) | |||
368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { | 368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { |
369 | if (waitqueue_active(&se401->wq)) { | 369 | if (waitqueue_active(&se401->wq)) { |
370 | wake_up_interruptible(&se401->wq); | 370 | wake_up_interruptible(&se401->wq); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
@@ -433,8 +433,8 @@ static int se401_start_stream(struct usb_se401 *se401) | |||
433 | int err=0, i; | 433 | int err=0, i; |
434 | se401->streaming=1; | 434 | se401->streaming=1; |
435 | 435 | ||
436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
438 | 438 | ||
439 | /* Set picture settings */ | 439 | /* Set picture settings */ |
440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ | 440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ |
@@ -571,7 +571,7 @@ static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | /* First three are absolute, all others relative. | 573 | /* First three are absolute, all others relative. |
574 | * Format is rgb from right to left (mirrorred image), | 574 | * Format is rgb from right to left (mirrorred image), |
575 | * we flip it to get bgr from left to right. */ | 575 | * we flip it to get bgr from left to right. */ |
576 | if (frame->curlinepix < 3) { | 576 | if (frame->curlinepix < 3) { |
577 | *(frame->curline-frame->curlinepix)=1+data*4; | 577 | *(frame->curline-frame->curlinepix)=1+data*4; |
@@ -703,7 +703,7 @@ static inline void decode_bayer (struct usb_se401 *se401, struct se401_scratch * | |||
703 | int width=se401->cwidth; | 703 | int width=se401->cwidth; |
704 | int blineoffset=0, bline; | 704 | int blineoffset=0, bline; |
705 | int linelength=width*3, i; | 705 | int linelength=width*3, i; |
706 | 706 | ||
707 | 707 | ||
708 | if (frame->curpix==0) { | 708 | if (frame->curpix==0) { |
709 | if (frame->grabstate==FRAME_READY) { | 709 | if (frame->grabstate==FRAME_READY) { |
@@ -831,7 +831,7 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) | |||
831 | se401->nullpackets=0; | 831 | se401->nullpackets=0; |
832 | info("to many null length packets, restarting capture"); | 832 | info("to many null length packets, restarting capture"); |
833 | se401_stop_stream(se401); | 833 | se401_stop_stream(se401); |
834 | se401_start_stream(se401); | 834 | se401_start_stream(se401); |
835 | } else { | 835 | } else { |
836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { | 836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { |
837 | se401->frame[framenr].grabstate=FRAME_ERROR; | 837 | se401->frame[framenr].grabstate=FRAME_ERROR; |
@@ -866,7 +866,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
866 | { | 866 | { |
867 | int i; | 867 | int i; |
868 | 868 | ||
869 | se401->dev = NULL; | 869 | se401->dev = NULL; |
870 | 870 | ||
871 | for (i=0; i<SE401_NUMSBUF; i++) | 871 | for (i=0; i<SE401_NUMSBUF; i++) |
872 | if (se401->urb[i]) { | 872 | if (se401->urb[i]) { |
@@ -882,9 +882,9 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
882 | usb_kill_urb(se401->inturb); | 882 | usb_kill_urb(se401->inturb); |
883 | usb_free_urb(se401->inturb); | 883 | usb_free_urb(se401->inturb); |
884 | } | 884 | } |
885 | info("%s disconnected", se401->camera_name); | 885 | info("%s disconnected", se401->camera_name); |
886 | 886 | ||
887 | /* Free the memory */ | 887 | /* Free the memory */ |
888 | kfree(se401->width); | 888 | kfree(se401->width); |
889 | kfree(se401->height); | 889 | kfree(se401->height); |
890 | kfree(se401); | 890 | kfree(se401); |
@@ -910,7 +910,7 @@ static int se401_open(struct inode *inode, struct file *file) | |||
910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
911 | if (se401->fbuf) | 911 | if (se401->fbuf) |
912 | file->private_data = dev; | 912 | file->private_data = dev; |
913 | else | 913 | else |
914 | err = -ENOMEM; | 914 | err = -ENOMEM; |
915 | se401->user = !err; | 915 | se401->user = !err; |
916 | 916 | ||
@@ -920,11 +920,11 @@ static int se401_open(struct inode *inode, struct file *file) | |||
920 | static int se401_close(struct inode *inode, struct file *file) | 920 | static int se401_close(struct inode *inode, struct file *file) |
921 | { | 921 | { |
922 | struct video_device *dev = file->private_data; | 922 | struct video_device *dev = file->private_data; |
923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
924 | int i; | 924 | int i; |
925 | 925 | ||
926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); | 926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); |
927 | if (se401->removed) { | 927 | if (se401->removed) { |
928 | usb_se401_remove_disconnected(se401); | 928 | usb_se401_remove_disconnected(se401); |
929 | info("device unregistered"); | 929 | info("device unregistered"); |
930 | } else { | 930 | } else { |
@@ -942,12 +942,12 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
942 | unsigned int cmd, void *arg) | 942 | unsigned int cmd, void *arg) |
943 | { | 943 | { |
944 | struct video_device *vdev = file->private_data; | 944 | struct video_device *vdev = file->private_data; |
945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; | 945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; |
946 | 946 | ||
947 | if (!se401->dev) | 947 | if (!se401->dev) |
948 | return -EIO; | 948 | return -EIO; |
949 | 949 | ||
950 | switch (cmd) { | 950 | switch (cmd) { |
951 | case VIDIOCGCAP: | 951 | case VIDIOCGCAP: |
952 | { | 952 | { |
953 | struct video_capability *b = arg; | 953 | struct video_capability *b = arg; |
@@ -981,8 +981,8 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
981 | return -EINVAL; | 981 | return -EINVAL; |
982 | return 0; | 982 | return 0; |
983 | } | 983 | } |
984 | case VIDIOCGPICT: | 984 | case VIDIOCGPICT: |
985 | { | 985 | { |
986 | struct video_picture *p = arg; | 986 | struct video_picture *p = arg; |
987 | 987 | ||
988 | se401_get_pict(se401, p); | 988 | se401_get_pict(se401, p); |
@@ -1007,7 +1007,7 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1007 | if (se401_set_size(se401, vw->width, vw->height)) | 1007 | if (se401_set_size(se401, vw->width, vw->height)) |
1008 | return -EINVAL; | 1008 | return -EINVAL; |
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | case VIDIOCGWIN: | 1011 | case VIDIOCGWIN: |
1012 | { | 1012 | { |
1013 | struct video_window *vw = arg; | 1013 | struct video_window *vw = arg; |
@@ -1095,11 +1095,11 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1095 | case VIDIOCGAUDIO: | 1095 | case VIDIOCGAUDIO: |
1096 | case VIDIOCSAUDIO: | 1096 | case VIDIOCSAUDIO: |
1097 | return -EINVAL; | 1097 | return -EINVAL; |
1098 | default: | 1098 | default: |
1099 | return -ENOIOCTLCMD; | 1099 | return -ENOIOCTLCMD; |
1100 | } /* end switch */ | 1100 | } /* end switch */ |
1101 | 1101 | ||
1102 | return 0; | 1102 | return 0; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | static int se401_ioctl(struct inode *inode, struct file *file, | 1105 | static int se401_ioctl(struct inode *inode, struct file *file, |
@@ -1142,7 +1142,7 @@ static ssize_t se401_read(struct file *file, char __user *buf, | |||
1142 | 1142 | ||
1143 | se401->frame[0].grabstate=FRAME_UNUSED; | 1143 | se401->frame[0].grabstate=FRAME_UNUSED; |
1144 | if (ret) | 1144 | if (ret) |
1145 | return ret; | 1145 | return ret; |
1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) | 1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) |
1147 | return -EFAULT; | 1147 | return -EFAULT; |
1148 | 1148 | ||
@@ -1183,24 +1183,24 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma) | |||
1183 | } | 1183 | } |
1184 | mutex_unlock(&se401->lock); | 1184 | mutex_unlock(&se401->lock); |
1185 | 1185 | ||
1186 | return 0; | 1186 | return 0; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | static struct file_operations se401_fops = { | 1189 | static struct file_operations se401_fops = { |
1190 | .owner = THIS_MODULE, | 1190 | .owner = THIS_MODULE, |
1191 | .open = se401_open, | 1191 | .open = se401_open, |
1192 | .release = se401_close, | 1192 | .release = se401_close, |
1193 | .read = se401_read, | 1193 | .read = se401_read, |
1194 | .mmap = se401_mmap, | 1194 | .mmap = se401_mmap, |
1195 | .ioctl = se401_ioctl, | 1195 | .ioctl = se401_ioctl, |
1196 | .compat_ioctl = v4l_compat_ioctl32, | 1196 | .compat_ioctl = v4l_compat_ioctl32, |
1197 | .llseek = no_llseek, | 1197 | .llseek = no_llseek, |
1198 | }; | 1198 | }; |
1199 | static struct video_device se401_template = { | 1199 | static struct video_device se401_template = { |
1200 | .owner = THIS_MODULE, | 1200 | .owner = THIS_MODULE, |
1201 | .name = "se401 USB camera", | 1201 | .name = "se401 USB camera", |
1202 | .type = VID_TYPE_CAPTURE, | 1202 | .type = VID_TYPE_CAPTURE, |
1203 | .hardware = VID_HARDWARE_SE401, | 1203 | .hardware = VID_HARDWARE_SE401, |
1204 | .fops = &se401_fops, | 1204 | .fops = &se401_fops, |
1205 | }; | 1205 | }; |
1206 | 1206 | ||
@@ -1209,12 +1209,12 @@ static struct video_device se401_template = { | |||
1209 | /***************************/ | 1209 | /***************************/ |
1210 | static int se401_init(struct usb_se401 *se401, int button) | 1210 | static int se401_init(struct usb_se401 *se401, int button) |
1211 | { | 1211 | { |
1212 | int i=0, rc; | 1212 | int i=0, rc; |
1213 | unsigned char cp[0x40]; | 1213 | unsigned char cp[0x40]; |
1214 | char temp[200]; | 1214 | char temp[200]; |
1215 | 1215 | ||
1216 | /* led on */ | 1216 | /* led on */ |
1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1218 | 1218 | ||
1219 | /* get camera descriptor */ | 1219 | /* get camera descriptor */ |
1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); | 1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); |
@@ -1254,7 +1254,7 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1254 | return 1; | 1254 | return 1; |
1255 | } | 1255 | } |
1256 | /* set output mode (BAYER) */ | 1256 | /* set output mode (BAYER) */ |
1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); | 1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); |
1258 | 1258 | ||
1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); | 1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); |
1260 | se401->brightness=cp[0]+cp[1]*256; | 1260 | se401->brightness=cp[0]+cp[1]*256; |
@@ -1292,71 +1292,71 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1292 | } else | 1292 | } else |
1293 | se401->inturb=NULL; | 1293 | se401->inturb=NULL; |
1294 | 1294 | ||
1295 | /* Flash the led */ | 1295 | /* Flash the led */ |
1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); | 1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); |
1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); | 1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); |
1300 | 1300 | ||
1301 | return 0; | 1301 | return 0; |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | static int se401_probe(struct usb_interface *intf, | 1304 | static int se401_probe(struct usb_interface *intf, |
1305 | const struct usb_device_id *id) | 1305 | const struct usb_device_id *id) |
1306 | { | 1306 | { |
1307 | struct usb_device *dev = interface_to_usbdev(intf); | 1307 | struct usb_device *dev = interface_to_usbdev(intf); |
1308 | struct usb_interface_descriptor *interface; | 1308 | struct usb_interface_descriptor *interface; |
1309 | struct usb_se401 *se401; | 1309 | struct usb_se401 *se401; |
1310 | char *camera_name=NULL; | 1310 | char *camera_name=NULL; |
1311 | int button=1; | 1311 | int button=1; |
1312 | 1312 | ||
1313 | /* We don't handle multi-config cameras */ | 1313 | /* We don't handle multi-config cameras */ |
1314 | if (dev->descriptor.bNumConfigurations != 1) | 1314 | if (dev->descriptor.bNumConfigurations != 1) |
1315 | return -ENODEV; | 1315 | return -ENODEV; |
1316 | 1316 | ||
1317 | interface = &intf->cur_altsetting->desc; | 1317 | interface = &intf->cur_altsetting->desc; |
1318 | 1318 | ||
1319 | /* Is it an se401? */ | 1319 | /* Is it an se401? */ |
1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && | 1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && |
1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { | 1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { |
1322 | camera_name="Endpoints/Aox SE401"; | 1322 | camera_name="Endpoints/Aox SE401"; |
1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && | 1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && |
1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { | 1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { |
1325 | camera_name="Philips PCVC665K"; | 1325 | camera_name="Philips PCVC665K"; |
1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { | 1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { |
1328 | camera_name="Kensington VideoCAM 67014"; | 1328 | camera_name="Kensington VideoCAM 67014"; |
1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { | 1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { |
1331 | camera_name="Kensington VideoCAM 6701(5/7)"; | 1331 | camera_name="Kensington VideoCAM 6701(5/7)"; |
1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { | 1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { |
1334 | camera_name="Kensington VideoCAM 67016"; | 1334 | camera_name="Kensington VideoCAM 67016"; |
1335 | button=0; | 1335 | button=0; |
1336 | } else | 1336 | } else |
1337 | return -ENODEV; | 1337 | return -ENODEV; |
1338 | 1338 | ||
1339 | /* Checking vendor/product should be enough, but what the hell */ | 1339 | /* Checking vendor/product should be enough, but what the hell */ |
1340 | if (interface->bInterfaceClass != 0x00) | 1340 | if (interface->bInterfaceClass != 0x00) |
1341 | return -ENODEV; | 1341 | return -ENODEV; |
1342 | if (interface->bInterfaceSubClass != 0x00) | 1342 | if (interface->bInterfaceSubClass != 0x00) |
1343 | return -ENODEV; | 1343 | return -ENODEV; |
1344 | 1344 | ||
1345 | /* We found one */ | 1345 | /* We found one */ |
1346 | info("SE401 camera found: %s", camera_name); | 1346 | info("SE401 camera found: %s", camera_name); |
1347 | 1347 | ||
1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { | 1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { |
1349 | err("couldn't kmalloc se401 struct"); | 1349 | err("couldn't kmalloc se401 struct"); |
1350 | return -ENOMEM; | 1350 | return -ENOMEM; |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | se401->dev = dev; | 1353 | se401->dev = dev; |
1354 | se401->iface = interface->bInterfaceNumber; | 1354 | se401->iface = interface->bInterfaceNumber; |
1355 | se401->camera_name = camera_name; | 1355 | se401->camera_name = camera_name; |
1356 | 1356 | ||
1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); | 1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); |
1358 | 1358 | ||
1359 | if (se401_init(se401, button)) { | 1359 | if (se401_init(se401, button)) { |
1360 | kfree(se401); | 1360 | kfree(se401); |
1361 | return -EIO; | 1361 | return -EIO; |
1362 | } | 1362 | } |
@@ -1375,7 +1375,7 @@ static int se401_probe(struct usb_interface *intf, | |||
1375 | info("registered new video device: video%d", se401->vdev.minor); | 1375 | info("registered new video device: video%d", se401->vdev.minor); |
1376 | 1376 | ||
1377 | usb_set_intfdata (intf, se401); | 1377 | usb_set_intfdata (intf, se401); |
1378 | return 0; | 1378 | return 0; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | static void se401_disconnect(struct usb_interface *intf) | 1381 | static void se401_disconnect(struct usb_interface *intf) |
@@ -1400,10 +1400,10 @@ static void se401_disconnect(struct usb_interface *intf) | |||
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | static struct usb_driver se401_driver = { | 1402 | static struct usb_driver se401_driver = { |
1403 | .name = "se401", | 1403 | .name = "se401", |
1404 | .id_table = device_table, | 1404 | .id_table = device_table, |
1405 | .probe = se401_probe, | 1405 | .probe = se401_probe, |
1406 | .disconnect = se401_disconnect, | 1406 | .disconnect = se401_disconnect, |
1407 | }; | 1407 | }; |
1408 | 1408 | ||
1409 | 1409 | ||