Correcting code style for 6242 webcam start-stop alone
[microdia.git] / microdia-dev.c
blob8759b134ea523cee4a7a1a62d553422904e65138
1 /**
2 * @file microdia-dev.c
3 * @author Nicolas VIVIEN
4 * @date 2008-02-01
5 * @version v0.0.0
7 * @brief Driver for Microdia USB video camera
9 * @note Copyright (C) Nicolas VIVIEN
11 * @par Licences
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include <linux/errno.h>
29 #include <linux/string.h>
30 #include <stdarg.h>
32 #include "microdia.h"
33 #include "sn9c20x.h"
34 #include "ov7670.h"
35 #include "ov965x.h"
36 #include "mt9vx11.h"
37 #include "ov7660.h"
39 int dev_microdia_init_camera(struct usb_microdia *dev)
41 return 0;
44 int dev_microdia_camera_on(struct usb_microdia *dev)
46 int ret = -1;
47 struct usb_device *udev = dev->udev;
49 ret = usb_set_interface(udev, 0, 8);
51 if (ret < 0)
52 UDIA_ERROR("usb_set_interface failed !\n");
54 return ret;
57 int dev_microdia_camera_off(struct usb_microdia *dev)
59 int ret = -1;
60 struct usb_device *udev = dev->udev;
62 ret = usb_set_interface(udev, 0, 0);
64 if (ret < 0)
65 UDIA_ERROR("usb_set_interface failed !\n");
67 return 0;
70 int dev_microdia_camera_settings(struct usb_microdia *dev)
72 dev_microdia_camera_set_contrast(dev);
73 dev_microdia_camera_set_brightness(dev);
74 dev_microdia_camera_set_gamma(dev);
75 dev_microdia_camera_set_exposure(dev);
76 dev_microdia_camera_set_hvflip(dev);
77 dev_microdia_camera_set_sharpness(dev);
78 dev_microdia_camera_set_rgb_gain(dev);
79 dev_microdia_camera_set_auto_exposure(dev);
80 dev_microdia_camera_set_auto_whitebalance(dev);
81 return 0;
84 int dev_microdia_camera_set_contrast(struct usb_microdia *dev)
86 int ret = -ENODEV;
87 if(dev && dev->set_contrast)
88 ret = dev->set_contrast(dev);
89 return ret;
92 int dev_microdia_camera_set_brightness(struct usb_microdia *dev)
94 int ret = -ENODEV;
95 if(dev && dev->set_brightness)
96 ret = dev->set_brightness(dev);
97 return ret;
100 int dev_microdia_camera_set_gamma(struct usb_microdia *dev)
102 int ret = -ENODEV;
103 if(dev && dev->set_gamma)
104 ret = dev->set_gamma(dev);
105 return ret;
108 int dev_microdia_camera_set_exposure(struct usb_microdia *dev)
110 if (dev->set_exposure != NULL) {
111 return dev->set_exposure(dev);
113 return 0;
116 int dev_microdia_camera_set_hvflip(struct usb_microdia *dev)
118 int ret = -ENODEV;
119 if(dev && dev->set_hvflip)
120 ret = dev->set_hvflip(dev);
122 return ret;
125 int dev_microdia_camera_set_sharpness(struct usb_microdia *dev)
127 int ret = -ENODEV;
128 if(dev && dev->set_sharpness)
129 ret = dev->set_sharpness(dev);
131 return ret;
134 int dev_microdia_camera_set_rgb_gain(struct usb_microdia *dev)
136 int ret = -ENODEV;
137 if (dev && dev->set_rgb_gain)
138 ret = dev->set_rgb_gain(dev);
140 return ret;
143 int dev_microdia_camera_set_auto_exposure(struct usb_microdia *dev)
145 int ret = -ENODEV;
146 if(dev && dev->set_auto_exposure)
147 ret = dev->set_auto_exposure(dev);
149 return ret;
152 int dev_microdia_camera_set_auto_whitebalance(struct usb_microdia *dev)
154 int ret = -ENODEV;
155 if(dev && dev->set_auto_whitebalance)
156 ret = dev->set_auto_whitebalance(dev);
158 return ret;
162 /**
163 * @brief From UsbSnoop-plugin-parsed.log
165 * @param dev
167 * @returns
169 int dev_microdia_initialize_device(struct usb_microdia *dev)
171 int ret = -ENODEV;
173 if(dev && dev->initialize)
174 ret = dev->initialize(dev);
176 return ret;
180 * @brief From init-physical-replug.log
182 * @param dev
184 * @returns 0
186 * @author psnel
188 * For SN9C201 with MI1300.
191 int microdia_6240_initialize(struct usb_microdia *dev)
193 int ret = 0;
194 __u8 buf;
196 UDIA_INFO("Initializing camera...\n");
198 ret = usb_microdia_control_read(dev, 0x130d, &buf, 1); /* URB 5 0x81 */
199 UDIA_INFO("...init: read %x, ret = %d\n", buf, ret);
201 ret += usb_microdia_control_read(dev, 0x1040, &buf, 1); /* URB 6 0xe4 */
202 UDIA_INFO("...init: read %x, ret = %d\n", buf, ret);
204 buf = 0x00;
205 ret += usb_microdia_control_write(dev, 0x10c8, &buf, 1); /* URB 7 */
206 UDIA_INFO("...init: write %x, ret = %d\n", buf, ret);
208 /* Interrupt going down (URB 8) */
210 buf = 0x80;
211 ret += usb_microdia_control_write(dev, 0x1020, &buf, 1); /* URB 9 */
212 UDIA_INFO("...init: write %x, ret = %d\n", buf, ret);
214 if (ret < 4) {
215 UDIA_ERROR("One or more errors occured during initialization!\n");
216 return -1;
219 return 0;
223 * @brief From start.log (14 jun 2008)
225 * @param dev
227 * @returns 0
229 * @author psnel
231 * For SN9C201 with MI1300.
234 int microdia_6240_start_stream(struct usb_microdia *dev)
236 int ret = 0;
237 int i;
238 __u16 reg;
239 __u8 buf;
240 __u8 buf24[24];
241 __u8 buf64[64];
242 __u8 buf10e1[21] = { 0x16, 0x00, 0x2d, 0x00, 0x08, 0x00, 0xf1, 0x0f,
243 0xd3, 0x0f, 0x3c, 0x00, 0x36, 0x00, 0xce, 0x0f,
244 0xfc, 0x0f, 0x00, 0x00, 0x00
246 __u8 buf1100[64] = { 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
247 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
248 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
249 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
250 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
251 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
252 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
253 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54
255 UDIA_INFO("Starting camera data stream...\n");
257 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
258 // URB 10 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 8
259 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
260 reg = 0x1066;
261 buf = 0x00;
262 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 12 */
263 if (ret < 0)
264 goto err;
266 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
267 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
269 reg = 0x1007;
270 buf = 0x20;
271 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 14 */
272 if (ret < 0)
273 goto err;
274 reg = 0x1006;
275 buf = 0x00;
276 ret = usb_microdia_control_write(dev, reg, &buf, 1);
277 if (ret < 0)
278 goto err;
279 reg = 0x1000;
280 buf = 0x78;
281 ret = usb_microdia_control_write(dev, reg, &buf, 1);
282 if (ret < 0)
283 goto err;
285 reg = 0x1001;
286 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* cf */
287 if (ret < 0)
288 goto err;
290 reg = 0x1001;
291 buf = 0xc7;
292 ret = usb_microdia_control_write(dev, reg, &buf, 1);
293 if (ret < 0)
294 goto err;
295 reg = 0x1002;
296 buf = 0x18;
297 ret = usb_microdia_control_write(dev, reg, &buf, 1);
298 if (ret < 0)
299 goto err;
301 reg = 0x1007;
302 ret = usb_microdia_control_read(dev, reg, buf24, 7); /* URB 20 << 20 00 ff 81 00 00 00 */
303 if (ret < 0)
304 goto err;
306 reg = 0x1006;
307 buf24[0] = 0x80; buf24[1] = 0xa0;
308 ret = usb_microdia_control_write(dev, reg, buf24, 2);
309 if (ret < 0)
310 goto err;
311 reg = 0x1061;
312 buf = 0x01;
313 ret = usb_microdia_control_write(dev, reg, &buf, 1);
314 if (ret < 0)
315 goto err;
316 reg = 0x1020;
317 buf = 0x80;
318 ret = usb_microdia_control_write(dev, reg, &buf, 1);
319 if (ret < 0)
320 goto err;
321 reg = 0x1067;
322 buf24[0] = 0x40; buf24[1] = 0x30; buf24[2] = 0x20; buf24[3] = 0x10;
323 buf24[4] = 0x08;
324 ret = usb_microdia_control_write(dev, reg, buf24, 5);
325 if (ret < 0)
326 goto err;
327 reg = 0x10c0;
328 buf24[0] = 0x80; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
329 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
330 buf24[8] = 0x03;
331 ret = usb_microdia_control_write(dev, reg, buf24, 9);
332 if (ret < 0)
333 goto err;
334 reg = 0x10e0;
335 buf24[0] = 0x45; buf24[1] = 0x18; buf24[2] = 0x00; buf24[3] = 0x30;
336 buf24[4] = 0x00; buf24[5] = 0x09; buf24[6] = 0x00; buf24[7] = 0xed;
337 buf24[8] = 0x0f; buf24[9] = 0xda; buf24[10] = 0x0f; buf24[11] = 0x3a;
338 buf24[12] = 0x00; buf24[13] = 0x3a; buf24[14] = 0x00; buf24[15] = 0xd0;
339 buf24[16] = 0x0f; buf24[17] = 0xf7; buf24[18] = 0x0f; buf24[19] = 0x00;
340 buf24[20] = 0x00; buf24[21] = 0x00; buf24[22] = 0x60; buf24[23] = 0x0a;
341 ret = usb_microdia_control_write(dev, reg, buf24, 24);
342 if (ret < 0)
343 goto err;
344 reg = 0x10f8;
345 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00;
346 ret = usb_microdia_control_write(dev, reg, buf24, 3);
347 if (ret < 0)
348 goto err;
349 reg = 0x10fb;
350 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
351 buf24[4] = 0x00;
352 ret = usb_microdia_control_write(dev, reg, buf24, 5);
353 if (ret < 0)
354 goto err;
355 reg = 0x1188;
356 buf24[0] = 0x06; buf24[1] = 0x4c; buf24[2] = 0x08;
357 ret = usb_microdia_control_write(dev, reg, buf24, 3);
358 if (ret < 0)
359 goto err;
361 reg = 0x118b;
362 buf24[0] = 0x00; buf24[1] = 0x20; buf24[2] = 0x20; buf24[3] = 0x20;
363 buf24[4] = 0x20; buf24[5] = 0x00; buf24[6] = 0x24; buf24[7] = 0x3b;
364 buf24[8] = 0x4f; buf24[9] = 0x61; buf24[10] = 0x71; buf24[11] = 0x80;
365 buf24[12] = 0x8f; buf24[13] = 0x9d; buf24[14] = 0xab; buf24[15] = 0xb8;
367 buf24[16] = 0xc4; buf24[17] = 0xd1; buf24[18] = 0xdd; buf24[19] = 0xe9;
368 buf24[20] = 0xf4; buf24[21] = 0xff;
369 ret = usb_microdia_control_write(dev, reg, buf24, 22); /* URB 30 */
370 if (ret < 0)
371 goto err;
373 reg = 0x11a1;
374 buf24[0] = 0x00; buf24[1] = 0x00;
375 ret = usb_microdia_control_write(dev, reg, buf24, 2);
376 if (ret < 0)
377 goto err;
379 reg = 0x11b7;
380 buf24[0] = 0x60; buf24[1] = 0x28; buf24[2] = 0x00; buf24[3] = 0x08;
381 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
382 buf24[8] = 0x00;
383 ret = usb_microdia_control_write(dev, reg, buf24, 9);
384 if (ret < 0)
385 goto err;
387 reg = 0x11b8;
388 buf = 0x38;
389 ret = usb_microdia_control_write(dev, reg, &buf, 1);
390 if (ret < 0)
391 goto err;
393 reg = 0x1000;
394 buf = 0x78;
395 ret = usb_microdia_control_write(dev, reg, &buf, 1);
396 if (ret < 0)
397 goto err;
399 reg = 0x10c0;
400 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
401 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
402 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 35..90 --> */
403 if (ret < 0)
404 goto err;
406 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
407 if (ret < 0)
408 goto err;
409 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
410 if (ret < 0)
411 goto err;
413 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
414 buf24[4] = 0x01; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
415 ret = usb_microdia_control_write(dev, reg, buf24, 8);
416 if (ret < 0)
417 goto err;
419 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
420 if (ret < 0)
421 goto err;
422 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
423 if (ret < 0)
424 goto err;
426 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
427 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
428 ret = usb_microdia_control_write(dev, reg, buf24, 8);
429 if (ret < 0)
430 goto err;
432 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
433 if (ret < 0)
434 goto err;
435 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
436 if (ret < 0)
437 goto err;
439 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x01; buf24[3] = 0x00;
440 buf24[4] = 0x0e; buf24[5] = 0x00; buf24[6] = 0x14; buf24[7] = 0x10;
441 ret = usb_microdia_control_write(dev, reg, buf24, 8);
442 if (ret < 0)
443 goto err;
445 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // URB 45 << d0 */
446 if (ret < 0)
447 goto err;
448 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
449 if (ret < 0)
450 goto err;
452 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x03; buf24[3] = 0x03;
453 buf24[4] = 0xc1; buf24[5] = 0x05; buf24[6] = 0x01; buf24[7] = 0x10;
454 ret = usb_microdia_control_write(dev, reg, buf24, 8);
455 if (ret < 0)
456 goto err;
458 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
459 if (ret < 0)
460 goto err;
461 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
462 if (ret < 0)
463 goto err;
465 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
466 buf24[4] = 0x83; buf24[5] = 0x00; buf24[6] = 0x06; buf24[7] = 0x10;
467 ret = usb_microdia_control_write(dev, reg, buf24, 8);
468 if (ret < 0)
469 goto err;
471 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
472 if (ret < 0)
473 goto err;
474 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
475 if (ret < 0)
476 goto err;
478 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
479 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
480 ret = usb_microdia_control_write(dev, reg, buf24, 8);
481 if (ret < 0)
482 goto err;
484 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
485 if (ret < 0)
486 goto err;
487 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
488 if (ret < 0)
489 goto err;
491 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x00;
492 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
493 ret = usb_microdia_control_write(dev, reg, buf24, 8);
494 if (ret < 0)
495 goto err;
497 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
498 if (ret < 0)
499 goto err;
500 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
501 if (ret < 0)
502 goto err;
504 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x0b; buf24[3] = 0x00;
505 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
506 ret = usb_microdia_control_write(dev, reg, buf24, 8);
507 if (ret < 0)
508 goto err;
510 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
511 if (ret < 0)
512 goto err;
513 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
514 if (ret < 0)
515 goto err;
517 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x11; buf24[3] = 0x00;
518 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
519 ret = usb_microdia_control_write(dev, reg, buf24, 8);
520 if (ret < 0)
521 goto err;
523 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
524 if (ret < 0)
525 goto err;
526 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
527 if (ret < 0)
528 goto err;
530 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x1e; buf24[3] = 0x80;
531 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
532 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 65 */
533 if (ret < 0)
534 goto err;
536 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
537 if (ret < 0)
538 goto err;
539 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
540 if (ret < 0)
541 goto err;
543 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
544 buf24[4] = 0x05; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
545 ret = usb_microdia_control_write(dev, reg, buf24, 8);
546 if (ret < 0)
547 goto err;
549 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
550 if (ret < 0)
551 goto err;
552 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
553 if (ret < 0)
554 goto err;
556 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
557 buf24[4] = 0x08; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
558 ret = usb_microdia_control_write(dev, reg, buf24, 8);
559 if (ret < 0)
560 goto err;
562 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
563 if (ret < 0)
564 goto err;
565 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
566 if (ret < 0)
567 goto err;
569 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
570 buf24[4] = 0x14; buf24[5] = 0x00; buf24[6] = 0x08; buf24[7] = 0x10;
571 ret = usb_microdia_control_write(dev, reg, buf24, 8);
572 if (ret < 0)
573 goto err;
575 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
576 if (ret < 0)
577 goto err;
578 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
579 if (ret < 0)
580 goto err;
582 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
583 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
584 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 77 */
585 if (ret < 0)
586 goto err;
588 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
589 if (ret < 0)
590 goto err;
592 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x5f; buf24[3] = 0x89;
593 buf24[4] = 0x04; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
594 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 79 */
595 if (ret < 0)
596 goto err;
598 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
599 if(ret < 0) goto err;
600 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
601 if (ret < 0)
602 goto err;
604 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x60; buf24[3] = 0x00;
605 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
606 ret = usb_microdia_control_write(dev, reg, buf24, 8);
607 if (ret < 0)
608 goto err;
610 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
611 if (ret < 0)
612 goto err;
613 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
614 if (ret < 0)
615 goto err;
617 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x62; buf24[3] = 0x04;
618 buf24[4] = 0x98; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
619 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 85 */
620 if (ret < 0)
621 goto err;
623 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
624 if (ret < 0)
625 goto err;
626 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
627 if (ret < 0)
628 goto err;
630 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x68; buf24[3] = 0x00;
631 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
632 ret = usb_microdia_control_write(dev, reg, buf24, 8);
633 if (ret < 0)
634 goto err;
636 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
637 if (ret < 0)
638 goto err;
639 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
640 if (ret < 0)
641 goto err;
642 /* // <-- 10c0 */
643 reg = 0x10c1;
644 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* URB 91 // << 5d*/
645 if (ret < 0)
646 goto err;
647 buf = 0x50;
648 ret = usb_microdia_control_write(dev, reg, &buf, 1);
649 if (ret < 0)
650 goto err;
652 reg = 0x10c0;
653 buf24[0] = 0x90; buf24[1] = 0x50; buf24[2] = 0x00; buf24[3] = 0x00;
654 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
655 for(i=93; i<=108; i++){
656 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 93..108 */
657 if (ret < 0)
658 goto err;
659 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 9c */
660 if (ret < 0)
661 goto err;
663 ret = usb_microdia_control_write(dev, reg, buf24, 8);
664 if (ret < 0)
665 goto err;
667 buf24[0] = 0x92; /* // change only 1st value */
668 for(i=110; i<=126; i++){
669 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 110..126 */
670 if (ret < 0)
671 goto err;
672 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 9e */
673 if (ret < 0)
674 goto err;
677 reg = 0x10c2;
678 ret = usb_microdia_control_read(dev, reg, buf24, 5); /* // << ff ff ff ff ff */
679 if (ret < 0)
680 goto err;
682 reg = 0x10c1;
683 buf = 0x5d;
684 ret = usb_microdia_control_write(dev, reg, &buf, 1);
685 if (ret < 0)
686 goto err;
688 reg = 0x10e0;
689 buf = 0x47;
690 ret = usb_microdia_control_write(dev, reg, &buf, 1);
691 if (ret < 0)
692 goto err;
693 buf = 0x07;
694 ret = usb_microdia_control_write(dev, reg, &buf, 1);
695 if (ret < 0)
696 goto err;
698 reg = 0x1001;
699 buf = 0xc6;
700 ret = usb_microdia_control_write(dev, reg, &buf, 1);
701 if (ret < 0)
702 goto err;
703 buf = 0xc4;
704 ret = usb_microdia_control_write(dev, reg, &buf, 1);
705 if (ret < 0)
706 goto err;
707 buf = 0x44;
708 ret = usb_microdia_control_write(dev, reg, &buf, 1);
709 if (ret < 0)
710 goto err;
712 reg = 0x1189;
713 buf = 0x0c;
714 ret = usb_microdia_control_write(dev, reg, &buf, 1);
715 if (ret < 0)
716 goto err;
718 buf = 0x00;
719 reg = 0x11bc;
720 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 135..138 */
721 if (ret < 0)
722 goto err;
723 reg = 0x11bd;
724 ret = usb_microdia_control_write(dev, reg, &buf, 1);
725 if (ret < 0)
726 goto err;
727 reg = 0x11be;
728 ret = usb_microdia_control_write(dev, reg, &buf, 1);
729 if (ret < 0)
730 goto err;
731 reg = 0x11bf;
732 ret = usb_microdia_control_write(dev, reg, &buf, 1);
733 if (ret < 0)
734 goto err;
736 reg = 0x10c0;
737 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
738 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
739 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 139 */
740 if (ret < 0)
741 goto err;
743 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
744 if (ret < 0)
745 goto err;
746 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
747 if (ret < 0)
748 goto err;
750 reg = 0x1180;
751 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
752 buf24[4] = 0x28; buf24[5] = 0x3c;
753 ret = usb_microdia_control_write(dev, reg, buf24, 6); /* URB 142 */
754 if (ret < 0)
755 goto err;
757 reg = 0x10fb;
758 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
759 buf24[4] = 0x00;
760 ret = usb_microdia_control_write(dev, reg, buf24, 5);
761 if (ret < 0)
762 goto err;
764 reg = 0x1189;
765 buf = 0x0c;
766 ret = usb_microdia_control_write(dev, reg, &buf, 1);
767 if (ret < 0)
768 goto err;
770 reg = 0x11a1;
771 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
772 ret = usb_microdia_control_write(dev, reg, buf24, 4);
773 if (ret < 0)
774 goto err;
776 reg = 0x11ab;
777 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
778 ret = usb_microdia_control_write(dev, reg, buf24, 4);
779 if (ret < 0)
780 goto err;
782 reg = 0x1000;
783 buf = 0x7c;
784 ret = usb_microdia_control_write(dev, reg, &buf, 1);
785 if (ret < 0)
786 goto err;
788 reg = 0x1002;
789 buf = 0x1c;
790 for(i=148; i<=149; i++){
791 ret = usb_microdia_control_write(dev, reg, &buf, 1);
792 if (ret < 0)
793 goto err;
796 reg = 0x11b8;
797 buf = 0x38;
798 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 150 */
799 if (ret < 0)
800 goto err;
802 reg = 0x118a;
803 buf = 0x05;
804 ret = usb_microdia_control_write(dev, reg, &buf, 1);
805 if (ret < 0)
806 goto err;
808 reg = 0x0395;
809 buf = 0x05;
810 ret = usb_microdia_control_write(dev, reg, &buf, 1);
811 if (ret < 0)
812 goto err;
814 reg = 0x11b8;
815 buf = 0x78;
816 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 153..163 */
817 if (ret < 0)
818 goto err;
819 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
820 if (ret < 0)
821 goto err;
822 buf = 0x79;
823 ret = usb_microdia_control_write(dev, reg, &buf, 1);
824 if (ret < 0)
825 goto err;
826 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
827 if (ret < 0)
828 goto err;
829 buf = 0x7a;
830 ret = usb_microdia_control_write(dev, reg, &buf, 1);
831 if (ret < 0)
832 goto err;
833 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
834 if (ret < 0)
835 goto err;
836 buf = 0x7b;
837 ret = usb_microdia_control_write(dev, reg, &buf, 1);
838 if (ret < 0)
839 goto err;
840 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
841 if (ret < 0)
842 goto err;
843 buf = 0xfc;
844 ret = usb_microdia_control_write(dev, reg, &buf, 1);
845 if (ret < 0)
846 goto err;
847 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
848 if (ret < 0)
849 goto err;
850 buf = 0x78;
851 ret = usb_microdia_control_write(dev, reg, &buf, 1);
852 if (ret < 0)
853 goto err;
854 /* <-- 0x11b8 */
855 reg = 0x10c0;
856 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
857 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
858 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 164..169 */
859 if (ret < 0)
860 goto err;
862 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
863 if (ret < 0)
864 goto err;
865 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
866 if (ret < 0)
867 goto err;
869 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
870 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
871 ret = usb_microdia_control_write(dev, reg, buf24, 8);
872 if (ret < 0)
873 goto err;
875 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
876 if (ret < 0)
877 goto err;
878 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
879 if (ret < 0)
880 goto err;
881 /* <-- 0x10c0 */
882 reg = 0x11ba;
883 buf = 0x0a;
884 ret = usb_microdia_control_write(dev, reg, &buf, 1);
885 if (ret < 0)
886 goto err;
888 buf = 0x00;
889 reg = 0x118c;
890 ret = usb_microdia_control_write(dev, reg, &buf, 1);
891 if (ret < 0)
892 goto err;
893 reg = 0x118d;
894 ret = usb_microdia_control_write(dev, reg, &buf, 1);
895 if (ret < 0)
896 goto err;
897 reg = 0x118e;
898 ret = usb_microdia_control_write(dev, reg, &buf, 1);
899 if (ret < 0)
900 goto err;
901 reg = 0x118f;
902 ret = usb_microdia_control_write(dev, reg, &buf, 1);
903 if (ret < 0)
904 goto err;
906 reg = 0x118b;
907 buf = 0x0a;
908 ret = usb_microdia_control_write(dev, reg, &buf, 1);
909 if (ret < 0)
910 goto err;
912 reg = 0x1190;
913 buf24[0] = 0x08; buf24[1] = 0x2e; buf24[2] = 0x55; buf24[3] = 0x6f;
914 buf24[4] = 0x7f; buf24[5] = 0x8d; buf24[6] = 0x9a; buf24[7] = 0xa6;
915 buf24[8] = 0xb1; buf24[9] = 0xbb; buf24[10] = 0xc5; buf24[11] = 0xce;
916 buf24[12] = 0xd7; buf24[13] = 0xdf; buf24[14] = 0xe8; buf24[15] = 0xef;
917 buf24[16] = 0xf7;
918 ret = usb_microdia_control_write(dev, reg, buf24, 17); /* URB 176 */
919 if (ret < 0)
920 goto err;
922 reg = 0x10e1;
923 for (i = 0; i < 21; i++) /* // zeroes */
924 buf24[i] = 0x00;
925 for (i = 177; i <= 184; i++) {
926 ret = usb_microdia_control_write(dev, reg, buf24, 21); /* URB 177..185 */
927 if (ret < 0)
928 goto err;
930 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* ..URB 185 */
931 if (ret < 0)
932 goto err;
934 reg = 0x10f7;
935 buf = 0x07;
936 ret = usb_microdia_control_write(dev, reg, &buf, 1);
937 if (ret < 0)
938 goto err;
939 reg = 0x10f6;
940 buf = 0x60;
941 ret = usb_microdia_control_write(dev, reg, &buf, 1);
942 if (ret < 0)
943 goto err;
945 reg = 0x10e1;
946 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 188 */
947 if (ret < 0)
948 goto err;
950 reg = 0x10f8;
951 buf = 0x14;
952 ret = usb_microdia_control_write(dev, reg, &buf, 1);
953 if (ret < 0)
954 goto err;
955 reg = 0x10fa;
956 buf = 0xff;
957 ret = usb_microdia_control_write(dev, reg, &buf, 1);
958 if (ret < 0)
959 goto err;
960 reg = 0x10f9;
961 buf = 0x00;
962 ret = usb_microdia_control_write(dev, reg, &buf, 1);
963 if (ret < 0)
964 goto err;
965 reg = 0x10f9;
966 ret = usb_microdia_control_write(dev, reg, &buf, 1);
967 if (ret < 0)
968 goto err;
970 reg = 0x11ba;
971 buf = 0x0a;
972 ret = usb_microdia_control_write(dev, reg, &buf, 1);
973 if (ret < 0)
974 goto err;
976 reg = 0x11bc;
977 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x00;
978 ret = usb_microdia_control_write(dev, reg, buf24, 4);
979 if (ret < 0)
980 goto err;
982 reg = 0x11c0;
983 for (i = 0; i < 48; i++)
984 buf64[i] = 0; /* // zeroes */
985 ret = usb_microdia_control_write(dev, reg, buf64, 48); /* URB 195 */
986 if (ret < 0)
987 goto err;
989 buf = 0x20;
990 reg = 0x118c;
991 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 196..199 */
992 if (ret < 0)
993 goto err;
994 reg = 0x118d;
995 ret = usb_microdia_control_write(dev, reg, &buf, 1);
996 if (ret < 0)
997 goto err;
998 reg = 0x118e;
999 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1000 if(ret < 0) goto err;
1001 reg = 0x118f;
1002 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1003 if (ret < 0)
1004 goto err;
1006 reg = 0x10c0;
1007 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1008 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1009 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 200 */
1010 if (ret < 0)
1011 goto err;
1013 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1014 if (ret < 0)
1015 goto err;
1016 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1017 if (ret < 0)
1018 goto err;
1020 reg = 0x1180;
1021 buf = 0x02;
1022 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1023 if (ret < 0)
1024 goto err;
1026 reg = 0x10c0;
1028 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1029 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1031 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 204..206 */
1032 if (ret < 0)
1033 goto err;
1035 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
1036 if (ret < 0)
1037 goto err;
1038 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1039 if (ret < 0)
1040 goto err;
1042 reg = 0x1182;
1043 buf = 0x02;
1044 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1045 if (ret < 0)
1046 goto err;
1048 reg = 0x10c0;
1049 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x03;
1050 buf24[4] = 0xe8; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1051 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 208..224 */
1052 if (ret < 0)
1053 goto err;
1055 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1056 if (ret < 0)
1057 goto err;
1058 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1059 if (ret < 0)
1060 goto err;
1062 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1063 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1064 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1065 if (ret < 0)
1066 goto err;
1068 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1069 if (ret < 0)
1070 goto err;
1071 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1072 if (ret < 0)
1073 goto err;
1075 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
1076 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1077 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 214 */
1078 if (ret < 0)
1079 goto err;
1081 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1082 if (ret < 0)
1083 goto err;
1084 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1085 if (ret < 0)
1086 goto err;
1088 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
1089 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1090 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1091 if (ret < 0)
1092 goto err;
1094 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1095 if (ret < 0)
1096 goto err;
1097 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1098 if (ret < 0)
1099 goto err;
1101 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
1102 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1103 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1104 if(ret < 0) goto err;
1106 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1107 if (ret < 0)
1108 goto err;
1110 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1111 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1112 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1113 if (ret < 0)
1114 goto err;
1116 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1117 if (ret < 0)
1118 goto err;
1119 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1120 if (ret < 0)
1121 goto err;
1123 buf = 0x20;
1124 reg = 0x118c;
1125 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 225..228 */
1126 if (ret < 0)
1127 goto err;
1128 reg = 0x118d;
1129 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1130 if (ret < 0)
1131 goto err;
1132 reg = 0x118e;
1133 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1134 if (ret < 0)
1135 goto err;
1136 reg = 0x118f;
1137 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1138 if (ret < 0)
1139 goto err;
1141 reg = 0x11a5;
1142 buf24[0] = 0x2d; buf24[1] = 0x2d; buf24[2] = 0x3a; buf24[3] = 0x05;
1143 buf24[4] = 0x04; buf24[5] = 0x3f;
1144 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1145 if (ret < 0)
1146 goto err;
1147 reg = 0x11af;
1148 buf24[0] = 0x28; buf24[1] = 0xd8; buf24[2] = 0x14; buf24[3] = 0xec;
1149 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1150 if (ret < 0)
1151 goto err;
1152 reg = 0x11b3;
1153 buf24[0] = 0x32; buf24[1] = 0xdd; buf24[2] = 0x2d; buf24[3] = 0xdd;
1154 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1155 if (ret < 0)
1156 goto err;
1158 reg = 0x10c0;
1159 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1160 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1161 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 232..242 */
1162 if (ret < 0)
1163 goto err;
1165 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1166 if (ret < 0)
1167 goto err;
1168 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1169 if (ret < 0)
1170 goto err;
1172 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2c; buf24[3] = 0x00;
1173 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x1d; buf24[7] = 0x10;
1174 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1175 if (ret < 0)
1176 goto err;
1178 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1179 if (ret < 0)
1180 goto err;
1181 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1182 if (ret < 0)
1183 goto err;
1185 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x30; buf24[3] = 0x00;
1186 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1187 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1188 if (ret < 0)
1189 goto err;
1191 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1192 if (ret < 0)
1193 goto err;
1195 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1196 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1197 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1198 if (ret < 0)
1199 goto err;
1201 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1202 if (ret < 0)
1203 goto err;
1204 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1205 if (ret < 0)
1206 goto err;
1208 reg = 0x118c;
1209 buf = 0x1f;
1210 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1211 if (ret < 0)
1212 goto err;
1213 reg = 0x118d;
1214 buf = 0x20;
1215 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1216 if (ret < 0)
1217 goto err;
1218 reg = 0x118e;
1219 buf = 0x20;
1220 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1221 if (ret < 0)
1222 goto err;
1223 reg = 0x118f;
1224 buf = 0x1f;
1225 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1226 if (ret < 0)
1227 goto err;
1229 reg = 0x10e0;
1230 buf = 0x07;
1231 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1232 if (ret < 0)
1233 goto err;
1234 buf = 0x27;
1235 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1236 if (ret < 0)
1237 goto err;
1239 reg = 0x1100;
1240 ret = usb_microdia_control_write(dev, reg, buf1100, 64); /* URB 249 (see also 509/510) */
1241 if (ret < 0)
1242 goto err;
1244 reg = 0x1140; /* 00000000: */
1245 buf64[0] = 0x0d; buf64[1] = 0x11; buf64[2] = 0x11; buf64[3] = 0x15;
1246 buf64[4] = 0x11; buf64[5] = 0x15; buf64[6] = 0x26; buf64[7] = 0x15;
1247 buf64[8] = 0x15; buf64[9] = 0x26; buf64[10] = 0x54; buf64[11] = 0x36;
1248 buf64[12] = 0x2e; buf64[13] = 0x36; buf64[14] = 0x54; buf64[15] = 0x54; /* 00000010: .. 00000030: 0x54 */
1249 for(i=16; i<=63; i++) buf64[i] = 0x54;
1250 ret = usb_microdia_control_write(dev, reg, buf64, 64); /* URB 250 */
1251 if (ret < 0)
1252 goto err;
1254 reg = 0x10e0;
1255 buf = 0x07;
1256 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1257 if (ret < 0)
1258 goto err;
1259 buf = 0x0b;
1260 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1261 if (ret < 0)
1262 goto err;
1264 reg = 0x1189;
1265 buf = 0x0c;
1266 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1267 if (ret < 0)
1268 goto err;
1270 buf = 0x00;
1271 reg = 0x11bc;
1272 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 254..257 */
1273 if (ret < 0)
1274 goto err;
1275 reg = 0x11bd;
1276 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1277 if (ret < 0)
1278 goto err;
1279 reg = 0x11be;
1280 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1281 if (ret < 0)
1282 goto err;
1283 reg = 0x11bf;
1284 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1285 if (ret < 0)
1286 goto err;
1288 reg = 0x1180;
1289 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
1290 buf24[4] = 0x28; buf24[5] = 0x3c;
1291 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1292 if (ret < 0)
1293 goto err;
1295 reg = 0x10fb;
1296 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1297 buf24[4] = 0x00;
1298 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1299 if (ret < 0)
1300 goto err;
1302 reg = 0x1189;
1303 buf = 0x0c;
1304 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1305 if (ret < 0)
1306 goto err;
1308 reg = 0x11a1;
1309 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
1310 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1311 if (ret < 0)
1312 goto err;
1313 reg = 0x11ab;
1314 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
1315 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1316 if (ret < 0)
1317 goto err;
1319 reg = 0x1061;
1320 buf = 0x03;
1321 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1322 if (ret < 0)
1323 goto err;
1324 reg = 0x11ba;
1325 buf = 0x0a;
1326 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1327 if (ret < 0)
1328 goto err;
1329 reg = 0x11b9;
1330 buf = 0x00;
1331 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1332 if (ret < 0)
1333 goto err;
1334 reg = 0x11ba;
1335 buf = 0x0b;
1336 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1337 if (ret < 0)
1338 goto err;
1339 reg = 0x1061;
1340 buf = 0x01;
1341 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1342 if (ret < 0)
1343 goto err;
1344 reg = 0x1000;
1345 buf = 0x7c;
1346 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1347 if (ret < 0)
1348 goto err;
1349 reg = 0x1002;
1350 buf = 0x1c;
1351 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1352 if (ret < 0)
1353 goto err;
1354 buf = 0x1c;
1355 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1356 if (ret < 0)
1357 goto err;
1358 reg = 0x11b8;
1359 buf = 0x78;
1360 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1361 if (ret < 0)
1362 goto err;
1363 reg = 0x118a;
1364 buf = 0x05;
1365 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1366 if (ret < 0)
1367 goto err;
1368 reg = 0x0395;
1369 buf = 0x05;
1370 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1371 if (ret < 0)
1372 goto err;
1375 reg = 0x11b8;
1376 buf = 0x78;
1377 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 274..284 */
1378 if (ret < 0)
1379 goto err;
1380 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
1381 if (ret < 0)
1382 goto err;
1383 buf = 0x79;
1384 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1385 if (ret < 0)
1386 goto err;
1387 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
1388 if (ret < 0)
1389 goto err;
1390 buf = 0x7a;
1391 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1392 if (ret < 0)
1393 goto err;
1394 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
1395 if (ret < 0)
1396 goto err;
1397 buf = 0x7b;
1398 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1399 if (ret < 0)
1400 goto err;
1401 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
1402 if (ret < 0)
1403 goto err;
1404 buf = 0xfc;
1405 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1406 if (ret < 0)
1407 goto err;
1408 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
1409 if (ret < 0)
1410 goto err;
1411 buf = 0x78;
1412 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1413 if (ret < 0)
1414 goto err;
1415 /* // <-- 0x11b8 */
1416 reg = 0x10c0;
1417 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
1418 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1419 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 285..295 */
1420 if (ret < 0)
1421 goto err;
1423 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1424 if (ret < 0)
1425 goto err;
1426 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1427 if (ret < 0)
1428 goto err;
1430 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
1431 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1432 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1433 if (ret < 0)
1434 goto err;
1436 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1437 if (ret < 0)
1438 goto err;
1439 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1440 if (ret < 0)
1441 goto err;
1443 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
1444 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1445 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1446 if (ret < 0)
1447 goto err;
1449 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1450 if (ret < 0)
1451 goto err;
1453 buf24[0] = 0xa2; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
1454 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1455 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1456 if (ret < 0)
1457 goto err;
1459 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a2 */
1460 if (ret < 0)
1461 goto err;
1462 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a6 */
1463 if (ret < 0)
1464 goto err;
1465 /* // <-- 0x10c0 */
1466 reg = 0x10c2;
1467 ret = usb_microdia_control_read(dev, reg, buf24, 5); /* URB 296 // << 00 00 00 84 31 */
1468 if (ret < 0)
1469 goto err;
1471 reg = 0x1061;
1472 buf = 0x03;
1473 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1474 if (ret < 0)
1475 goto err;
1476 buf = 0x01;
1477 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1478 if (ret < 0)
1479 goto err;
1481 reg = 0x10c0;
1482 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1483 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1484 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1485 if (ret < 0)
1486 goto err;
1488 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1489 if (ret < 0)
1490 goto err;
1491 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1492 if (ret < 0)
1493 goto err;
1495 reg = 0x1000;
1496 buf = 0x3c;
1497 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1498 if (ret < 0)
1499 goto err;
1500 reg = 0x11b8;
1501 buf = 0x68;
1502 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1503 if (ret < 0)
1504 goto err;
1505 reg = 0x1007;
1506 buf = 0xa0;
1507 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1508 if (ret < 0)
1509 goto err;
1510 reg = 0x1006;
1511 buf = 0xa0;
1512 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1513 if (ret < 0)
1514 goto err;
1516 reg = 0x1000;
1517 buf24[0] = 0x98; buf24[1] = 0xef; buf24[2] = 0x11;
1518 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1519 if (ret < 0)
1520 goto err;
1522 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1523 // URB 307 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 0
1524 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1527 reg = 0x1066;
1528 buf = 0x00;
1529 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1530 if (ret < 0)
1531 goto err;
1533 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1534 // URB 310 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 8
1535 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1537 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 312 */
1538 if (ret < 0)
1539 goto err;
1541 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1542 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1545 reg = 0x1007;
1546 buf = 0xa0;
1547 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 314 */
1548 if (ret < 0)
1549 goto err;
1550 reg = 0x1006;
1551 buf = 0x80;
1552 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1553 if (ret < 0)
1554 goto err;
1555 reg = 0x1000;
1556 buf = 0x78;
1557 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1558 if (ret < 0)
1559 goto err;
1560 reg = 0x1001;
1561 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << ef */
1562 if (ret < 0)
1563 goto err;
1564 buf = 0xc7;
1565 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1566 if (ret < 0)
1567 goto err;
1568 reg = 0x1002;
1569 buf = 0x18;
1570 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1571 if (ret < 0)
1572 goto err;
1574 reg = 0x1007;
1575 ret = usb_microdia_control_read(dev, reg, buf24, 7); /* URB 320 // << a0 00 ff 81 00 00 00 */
1576 if (ret < 0)
1577 goto err;
1578 reg = 0x1006;
1579 buf24[0] = 0x80; buf24[1] = 0xa0;
1580 ret = usb_microdia_control_write(dev, reg, buf24, 2);
1581 if (ret < 0)
1582 goto err;
1584 reg = 0x1061;
1585 buf = 0x01;
1586 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1587 if (ret < 0)
1588 goto err;
1589 reg = 0x1020;
1590 buf = 0x80;
1591 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1592 if (ret < 0)
1593 goto err;
1595 reg = 0x1067;
1596 buf24[0] = 0x40; buf24[1] = 0x30; buf24[2] = 0x20; buf24[3] = 0x10;
1597 buf24[4] = 0x08;
1598 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1599 if (ret < 0)
1600 goto err;
1602 reg = 0x10c0;
1603 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1604 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1605 buf24[8] = 0x03;
1606 ret = usb_microdia_control_write(dev, reg, buf24, 9);
1607 if (ret < 0)
1608 goto err;
1610 reg = 0x10e0;
1611 /* // 00000000: */
1612 buf24[0] = 0x45; buf24[1] = 0x18; buf24[2] = 0x00; buf24[3] = 0x30;
1613 buf24[4] = 0x00; buf24[5] = 0x09; buf24[6] = 0x00; buf24[7] = 0xed;
1614 buf24[8] = 0x0f; buf24[9] = 0xda; buf24[10] = 0x0f; buf24[11] = 0x3a;
1615 buf24[12] = 0x00; buf24[13] = 0x3a; buf24[14] = 0x00; buf24[15] = 0xd0;
1616 /* // 00000010: */
1617 buf24[16] = 0x0f; buf24[17] = 0xf7; buf24[18] = 0x0f; buf24[19] = 0x10;
1618 buf24[20] = 0x00; buf24[21] = 0x00; buf24[22] = 0x60; buf24[23] = 0x0a;
1619 ret = usb_microdia_control_write(dev, reg, buf24, 24); /* URB 326 */
1620 if (ret < 0)
1621 goto err;
1623 reg = 0x10f8;
1624 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00;
1625 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1626 if (ret < 0)
1627 goto err;
1629 reg = 0x10fb;
1630 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1631 buf24[4] = 0x00;
1632 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1633 if (ret < 0)
1634 goto err;
1636 reg = 0x1188;
1637 buf24[0] = 0x06; buf24[1] = 0x4c; buf24[2] = 0x08;
1638 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1639 if (ret < 0)
1640 goto err;
1642 reg = 0x118b;
1643 /* // 00000000: */
1644 buf24[0] = 0x00; buf24[1] = 0x20; buf24[2] = 0x20; buf24[3] = 0x20;
1645 buf24[4] = 0x20; buf24[5] = 0x00; buf24[6] = 0x24; buf24[7] = 0x3b;
1646 buf24[8] = 0x4f; buf24[9] = 0x61; buf24[10] = 0x71; buf24[11] = 0x80;
1647 buf24[12] = 0x8f; buf24[13] = 0x9d; buf24[14] = 0xab; buf24[15] = 0xb8;
1648 /* // 00000010: */
1649 buf24[16] = 0xc4; buf24[17] = 0xd1; buf24[18] = 0xdd; buf24[19] = 0xe9;
1650 buf24[20] = 0xf4; buf24[21] = 0xff;
1651 ret = usb_microdia_control_write(dev, reg, buf24, 22); /* URB 330 */
1652 if (ret < 0)
1653 goto err;
1655 reg = 0x11a1;
1656 buf24[0] = 0x00; buf24[1] = 0x00;
1657 ret = usb_microdia_control_write(dev, reg, buf24, 2);
1658 if (ret < 0)
1659 goto err;
1661 reg = 0x11b7;
1662 buf24[0] = 0x60; buf24[1] = 0x28; buf24[2] = 0x00; buf24[3] = 0x08;
1663 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
1664 buf24[8] = 0x00;
1665 ret = usb_microdia_control_write(dev, reg, buf24, 9);
1666 if (ret < 0)
1667 goto err;
1669 reg = 0x11b8;
1670 buf = 0x38;
1671 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1672 if (ret < 0)
1673 goto err;
1674 reg = 0x1000;
1675 buf = 0x78;
1676 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1677 if (ret < 0)
1678 goto err;
1680 reg = 0x10c0;
1681 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1682 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1683 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 335..390 */
1684 if (ret < 0)
1685 goto err;
1687 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1688 if (ret < 0)
1689 goto err;
1690 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1691 if (ret < 0)
1692 goto err;
1694 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1695 buf24[4] = 0x01; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1696 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1697 if (ret < 0)
1698 goto err;
1700 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1701 if (ret < 0)
1702 goto err;
1703 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1704 if (ret < 0)
1705 goto err;
1707 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1708 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1709 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1710 if (ret < 0)
1711 goto err;
1713 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1714 if (ret < 0)
1715 goto err;
1716 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1717 if (ret < 0)
1718 goto err;
1720 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x01; buf24[3] = 0x00;
1721 buf24[4] = 0x0e; buf24[5] = 0x00; buf24[6] = 0x14; buf24[7] = 0x10;
1722 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 344 */
1723 if (ret < 0)
1724 goto err;
1726 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1727 if (ret < 0)
1728 goto err;
1729 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1730 if (ret < 0)
1731 goto err;
1733 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x03; buf24[3] = 0x03;
1734 buf24[4] = 0xc1; buf24[5] = 0x05; buf24[6] = 0x01; buf24[7] = 0x10;
1735 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1736 if (ret < 0)
1737 goto err;
1739 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1740 if (ret < 0)
1741 goto err;
1742 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1743 if (ret < 0)
1744 goto err;
1746 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
1747 buf24[4] = 0x83; buf24[5] = 0x00; buf24[6] = 0x06; buf24[7] = 0x10;
1748 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1749 if (ret < 0)
1750 goto err;
1752 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1753 if (ret < 0)
1754 goto err;
1755 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1756 if (ret < 0)
1757 goto err;
1759 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1760 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1761 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1762 if (ret < 0)
1763 goto err;
1765 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1766 if (ret < 0)
1767 goto err;
1768 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1769 if (ret < 0)
1770 goto err;
1772 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x00;
1773 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1774 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 356 */
1775 if (ret < 0)
1776 goto err;
1778 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1779 if(ret < 0) goto err;
1780 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1781 if (ret < 0)
1782 goto err;
1784 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x0b; buf24[3] = 0x00;
1785 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1786 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1787 if (ret < 0)
1788 goto err;
1790 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1791 if (ret < 0)
1792 goto err;
1793 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1794 if (ret < 0)
1795 goto err;
1797 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x11; buf24[3] = 0x00;
1798 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1799 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1800 if (ret < 0)
1801 goto err;
1803 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1804 if (ret < 0)
1805 goto err;
1806 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1807 if (ret < 0)
1808 goto err;
1810 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x1e; buf24[3] = 0x80;
1811 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1812 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 365 */
1813 if (ret < 0)
1814 goto err;
1816 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1817 if (ret < 0)
1818 goto err;
1819 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1820 if (ret < 0)
1821 goto err;
1823 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1824 buf24[4] = 0x05; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1825 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1826 if (ret < 0)
1827 goto err;
1829 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1830 if (ret < 0)
1831 goto err;
1832 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1833 if (ret < 0)
1834 goto err;
1836 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
1837 buf24[4] = 0x08; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1838 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1839 if (ret < 0)
1840 goto err;
1842 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1843 if (ret < 0)
1844 goto err;
1845 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1846 if (ret < 0)
1847 goto err;
1849 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
1850 buf24[4] = 0x14; buf24[5] = 0x00; buf24[6] = 0x08; buf24[7] = 0x10;
1851 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1852 if (ret < 0)
1853 goto err;
1855 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1856 if (ret < 0)
1857 goto err;
1858 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1859 if (ret < 0)
1860 goto err;
1862 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
1863 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1864 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 377 */
1865 if (ret < 0)
1866 goto err;
1868 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1869 if (ret < 0)
1870 goto err;
1872 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x5f; buf24[3] = 0x89;
1873 buf24[4] = 0x04; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1874 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1875 if (ret < 0)
1876 goto err;
1878 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1879 if (ret < 0)
1880 goto err;
1881 ret = usb_microdia_control_read(dev, reg, &buf, 1); // << b4
1882 if (ret < 0)
1883 goto err;
1885 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x60; buf24[3] = 0x00;
1886 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1887 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1888 if (ret < 0)
1889 goto err;
1891 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1892 if (ret < 0)
1893 goto err;
1894 ret = usb_microdia_control_read(dev, reg, &buf, 1); // << d4
1895 if (ret < 0)
1896 goto err;
1898 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x62; buf24[3] = 0x04;
1899 buf24[4] = 0x98; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1900 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 385 */
1901 if (ret < 0)
1902 goto err;
1904 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1905 if (ret < 0)
1906 goto err;
1907 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1908 if (ret < 0)
1909 goto err;
1911 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x68; buf24[3] = 0x00;
1912 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1913 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1914 if (ret < 0)
1915 goto err;
1917 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1918 if (ret < 0)
1919 goto err;
1920 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1921 if (ret < 0)
1922 goto err;
1923 /* // <-- 0x10c0 */
1924 reg = 0x10e0;
1925 buf = 0x47;
1926 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 391 */
1927 if (ret < 0)
1928 goto err;
1929 buf = 0x07;
1930 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1931 if (ret < 0)
1932 goto err;
1934 reg = 0x1001;
1935 buf = 0xc6;
1936 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1937 if (ret < 0)
1938 goto err;
1939 buf = 0xc4;
1940 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1941 if (ret < 0)
1942 goto err;
1943 buf = 0x44;
1944 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1945 if (ret < 0)
1946 goto err;
1948 reg = 0x1189;
1949 buf = 0x0c;
1950 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1951 if (ret < 0)
1952 goto err;
1954 buf = 0x00;
1955 reg = 0x11bc;
1956 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 397..400 */
1957 if (ret < 0)
1958 goto err;
1959 reg = 0x11bd;
1960 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1961 if (ret < 0)
1962 goto err;
1963 reg = 0x11be;
1964 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1965 if (ret < 0)
1966 goto err;
1967 reg = 0x11bf;
1968 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1969 if (ret < 0)
1970 goto err;
1972 reg = 0x10c0;
1973 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1974 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1975 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 401 */
1976 if (ret < 0)
1977 goto err;
1979 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1980 if (ret < 0)
1981 goto err;
1982 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1983 if (ret < 0)
1984 goto err;
1986 reg = 0x1180;
1987 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
1988 buf24[4] = 0x28; buf24[5] = 0x3c;
1989 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1990 if (ret < 0)
1991 goto err;
1992 reg = 0x10fb;
1993 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1994 buf24[4] = 0x00;
1995 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1996 if (ret < 0)
1997 goto err;
1999 reg = 0x1189;
2000 buf = 0x0c;
2001 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2002 if (ret < 0)
2003 goto err;
2005 reg = 0x11a1;
2006 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
2007 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2008 if (ret < 0)
2009 goto err;
2010 reg = 0x11ab;
2011 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
2012 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2013 if (ret < 0)
2014 goto err;
2016 reg = 0x1000;
2017 buf = 0x7c;
2018 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2019 if (ret < 0)
2020 goto err;
2022 reg = 0x1002;
2023 buf = 0x1c;
2024 for(i=410; i<=411; i++){
2025 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2026 if (ret < 0)
2027 goto err;
2030 reg = 0x11b8;
2031 buf = 0x38;
2032 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2033 if (ret < 0)
2034 goto err;
2035 reg = 0x118a;
2036 buf = 0x05;
2037 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2038 if (ret < 0)
2039 goto err;
2040 reg = 0x0395;
2041 buf = 0x05;
2042 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2043 if (ret < 0)
2044 goto err;
2046 reg = 0x11b8;
2047 buf = 0x78;
2048 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 415..425 */
2049 if (ret < 0)
2050 goto err;
2051 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
2052 if (ret < 0)
2053 goto err;
2054 buf = 0x79;
2055 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2056 if (ret < 0)
2057 goto err;
2058 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
2059 if (ret < 0)
2060 goto err;
2061 buf = 0x7a;
2062 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2063 if (ret < 0)
2064 goto err;
2065 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
2066 if (ret < 0)
2067 goto err;
2068 buf = 0x7b;
2069 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2070 if (ret < 0)
2071 goto err;
2072 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
2073 if (ret < 0)
2074 goto err;
2075 buf = 0xfc;
2076 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2077 if (ret < 0)
2078 goto err;
2079 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
2080 if (ret < 0)
2081 goto err;
2082 buf = 0x78;
2083 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2084 if (ret < 0)
2085 goto err;
2086 /* // <-- 0x11b8 */
2087 reg = 0x10c0;
2089 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
2090 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2091 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 426..431 */
2092 if (ret < 0)
2093 goto err;
2095 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2096 if (ret < 0)
2097 goto err;
2098 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2099 if (ret < 0)
2100 goto err;
2102 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
2103 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2104 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2105 if (ret < 0)
2106 goto err;
2108 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2109 if (ret < 0)
2110 goto err;
2111 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2112 if (ret < 0)
2113 goto err;
2114 /* // <-- 0x10c0 */
2115 reg = 0x11ba;
2116 buf = 0x0a;
2117 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2118 if (ret < 0)
2119 goto err;
2120 reg = 0x118c;
2121 buf = 0x1f;
2122 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2123 if (ret < 0)
2124 goto err;
2125 reg = 0x118d;
2126 buf = 0x20;
2127 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2128 if (ret < 0)
2129 goto err;
2130 reg = 0x118e;
2131 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2132 if (ret < 0)
2133 goto err;
2134 reg = 0x118f;
2135 buf = 0x1f;
2136 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2137 if (ret < 0)
2138 goto err;
2139 reg = 0x118b;
2140 buf = 0x0a;
2141 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2142 if (ret < 0)
2143 goto err;
2145 reg = 0x1190;
2146 buf24[0] = 0x08; buf24[1] = 0x2e; buf24[2] = 0x55; buf24[3] = 0x6f;
2147 buf24[4] = 0x7f; buf24[5] = 0x8d; buf24[6] = 0x9a; buf24[7] = 0xa6;
2148 buf24[8] = 0xb1; buf24[9] = 0xbb; buf24[10] = 0xc5; buf24[11] = 0xce;
2149 buf24[12] = 0xd7; buf24[13] = 0xdf; buf24[14] = 0xe8; buf24[15] = 0xef;
2150 buf24[16] = 0xf7;
2151 ret = usb_microdia_control_write(dev, reg, buf24, 17); /* URB 438 */
2152 if (ret < 0)
2153 goto err;
2155 reg = 0x10e1;
2156 for(i=439; i<=447; i++){
2157 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 439..447 */
2158 if (ret < 0)
2159 goto err;
2162 reg = 0x10f7;
2163 buf = 0x07;
2164 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2165 if (ret < 0)
2166 goto err;
2167 reg = 0x10f6;
2168 buf = 0x60;
2169 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2170 if (ret < 0)
2171 goto err;
2173 reg = 0x10e1;
2174 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 450 */
2175 if (ret < 0)
2176 goto err;
2178 reg = 0x10f8;
2179 buf = 0x14;
2180 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2181 if (ret < 0)
2182 goto err;
2183 reg = 0x10fa;
2184 buf = 0xff;
2185 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2186 if (ret < 0)
2187 goto err;
2189 reg = 0x10f9;
2190 buf = 0x00;
2191 for(i=453; i<454; i++){
2192 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2193 if (ret < 0)
2194 goto err;
2197 reg = 0x11ba;
2198 buf = 0x0a;
2199 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2200 if (ret < 0)
2201 goto err;
2203 reg = 0x11bc;
2204 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x00;
2205 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2206 if (ret < 0)
2207 goto err;
2209 reg = 0x11c0;
2210 for (i = 0; i < 48; i++)
2211 buf64[i] = 0; /* // zeroes */
2212 ret = usb_microdia_control_write(dev, reg, buf64, 48); /* URB 457 */
2213 if (ret < 0)
2214 goto err;
2216 buf = 0x20;
2217 reg = 0x118c;
2218 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 458..461 */
2219 if (ret < 0)
2220 goto err;
2221 reg = 0x118d;
2222 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2223 if (ret < 0)
2224 goto err;
2225 reg = 0x118e;
2226 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2227 if (ret < 0)
2228 goto err;
2229 reg = 0x118f;
2230 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2231 if (ret < 0)
2232 goto err;
2234 reg = 0x10c0;
2235 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
2236 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2237 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 462 */
2238 if (ret < 0)
2239 goto err;
2241 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2242 if (ret < 0)
2243 goto err;
2244 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2245 if (ret < 0)
2246 goto err;
2248 reg = 0x1180;
2249 buf = 0x02;
2250 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2251 if (ret < 0)
2252 goto err;
2254 reg = 0x10c0;
2255 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
2256 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2257 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 466 */
2258 if (ret < 0)
2259 goto err;
2261 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2262 if (ret < 0)
2263 goto err;
2264 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2265 if (ret < 0)
2266 goto err;
2268 reg = 0x1182;
2269 buf = 0x02;
2270 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2271 if (ret < 0)
2272 goto err;
2274 reg = 0x10c0;
2275 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2276 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2277 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 470..483 */
2278 if (ret < 0)
2279 goto err;
2281 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2282 if (ret < 0)
2283 goto err;
2284 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2285 if (ret < 0)
2286 goto err;
2288 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
2289 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
2290 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2291 if (ret < 0)
2292 goto err;
2294 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
2295 if (ret < 0)
2296 goto err;
2297 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2298 if (ret < 0)
2299 goto err;
2301 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
2302 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
2303 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2304 if (ret < 0)
2305 goto err;
2307 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
2308 if (ret < 0)
2309 goto err;
2310 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2311 if (ret < 0)
2312 goto err;
2314 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
2315 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2316 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 479 */
2317 if (ret < 0)
2318 goto err;
2320 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2321 if (ret < 0)
2322 goto err;
2324 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2325 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2326 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2327 if (ret < 0)
2328 goto err;
2330 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2331 if (ret < 0)
2332 goto err;
2333 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2334 if (ret < 0)
2335 goto err;
2336 /* // <-- 0x10c0 */
2337 buf = 0x20;
2338 reg = 0x118c;
2339 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 484..487 */
2340 if (ret < 0)
2341 goto err;
2342 reg = 0x118d;
2343 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2344 if (ret < 0)
2345 goto err;
2346 reg = 0x118e;
2347 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2348 if (ret < 0)
2349 goto err;
2350 reg = 0x118f;
2351 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2352 if (ret < 0)
2353 goto err;
2355 reg = 0x11a5;
2356 buf24[0] = 0x2d; buf24[1] = 0x2d; buf24[2] = 0x3a; buf24[3] = 0x05;
2357 buf24[4] = 0x04; buf24[5] = 0x3f;
2358 ret = usb_microdia_control_write(dev, reg, buf24, 6);
2359 if (ret < 0)
2360 goto err;
2361 reg = 0x11af;
2362 buf24[0] = 0x28; buf24[1] = 0xd8; buf24[2] = 0x14; buf24[3] = 0xec;
2363 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2364 if (ret < 0)
2365 goto err;
2366 reg = 0x11b3;
2367 buf24[0] = 0x32; buf24[1] = 0xdd; buf24[2] = 0x2d; buf24[3] = 0xdd;
2368 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2369 if (ret < 0)
2370 goto err;
2372 reg = 0x10c0;
2373 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2374 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2375 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 491..502 */
2376 if (ret < 0)
2377 goto err;
2379 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2380 if (ret < 0)
2381 goto err;
2382 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2383 if (ret < 0)
2384 goto err;
2386 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2c; buf24[3] = 0x00;
2387 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x1d; buf24[7] = 0x10;
2388 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2389 if (ret < 0)
2390 goto err;
2392 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 495: d0 */
2393 if (ret < 0)
2394 goto err;
2395 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 496: d0 */
2396 if (ret < 0)
2397 goto err;
2398 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2399 if (ret < 0)
2400 goto err;
2402 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x30; buf24[3] = 0x00;
2403 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2404 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2405 if (ret < 0)
2406 goto err;
2408 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2409 if (ret < 0)
2410 goto err;
2412 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2413 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2414 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2415 if (ret < 0)
2416 goto err;
2418 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2419 if (ret < 0)
2420 goto err;
2421 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2422 if (ret < 0)
2423 goto err;
2424 /* // <-- 0x10c0 */
2425 reg = 0x118c;
2426 buf = 0x1f;
2427 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2428 if (ret < 0)
2429 goto err;
2430 reg = 0x118d;
2431 buf = 0x20;
2432 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2433 if (ret < 0)
2434 goto err;
2435 reg = 0x118e;
2436 buf = 0x20;
2437 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2438 if (ret < 0)
2439 goto err;
2440 reg = 0x118f;
2441 buf = 0x1f;
2442 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2443 if (ret < 0)
2444 goto err;
2446 reg = 0x10e0;
2447 buf = 0x07;
2448 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2449 if (ret < 0)
2450 goto err;
2451 buf = 0x27;
2452 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2453 if (ret < 0)
2454 goto err;
2456 reg = 0x1100;
2457 ret = usb_microdia_control_write(dev, reg, buf1100, 64); /* URB 509 (see also 249/250) */
2458 if (ret < 0)
2459 goto err;
2461 reg = 0x1140;
2462 /* // 00000000: */
2463 buf64[0] = 0x0d; buf64[1] = 0x11; buf64[2] = 0x11; buf64[3] = 0x15;
2464 buf64[4] = 0x11; buf64[5] = 0x15; buf64[6] = 0x26; buf64[7] = 0x15;
2465 buf64[8] = 0x15; buf64[9] = 0x26; buf64[10] = 0x54; buf64[11] = 0x36;
2466 buf64[12] = 0x2e; buf64[13] = 0x36; buf64[14] = 0x54; buf64[15] = 0x54;
2467 /* // 00000010: .. 00000030: 0x54 */
2468 for(i=16; i<=63; i++) buf64[i] = 0x54;
2469 ret = usb_microdia_control_write(dev, reg, buf64, 64); /* URB 510 */
2470 if (ret < 0)
2471 goto err;
2473 reg = 0x10e0;
2474 buf = 0x07;
2475 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2476 if (ret < 0)
2477 goto err;
2478 buf = 0x0b;
2479 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2480 if (ret < 0)
2481 goto err;
2483 reg = 0x1189;
2484 buf = 0x0c;
2485 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2486 if (ret < 0)
2487 goto err;
2489 buf = 0x00;
2490 reg = 0x11bc;
2491 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 514..517 */
2492 if (ret < 0)
2493 goto err;
2494 reg = 0x11bd;
2495 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2496 if (ret < 0)
2497 goto err;
2498 reg = 0x11be;
2499 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2500 if (ret < 0)
2501 goto err;
2502 reg = 0x11bf;
2503 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2504 if (ret < 0)
2505 goto err;
2507 reg = 0x1180;
2508 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
2509 buf24[4] = 0x28; buf24[5] = 0x3c;
2510 ret = usb_microdia_control_write(dev, reg, buf24, 6);
2512 reg = 0x10fb;
2513 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
2514 buf24[4] = 0x00;
2515 ret = usb_microdia_control_write(dev, reg, buf24, 5);
2517 reg = 0x1189;
2518 buf = 0x0c;
2519 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2520 if (ret < 0)
2521 goto err;
2523 reg = 0x11a1;
2524 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
2525 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2527 reg = 0x11ab;
2528 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
2529 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2531 reg = 0x1061;
2532 buf = 0x03;
2533 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2534 if (ret < 0)
2535 goto err;
2536 reg = 0x11ba;
2537 buf = 0x0a;
2538 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2539 if (ret < 0)
2540 goto err;
2541 reg = 0x11b9;
2542 buf = 0x00;
2543 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2544 if (ret < 0)
2545 goto err;
2546 reg = 0x11ba;
2547 buf = 0x0b;
2548 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2549 if (ret < 0)
2550 goto err;
2551 reg = 0x1061;
2552 buf = 0x01;
2553 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2554 if (ret < 0)
2555 goto err;
2556 reg = 0x1000;
2557 buf = 0x7c;
2558 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2559 if (ret < 0)
2560 goto err;
2562 reg = 0x1002;
2563 buf = 0x1c;
2564 for(i=529; i<=530; i++){
2565 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2566 if (ret < 0)
2567 goto err;
2570 reg = 0x11b8;
2571 buf = 0x78;
2572 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2573 if (ret < 0)
2574 goto err;
2575 reg = 0x118a;
2576 buf = 0x05;
2577 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2578 if (ret < 0)
2579 goto err;
2580 reg = 0x0395;
2581 buf = 0x05;
2582 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2583 if (ret < 0)
2584 goto err;
2586 reg = 0x11b8;
2587 buf = 0x78;
2588 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 534..544 */
2589 if (ret < 0)
2590 goto err;
2591 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
2592 if (ret < 0)
2593 goto err;
2594 buf = 0x79;
2595 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2596 if (ret < 0)
2597 goto err;
2598 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
2599 if (ret < 0)
2600 goto err;
2601 buf = 0x7a;
2602 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2603 if (ret < 0)
2604 goto err;
2605 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
2606 if (ret < 0)
2607 goto err;
2608 buf = 0x7b;
2609 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2610 if (ret < 0)
2611 goto err;
2612 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
2613 if (ret < 0)
2614 goto err;
2615 buf = 0xfc;
2616 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2617 if (ret < 0)
2618 goto err;
2619 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
2620 if (ret < 0)
2621 goto err;
2622 buf = 0x78;
2623 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2624 if (ret < 0)
2625 goto err;
2626 /* // <-- 0x11b8 */
2627 reg = 0x10c0;
2628 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
2629 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2630 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 545..555 */
2631 if (ret < 0)
2632 goto err;
2634 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2635 if (ret < 0)
2636 goto err;
2637 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2638 if (ret < 0)
2639 goto err;
2641 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
2642 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2643 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2644 if (ret < 0)
2645 goto err;
2647 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2648 if (ret < 0)
2649 goto err;
2650 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2651 if (ret < 0)
2652 goto err;
2654 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
2655 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2656 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2657 if (ret < 0)
2658 goto err;
2660 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2661 if (ret < 0)
2662 goto err;
2664 buf24[0] = 0xa2; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
2665 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2666 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2667 if (ret < 0)
2668 goto err;
2670 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a2 */
2671 if (ret < 0)
2672 goto err;
2673 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a6 */
2674 if (ret < 0)
2675 goto err;
2676 /* // <-- 0x10c0 */
2677 reg = 0x10c2;
2678 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x84;
2679 buf24[4] = 0x31;
2680 ret = usb_microdia_control_write(dev, reg, buf24, 5);
2681 if (ret < 0)
2682 goto err;
2684 reg = 0x1061;
2685 buf = 0x03;
2686 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 557 */
2687 if (ret < 0)
2688 goto err;
2690 /* UNKNOWN -- URB_FUNCTION_RESET_PIPE:
2691 // UNKNOWN -- URB_FUNCTION_RESET_PIPE:
2692 // UNKNOWN -- URB_FUNCTION_GET_CURRENT_FRAME_NUMBER:
2693 // UNKNOWN -- URB_FUNCTION_GET_CURRENT_FRAME_NUMBER:
2694 // URB 560 >>> SENDING ISO REQUEST
2696 UDIA_INFO("...start function completed without errors.\n");
2697 return ret;
2698 err:
2699 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
2700 return ret;
2704 * @brief From stop-close-amcap.log
2706 * @param dev
2708 * @returns 0
2710 * @author psnel
2712 * For SN9C201 with MI1300. Comments from parser-usbsnoop(updated_13Mar2008).pl output
2715 int microdia_6240_stop_stream(struct usb_microdia *dev)
2717 int ret=0;
2718 __u8 buf[8];
2720 UDIA_INFO("Stopping camera...\n");
2722 buf[0]=0x01;
2723 ret = usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 25319 */
2724 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2726 buf[0]=0xb0; buf[1]=0x5d; buf[2]=0x07; buf[3]=0x00;
2727 buf[4]=0x00; buf[5]=0x00; buf[6]=0x00; buf[7]=0x10;
2728 ret += usb_microdia_control_write(dev, 0x10c0, buf, 8); /* URB 25320 */
2729 UDIA_INFO("...stop: write buf[8], ret = %d\n",ret);
2731 ret += usb_microdia_control_read(dev, 0x10c0, buf, 1); /* URB 25321 << b0 */
2732 UDIA_INFO("...stop: read %x, ret = %d\n",buf[0],ret);
2734 ret += usb_microdia_control_read(dev, 0x10c0, buf, 1); /* URB 25322 << b4 */
2735 UDIA_INFO("...stop: read %x, ret = %d\n",buf[0],ret);
2737 buf[0]=0x3c;
2738 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 25323 */
2739 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2741 buf[0]=0x68;
2742 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 25324 */
2743 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2745 buf[0]=0xa0;
2746 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 25325 */
2747 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2749 buf[0]=0xa0;
2750 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 25326 */
2751 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2753 buf[0]=0x98; buf[1]=0xef; buf[2]=0x11;
2754 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); /* URB 25327 */
2755 UDIA_INFO("...stop: write buf[3], ret = %d\n",ret);
2757 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: (URB 5009)
2758 // URB 25328 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 0
2759 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: (URB 25329)
2762 buf[0]=0x00;
2763 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 25330 */
2764 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2766 if (ret < 19) {
2767 UDIA_ERROR("One ore more errors occured during stop sequence !\n");
2768 return -1;
2771 return 0;
2775 * @brief From init.sequence.log
2777 * @param dev
2779 * @returns 0
2781 * @author GWater
2783 * For SN9C201 with SOI968.
2784 * Tests showed this function is actually unnecessary.
2785 * Nevertheless the reads may give us valuable values we don't know about yet.
2787 int microdia_624e_initialize(struct usb_microdia *dev)
2789 __u8 buf;
2791 usb_microdia_control_read(dev, 0x130d, &buf, 1);
2792 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2794 return 0;
2797 /**
2798 * @brief From UsbSnoop-plugin-parsed.log
2800 * @param dev
2802 * @returns
2804 int microdia_624f_initialize(struct usb_microdia *dev)
2806 /* Do nothing here */
2807 return 0;
2811 * @brief From UsbSnoop-plugin-parsed.log
2813 * @param dev
2815 * @returns
2817 int microdia_6260_initialize(struct usb_microdia *dev)
2819 __u8 buf;
2821 usb_microdia_control_read(dev, 0x130d, &buf, 1);
2822 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2823 buf = 0x00;
2824 usb_microdia_control_write(dev, 0x10c8, &buf, 1);
2825 usb_microdia_control_read(dev, 0x100a, &buf, 1);
2826 buf = 0x04;
2827 usb_microdia_control_write(dev, 0x100a, &buf, 1);
2828 usb_microdia_control_read(dev, 0x100b, &buf, 1);
2829 buf = 0x04;
2830 usb_microdia_control_write(dev, 0x100b, &buf, 1);
2831 usb_microdia_control_read(dev, 0x1001, &buf, 1);
2832 buf = 0xc7;
2833 usb_microdia_control_write(dev, 0x1001, &buf, 1);
2834 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2835 buf = 0x00;
2836 usb_microdia_control_write(dev, 0x1040, &buf, 1);
2837 usb_microdia_control_read(dev, 0x1045, &buf, 1);
2838 buf = 0x04;
2839 usb_microdia_control_write(dev, 0x1045, &buf, 1);
2840 usb_microdia_control_read(dev, 0x1046, &buf, 1);
2841 buf = 0x10;
2842 usb_microdia_control_write(dev, 0x1046, &buf, 1);
2843 buf = 0x14;
2844 usb_microdia_control_write(dev, 0x1045, &buf, 1);
2845 buf = 0x01;
2846 usb_microdia_control_write(dev, 0x1040, &buf, 1);
2847 buf = 0x80;
2848 usb_microdia_control_write(dev, 0x1020, &buf, 1);
2850 return 0;
2854 * @brief From 6 init-logs
2856 * @param dev
2858 * @returns 0 (ok) or -1 (error)
2860 * @author Comer352l
2862 * Windows driver versions: 5.5.8.12 and 5.7.23.000
2863 * Windows versions: 2000 and XP
2864 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
2866 * Comments behind read oprations contain HEX-values that appeared in the logs
2868 int microdia_6270_initialize(struct usb_microdia *dev)
2870 //int actual;
2871 int ret = 0;
2872 int retSP = 0;
2873 int retASS = 0;
2874 __u8 buf[8];
2875 __u8 buf_0395[1];
2876 __u8 buf_1000[5];
2877 __u8 buf_1060[2];
2878 __u8 buf_11b8[1];
2880 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); // URB 5 0x81,0x85,0x04,0x8b,0x02,...
2882 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); // URB 6 0xe4,0xc4,0xa4,0x44,...
2885 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
2886 * buf[0]=0x00;
2887 * usb_microdia_control_write(dev, 0x10c8, buf, 1);
2890 ret += usb_microdia_control_read(dev, 0x118a, buf, 1); // URB 7 0x05,0x7b,0x01,0x04,...
2892 ret += usb_microdia_control_read(dev, 0x0395, buf_0395, 1); // URB 8 0xc2,0x82,0x38,0x98,0x04,...
2893 // => this value will be rewritten to 0x118a and 0x0395 later (URBs 81+82)
2895 buf[0] = 0x05;
2896 ret += usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 9
2898 ret += usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 10
2900 ret += usb_microdia_control_read(dev, 0x11b8, buf_11b8, 1); // URB 11 0xa0,0x00,0x24,...
2901 // => this value will be rewritten to 0x11b8 later (URB 83)
2903 buf[0] = 0x10;
2904 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 12
2906 ret += usb_microdia_control_read(dev, 0x1000, buf_1000, 5); // URB 13 0x30 0xCF 0x00 0x03 (0x02 or 0x00)
2907 // => these values will be rewritten to 0x1000 later (URB 84)
2909 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
2910 ret += usb_microdia_control_write(dev, 0x1000, buf, 5); // URB 14
2912 ret += usb_microdia_control_read(dev, 0x1060, buf_1060, 2); // URB 15 0x08 0x00 (always ???)
2913 // => this value will be rewritten to 0x1060 later (URB 85)
2915 buf[0] = 0x00; buf[1] = 0x03;
2916 ret += usb_microdia_control_write(dev, 0x1060, buf, 2); // URB 16
2918 // initialize I2C registers to avoid getting no ACK at first I2C operation:
2919 ret += sn9c20x_initialize_i2c(dev, SN9C20X_I2C_2WIRE, MT9V011_I2C_SLAVE_ADDRESS);
2921 // enable I2C communication (bit 0)
2922 buf[0] = 0x21; // THE OLD DRIVER 5.5.8.12 WRITES 0x5d
2923 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); // URB 17
2925 // probe sensor model:
2926 retSP = mt9vx11_sensor_probe(dev); // substitutes URBs 18-48
2927 if ((retSP == 0) && (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS))
2928 // switch (back) to IFP address space:
2929 retASS = mt9v111_select_address_space(dev, MT9V111_ADDRESSSPACE_IFP);
2931 ret += usb_microdia_control_write(dev, 0x118a, buf_0395, 1); // URB 81 => write value read with URB 8
2933 ret += usb_microdia_control_write(dev, 0x0395, buf_0395, 1); // URB 82 => write value read with URB 8
2935 ret += usb_microdia_control_write(dev, 0x11b8, buf_11b8, 1); // URB 83 => write value read with URB 11
2937 ret += usb_microdia_control_write(dev, 0x1000, buf_1000, 5); // URB 84 => write value read with URB 13
2939 ret += usb_microdia_control_write(dev, 0x1060, buf_1060, 2); // URB 85 => write value read with URB 15; (always 08 00 ???)
2941 // USB-interrupt-message: doesn't work yet (returns error -110)
2942 //usb_interrupt_msg(dev->udev, usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), dev->int_in_buffer, dev->int_in_size, &actual, 1000); // URB 86
2945 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
2946 * wbuf[0]=0x80;
2947 * usb_microdia_control_write(dev, 0x1020, wbuf, 1);
2950 if ((retSP != 0) || (retASS != 0) || (ret < 33))
2952 if (ret < 33)
2953 UDIA_INFO("One ore more errors occured during initialization !\n");
2954 return -1;
2956 else
2957 return 0;
2960 /**
2961 * @brief From UsbSnoop-plugin-parsed.log
2963 * @param dev
2965 * @returns
2967 int microdia_627b_initialize(struct usb_microdia *dev)
2969 /*int actual;*/
2970 int ret;
2971 int retI2C;
2972 __u16 reg;
2973 __u8 buf[32];
2974 __u8 reg0395[1];
2975 __u8 reg11b8[1];
2976 __u8 reg1000[5];
2977 __u8 reg1060[2];
2979 reg = 0x130d;
2980 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 5 */
2981 if (ret < 0)
2982 goto err;
2983 reg = 0x1040;
2984 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 6 */
2985 if (ret < 0)
2986 goto err;
2988 reg = 0x118a;
2989 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 7 */
2990 if (ret < 0)
2991 goto err;
2992 reg = 0x0395;
2993 ret = usb_microdia_control_read(dev, reg, reg0395, 1); /* URB 8 */
2994 if (ret < 0)
2995 goto err;
2997 reg = 0x118a;
2998 buf[0] = 0x05;
2999 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 9 */
3000 if (ret < 0)
3001 goto err;
3002 reg = 0x0395;
3003 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 10 */
3004 if (ret < 0)
3005 goto err;
3007 reg = 0x11b8;
3008 ret = usb_microdia_control_read(dev, reg, reg11b8, 1); /* URB 11 */
3009 if (ret < 0)
3010 goto err;
3012 reg = 0x11b8;
3013 buf[0] = 0x10;
3014 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 12 */
3015 if (ret < 0)
3016 goto err;
3017 reg = 0x1000;
3018 ret = usb_microdia_control_read(dev, reg, reg1000, 5); /* URB 13 */
3019 if (ret < 0)
3020 goto err;
3022 reg = 0x1000;
3023 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
3024 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 14 */
3025 if (ret < 0)
3026 goto err;
3028 reg = 0x1060;
3029 ret = usb_microdia_control_read(dev, reg, reg1060, 2); /* URB 15 */
3030 if (ret < 0)
3031 goto err;
3033 reg = 0x1060;
3034 buf[0] = 0x00; buf[1] = 0x03;
3035 ret = usb_microdia_control_write(dev, reg, buf, 2); /* URB 16 */
3036 if (ret < 0)
3037 goto err;
3039 reg = 0x10c8;
3040 buf[0] = 0x21;
3041 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 17 */
3042 if (ret < 0)
3043 goto err;
3045 retI2C = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
3046 OV7660_CTL_PID, dev->sensor_flags, buf); /* URBs 18-29 */
3047 if (retI2C < 0) {
3048 /* 2nd try... */
3049 reg = 0x10c8;
3050 buf[0] = 0x21;
3051 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 30 */
3052 if (ret < 0)
3053 goto err;
3055 retI2C = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
3056 OV7660_CTL_PID, dev->sensor_flags, buf); /* URBs 31-35 */
3058 if (retI2C < 0)
3059 UDIA_ERROR("Read of sensor register 0x0a failed.");
3061 reg = 0x118a;
3062 buf[0] = 0xa6;
3063 ret = usb_microdia_control_write(dev, reg, reg0395, 1); /* URB 36 */
3064 if (ret < 0)
3065 goto err;
3066 reg = 0x0395;
3067 ret = usb_microdia_control_write(dev, reg, reg0395, 1); /* URB 37 */
3068 if (ret < 0)
3069 goto err;
3071 reg = 0x11b8;
3072 buf[0] = 0x06;
3073 ret = usb_microdia_control_write(dev, reg, reg11b8, 1); /* URB 38 */
3074 if (ret < 0)
3075 goto err;
3077 reg = 0x1000;
3078 buf[0] = 0x30; buf[1] = 0xcf; buf[2] = 0x00; buf[3] = 0x03; buf[4] = 0x02;
3079 ret = usb_microdia_control_write(dev, reg, reg1000, 5); /* URB 39 */
3080 if (ret < 0)
3081 goto err;
3083 reg = 0x1060;
3084 buf[0] = 0x08; buf[1] = 0x00;
3085 ret = usb_microdia_control_write(dev, reg, reg1060, 2); /* URB 40 */
3086 if (ret < 0)
3087 goto err;
3090 //URB 41
3091 ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000);
3094 return ret;
3095 err:
3096 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
3097 return ret;
3101 * @brief From init-start-stop-log (made by Víctor M. Hernández Rocamora)
3103 * @param dev
3105 * @returns 0 (ok) or -1 (error)
3107 * @author Comer352l
3109 * USB-Logger: SniffUSB 2.0
3111 * Comments behind read oprations contain HEX-values that appeared in the log
3113 int microdia_627f_initialize(struct usb_microdia *dev)
3115 __u8 buf[1];
3116 int ret = 0;
3118 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); // URB 5 0x81
3120 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); // URB 6 0xe4
3122 buf[0] = 0x00;
3123 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); // URB 7
3125 buf[0] = 0x80;
3126 ret += usb_microdia_control_write(dev, 0x1020, buf, 1); // URB 8
3128 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 9 0x0f
3130 buf[0] = 0x1f;
3131 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 10
3133 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 11 0x1f
3135 buf[0] = 0x0f;
3136 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 12
3138 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 13 0x0f
3140 buf[0] = 0x1f;
3141 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 14
3143 if (ret < 10)
3145 UDIA_INFO("One ore more errors occured during initialization !\n");
3146 return -1;
3148 return 0;
3151 /**
3152 * @brief From UsbSnoop-plugin-parsed.log
3154 * @param dev
3156 * @returns 0 (OK) or <0 (Error)
3158 * @author Vincent, Kuzja
3160 int microdia_6288_initialize(struct usb_microdia *dev)
3163 int ret;
3164 __u16 reg;
3165 __u8 buf[2];
3167 reg = 0x130d ;
3168 ret = usb_microdia_control_read(dev, reg, buf, 1);
3169 if(ret < 0) goto err;
3171 reg = 0x1040 ;
3172 ret = usb_microdia_control_read(dev, reg, buf, 1);
3173 if(ret < 0) goto err;
3175 if (ret < 0)
3176 return ret;
3177 else
3178 return 0;
3179 err:
3180 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
3181 return ret;
3184 /**
3185 * @brief From UsbSnoop-plugin-parsed.log
3187 * @param dev
3189 * @returns 0 if all OK
3191 * Function to initialize Microdia 6128 webcam
3192 * Bridge SN9C325 + OM6802 CMOS sensor
3193 * note: comments are my observations so they could be wrong
3195 int microdia_6128_initialize(struct usb_microdia *dev)
3197 int ret = 0;
3198 __u8 buf[2];
3200 UDIA_INFO("Initializing camera...\n");
3202 buf[0] = 0x01;
3203 ret += usb_microdia_control_write(dev, 0xf1, buf, 1);
3204 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // read reg 0x00 must write 0x00 in buf[0]
3205 ret += usb_microdia_control_write(dev, 0xf1, buf, 1);
3206 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // get cam ID, must read 0x12
3208 if(buf[0] != 0x12){
3209 UDIA_ERROR("Microdia 6128 is not connected or working !!!\n");
3210 return -ENODEV;
3213 buf[0] = 0x29; buf[1] = 0x70; // Configure GPIO
3214 ret += usb_microdia_control_write(dev, 0x01, buf, 2);
3216 buf[0] = 0x01;
3217 ret += usb_microdia_control_write(dev, 0xf1, buf, 1); // Maybe wakeup
3219 buf[0] = 0x0e;
3220 ret += usb_microdia_control_write(dev, 0x01, buf, 1); // Command to initialize cam
3222 if(ret != 8)
3223 UDIA_DEBUG("Some read or writes were not successful in initialization !\n");
3225 /* Device is initialized and ready */
3226 UDIA_INFO("Microdia USB2.0 Camera is ready\n");
3228 return 0;
3232 int dev_microdia_start_stream(struct usb_microdia *dev)
3234 int ret = -ENODEV;
3235 if(dev && dev->start_stream)
3236 ret = dev->start_stream(dev);
3238 return ret;
3242 * @brief From start.htm
3244 * @param dev
3246 * @returns 0
3248 * @author GWater
3250 * For SN9C201 with MI1310.
3251 * This function has not been tested yet.
3253 int microdia_6242_start_stream(struct usb_microdia *dev)
3255 int i = -1;
3256 __u8 buf[48];
3258 __u8 urb10[24] = {
3259 0x01, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
3260 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
3261 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
3263 __u8 urb13[11] = {
3264 0x02, 0x00, 0x02, 0x00, 0x50, 0x78, 0x00, 0x00,
3265 0x07, 0xc0, 0x0a};
3267 __u8 urb14[22] = {
3268 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
3269 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
3270 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
3272 __u8 urb119[17] = {
3273 0x08, 0x38, 0x58, 0x6f, 0x7f, 0x8d, 0x9a, 0xa6,
3274 0xb1, 0xbb, 0xc5, 0xce, 0xd7, 0xdf, 0xe8, 0xef,
3275 0xf7};
3277 __u8 urb120[21] = {
3278 0x16, 0x00, 0x2b, 0x00, 0x08, 0x00, 0x00, 0x00,
3279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3280 0x00, 0x00, 0x00, 0x00, 0x00};
3282 __u8 qtable1[64] = {
3283 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
3284 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
3285 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
3286 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
3287 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
3288 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
3289 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
3290 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54};
3292 __u8 qtable2[64] = {
3293 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
3294 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
3295 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3296 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3297 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3298 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3299 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3300 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54};
3302 __u8 first10c0[7][3] = {
3303 {0x0d, 0x00, 0x08},
3304 {0x0d, 0x00, 0x09},
3305 {0x0d, 0x00, 0x08},
3306 {0xf0, 0x00, 0x01},
3307 {0x3a, 0x73, 0x00},
3308 {0x06, 0x30, 0x8c},
3309 {0xf0, 0x00, 0x00}
3312 __u8 second10c0a[2][5] = {
3313 {0x01, 0x00, 0x0e, 0x00, 0x14},
3314 {0x03, 0x03, 0xc4, 0x05, 0x14}
3317 __u8 second10c0b[3] =
3318 {0xc8, 0x00, 0x03};
3320 __u8 third10c0[4][3] = {
3321 {0x0a, 0x00, 0x01},
3322 {0x06, 0x00, 0x29},
3323 {0x05, 0x00, 0x72},
3324 {0x20, 0x00, 0x00}
3327 __u8 fourth10c0a[3][3] = {
3328 {0x20, 0x00, 0x00},
3329 {0x09, 0x01, 0x90},
3330 {0x0d, 0x80, 0x08}
3333 __u8 fourth10c0b[2][5] = {
3334 {0x2b, 0x01, 0x88, 0x01, 0x88},
3335 {0x2d, 0x01, 0x88, 0x01, 0x88}
3338 __u8 fifth10c0[4][3] = {
3339 {0x0a, 0x00, 0x01},
3340 {0x06, 0x00, 0x29},
3341 {0x05, 0x00, 0x72}
3344 /* interrupt down */
3346 buf[0] = 0x00;
3347 usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 1 */
3349 /* interrupt up */
3350 /* interrupt down */
3352 buf[0] = 0x60;
3353 usb_microdia_control_write(dev, 0x1007, buf, 1);
3355 buf[0] = 0x00;
3356 usb_microdia_control_write(dev, 0x1006, buf, 1);
3358 buf[0] = 0x78;
3359 usb_microdia_control_write(dev, 0x1000, buf, 1);
3361 buf[0] = 0xc7;
3362 usb_microdia_control_write(dev, 0x1001, buf, 1);
3364 buf[0] = 0x1c;
3365 usb_microdia_control_write(dev, 0x1002, buf, 1);
3367 buf[0] = 0x01;
3368 usb_microdia_control_write(dev, 0x1061, buf, 1);
3370 buf[0] = 0x80;
3371 usb_microdia_control_write(dev, 0x1020, buf, 1);
3373 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3374 buf[3] = 0x10; buf[4] = 0x08;
3375 usb_microdia_control_write(dev, 0x1067, buf, 5);
3377 buf[0] = 0xb0; buf[1] = dev->sensor_slave_address; buf[2] = 0x0d;
3378 buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00;
3379 buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
3380 usb_microdia_control_write(dev, 0x10c0, buf, 9);
3382 usb_microdia_control_write(dev, 0x10e0, urb10, 24); /* URB 10 */
3384 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
3385 usb_microdia_control_write(dev, 0x10f8, buf, 3);
3387 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00;
3388 buf[3] = 0xe0; buf[4] = 0x03;
3389 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3391 usb_microdia_control_write(dev, 0x1180, urb13, 11);
3393 usb_microdia_control_write(dev, 0x118b, urb14, 22);
3395 buf[0] = 0x00; buf[1] = 0x00;
3396 usb_microdia_control_write(dev, 0x11a1, buf, 2);
3398 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
3399 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00;
3400 buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00;
3401 usb_microdia_control_write(dev, 0x11b7, buf, 9);
3403 buf[0] = 0x30;
3404 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3406 buf[0] = 0x78;
3407 usb_microdia_control_write(dev, 0x1000, buf, 1);
3409 for (i = 0; i < 7; i++)
3410 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3411 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]); /* URB 9-48 */
3413 buf[0] = 0x60;
3414 usb_microdia_control_write(dev, 0x1007, buf, 1);
3416 buf[0] = 0x00;
3417 usb_microdia_control_write(dev, 0x1006, buf, 1);
3419 buf[0] = 0x03;
3420 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 50 */
3422 buf[0] = 0x03;
3423 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3425 buf[0] = 0xc6;
3426 usb_microdia_control_write(dev, 0x1001, buf, 1);
3428 buf[0] = 0xc4;
3429 usb_microdia_control_write(dev, 0x1001, buf, 1);
3431 buf[0] = 0x44;
3432 usb_microdia_control_write(dev, 0x1001, buf, 1);
3434 buf[0] = 0x80;
3435 usb_microdia_control_write(dev, 0x1189, buf, 1);
3437 buf[0] = 0x00;
3438 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3440 buf[0] = 0x00;
3441 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3443 buf[0] = 0x00;
3444 usb_microdia_control_write(dev, 0x11be, buf, 1);
3446 buf[0] = 0x00;
3447 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3449 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3450 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
3452 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3453 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
3455 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3456 0x09, dev->sensor_flags, NULL);
3458 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3459 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3461 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
3462 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3463 usb_microdia_control_write(dev, 0x1180, buf, 6);
3465 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3466 buf[3] = 0xf0; buf[4] = 0x00;
3467 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 70 */
3469 buf[0] = 0x8c;
3470 usb_microdia_control_write(dev, 0x1189, buf, 1);
3472 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3473 usb_microdia_control_write(dev, 0x11a1, buf, 4);
3475 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3476 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3478 buf[0] = 0x78;
3479 usb_microdia_control_write(dev, 0x1000, buf, 1);
3481 buf[0] = 0x18;
3482 usb_microdia_control_write(dev, 0x1002, buf, 1);
3484 buf[0] = 0x18;
3485 usb_microdia_control_write(dev, 0x1002, buf, 1);
3487 buf[0] = 0x38;
3488 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3490 buf[0] = 0x02;
3491 usb_microdia_control_write(dev, 0x118a, buf, 1);
3493 buf[0] = 0x02;
3494 usb_microdia_control_write(dev, 0x0395, buf, 1);
3496 buf[0] = 0x78;
3497 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 80 */
3498 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3500 buf[0] = 0xf9;
3501 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3502 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3504 buf[0] = 0xfa;
3505 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3506 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3508 buf[0] = 0x7b;
3509 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3510 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3512 buf[0] = 0x7c;
3513 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3514 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3516 buf[0] = 0x7b;
3517 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 90 */
3519 for (i = 0; i < 4; i++)
3520 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3521 third10c0[i][0], dev->sensor_flags, &third10c0[i][1]); /* URB 97-106 */
3523 buf[0] = 0x06;
3524 usb_microdia_control_write(dev, 0x1180, buf, 1);
3526 for (i = 0; i < 3; i++)
3527 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3528 fourth10c0a[i][0], dev->sensor_flags, &fourth10c0a[i][1]);
3530 for (i = 0; i < 2; i++)
3531 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3532 fourth10c0b[i][0], dev->sensor_flags, &fourth10c0b[i][1]);
3534 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3535 0x33, dev->sensor_flags, NULL);
3537 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3538 first10c0[0][0], dev->sensor_flags, &first10c0[0][1]);
3540 buf[0] = 0x20;
3541 usb_microdia_control_write(dev, 0x118c, buf, 1);
3543 buf[0] = 0x20;
3544 usb_microdia_control_write(dev, 0x118d, buf, 1); /* URB 110 */
3546 buf[0] = 0x20;
3547 usb_microdia_control_write(dev, 0x118e, buf, 1);
3549 buf[0] = 0x20;
3550 usb_microdia_control_write(dev, 0x118f, buf, 1);
3552 buf[0] = 0x0a;
3553 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3555 buf[0] = 0x20;
3556 usb_microdia_control_write(dev, 0x118c, buf, 1);
3558 buf[0] = 0x20;
3559 usb_microdia_control_write(dev, 0x118d, buf, 1);
3561 buf[0] = 0x20;
3562 usb_microdia_control_write(dev, 0x118e, buf, 1);
3564 buf[0] = 0x20;
3565 usb_microdia_control_write(dev, 0x118f, buf, 1);
3567 buf[0] = 0x10;
3568 usb_microdia_control_write(dev, 0x118b, buf, 1);
3570 usb_microdia_control_write(dev, 0x1190, urb119, 17);
3572 for (i = 0; i < 9; i++)
3573 usb_microdia_control_write(dev, 0x10e1, urb120, 21); /* URB 120-128 */
3575 buf[0] = 0x05;
3576 usb_microdia_control_write(dev, 0x10f7, buf, 1);
3578 buf[0] = 0x60;
3579 usb_microdia_control_write(dev, 0x10f6, buf, 1); /* URB 130 */
3581 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
3583 buf[0] = 0x14;
3584 usb_microdia_control_write(dev, 0x10f8, buf, 1);
3586 buf[0] = 0xff;
3587 usb_microdia_control_write(dev, 0x10fa, buf, 1);
3589 buf[0] = 0x00;
3590 usb_microdia_control_write(dev, 0x10f9, buf, 1);
3592 buf[0] = 0x00;
3593 usb_microdia_control_write(dev, 0x10f9, buf, 1);
3595 buf[0] = 0x0a;
3596 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3598 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
3599 usb_microdia_control_write(dev, 0x11bc, buf, 4);
3601 /* Set whole array buf to 0x00 */
3602 memset(buf, 0x00, 48);
3603 usb_microdia_control_write(dev, 0x11c0, buf, 48);
3605 buf[0] = 0x20;
3606 usb_microdia_control_write(dev, 0x118c, buf, 1);
3608 buf[0] = 0x20;
3609 usb_microdia_control_write(dev, 0x118d, buf, 1); /* URB 140 */
3611 buf[0] = 0x20;
3612 usb_microdia_control_write(dev, 0x118e, buf, 1);
3614 buf[0] = 0x20;
3615 usb_microdia_control_write(dev, 0x118f, buf, 1);
3617 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
3618 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
3619 usb_microdia_control_write(dev, 0x11a5, buf, 6);
3621 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
3622 usb_microdia_control_write(dev, 0x11af, buf, 4);
3624 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
3625 usb_microdia_control_write(dev, 0x11b3, buf, 4);
3627 buf[0] = 0x07;
3628 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3630 buf[0] = 0x01;
3631 usb_microdia_control_write(dev, 0x1061, buf, 1);
3633 buf[0] = 0x27;
3634 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3636 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
3638 usb_microdia_control_write(dev, 0x1140, qtable2, 64); /* URB 150 */
3640 buf[0] = 0x07;
3641 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3643 buf[0] = 0x03;
3644 usb_microdia_control_write(dev, 0x1061, buf, 1);
3646 buf[0] = 0x0b;
3647 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3649 buf[0] = 0x8c;
3650 usb_microdia_control_write(dev, 0x1189, buf, 1);
3652 buf[0] = 0x00;
3653 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3655 buf[0] = 0x00;
3656 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3658 buf[0] = 0x00;
3659 usb_microdia_control_write(dev, 0x11be, buf, 1);
3661 buf[0] = 0x00;
3662 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3664 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3665 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
3667 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3668 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
3670 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3671 0x09, dev->sensor_flags, NULL);
3673 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3674 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3676 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
3677 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3678 usb_microdia_control_write(dev, 0x1180, buf, 6);
3680 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3681 buf[3] = 0xf0; buf[4] = 0x00;
3682 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3684 buf[0] = 0x8c;
3685 usb_microdia_control_write(dev, 0x1189, buf, 1);
3687 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3688 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 170 */
3690 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3691 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3693 buf[0] = 0x03;
3694 usb_microdia_control_write(dev, 0x1061, buf, 1);
3696 buf[0] = 0x0a;
3697 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3699 buf[0] = 0x00;
3700 usb_microdia_control_write(dev, 0x11b9, buf, 1);
3702 buf[0] = 0x0b;
3703 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3705 buf[0] = 0x01;
3706 usb_microdia_control_write(dev, 0x1061, buf, 1);
3708 buf[0] = 0x78;
3709 usb_microdia_control_write(dev, 0x1000, buf, 1);
3711 buf[0] = 0x18;
3712 usb_microdia_control_write(dev, 0x1002, buf, 1);
3714 buf[0] = 0x18;
3715 usb_microdia_control_write(dev, 0x1002, buf, 1);
3717 buf[0] = 0x7b;
3718 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 180 */
3720 buf[0] = 0x02;
3721 usb_microdia_control_write(dev, 0x118a, buf, 1);
3723 buf[0] = 0x02;
3724 usb_microdia_control_write(dev, 0x0395, buf, 1);
3726 buf[0] = 0x78;
3727 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3728 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3730 buf[0] = 0xf9;
3731 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3732 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3734 buf[0] = 0xfa;
3735 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3736 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3738 buf[0] = 0x7b;
3739 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3740 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 190 */
3742 buf[0] = 0x7c;
3743 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3744 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3746 buf[0] = 0x7b;
3747 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3749 for (i = 0; i < 3; i++)
3750 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3751 fifth10c0[i][0], dev->sensor_flags, &fifth10c0[i][1]); /* URB 200-205 */
3753 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2,
3754 0x00, dev->sensor_flags, buf);
3755 /* __u8 result[2] = {buf[3], buf[4]}; */
3757 buf[0] = 0x03;
3758 usb_microdia_control_write(dev, 0x1061, buf, 1);
3760 return 0;
3764 * @brief From startstream.log
3766 * @param dev
3768 * @returns 0
3770 * @author GWater
3772 * For SN9C201 with SOI968.
3773 * This is function triggers a working stream of image data and a glowing LED.
3775 int microdia_624e_start_stream(struct usb_microdia *dev)
3777 int i = -1;
3778 __u8 buf[48];
3780 __u8 urb10[24] =
3781 {0x47, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
3782 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
3783 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
3785 __u8 urb14[22] =
3786 {0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
3787 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
3788 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
3790 __u8 urb119[17] =
3791 {0x08, 0x2b, 0x59, 0x79, 0x91, 0x9e, 0xa9, 0xb3,
3792 0xbd, 0xc6, 0xce, 0xd6, 0xdd, 0xe4, 0xea, 0xf1,
3793 0xf7};
3795 __u8 urb120[21] =
3796 {0x16, 0x00, 0x2d, 0x00, 0x08, 0x00, 0xdd, 0x0f,
3797 0xbc, 0x0f, 0x68, 0x00, 0x68, 0x00, 0xa9, 0x0f,
3798 0xf0, 0x0f, 0x00, 0x00, 0x00};
3800 __u8 qtable1[64] =
3801 {0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
3802 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
3803 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
3804 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
3805 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
3806 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
3807 0x4f, 0x53, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
3808 0x64, 0x5c, 0x53, 0x64, 0x4b, 0x53, 0x58, 0x53};
3810 __u8 qtable2[64] =
3811 {0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
3812 0x15, 0x26, 0x53, 0x36, 0x2e, 0x36, 0x53, 0x53,
3813 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3814 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3815 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3816 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3817 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3818 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53};
3820 __u8 first10c0[20][2] = {
3821 {0x12, 0x80}, {0x12, 0x00}, {0x0c, 0x00}, {0x0f, 0x1f},
3822 {0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00}, {0x33, 0x08},
3823 {0x35, 0x8c}, {0x36, 0x0c}, {0x37, 0x04}, {0x45, 0x04},
3824 {0x47, 0xff}, {0x3e, 0x00}, {0x3f, 0x00}, {0x3b, 0x20},
3825 {0x3a, 0x96}, {0x3d, 0x0a}, {0x14, 0x4e}, {0x13, 0x88}};
3827 __u8 second10c0a[2] =
3828 {0x12, 0x40};
3829 __u8 second10c0b[5] =
3830 {0x17, 0x13, 0x63, 0x01, 0x79}; // length 4
3831 __u8 second10c0c[2] =
3832 {0x1b, 0x00}; // length 0
3833 __u8 second10c0d[2][2] = {
3834 {0x32, 0x24},
3835 {0x03, 0x00}};
3837 __u8 third10c0a[5][2] = {
3838 {0x11, 0x40},
3839 {0x2a, 0x10},
3840 {0x2b, 0xe0},
3841 {0x10, 0x32},
3842 {0x00, 0x00}};
3843 __u8 third10c0b[3] =
3844 {0x01, 0x80, 0x80}; // length 2
3846 __u8 read10c0[4] =
3847 {0x0a, 0x0b, 0x1c, 0x1d}; // these are four addresses
3849 // interrupt down
3851 buf[0] = 0x00;
3852 usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 1
3854 // interrupt up
3856 // interrupt down
3858 buf[0] = 0x78;
3859 usb_microdia_control_write(dev, 0x1000, buf, 1);
3861 buf[0] = 0xc7;
3862 usb_microdia_control_write(dev, 0x1001, buf, 1);
3864 buf[0] = 0x1c;
3865 usb_microdia_control_write(dev, 0x1002, buf, 1);
3867 buf[0] = 0xa0; buf[1] = 0xa0;
3868 usb_microdia_control_write(dev, 0x1006, buf, 2);
3870 buf[0] = 0x01;
3871 usb_microdia_control_write(dev, 0x1061, buf, 1);
3873 buf[0] = 0x80;
3874 usb_microdia_control_write(dev, 0x1020, buf, 1);
3876 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3877 buf[3] = 0x10; buf[4] = 0x08;
3878 usb_microdia_control_write(dev, 0x1067, buf, 5);
3880 buf[0] = 0x92; buf[1] = dev->sensor_slave_address; buf[2] = 0x00;
3881 buf[3] = 0x00; buf[4] = 0x1d; buf[5] = 0x00;
3882 buf[6] = 0xa2; buf[7] = 0x10; buf[8] = 0x03;
3883 usb_microdia_control_write(dev, 0x10c0, buf, 9);
3885 usb_microdia_control_write(dev, 0x10e0, urb10, 24); // URB 10
3887 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
3888 usb_microdia_control_write(dev, 0x10f8, buf, 3);
3890 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3891 buf[3] = 0xf0; buf[4] = 0x00;
3892 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3894 buf[0] = 0x8a; buf[1] = 0xcc; buf[2] = 0x08;
3895 usb_microdia_control_write(dev, 0x1188, buf, 3);
3897 usb_microdia_control_write(dev, 0x118b, urb14, 22);
3899 buf[0] = 0x00; buf[1] = 0x00;
3900 usb_microdia_control_write(dev, 0x11a1, buf, 2);
3902 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
3903 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x40;
3904 buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
3905 usb_microdia_control_write(dev, 0x11b7, buf, 9);
3907 buf[0] = 0x30;
3908 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3910 buf[0] = 0x78;
3911 usb_microdia_control_write(dev, 0x1000, buf, 1);
3913 for (i = 0; i < 20; i++) // URB 9-48
3914 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3915 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]);
3917 buf[0] = 0x47;
3918 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3920 buf[0] = 0x07;
3921 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 50
3923 buf[0] = 0xc6;
3924 usb_microdia_control_write(dev, 0x1001, buf, 1);
3926 buf[0] = 0xc4;
3927 usb_microdia_control_write(dev, 0x1001, buf, 1);
3929 buf[0] = 0x44;
3930 usb_microdia_control_write(dev, 0x1001, buf, 1);
3932 buf[0] = 0x8c;
3933 usb_microdia_control_write(dev, 0x1189, buf, 1);
3935 buf[0] = 0x00;
3936 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3938 buf[0] = 0x00;
3939 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3941 buf[0] = 0x00;
3942 usb_microdia_control_write(dev, 0x11be, buf, 1);
3944 buf[0] = 0x00;
3945 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3948 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, // URB 59-60
3949 second10c0a[0], dev->sensor_flags, &second10c0a[1]);
3951 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3952 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3954 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3955 second10c0c[0], dev->sensor_flags, &second10c0c[1]);
3957 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3958 second10c0d[0][0], dev->sensor_flags, &second10c0d[0][1]);
3960 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3961 second10c0d[1][0], dev->sensor_flags, &second10c0d[1][1]);
3963 buf[0] = 0x3c; buf[1] = 0x00; buf[2] = 0x0b;
3964 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3965 usb_microdia_control_write(dev, 0x1180, buf, 6);
3967 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3968 buf[3] = 0xf0; buf[4] = 0x00;
3969 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 70
3971 buf[0] = 0x8c;
3972 usb_microdia_control_write(dev, 0x1189, buf, 1);
3974 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3975 usb_microdia_control_write(dev, 0x11a1, buf, 4);
3977 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3978 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3980 buf[0] = 0x7c;
3981 usb_microdia_control_write(dev, 0x1000, buf, 1);
3983 buf[0] = 0x1c;
3984 usb_microdia_control_write(dev, 0x1002, buf, 1);
3986 buf[0] = 0x1c;
3987 usb_microdia_control_write(dev, 0x1002, buf, 1);
3989 buf[0] = 0x38;
3990 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3992 buf[0] = 0x05;
3993 usb_microdia_control_write(dev, 0x118a, buf, 1);
3995 buf[0] = 0x05;
3996 usb_microdia_control_write(dev, 0x0395, buf, 1);
3998 buf[0] = 0x78;
3999 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 80
4000 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4002 buf[0] = 0xf9;
4003 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4004 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4006 buf[0] = 0x7a;
4007 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4008 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4010 buf[0] = 0x7b;
4011 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4012 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4014 buf[0] = 0x7c;
4015 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4016 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4018 buf[0] = 0xfd;
4019 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 90
4020 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4022 buf[0] = 0xfe;
4023 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4024 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4026 buf[0] = 0x7f;
4027 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4028 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4030 buf[0] = 0x7a;
4031 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4033 for (i = 0; i < 5; i++) // URB 97-106
4034 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4035 third10c0a[i][0], dev->sensor_flags, &third10c0a[i][1]);
4037 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
4038 third10c0b[0], dev->sensor_flags, &third10c0b[1]);
4040 buf[0] = 0x20;
4041 usb_microdia_control_write(dev, 0x118c, buf, 1);
4043 buf[0] = 0x20;
4044 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 110
4046 buf[0] = 0x20;
4047 usb_microdia_control_write(dev, 0x118e, buf, 1);
4049 buf[0] = 0x20;
4050 usb_microdia_control_write(dev, 0x118f, buf, 1);
4052 buf[0] = 0x0a;
4053 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4055 buf[0] = 0x20;
4056 usb_microdia_control_write(dev, 0x118c, buf, 1);
4058 buf[0] = 0x20;
4059 usb_microdia_control_write(dev, 0x118d, buf, 1);
4061 buf[0] = 0x20;
4062 usb_microdia_control_write(dev, 0x118e, buf, 1);
4064 buf[0] = 0x20;
4065 usb_microdia_control_write(dev, 0x118f, buf, 1);
4067 buf[0] = 0x0a;
4068 usb_microdia_control_write(dev, 0x118b, buf, 1);
4070 usb_microdia_control_write(dev, 0x1190, urb119, 17);
4072 for (i = 0; i < 9; i++) // URB 120-128
4073 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
4076 buf[0] = 0x07;
4077 usb_microdia_control_write(dev, 0x10f7, buf, 1);
4079 buf[0] = 0x60;
4080 usb_microdia_control_write(dev, 0x10f6, buf, 1); // URB 130
4082 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
4084 buf[0] = 0x14;
4085 usb_microdia_control_write(dev, 0x10f8, buf, 1);
4087 buf[0] = 0xff;
4088 usb_microdia_control_write(dev, 0x10fa, buf, 1);
4090 buf[0] = 0x00;
4091 usb_microdia_control_write(dev, 0x10f9, buf, 1);
4093 buf[0] = 0x00;
4094 usb_microdia_control_write(dev, 0x10f9, buf, 1);
4096 buf[0] = 0x0e;
4097 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4099 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
4100 usb_microdia_control_write(dev, 0x11bc, buf, 4);
4102 /* Set whole buf to 0x00 */
4103 memset(buf, 0, 48);
4104 usb_microdia_control_write(dev, 0x11c0, buf, 48);
4106 buf[0] = 0x20;
4107 usb_microdia_control_write(dev, 0x118c, buf, 1);
4109 buf[0] = 0x20;
4110 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 140
4112 buf[0] = 0x20;
4113 usb_microdia_control_write(dev, 0x118e, buf, 1);
4115 buf[0] = 0x20;
4116 usb_microdia_control_write(dev, 0x118f, buf, 1);
4118 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
4119 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
4120 usb_microdia_control_write(dev, 0x11a5, buf, 6);
4122 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
4123 usb_microdia_control_write(dev, 0x11af, buf, 4);
4125 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
4126 usb_microdia_control_write(dev, 0x11b3, buf, 4);
4128 buf[0] = 0x07;
4129 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4131 buf[0] = 0x01;
4132 usb_microdia_control_write(dev, 0x1061, buf, 1);
4134 buf[0] = 0x27;
4135 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4137 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
4139 usb_microdia_control_write(dev, 0x1140, qtable2, 64); // URB 150
4141 buf[0] = 0x07;
4142 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4144 buf[0] = 0x03;
4145 usb_microdia_control_write(dev, 0x1061, buf, 1);
4147 buf[0] = 0x0b;
4148 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4150 buf[0] = 0x8c;
4151 usb_microdia_control_write(dev, 0x1189, buf, 1);
4153 buf[0] = 0x00;
4154 usb_microdia_control_write(dev, 0x11bc, buf, 1);
4156 buf[0] = 0x00;
4157 usb_microdia_control_write(dev, 0x11bd, buf, 1);
4159 buf[0] = 0x00;
4160 usb_microdia_control_write(dev, 0x11be, buf, 1);
4162 buf[0] = 0x00;
4163 usb_microdia_control_write(dev, 0x11bf, buf, 1);
4165 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, // URB 159-160
4166 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
4168 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
4169 second10c0c[0], dev->sensor_flags, &second10c0c[1]);
4171 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4172 second10c0d[0][0], dev->sensor_flags, &second10c0d[0][1]);
4174 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4175 second10c0d[1][0], dev->sensor_flags, &second10c0d[1][1]);
4177 buf[0] = 0x3c; buf[1] = 0x00; buf[2] = 0x0b;
4178 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
4179 usb_microdia_control_write(dev, 0x1180, buf, 6);
4181 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
4182 buf[3] = 0xf0; buf[4] = 0x00;
4183 usb_microdia_control_write(dev, 0x10fb, buf, 5);
4185 buf[0] = 0x8c;
4186 usb_microdia_control_write(dev, 0x1189, buf, 1);
4188 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
4189 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 170
4191 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
4192 usb_microdia_control_write(dev, 0x11ab, buf, 4);
4194 buf[0] = 0x03;
4195 usb_microdia_control_write(dev, 0x1061, buf, 1);
4197 buf[0] = 0x0e;
4198 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4200 buf[0] = 0x00;
4201 usb_microdia_control_write(dev, 0x11b9, buf, 1);
4203 buf[0] = 0x0f;
4204 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4206 buf[0] = 0x01;
4207 usb_microdia_control_write(dev, 0x1061, buf, 1);
4209 buf[0] = 0x7c;
4210 usb_microdia_control_write(dev, 0x1000, buf, 1);
4212 buf[0] = 0x1c;
4213 usb_microdia_control_write(dev, 0x1002, buf, 1);
4215 buf[0] = 0x1c;
4216 usb_microdia_control_write(dev, 0x1002, buf, 1);
4218 buf[0] = 0x7a;
4219 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 180
4221 buf[0] = 0x05;
4222 usb_microdia_control_write(dev, 0x118a, buf, 1);
4224 buf[0] = 0x05;
4225 usb_microdia_control_write(dev, 0x0395, buf, 1);
4227 buf[0] = 0x78;
4228 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4229 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4231 buf[0] = 0xf9;
4232 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4233 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4235 buf[0] = 0x7a;
4236 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4237 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4239 buf[0] = 0x7b;
4240 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4241 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 190
4243 buf[0] = 0x7c;
4244 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4245 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4247 buf[0] = 0x7d;
4248 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4249 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4251 buf[0] = 0xfe;
4252 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4253 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4255 buf[0] = 0x7f;
4256 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4257 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4259 buf[0] = 0x7a;
4260 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4262 for (i = 0; i < 3; i++) // URB 200-205
4263 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4264 third10c0a[i][0], dev->sensor_flags, &third10c0a[i][1]);
4266 for (i = 0; i < 4; i++) // URB 206-225
4267 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address,
4268 1, read10c0[i], dev->sensor_flags, buf);
4270 buf[0] = 0x03;
4271 usb_microdia_control_write(dev, 0x1061, buf, 1);
4273 buf[0] = 0xa0;
4274 usb_microdia_control_write(dev, 0x1007, buf, 1);
4276 buf[0] = 0x80;
4277 usb_microdia_control_write(dev, 0x1006, buf, 1);
4279 return 0;
4282 int microdia_624f_start_stream(struct usb_microdia *dev)
4284 int ret, i;
4285 __u8 last_11b8[1];
4286 __u8 eeprom_slave_id = 0x50;
4287 __u8 eeprom_flags = SN9C20X_I2C_2WIRE;
4288 __u16 command;
4289 __u8 buf[64];
4290 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
4291 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
4293 buf[0] = 0x20;
4294 command = 0x1007;
4295 ret = usb_microdia_control_write(dev, command, buf, 1);
4296 if(ret < 0) goto err;
4298 buf[0] = 0x00;
4299 command = 0x1006;
4300 ret = usb_microdia_control_write(dev, command, buf, 1);
4301 if(ret < 0) goto err;
4303 buf[0] = 0x78;
4304 command = 0x1000;
4305 ret = usb_microdia_control_write(dev, command, buf, 1);
4306 if(ret < 0) goto err;
4308 buf[0] = 0xc7;
4309 command = 0x1001;
4310 ret = usb_microdia_control_write(dev, command, buf, 1);
4311 if(ret < 0) goto err;
4313 buf[0] = 0x1c;
4314 command = 0x1002;
4315 ret = usb_microdia_control_write(dev, command, buf, 1);
4316 if(ret < 0) goto err;
4318 buf[0] = 0x01;
4319 command = 0x1061;
4320 ret = usb_microdia_control_write(dev, command, buf, 1);
4321 if(ret < 0) goto err;
4323 buf[0] = 0x80;
4324 command = 0x1020;
4325 ret = usb_microdia_control_write(dev, command, buf, 1);
4326 if(ret < 0) goto err;
4328 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
4329 buf[3] = 0x10; buf[4] = 0x08;
4330 command = 0x1067;
4331 ret = usb_microdia_control_write(dev, command, buf, 5);
4332 if(ret < 0) goto err;
4334 /* this is the same register as the I2C write, not sure why
4335 * we're writing 9 bytes -- the SN9C102 docs say all writes
4336 * must be 8 bytes, but we don't have docs for SN9C20x */
4337 command = 0x10c0;
4338 ret = usb_microdia_control_write(dev, command, unknown1, 9);
4339 if(ret < 0) goto err;
4341 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
4342 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
4343 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
4344 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
4345 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
4346 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
4347 command = 0x10e0;
4348 ret = usb_microdia_control_write(dev, command, buf, 24);
4349 if(ret < 0) goto err;
4351 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
4352 command = 0x10f8;
4353 ret = usb_microdia_control_write(dev, command, buf, 3);
4354 if(ret < 0) goto err;
4356 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
4357 buf[3] = 0xf0; buf[4] = 0x00;
4358 command = 0x10fb;
4359 ret = usb_microdia_control_write(dev, command, buf, 5);
4360 if(ret < 0) goto err;
4362 buf[0] = 0x87; buf[1] = 0xcc; buf[2] = 0x08;
4363 command = 0x1188;
4364 ret = usb_microdia_control_write(dev, command, buf, 3);
4365 if(ret < 0) goto err;
4367 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
4368 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
4369 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
4370 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
4371 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
4372 buf[20] = 0xf4; buf[21] = 0xff;
4373 command = 0x118b;
4374 ret = usb_microdia_control_write(dev, command, buf, 22);
4375 if(ret < 0) goto err;
4377 buf[0] = 0x00; buf[1] = 0x00;
4378 command = 0x11a1;
4379 ret = usb_microdia_control_write(dev, command, buf, 2);
4380 if(ret < 0) goto err;
4382 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08;
4383 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
4384 buf[8] = 0x00;
4385 command = 0x11b7;
4386 ret = usb_microdia_control_write(dev, command, buf, 9);
4387 if(ret < 0) goto err;
4389 buf[0] = 0x30;
4390 command = 0x11b8;
4391 ret = usb_microdia_control_write(dev, command, buf, 1);
4392 if(ret < 0) goto err;
4394 buf[0] = 0x78;
4395 command = 0x1000;
4396 ret = usb_microdia_control_write(dev, command, buf, 1);
4397 if(ret < 0) goto err;
4399 /* reset all SCCB registers to their default values */
4400 buf[0] = OV965X_COM7_SCCB_RESET;
4401 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM7,
4402 dev->sensor_flags, buf);
4403 if(ret < 0) goto err;
4405 buf[0] = 0x7f; //0x7f; /* AGC setting */
4406 buf[1] = 0xe0; /* blue gain setting */
4407 buf[2] = 0x90; /* red gain setting */
4408 buf[3] = OV965X_VREF_VSTOP_LOW3(0x04) | OV965X_VREF_VSTART_LOW3(0x02);
4409 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_GAIN,
4410 dev->sensor_flags, buf);
4411 if(ret < 0) goto err;
4414 this write appears to be unnecessary since we issued
4415 the reset above and the spec says that 0x00 is the default
4416 for all 4 of the registers we're writing to here
4418 memset(buf, 0, 4);
4419 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM1,
4420 dev->sensor_flags, buf);
4421 if(ret < 0) goto err;
4423 /* first byte still 0, not sure why, RAVE default is 0x00 too */
4424 buf[0] = 0;
4425 buf[1] = OV965X_COM2_OUTPUT_DRIVE_CAP_2X;
4426 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, OV965X_CTL_RAVE,
4427 dev->sensor_flags, buf);
4428 if(ret < 0) goto err;
4430 buf[0] = 0x00; buf[1] = 0x00;
4431 /* not sure why we're setting bit 5 below, spec says it's reserved */
4432 buf[2] = OV965X_COM5_15FPS_48MHZ_RGB | 0x20;
4433 /* likewise, spec says 4 & 6 are reserved */
4434 buf[3] = OV965X_COM6_TIMING_RESET_ON_FMT_CHANGE | 0x50;
4435 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM3,
4436 dev->sensor_flags, buf);
4437 if(ret < 0) goto err;
4439 buf[0] = 0xff; /* AEC bits 2-9 */
4440 buf[1] = OV965X_CLKRC_INPUT_CLK_NO_SCALE;
4441 buf[2] = OV965X_COM7_OUTPUT_RAW_RGB;
4442 buf[3] = OV965X_COM8_FAST_AGC_AEC | OV965X_COM8_AEC_STEP_SIZE_NOLIMIT |
4443 /*OV965X_COM8_AGC_ENABLE |*/ OV965X_COM8_AEC_ENABLE | OV965X_COM8_AWB_ENABLE;
4444 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_AECH,
4445 dev->sensor_flags, buf);
4446 if(ret < 0) goto err;
4448 buf[0] = OV965X_COM9_MAX_AGC_8X | OV965X_COM9_RELAX_EXPOSURE_TIMING |
4449 OV965X_COM9_DROP_VSYNC_ON_FRAME_DROP |
4450 OV965X_COM9_DROP_FRAME_ON_BIG_AEC;
4451 buf[1] = 0x00;
4452 buf[2] = 0x07; /* hmm, spec says this is reserved */
4453 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, OV965X_CTL_COM9,
4454 dev->sensor_flags, buf);
4455 if(ret < 0) goto err;
4457 /* this is supposed to be reserved too */
4458 buf[0] = 0x04; buf[1] = 0x00;
4459 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, OV965X_CTL_MVFP,
4460 dev->sensor_flags, buf);
4461 if(ret < 0) goto err;
4463 buf[0] = 0x78; /* this is the default! */
4464 buf[1] = 0x68; /* this is the default! */
4465 buf[2] = 0xd4; /* this is the default! */
4466 buf[3] = 0x80; /* this is the default! */
4467 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_AEW,
4468 dev->sensor_flags, buf);
4469 if(ret < 0) goto err;
4471 buf[0] = OV965X_BIAS_SUBTRACT;
4472 buf[1] = OV965X_Gr_COM_BYPASS_ANALOG_BLC | OV965X_Gr_COM_BYPASS_REGULATOR;
4473 buf[2] = 0x00; buf[3] = 0x00;
4474 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_GbBIAS,
4475 dev->sensor_flags, buf);
4476 if(ret < 0) goto err;
4478 buf[0] = OV965X_BIAS_SUBTRACT;
4479 buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
4480 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_RBIAS,
4481 dev->sensor_flags, buf);
4482 if(ret < 0) goto err;
4484 buf[0] = 0x08; /* HSYNC rising edge start */
4485 buf[1] = 0x30; /* HSYNC rising edge end */
4486 buf[2] = OV965X_HREF_EDGE_OFT_TO_DATA_OUT(2) | OV965X_HREF_HSTART_LOW3(6)
4487 | OV965X_HREF_HSTOP_LOW3(4);
4488 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, OV965X_CTL_HSYST,
4489 dev->sensor_flags, buf);
4490 if(ret < 0) goto err;
4492 /* the docs say all 4 of these bytes are reserved */
4493 buf[0] = 0xe2; buf[1] = 0xbf; buf[2] = 0x81; buf[3] = 0xf9;
4494 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_CHLF,
4495 dev->sensor_flags, buf);
4496 if(ret < 0) goto err;
4498 /* the docs say these 2 bytes are reserved */
4499 buf[0] = 0x00; buf[1] = 0x93;
4500 buf[2] = 0x50; /* bits 4 and 6 are supposedly reserved */
4501 buf[3] = OV965X_TSLB_OUTPUT_SEQ_UYVY | OV965X_TSLB_DIGITAL_BLC_ENABLE;
4502 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_ADC,
4503 dev->sensor_flags, buf);
4504 if(ret < 0) goto err;
4506 buf[0] = OV965X_COM11_MANUAL_BANDING_FILTER;
4507 buf[1] = 0x73; /* these bits all reserved */
4508 buf[2] = OV965X_COM13_ENABLE_COLOR_MATRIX | OV965X_COM13_DELAY_Y_CHANNEL
4509 | OV965X_COM13_OUTPUT_DELAY(1);
4510 buf[3] = OV965X_COM14_YUV_EDGE_ENHANCE
4511 | OV965X_COM14_EDGE_ENHANCE_FACTOR_DBL
4512 | 0x0b; /* these last bits supposedly reserved */
4513 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM11,
4514 dev->sensor_flags, buf);
4515 if(ret < 0) goto err;
4517 buf[0] = OV965X_EDGE_EDGE_ENHANCE_LOW4(8)
4518 | OV965X_EDGE_EDGE_ENHANCE_FACTOR(8);
4519 buf[1] = OV965X_COM15_OUTPUT_RANGE_O0_TO_FF | 0x01; /* bit reserved */
4520 buf[2] = 0x00; buf[3] = 0x08; /* this bit supposedly reserved */
4521 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_EDGE,
4522 dev->sensor_flags, buf);
4523 if(ret < 0) goto err;
4525 buf[0] = 0x00;
4526 /* OV9653 control register 0x43 is reserved, according to the docs */
4527 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x43,
4528 dev->sensor_flags, buf); // 'Dummy'-write
4529 if(ret < 0) goto err;
4531 buf[0] = 0x80; buf[1] = 0x80; buf[2] = 0x40; buf[3] = 0x00;
4532 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_MANU,
4533 dev->sensor_flags, buf);
4534 if(ret < 0) goto err;
4536 buf[0] = 0x0a;
4537 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DBLV,
4538 dev->sensor_flags, buf);
4539 if(ret < 0) goto err;
4541 buf[0] = 0x06; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x00;
4542 /* OV9653 control register 0x8b is reserved, according to the docs */
4543 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x8b,
4544 dev->sensor_flags, buf);
4545 if(ret < 0) goto err;
4547 buf[0] = 0xdf;
4548 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DBLC1,
4549 dev->sensor_flags, buf);
4550 if(ret < 0) goto err;
4552 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x88; buf[3] = 0x88;
4553 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_DM_LNL,
4554 dev->sensor_flags, buf);
4555 if(ret < 0) goto err;
4557 buf[0] = 0x04;
4558 /* control reg 0x96 reserved, according to docs */
4559 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x96,
4560 dev->sensor_flags, buf);
4561 if(ret < 0) goto err;
4563 buf[0] = 0x80;
4564 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM26,
4565 dev->sensor_flags, buf);
4566 if(ret < 0) goto err;
4568 buf[0] = 0x80; buf[1] = 0xb8; buf[2] = 0x92; buf[3] = 0x0a;
4569 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_ACOM2,
4570 dev->sensor_flags, buf);
4571 if(ret < 0) goto err;
4573 /* reserved, according to docs */
4574 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0xac,
4575 dev->sensor_flags, NULL);
4576 if(ret < 0) goto err;
4578 buf[0] = 0x1b; buf[1] = 0xbb; buf[2] = 0x05; buf[3] = 0x7d;
4579 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_HSTART,
4580 dev->sensor_flags, buf);
4581 if(ret < 0) goto err;
4583 buf[0] = 0x00;
4584 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_PSHIFT,
4585 dev->sensor_flags, buf);
4586 if(ret < 0) goto err;
4588 /* now for some reason it switches to these two reads and
4589 * then back to the long init sequence */
4590 command = 0x10c1;
4591 ret = usb_microdia_control_read(dev, command, buf, 1); /* reads 30 */
4592 if(ret < 0) goto err;
4593 //msg("Should read 0x30, read: %x", buf[0]);
4595 command = 0x10c1;
4596 buf[0] = eeprom_slave_id;
4597 ret = usb_microdia_control_write(dev, command, buf, 1);
4598 if(ret < 0) goto err;
4600 // TRY TO READ FROM EEPROM:
4601 ret = sn9c20x_read_i2c_data(dev, eeprom_slave_id, 1, 0x00, eeprom_flags, buf);
4602 if (ret < 0)
4604 UDIA_INFO("No EEPROM found\n");
4606 else
4608 UDIA_INFO("Read from EEPROM successful\n");
4609 /* returns 0xff -- don't know what we're supposed to do w/ that info */
4610 //msg("Read from eeprom, should read 0xff, read: %x", buf[0]);
4613 command = 0x10c1;
4614 buf[0] = dev->sensor_slave_address;
4615 ret = usb_microdia_control_write(dev, command, buf, 1);
4616 if(ret < 0) goto err;
4618 command = 0x10e0;
4619 buf[0] = 0x47;
4620 ret = usb_microdia_control_write(dev, command, buf, 1);
4621 if(ret < 0) goto err;
4623 command = 0x10e0;
4624 buf[0] = 0x07;
4625 ret = usb_microdia_control_write(dev, command, buf, 1);
4626 if(ret < 0) goto err;
4628 command = 0x1001;
4629 buf[0] = 0xc6;
4630 ret = usb_microdia_control_write(dev, command, buf, 1);
4631 if(ret < 0) goto err;
4633 command = 0x1001;
4634 buf[0] = 0xc4;
4635 ret = usb_microdia_control_write(dev, command, buf, 1);
4636 if(ret < 0) goto err;
4638 command = 0x1001;
4639 buf[0] = 0x44;
4640 ret = usb_microdia_control_write(dev, command, buf, 1);
4641 if(ret < 0) goto err;
4643 command = 0x1189;
4644 buf[0] = 0x8c;
4645 ret = usb_microdia_control_write(dev, command, buf, 1);
4646 if(ret < 0) goto err;
4648 command = 0x11bc;
4649 buf[0] = 0x40;
4650 ret = usb_microdia_control_write(dev, command, buf, 1);
4651 if (ret < 0) goto err;
4653 command = 0x11bd;
4654 buf[0] = 0x01;
4655 ret = usb_microdia_control_write(dev, command, buf, 1);
4656 if (ret < 0) goto err;
4658 command = 0x11be;
4659 buf[0] = 0xf0;
4660 ret = usb_microdia_control_write(dev, command, buf, 1);
4661 if (ret < 0) goto err;
4663 command = 0x11bf;
4664 buf[0] = 0x00;
4665 ret = usb_microdia_control_write(dev, command, buf, 1);
4666 if (ret < 0) goto err;
4668 buf[0] = 0x45;
4669 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM7,
4670 dev->sensor_flags, buf);
4671 if(ret < 0) goto err;
4673 buf[0] = 0x36;
4674 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_VREF,
4675 dev->sensor_flags, buf);
4676 if(ret < 0) goto err;
4678 buf[0] = 0x24; buf[1] = 0xc5; buf[2] = 0x00; buf[3] = 0x3c;
4679 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_HSTART,
4680 dev->sensor_flags, buf);
4681 if(ret < 0) goto err;
4683 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, OV965X_CTL_PSHIFT,
4684 dev->sensor_flags, NULL);
4685 if(ret < 0) goto err;
4687 buf[0] = 0x84;
4688 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_HREF,
4689 dev->sensor_flags, buf);
4690 if(ret < 0) goto err;
4692 command = 0x1180;
4693 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x07; buf[3] = 0x00;
4694 buf[4] = 0x28; buf[5] = 0x3c;
4695 ret = usb_microdia_control_write(dev, command, buf, 6);
4696 if(ret < 0) goto err;
4698 command = 0x10fb;
4699 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
4700 buf[4] = 0x00;
4701 ret = usb_microdia_control_write(dev, command, buf, 5);
4702 if(ret < 0) goto err;
4704 command = 0x1189;
4705 buf[0] = 0x8c;
4706 ret = usb_microdia_control_write(dev, command, buf, 1);
4707 if(ret < 0) goto err;
4709 command = 0x11a1;
4710 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
4711 ret = usb_microdia_control_write(dev, command, buf, 4);
4712 if(ret < 0) goto err;
4714 command = 0x11ab;
4715 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
4716 ret = usb_microdia_control_write(dev, command, buf, 4);
4717 if(ret < 0) goto err;
4719 command = 0x1000;
4720 buf[0] = 0x78;
4721 ret = usb_microdia_control_write(dev, command, buf, 1);
4722 if(ret < 0) goto err;
4724 command = 0x1002;
4725 buf[0] = 0x18;
4726 ret = usb_microdia_control_write(dev, command, buf, 1);
4727 if(ret < 0) goto err;
4729 command = 0x1002;
4730 buf[0] = 0x18;
4731 ret = usb_microdia_control_write(dev, command, buf, 1);
4732 if(ret < 0) goto err;
4734 /* urb 297 */
4735 command = 0x11b8;
4736 buf[0] = 0x38;
4737 ret = usb_microdia_control_write(dev, command, buf, 1);
4738 if(ret < 0) goto err;
4740 command = 0x118a;
4741 buf[0] = 0x04;
4742 ret = usb_microdia_control_write(dev, command, buf, 1);
4743 if(ret < 0) goto err;
4745 command = 0x0395;
4746 buf[0] = 0x04;
4747 ret = usb_microdia_control_write(dev, command, buf, 1);
4748 if(ret < 0) goto err;
4750 command = 0x11b8;
4751 buf[0] = 0x78;
4752 ret = usb_microdia_control_write(dev, command, buf, 1);
4753 if(ret < 0) goto err;
4754 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x38
4755 if(ret < 0) goto err;
4756 if (buf[0] == 0x38)
4757 buf[0] = 0x79;
4758 else if (buf[0] == 0xb8)
4759 buf[0] = 0xf9;
4760 ret = usb_microdia_control_write(dev, command, buf, 1);
4761 if(ret < 0) goto err;
4762 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x39
4763 if(ret < 0) goto err;
4764 if (buf[0] == 0x39)
4765 buf[0] = 0x7a;
4766 else if (buf[0] == 0xb9)
4767 buf[0] = 0xfa;
4768 ret = usb_microdia_control_write(dev, command, buf, 1);
4769 if(ret < 0) goto err;
4770 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3a
4771 if(ret < 0) goto err;
4772 if (buf[0] == 0x3a)
4773 buf[0] = 0x7b;
4774 else if (buf[0] == 0xba)
4775 buf[0] = 0xfb;
4776 ret = usb_microdia_control_write(dev, command, buf, 1);
4777 if(ret < 0) goto err;
4778 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3b
4779 if(ret < 0) goto err;
4780 if (buf[0] == 0x3b)
4781 buf[0] = 0x7c;
4782 else if (buf[0] == 0xbb)
4783 buf[0] = 0xfc;
4784 ret = usb_microdia_control_write(dev, command, buf, 1);
4785 if(ret < 0) goto err;
4786 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3c
4787 if(ret < 0) goto err;
4788 last_11b8[0] = buf[0];
4789 buf[0] = last_11b8[0] & 0xf0; // 0xf0 or 0x70
4790 buf[0] = buf[0] | 0x0a; // => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
4791 ret = usb_microdia_control_write(dev, command, buf, 1);
4792 if(ret < 0) goto err;
4794 buf[0] = 0x80;
4795 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_CLKRC,
4796 dev->sensor_flags, buf);
4797 if(ret < 0) goto err;
4799 /* urb 331 */
4800 buf[0] = 0x00;
4801 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCH,
4802 dev->sensor_flags, buf);
4803 if(ret < 0) goto err;
4805 buf[0] = 0x00;
4806 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCL,
4807 dev->sensor_flags, buf);
4808 if(ret < 0) goto err;
4810 buf[0] = 0x00;
4811 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNL,
4812 dev->sensor_flags, buf);
4813 if(ret < 0) goto err;
4815 /* urb 347 */
4816 buf[0] = 0x00;
4817 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNH,
4818 dev->sensor_flags, buf);
4819 if(ret < 0) goto err;
4821 buf[0] = 0x04;
4822 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MVFP,
4823 dev->sensor_flags, buf);
4824 if(ret < 0) goto err;
4826 /* is it really necessary to do this same write again?; 627f does this, too */
4827 buf[0] = 0x04;
4828 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MVFP,
4829 dev->sensor_flags, buf);
4830 if(ret < 0) goto err;
4832 /* urb 365 */
4833 command = 0x1182;
4834 buf[0] = 0x07;
4835 ret = usb_microdia_control_write(dev, command, buf, 1);
4836 if(ret < 0) goto err;
4838 buf[0] = 0x7c;
4839 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_AECH,
4840 dev->sensor_flags, buf);
4841 if(ret < 0) goto err;
4843 buf[0] = 0x03;
4844 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM1,
4845 dev->sensor_flags, buf);
4846 if(ret < 0) goto err;
4848 /* urb 379 */
4849 buf[0] = 0x00;
4850 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_AECHM,
4851 dev->sensor_flags, buf);
4852 if(ret < 0) goto err;
4854 buf[0] = 0x00;
4855 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_ADVFL,
4856 dev->sensor_flags, buf);
4857 if(ret < 0) goto err;
4859 /* urb 391 */
4860 buf[0] = 0x00;
4861 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_ADVFH,
4862 dev->sensor_flags, buf);
4863 if(ret < 0) goto err;
4865 /* urb 397 */
4866 buf[0] = 0x00;
4867 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_GAIN,
4868 dev->sensor_flags, buf);
4869 if(ret < 0) goto err;
4871 /* urb 403 */
4872 buf[0] = 0x78; /*buf[1] = 0x78;*/
4873 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_BLUE,
4874 dev->sensor_flags, buf);
4875 if(ret < 0) goto err;
4876 /* urb 409 */
4877 buf[0] = 0x78;
4878 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_RED,
4879 dev->sensor_flags, buf);
4880 if(ret < 0) goto err;
4881 // 627f does the last two writes at once (2 byte write to OV965X_CTL_BLUE)
4883 command = 0x118c;
4884 buf[0] = 0x20;
4885 ret = usb_microdia_control_write(dev, command, buf, 1);
4886 if(ret < 0) goto err;
4888 command = 0x118d;
4889 buf[0] = 0x20;
4890 ret = usb_microdia_control_write(dev, command, buf, 1);
4891 if(ret < 0) goto err;
4893 command = 0x118e;
4894 buf[0] = 0x20;
4895 ret = usb_microdia_control_write(dev, command, buf, 1);
4896 if(ret < 0) goto err;
4898 command = 0x118f;
4899 buf[0] = 0x20;
4900 ret = usb_microdia_control_write(dev, command, buf, 1);
4901 if(ret < 0) goto err;
4903 /* urb 423 */
4904 command = 0x11ba;
4905 buf[0] = 0x0a;
4906 ret = usb_microdia_control_write(dev, command, buf, 1);
4907 if(ret < 0) goto err;
4909 command = 0x118c;
4910 buf[0] = 0x20;
4911 ret = usb_microdia_control_write(dev, command, buf, 1);
4912 if(ret < 0) goto err;
4914 /* urb 427 */
4915 buf[0] = 0x20;
4916 command = 0x118d;
4917 ret = usb_microdia_control_write(dev, command, buf, 1);
4918 if(ret < 0) goto err;
4920 buf[0] = 0x20;
4921 command = 0x118e;
4922 ret = usb_microdia_control_write(dev, command, buf, 1);
4923 if(ret < 0) goto err;
4925 buf[0] = 0x20;
4926 command = 0x118f;
4927 ret = usb_microdia_control_write(dev, command, buf, 1);
4928 if(ret < 0) goto err;
4930 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4931 buf[0] = 0x0e;
4932 else // 624f
4933 buf[0] = 0x00;
4934 command = 0x118b;
4935 ret = usb_microdia_control_write(dev, command, buf, 1);
4936 if(ret < 0) goto err;
4938 /* urb 435 */
4939 /* Gamma control? */
4940 command = 0x1190;
4941 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4943 buf[0] = 0x08; buf[1] = 0x23; buf[2] = 0x37; buf[3] = 0x48;
4944 buf[4] = 0x59; buf[5] = 0x68; buf[6] = 0x77; buf[7] = 0x85;
4945 buf[8] = 0x93; buf[9] = 0xa1; buf[10] = 0xae; buf[11] = 0xba;
4946 buf[12] = 0xc7; buf[13] = 0xd3; buf[14] = 0xe0; buf[15] = 0xeb;
4947 buf[16] = 0xf7;
4949 else // 624f
4951 /*buf[0] = 0x0a; buf[1] = 0x37; buf[2] = 0x58; buf[3] = 0x70;
4952 buf[4] = 0x81; buf[5] = 0x8f; buf[6] = 0x9c; buf[7] = 0xa9;
4953 buf[8] = 0xb5; buf[9] = 0xbe; buf[10] = 0xc8; buf[11] = 0xd1;
4954 buf[12] = 0xda; buf[13] = 0xe2; buf[14] = 0xec; buf[15] = 0xf0;
4955 buf[16] = 0xf5;*/
4957 /* Old one */
4958 buf[0] = 0x00; buf[1] = 0x2a; buf[2] = 0x42; buf[3] = 0x56;
4959 buf[4] = 0x67; buf[5] = 0x78; buf[6] = 0x87; buf[7] = 0x95;
4960 buf[8] = 0xa2; buf[9] = 0xaf; buf[10] = 0xbc; buf[11] = 0xc8;
4961 buf[12] = 0xd4; buf[13] = 0xdf; buf[14] = 0xea; buf[15] = 0xf5;
4962 buf[16] = 0xff;
4964 ret = usb_microdia_control_write(dev, command, buf, 17);
4965 if(ret < 0) goto err;
4967 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4969 buf[0] = 0xf3; buf[1] = 0x0f; buf[2] = 0xf3; buf[3] = 0x0f;
4970 buf[4] = 0x0f; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
4971 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
4972 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
4973 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
4974 buf[20] = 0x00;
4976 else // 624f
4977 memset(buf, 0, 21);
4978 command = 0x10e1;
4979 for(i = 0; i < 8; i++)
4980 ret = usb_microdia_control_write(dev, command, buf, 21);
4982 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4984 buf[0] = 0x0f; buf[1] = 0x00; buf[2] = 0x15; buf[3] = 0x00;
4985 buf[4] = 0x1a; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
4986 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
4987 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
4988 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
4989 buf[20] = 0x00;
4991 else // 624f
4993 /* urb 453 */
4994 buf[0] = 0x15; buf[2] = 0x29;
4996 ret = usb_microdia_control_write(dev, command, buf, 21);
4997 if (ret < 0) goto err;
4999 command = 0x10f7;
5000 buf[0] = 0x05;
5001 ret = usb_microdia_control_write(dev, command, buf, 1);
5002 if(ret < 0) goto err;
5004 command = 0x10f6; // picture sharpness
5005 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5006 buf[0] = 0x80;
5007 else // 624f
5008 buf[0] = 0x00; // 624f-log: 0xc0 !
5009 ret = usb_microdia_control_write(dev, command, buf, 1);
5010 if(ret < 0) goto err;
5012 /* urb 459 */
5013 command = 0x10e1;
5014 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5016 buf[0] = 0x0f; buf[1] = 0x00; buf[2] = 0x15; buf[3] = 0x00;
5017 buf[4] = 0x1a; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5018 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5019 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5020 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
5021 buf[20] = 0x00;
5023 else // 624f
5025 memset(buf, 0, 21);
5026 buf[0] = 0x15; buf[2] = 0x29; buf [4] = 0x08;
5028 ret = usb_microdia_control_write(dev, command, buf, 21);
5029 if(ret < 0) goto err;
5031 command = 0x10f8;
5032 buf[0] = 0x14;
5033 ret = usb_microdia_control_write(dev, command, buf, 1);
5034 if(ret < 0) goto err;
5036 /* urb 463 */
5037 command = 0x10fa;
5038 buf[0] = 0xff;
5039 ret = usb_microdia_control_write(dev, command, buf, 1);
5040 if(ret < 0) goto err;
5042 command = 0x10f9;
5043 buf[0] = 0x00;
5044 ret = usb_microdia_control_write(dev, command, buf, 1);
5045 if(ret < 0) goto err;
5047 /* urb 467 */
5048 command = 0x10f9;
5049 buf[0] = 0x00;
5050 ret = usb_microdia_control_write(dev, command, buf, 1);
5051 if(ret < 0) goto err;
5053 command = 0x11ba;
5054 buf[0] = 0x0e;
5055 ret = usb_microdia_control_write(dev, command, buf, 1);
5056 if(ret < 0) goto err;
5058 //memset(buf, 0, 4);
5059 command = 0x11bc;
5060 buf[0] = 0x80; buf[1] = 0x02; buf[2] = 0xe0; buf[3] = 0x01;
5061 ret = usb_microdia_control_write(dev, command, buf, 4);
5062 if(ret < 0) goto err;
5064 command = 0x11c0;
5065 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5067 buf[0] = 0x19; buf[1] = 0x31; buf[2] = 0x44; buf[3] = 0x50;
5068 buf[4] = 0x52; buf[5] = 0x56; buf[6] = 0x5b; buf[7] = 0x61;
5069 buf[8] = 0x65; buf[9] = 0x6a; buf[10] = 0x6c; buf[11] = 0x6e;
5070 buf[12] = 0x70; buf[13] = 0x72; buf[14] = 0x74; buf[15] = 0x76;
5071 buf[16] = 0x1a; buf[17] = 0x31; buf[18] = 0x44; buf[19] = 0x51;
5072 buf[20] = 0x54; buf[21] = 0x57; buf[22] = 0x5c; buf[23] = 0x61;
5073 buf[24] = 0x66; buf[25] = 0x6b; buf[26] = 0x6d; buf[27] = 0x6f;
5074 buf[28] = 0x71; buf[29] = 0x73; buf[30] = 0x75; buf[31] = 0x76;
5075 buf[32] = 0x1b; buf[33] = 0x32; buf[34] = 0x44; buf[35] = 0x50;
5076 buf[36] = 0x50; buf[37] = 0x54; buf[38] = 0x59; buf[39] = 0x5e;
5077 buf[40] = 0x63; buf[41] = 0x67; buf[42] = 0x6a; buf[43] = 0x6c;
5078 buf[44] = 0x6e; buf[45] = 0x70; buf[46] = 0x72; buf[47] = 0x73;
5080 else // 624f
5082 buf[0] = 0x10; buf[1] = 0x21; buf[2] = 0x34; buf[3] = 0x40;
5083 buf[4] =0x47; buf[5] = 0x4F; buf[6] = 0x57; buf[7] = 0x5F;
5084 buf[8] = 0x64; buf[9] = 0x68; buf[10] = 0x6D; buf[11] = 0x73;
5085 buf[12] = 0x79; buf[13] = 0x80; buf[14] = 0x89; buf[15] = 0x97;
5086 buf[16] = 0x0D; buf[17] = 0x1C; buf[18] = 0x2A; buf[19] = 0x33;
5087 buf[20] = 0x38; buf[21] = 0x3D; buf[22] = 0x44; buf[23] = 0x4A;
5088 buf[24] = 0x4E; buf[25] = 0x52; buf[26] = 0x56; buf[27] = 0x5B;
5089 buf[28] = 0x61; buf[29] = 0x68; buf[30] = 0x6F; buf[31] = 0x7A;
5090 buf[32] = 0x0D; buf[33] = 0x1A; buf[34] = 0x2A; buf[35] = 0x31;
5091 buf[36] = 0x36; buf[37] = 0x3B; buf[38] = 0x41; buf[39] = 0x47;
5092 buf[40] = 0x4A; buf[41] = 0x4E; buf[42] = 0x53; buf[43] = 0x58;
5093 buf[44] = 0x5D; buf[45] = 0x64; buf[46] = 0x6B; buf[47] = 0x76;
5095 ret = usb_microdia_control_write(dev, command, buf, 48);
5097 command = 0x118c;
5098 buf[0] = 0x20;
5099 ret = usb_microdia_control_write(dev, command, buf, 1);
5100 if(ret < 0) goto err;
5102 /* urb 477 */
5103 command = 0x118d;
5104 buf[0] = 0x20;
5105 ret = usb_microdia_control_write(dev, command, buf, 1);
5106 if(ret < 0) goto err;
5108 command = 0x118e;
5109 buf[0] = 0x20;
5110 ret = usb_microdia_control_write(dev, command, buf, 1);
5111 if(ret < 0) goto err;
5113 command = 0x118f;
5114 buf[0] = 0x20;
5115 ret = usb_microdia_control_write(dev, command, buf, 1);
5116 if(ret < 0) goto err;
5118 /* urb 483 */
5119 command = 0x11a5;
5120 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
5121 buf[4] = 0x04; buf[5] = 0x3f;
5122 ret = usb_microdia_control_write(dev, command, buf, 6);
5123 if(ret < 0) goto err;
5125 /* urb 485 */
5126 command = 0x11af;
5127 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
5128 ret = usb_microdia_control_write(dev, command, buf, 4);
5129 if(ret < 0) goto err;
5131 command = 0x11b3;
5132 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
5133 ret = usb_microdia_control_write(dev, command, buf, 4);
5134 if(ret < 0) goto err;
5136 /* urb 489 */
5137 command = 0x10e0;
5138 buf[0] = 0x07;
5139 ret = usb_microdia_control_write(dev, command, buf, 1);
5140 if(ret < 0) goto err;
5142 command = 0x1061;
5143 buf[0] = 0x01;
5144 ret = usb_microdia_control_write(dev, command, buf, 1);
5145 if(ret < 0) goto err;
5147 command = 0x10e0;
5148 buf[0] = 0x27;
5149 ret = usb_microdia_control_write(dev, command, buf, 1);
5150 if(ret < 0) goto err;
5153 //////////////////////////////////////////////////////////////////////
5154 /* urb 495 */
5155 command = 0x1100;
5156 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
5157 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
5158 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
5159 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
5160 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
5161 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
5162 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
5163 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
5164 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
5165 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
5166 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
5167 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
5168 buf[48] = 0x4f; buf[49] = 0x54; buf[50] = 0x58; buf[51] = 0x58;
5169 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
5170 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x54; buf[59] = 0x64;
5171 buf[60] = 0x4b; buf[61] = 0x54; buf[62] = 0x58; buf[63] = 0x54;
5172 ret = usb_microdia_control_write(dev, command, buf, 64);
5173 if(ret < 0) goto err;
5175 command = 0x1140;
5176 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
5177 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
5178 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x54; buf[11] = 0x36;
5179 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x54; buf[15] = 0x54;
5180 buf[16] = 0x54; buf[17] = 0x54; buf[18] = 0x54; buf[19] = 0x54;
5181 buf[20] = 0x54; buf[21] = 0x54; buf[22] = 0x54; buf[23] = 0x54;
5182 buf[24] = 0x54; buf[25] = 0x54; buf[26] = 0x54; buf[27] = 0x54;
5183 buf[28] = 0x54; buf[29] = 0x54; buf[30] = 0x54; buf[31] = 0x54;
5184 buf[32] = 0x54; buf[33] = 0x54; buf[34] = 0x54; buf[35] = 0x54;
5185 buf[36] = 0x54; buf[37] = 0x54; buf[38] = 0x54; buf[39] = 0x54;
5186 buf[40] = 0x54; buf[41] = 0x54; buf[42] = 0x54; buf[43] = 0x54;
5187 buf[44] = 0x54; buf[45] = 0x54; buf[46] = 0x54; buf[47] = 0x54;
5188 buf[48] = 0x54; buf[49] = 0x54; buf[50] = 0x54; buf[51] = 0x54;
5189 buf[52] = 0x54; buf[53] = 0x54; buf[54] = 0x54; buf[55] = 0x54;
5190 buf[56] = 0x54; buf[57] = 0x54; buf[58] = 0x54; buf[59] = 0x54;
5191 buf[60] = 0x54; buf[61] = 0x54; buf[62] = 0x54; buf[63] = 0x54;
5192 ret = usb_microdia_control_write(dev, command, buf, 64);
5193 if(ret < 0) goto err;
5195 /* urb 499 */
5196 command = 0x10e0;
5197 buf[0] = 0x07;
5198 ret = usb_microdia_control_write(dev, command, buf, 1);
5199 if(ret < 0) goto err;
5201 command = 0x1061;
5202 buf[0] = 0x03;
5203 ret = usb_microdia_control_write(dev, command, buf, 1);
5204 if(ret < 0) goto err;
5206 /* urb 503 */
5207 command = 0x10e0;
5208 buf[0] = 0x0b;
5209 ret = usb_microdia_control_write(dev, command, buf, 1);
5210 if(ret < 0) goto err;
5212 command = 0x1189;
5213 buf[0] = 0x8c;
5214 ret = usb_microdia_control_write(dev, command, buf, 1);
5215 if(ret < 0) goto err;
5217 buf[0] = 0x40;
5218 command = 0x11bc;
5219 ret = usb_microdia_control_write(dev, command, buf, 1);
5220 if(ret < 0) goto err;
5222 buf[0] = 0x01;
5223 command = 0x11bd;
5224 ret = usb_microdia_control_write(dev, command, buf, 1);
5225 if(ret < 0) goto err;
5227 buf[0] = 0xf0;
5228 command = 0x11be;
5229 ret = usb_microdia_control_write(dev, command, buf, 1);
5230 if(ret < 0) goto err;
5232 buf[0] = 0x00;
5233 command = 0x11bf;
5234 ret = usb_microdia_control_write(dev, command, buf, 1);
5235 if(ret < 0) goto err;
5237 /* urb 515 */
5238 command = 0x1180;
5239 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x07; buf[3] = 0x00;
5240 buf[4] = 0x28; buf[5] = 0x3c;
5241 ret = usb_microdia_control_write(dev, command, buf, 6);
5242 if(ret < 0) goto err;
5244 command = 0x10fb;
5245 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5246 buf[4] = 0x00;
5247 ret = usb_microdia_control_write(dev, command, buf, 5);
5248 if(ret < 0) goto err;
5250 command = 0x1189;
5251 buf[0] = 0x8c;
5252 ret = usb_microdia_control_write(dev, command, buf, 1);
5253 if(ret < 0) goto err;
5255 command = 0x11a1;
5256 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
5257 ret = usb_microdia_control_write(dev, command, buf, 4);
5258 if(ret < 0) goto err;
5260 /* 523 */
5261 command = 0x11ab;
5262 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
5263 ret = usb_microdia_control_write(dev, command, buf, 4);
5264 if(ret < 0) goto err;
5266 command = 0x1061;
5267 buf[0] = 0x03;
5268 ret = usb_microdia_control_write(dev, command, buf, 1);
5269 if(ret < 0) goto err;
5271 command = 0x11ba;
5272 buf[0] = 0x0e;
5273 ret = usb_microdia_control_write(dev, command, buf, 1);
5274 if(ret < 0) goto err;
5276 command = 0x11b9;
5277 buf[0] = 0x00;
5278 ret = usb_microdia_control_write(dev, command, buf, 1);
5279 if(ret < 0) goto err;
5281 command = 0x11ba;
5282 buf[0] = 0x0f;
5283 ret = usb_microdia_control_write(dev, command, buf, 1);
5284 if(ret < 0) goto err;
5286 command = 0x1061;
5287 buf[0] = 0x01;
5288 ret = usb_microdia_control_write(dev, command, buf, 1);
5289 if(ret < 0) goto err;
5291 command = 0x1000;
5292 buf[0] = 0x78;
5293 ret = usb_microdia_control_write(dev, command, buf, 1);
5294 if(ret < 0) goto err;
5296 command = 0x1002;
5297 buf[0] = 0x18;
5298 ret = usb_microdia_control_write(dev, command, buf, 1);
5299 if(ret < 0) goto err;
5301 /* urb 539 */
5302 command = 0x1002;
5303 buf[0] = 0x18;
5304 ret = usb_microdia_control_write(dev, command, buf, 1);
5305 if(ret < 0) goto err;
5307 command = 0x11b8;
5308 buf[0] = 0x7a;
5309 ret = usb_microdia_control_write(dev, command, buf, 1);
5310 if(ret < 0) goto err;
5312 command = 0x118a;
5313 buf[0] = 0x04;
5314 ret = usb_microdia_control_write(dev, command, buf, 1);
5315 if(ret < 0) goto err;
5317 /* urb 545 */
5318 command = 0x0395;
5319 buf[0] = 0x04;
5320 ret = usb_microdia_control_write(dev, command, buf, 1);
5321 if(ret < 0) goto err;
5323 command = 0x11b8;
5324 if (last_11b8[0] == 0x3c)
5325 buf[0] = 0x78;
5326 else if (last_11b8[0] == 0xbc)
5327 buf[0] = 0xf8;
5328 ret = usb_microdia_control_write(dev, command, buf, 1);
5329 if(ret < 0) goto err;
5330 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0xb8 627f: 0x38
5331 if(ret < 0) goto err;
5332 if (buf[0] == 0x38)
5333 buf[0] = 0x79;
5334 else if (buf[0] == 0xb8)
5335 buf[0] = 0xf9;
5336 ret = usb_microdia_control_write(dev, command, buf, 1);
5337 if(ret < 0) goto err;
5338 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0xb9 627f: 0x39
5339 if(ret < 0) goto err;
5340 if (buf[0] == 0x39)
5341 buf[0] = 0x7a;
5342 else if (buf[0] == 0xb9)
5343 buf[0] = 0xfa;
5344 ret = usb_microdia_control_write(dev, command, buf, 1);
5345 if(ret < 0) goto err;
5346 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3a
5347 if(ret < 0) goto err;
5348 if (buf[0] == 0x3a)
5349 buf[0] = 0x7b;
5350 else if (buf[0] == 0xba)
5351 buf[0] = 0xfb;
5352 ret = usb_microdia_control_write(dev, command, buf, 1);
5353 if(ret < 0) goto err;
5354 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0x3b 627f: 0xbb
5355 if(ret < 0) goto err;
5356 if (buf[0] == 0x3b)
5357 buf[0] = 0x7c;
5358 else if (buf[0] == 0xbb)
5359 buf[0] = 0xfc;
5360 ret = usb_microdia_control_write(dev, command, buf, 1);
5361 if(ret < 0) goto err;
5362 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0x3c 627f: 0xbc
5363 if(ret < 0) goto err;
5364 buf[0] = buf[0] & 0xf0; // 0xf0 or 0x70
5365 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5366 buf[0] = buf[0] | 0x09; // THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
5367 else // 624f
5368 buf[0] = buf[0] | 0x08; // THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
5369 ret = usb_microdia_control_write(dev, command, buf, 1);
5370 if(ret < 0) goto err;
5372 buf[0] = 0x80;
5373 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_CLKRC,
5374 dev->sensor_flags, buf);
5375 if(ret < 0) goto err;
5377 buf[0] = 0x00;
5378 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCH,
5379 dev->sensor_flags, buf);
5380 if(ret < 0) goto err;
5382 /* urb 581 */
5383 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCL,
5384 dev->sensor_flags, buf);
5385 if(ret < 0) goto err;
5387 /* urb 587 */
5388 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNL,
5389 dev->sensor_flags, buf);
5390 if(ret < 0) goto err;
5392 /* urb 593 */
5393 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNH,
5394 dev->sensor_flags, buf);
5395 if(ret < 0) goto err;
5397 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_PID,
5398 dev->sensor_flags, buf);
5399 /* returns 96, no idea what we're supposed to do with it */
5400 if(ret < 0) goto err;
5401 //msg("sensor pid, should be 0x96: %x", buf[0]);
5403 /* urb 609 */
5404 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_VER,
5405 dev->sensor_flags, buf);
5406 /* returns 52, no idea what we're supposed to do with it */
5407 if(ret < 0) goto err;
5408 //msg("sensor ver, should be 0x52: %x", buf[0]);
5410 /* urb 619 */
5411 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MIDH,
5412 dev->sensor_flags, buf);
5413 /* returns 7f, no idea what we're supposed to do with it */
5414 if(ret < 0) goto err;
5415 //msg("sensor midh, should be 0x7f: %x", buf[0]);
5417 /* urb 629 */
5418 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MIDL,
5419 dev->sensor_flags, buf);
5420 /* returns a2, no idea what we're supposed to do with it */
5421 if(ret < 0) goto err;
5422 //msg("sensor midl, should be 0xa2: %x", buf[0]);
5424 command = 0x1061;
5425 buf[0] = 0x03;
5426 ret = usb_microdia_control_write(dev, command, buf, 1);
5427 if(ret < 0) goto err;
5428 //////////////////////////////////////////////////////////////////////////////////
5429 //STREAM STARTED!
5430 //////////////////////////////////////////////////////////////////////////////////
5432 /* --- ADJUSTMENTS OF SHARPNESS, COLORS, CONTRAST, BRIGHTNESS ---
5433 * SHOULD BE REMOVED (writes to 0x10e1 and 0x10f6 are done again afterwards by dev_microdia_camera_settings() )
5434 * => NOT done by device 627f
5435 * => NOT in the 624f-log from 15-feb-08 at files.zenum.net
5438 command = 0x10f6;
5439 buf[0] = 0x80;
5440 ret = usb_microdia_control_write(dev, command, buf, 1);
5441 if(ret < 0) goto err;
5443 command = 0x10e1;
5444 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5445 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5446 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5447 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xDD ; buf[15] = 0x0F;
5448 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5449 buf[20] = 0x00;
5450 ret = usb_microdia_control_write(dev, command, buf, 21);
5451 if(ret < 0) goto err;
5453 buf[0] = 0x7d; buf[1] = 0x00;
5454 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x2d,
5455 dev->sensor_flags, buf);
5457 buf[0] = 0x0f;
5458 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x00,
5459 dev->sensor_flags, buf);
5461 // urb 679
5462 command = 0x10e1;
5463 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5464 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5465 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5466 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xDD ; buf[15] = 0x0F;
5467 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5468 buf[20] = 0x00;
5469 ret = usb_microdia_control_write(dev, command, buf, 21);
5470 if(ret < 0) goto err;
5472 // These 2 regs controls brightness of image
5473 // (night mode or something like that)
5475 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x2d,
5476 dev->sensor_flags, buf);
5477 //msg("Old brightness value: %x %x", buf[0], buf[1]);
5478 buf[0] = 0x00; buf[1] = 0x04;
5479 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x2d,
5480 dev->sensor_flags, buf);
5482 // urb 743
5483 command = 0x10f6;
5484 buf[0] = 0x74;
5485 ret = usb_microdia_control_write(dev, command, buf, 1);
5487 // urb 745
5488 command = 0x10e1;
5489 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5490 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5491 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5492 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xdd ; buf[15] = 0x0F;
5493 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5494 buf[20] = 0x00;
5495 ret = usb_microdia_control_write(dev, command, buf, 21);
5496 if(ret < 0) goto err;
5497 return ret;
5499 buf[0] = 0xe8;
5500 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x01,
5501 dev->sensor_flags, buf);
5502 // THIS WRITE WILL NEVER BE DONE, because function returned before
5504 return 0;
5506 err:
5507 UDIA_ERROR("start stream: command %x failed (%d)!\n", command, ret);
5508 return ret;
5511 int microdia_6260_start_stream(struct usb_microdia *dev)
5513 int ret;
5514 __u8 buf[32];
5516 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
5517 buf[0] = 0x1f;
5518 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
5519 buf[0] = 0x00;
5520 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
5521 buf[0] = 0x20;
5522 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
5523 buf[0] = 0x00;
5524 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
5525 buf[0] = 0x78;
5526 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5527 buf[0] = 0xc7;
5528 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5529 buf[0] = 0x18;
5530 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5531 buf[0] = 0x01;
5532 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5533 buf[0] = 0x80;
5534 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
5536 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10;
5537 buf[4] = 0x08;
5538 ret = usb_microdia_control_write(dev, 0x1067, buf, 5);
5540 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
5541 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5542 buf[8] = 0x03;
5543 ret = usb_microdia_control_write(dev, 0x10c0, buf, 9);
5545 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
5546 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
5547 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
5548 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
5549 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
5550 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
5551 ret = usb_microdia_control_write(dev, 0x10e0, buf, 24);
5553 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
5554 ret = usb_microdia_control_write(dev, 0x10f8, buf, 3);
5556 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5557 buf[4] = 0x00;
5558 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5560 buf[0] = 0x8a; buf[1] = 0x8c; buf[2] = 0x08;
5561 ret = usb_microdia_control_write(dev, 0x1188, buf, 3);
5563 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
5564 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
5565 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
5566 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
5567 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
5568 buf[20] = 0xf4; buf[21] = 0xff;
5569 ret = usb_microdia_control_write(dev, 0x118b, buf, 22);
5571 buf[0] = 0x00; buf[1] = 0x00;
5572 ret = usb_microdia_control_write(dev, 0x11a1, buf, 2);
5574 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x00;
5575 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
5576 buf[8] = 0x00;
5577 ret = usb_microdia_control_write(dev, 0x11b7, buf, 9);
5579 buf[0] = 0x78;
5580 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5582 buf[0] = 0x38;
5583 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5585 ret = ov7670_initialise(dev);
5587 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x3b, dev->sensor_flags, buf);
5588 ret = usb_microdia_control_read(dev, 0x10c1, buf, 1);
5589 buf[0] = 0x50;
5590 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
5592 /* TRY TO READ FROM EEPROM: */
5593 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, dev->sensor_flags, buf);
5594 if (ret < 0)
5595 UDIA_INFO("No EEPROM found\n");
5596 else
5597 UDIA_INFO("Read from EEPROM successful\n");
5599 buf[0] = 0x21;
5600 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
5601 buf[0] = 0x45;
5602 ret = usb_microdia_control_write(dev, 0x10e0, buf, 1);
5603 buf[0] = 0xc6;
5604 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5605 buf[0] = 0xc4;
5606 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5608 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5609 buf[4] = 0x50; buf[5] = 0x3c;
5610 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
5612 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
5613 buf[4] = 0x01;
5614 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5616 buf[0] = 0x80;
5617 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
5619 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
5620 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
5622 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
5623 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
5624 buf[0] = 0x78;
5625 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5626 buf[0] = 0x10;
5627 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5628 buf[0] = 0x00;
5629 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5630 buf[0] = 0x38;
5631 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5632 buf[0] = 0x04;
5633 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
5634 buf[0] = 0x04;
5635 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
5636 buf[0] = 0x78;
5637 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5638 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5639 buf[0] = 0xf9;
5640 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5641 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5642 buf[0] = 0xfa;
5643 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5644 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5645 buf[0] = 0x7b;
5646 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5647 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5648 buf[0] = 0x7c;
5649 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5650 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5651 buf[0] = 0x7d;
5652 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5653 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5654 buf[0] = 0x7b;
5655 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5657 /* OV7670 Intialise Part 2 */
5658 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5659 buf[4] = 0x50; buf[5] = 0x3c;
5660 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
5662 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
5663 buf[4] = 0x01;
5664 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5666 buf[0] = 0x80;
5667 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
5669 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
5670 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
5672 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
5673 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
5675 buf[0] = 0x03;
5676 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5677 buf[0] = 0x01;
5678 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5679 buf[0] = 0x78;
5680 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5681 buf[0] = 0x00;
5682 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5683 buf[0] = 0x00;
5684 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5685 buf[0] = 0x7b;
5686 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5687 buf[0] = 0x04;
5688 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
5689 buf[0] = 0x04;
5690 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
5691 buf[0] = 0x78;
5692 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5693 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5694 buf[0] = 0x79;
5695 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5696 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5697 buf[0] = 0x7a;
5698 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5699 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5700 buf[0] = 0x7b;
5701 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5702 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5703 buf[0] = 0x7c;
5704 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5705 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5706 buf[0] = 0x7d;
5707 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5708 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5709 buf[0] = 0xfa;
5710 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5712 /* OV7670 Initialisation Part 3 Goes Here */
5713 buf[0] = 0x03;
5714 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5716 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5717 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5718 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5719 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5720 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5721 buf[20] = 0x00;
5722 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5724 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5725 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5726 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5727 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5728 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5729 buf[20] = 0x00;
5730 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5732 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5733 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5734 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5735 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5736 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5737 buf[20] = 0x00;
5738 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5740 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5741 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5742 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5743 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5744 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5745 buf[20] = 0x00;
5746 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5748 return ret;
5752 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
5754 * @param dev
5756 * @returns 0 (ok) or -1 (error)
5758 * @author Comer352l
5760 * Windows driver versions: 5.7.23.000
5761 * Windows versions: 2000 and XP
5762 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
5763 * All logs were made using AMCAP with 640x480, RGB24
5765 int microdia_6270_start_stream(struct usb_microdia *dev)
5767 __u8 buf[64];
5768 __u8 last_11b8[1];
5769 int k;
5770 int retI2C;
5772 // Check if sensor slave address is valid:
5773 if ((dev->sensor_slave_address != MT9V111_I2C_SLAVE_ADDRESS) && (dev->sensor_slave_address != MT9V011_I2C_SLAVE_ADDRESS))
5775 UDIA_INFO("microdia_6270_start_stream(): Invalid sensor slave address !\n");
5776 return -1;
5779 // <= INTERRUPT COMING BACK (URB 1953)
5780 // SWITCH TO ALTERNATE SETTINGS 8 (URB 1954) // NOT IN ALEX'S LOG
5781 // => INTERRUPT GOING DOWN (URB 1955)
5783 buf[0] = 0x00;
5784 usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 1956
5786 // <= INTERRUPT COMING BACK (URB 1955)
5787 // => INTERRUPT GOING DOWN (URB 1957)
5789 buf[0] = 0x78;
5790 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 1958
5791 buf[0] = 0xc7;
5792 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 1959
5793 buf[0] = 0x18;
5794 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 1960
5795 buf[0] = 0x01;
5796 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 1961
5797 buf[0] = 0x80;
5798 usb_microdia_control_write(dev, 0x1020, buf, 1); // URB 1962
5799 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
5800 usb_microdia_control_write(dev, 0x1067, buf, 5); // URB 1963
5802 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5803 // STRANGE I2C MESSAGE:
5804 // - 9 bytes
5805 // - byte 8 = 0x00 at first start + first cycle
5806 // - procedure not complete: no wait/check for ack/error, no readout of 0x10c2
5807 // - dummy writes at first cycle and read at second cycle, but there are many I2C messages in the meantime, so this should not work
5809 // AT FIRST START + FIRST CYCLE:
5810 buf[0] = 0x80; buf[1] = dev->sensor_slave_address; buf[2] = 0x00; buf[3] = 0x00;
5811 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
5812 // AT ALL FURTHER STARTS + FIRST CYCLE:
5813 //MT9V111: I2C MESSAGE => IFP Register 0x33: Auto exposure
5814 //buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x33; buf[3] = 0x00;
5815 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5816 //MT9V011: ?????????????????????????
5817 //buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x07; buf[3] = 0x00;
5818 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5819 // ALWAYS AT 2nd AND FURTHER CYCLES:
5820 //MT9V111:
5821 //buf[0] = 0xa2; buf[1] = 0x5c; buf[2] = 0x00; buf[3] = 0x36;
5822 //buf[4] = 0x00; buf[5] = 0x82; buf[6] = 0x3a; buf[7] = 0x10; buf[8] = 0x03;
5823 // => buf[3] to buf[6] simply contain bytes read with URB 2215
5824 //MT9V011:
5825 //buf[0] = 0xb0; buf[1] = 0x5d; buf[2] = 0x07; buf[3] = 0x00;
5826 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5827 usb_microdia_control_write(dev, 0x10c0, buf, 9); // URB 1964
5828 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5830 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
5831 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
5832 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
5833 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
5834 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
5835 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
5836 usb_microdia_control_write(dev, 0x10e0, buf, 24); // URB 1965
5837 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
5838 usb_microdia_control_write(dev, 0x10f8, buf, 3); // URB 1966
5839 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
5840 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 1967
5841 buf[0] = 0x06; buf[1] = 0x0c; buf[2] = 0x08;
5842 usb_microdia_control_write(dev, 0x1188, buf, 3); // URB 1968
5843 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
5844 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
5845 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
5846 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
5847 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
5848 buf[20] = 0xf4; buf[21] = 0xff;
5849 usb_microdia_control_write(dev, 0x118b, buf, 22); // URB 1969
5850 buf[0] = 0x00; buf[1] = 0x00;
5851 usb_microdia_control_write(dev, 0x11a1, buf, 2); // URB 1970
5852 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08;
5853 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5854 buf[8] = 0x00;
5855 usb_microdia_control_write(dev, 0x11b7, buf, 9); // URB 1971
5856 buf[0] = 0x38;
5857 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 1972
5858 buf[0] = 0x78;
5859 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 1973
5861 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5862 // I2C MESSAGES
5863 retI2C = 0;
5864 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
5866 // Write to IFP register 0x0d: Color Correction Register 8
5867 buf[0] = 0x00; buf[1] = 0x01;
5868 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); // URBs 1974-1976
5869 // Write to IFP register 0x0d: Color Correction Register 8
5870 buf[0] = 0x00; buf[1] = 0x00; // ???
5871 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); // URBs 1977-1979
5872 // Writes to IFP registers 0x01: Register Address Space Selection
5873 // 0x02: Color Correction Register 1
5874 buf[0] = 0x00; buf[1] = 0x01; // select IFP address space
5875 buf[2] = 0x00; buf[3] = 0x16; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5876 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); // URBs 1980-1982
5877 // Writes to IFP registers 0x03: Color Correction Register 3
5878 // 0x04: Color Correction Register 4
5879 buf[0] = 0x01; buf[1] = 0xe1; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5880 buf[2] = 0x02; buf[3] = 0x81; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5881 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); // URBs 1983-1985
5882 // Writes to IFP registers 0x05: Aperture Correction (Sharpening)
5883 // 0x06: Operating Mode Control
5884 buf[0] = 0x00; buf[1] = 0x04; // 100% sharpening, no automatic sharpness reduction at low light // AT FIRST START + FIRST CYCLE: 0x00 0x00: no sharpening
5885 buf[2] = 0x00; buf[3] = 0x00; // stop AWB at the current values, no on-the-fly defect correction, no auto exposure, + RESREVED option
5886 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); // URBs 1986-1988
5887 // Writes to IFP registers 0x07: Image Flow Processor Soft Reset
5888 // 0x08: Output Format Control
5889 buf[0] = 0x30; buf[1] = 0x02; // reset // AT FIRST START + FIRST CYCLE: 0x00 0x00
5890 buf[2] = 0x04; buf[3] = 0x80; // bypass entire image processing, raw 8+2 Bayer data output directly
5891 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); // URBs 1989-1991
5892 // "Dummy" write to IFP Register 0x11: Color Correction Register 12
5893 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); // URBs 1992-1993
5894 // Write to register 0x01: Register address space selection
5895 // Write to sensor register 0x02: Column Start
5896 buf[0] = 0x00; buf[1] = 0x04; // select sensor address space
5897 buf[2] = 0x00; buf[3] = 0x16; // start with column 22
5898 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); // URBs 1994-1996
5899 // Writes to sensor registers 0x03: Window Height
5900 // 0x04: Window Width
5901 buf[0] = 0x01; buf[1] = 0xe6; // 486
5902 buf[2] = 0x02; buf[3] = 0x86; // 646
5903 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); // URBs 1997-1999
5904 // Writes to sensor registers 0x05: Horizontal Blanking
5905 // 0x06: Vertical Blanking
5906 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00
5907 buf[2] = 0x00; buf[3] = 0x00; // 0 rows
5908 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); // URBs 2000-2002
5909 // Writes to sensor registers 0x07: Output Control
5910 // 0x08: Row Start
5911 buf[0] = 0x30; buf[1] = 0x02; // normal operation + chip enable + RESERVED options
5912 buf[2] = 0x00; buf[3] = 0x08; // row 8
5913 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); // URBs 2003-2005
5914 // "Dummy" write to sensor Register 0x11: UNDOCUMENTED
5915 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); // URBs 2006-2007
5916 // Writes to sensor registers 0x0c: Shutter Delay
5917 // 0x0d: Reset (Soft) (from MT9V011 datasheet)
5918 buf[0] = 0x00; buf[1] = 0x00; // 0 master clocks
5919 buf[2] = 0x00; buf[3] = 0x00; // return to normal operation
5920 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf); // URBs 2008-2010
5921 // Writes to sensor registers 0x0e: UNDOCUMENTED
5922 // 0x0f: UNDOCUMENTED
5923 buf[0] = 0x00; buf[1] = 0x00;
5924 buf[2] = 0x00; buf[3] = 0x00;
5925 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf); // URBs 2011-2013
5926 // Writes to sensor registers 0x10: UNDOCUMENTED
5927 // 0x11: UNDOCUMENTED
5928 buf[0] = 0x00; buf[1] = 0x00;
5929 buf[2] = 0x00; buf[3] = 0x00;
5930 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf); // URBs 2014-2016
5931 // Writes to sensor registers 0x12: 2X Zoom Col Start => 0x1e bit 0 must be set to activate zoom
5932 // 0x13: 2X Zoom Row Start => 0x1e bit 0 must be set to activate zoom
5933 buf[0] = 0x00; buf[1] = 0xb0; // column 176
5934 buf[2] = 0x00; buf[3] = 0x7c; // row 124
5935 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf); // URBs 2017-2018
5936 // Writes to sensor registers 0x14: UNDOCUMENTED
5937 // 0x15: UNDOCUMENTED
5938 buf[0] = 0x00; buf[1] = 0x00;
5939 buf[2] = 0x00; buf[3] = 0x00;
5940 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf); // URBs 2019-2021
5941 // Writes to sensor registers 0x16: UNDOCUMENTED
5942 // 0x17: UNDOCUMENTED
5943 buf[0] = 0x00; buf[1] = 0x00;
5944 buf[2] = 0x00; buf[3] = 0x00;
5945 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf); // URBs 2022-2024
5946 // Writes to sensor registers 0x18: UNDOCUMENTED
5947 // 0x19: UNDOCUMENTED
5948 buf[0] = 0x00; buf[1] = 0x00;
5949 buf[2] = 0x00; buf[3] = 0x00;
5950 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf); // URBs 2025-2027
5951 // Writes to sensor registers 0x1a: UNDOCUMENTED
5952 // 0x1b: UNDOCUMENTED
5953 buf[0] = 0x00; buf[1] = 0x00;
5954 buf[2] = 0x00; buf[3] = 0x00;
5955 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf); // URBs 2028-2030
5956 // Writes to sensor registers 0x1c: UNDOCUMENTED
5957 // 0x1d: UNDOCUMENTED
5958 buf[0] = 0x00; buf[1] = 0x00;
5959 buf[2] = 0x00; buf[3] = 0x00;
5960 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf); // URBs 2031-2033
5961 // Write to sensor register 0x30: RESERVED
5962 buf[0] = 0x00; buf[1] = 0x00;
5963 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x30, dev->sensor_flags, buf); // URBs 2034-2036
5964 // Write to sensor register 0x20: Read Mode
5965 buf[0] = 0x00; buf[1] = 0x00; // normal readout
5966 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2037-2039
5967 // Writes to sensor registers 0x30: RESERVED
5968 // 0x31: RESERVED
5969 buf[0] = 0x00; buf[1] = 0x05;
5970 buf[2] = 0x00; buf[3] = 0x00;
5971 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x30, dev->sensor_flags, buf); // URBs 2040-2042
5972 // "Dummy" write to sensor Register 0x34: RESERVED
5973 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x34, dev->sensor_flags, NULL); // URBs 2043-2044
5975 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
5977 // Write to sensor register 0x07: Output Control
5978 buf[0] = 0x00; buf[1] = 0x02; // chip enable, normal operation
5979 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
5980 // Write to sensor register 0x0d: Soft Reset
5981 buf[0] = 0x00; buf[1] = 0x01; // reset
5982 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
5983 // Write to sensor register 0x0d: Soft Reset
5984 buf[0] = 0x00; buf[1] = 0x00; // resume operation
5985 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
5986 // Writes to sensor registers 0x01: Row start
5987 // 0x02: Column Start
5988 buf[0] = 0x00; buf[1] = 0x08; // start with row 8
5989 buf[2] = 0x00; buf[3] = 0x16; // start with column 22
5990 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf);
5991 // Writes to sensor registers 0x03: Window Height
5992 // 0x04: Window Width
5993 buf[0] = 0x01; buf[1] = 0xe1; // 481
5994 buf[2] = 0x02; buf[3] = 0x81; // 641
5995 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf);
5996 // Writes to sensor registers 0x05: Horizontal Blanking
5997 // 0x06: Vertical Blanking
5998 buf[0] = 0x00; buf[1] = 0x83; // 131 columns (pixel clocks)
5999 buf[2] = 0x00; buf[3] = 0x06; // 6 rows
6000 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf);
6001 // Write to sensor register 0x0d: Soft Reset
6002 buf[0] = 0x00; buf[1] = 0x02; // UNKNOWN
6003 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
6004 // Writes to sensor registers 0x0a: Pixel Clock Speed
6005 // 0x0b: Frame Restart
6006 buf[0] = 0x00; buf[1] = 0x00; // default
6007 buf[2] = 0x00; buf[3] = 0x00; // (has no effect/no restart)
6008 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0a, dev->sensor_flags, buf);
6009 // Writes to sensor registers 0x0c: Shutter Delay
6010 // 0x0d: Soft Reset
6011 buf[0] = 0x00; buf[1] = 0x00; // 0 master clocks
6012 buf[2] = 0x00; buf[3] = 0x00; // resume operation
6013 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf);
6014 // Writes to sensor registers 0x0e: UNDOCUMENTED
6015 // 0x0f: UNDOCUMENTED
6016 buf[0] = 0x00; buf[1] = 0x00;
6017 buf[2] = 0x00; buf[3] = 0x00;
6018 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf);
6019 // Writes to sensor registers 0x10: UNDOCUMENTED
6020 // 0x11: UNDOCUMENTED
6021 buf[0] = 0x00; buf[1] = 0x00;
6022 buf[2] = 0x00; buf[3] = 0x00;
6023 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf);
6024 // Writes to sensor registers 0x12: 2X Zoom Column Start (from MT9V111 datasheet)
6025 // 0x13: 2X Zoom Row Start (from MT9V111 datasheet)
6026 buf[0] = 0x00; buf[1] = 0x00; // column 0 => bit0 of reg 0x1e must be set to activate zoom
6027 buf[2] = 0x00; buf[3] = 0x00; // row 0 => bit0 of reg 0x1e must be set to activate zoom
6028 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf);
6029 // Writes to sensor registers 0x14: UNDOCUMENTED
6030 // 0x15: UNDOCUMENTED
6031 buf[0] = 0x00; buf[1] = 0x00;
6032 buf[2] = 0x00; buf[3] = 0x00;
6033 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf);
6034 // Writes to sensor registers 0x16: UNDOCUMENTED
6035 // 0x17: UNDOCUMENTED
6036 buf[0] = 0x00; buf[1] = 0x00;
6037 buf[2] = 0x00; buf[3] = 0x00;
6038 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf);
6039 // Writes to sensor registers 0x18: UNDOCUMENTED
6040 // 0x19: UNDOCUMENTED
6041 buf[0] = 0x00; buf[1] = 0x00;
6042 buf[2] = 0x00; buf[3] = 0x00;
6043 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf);
6044 // Writes to sensor registers 0x1a: UNDOCUMENTED
6045 // 0x1b: UNDOCUMENTED
6046 buf[0] = 0x00; buf[1] = 0x00;
6047 buf[2] = 0x00; buf[3] = 0x00;
6048 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf);
6049 // Writes to sensor registers 0x1c: UNDOCUMENTED
6050 // 0x1d: UNDOCUMENTED
6051 buf[0] = 0x00; buf[1] = 0x00;
6052 buf[2] = 0x00; buf[3] = 0x00;
6053 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf);
6054 // Write to sensor register 0x32: RESERVED
6055 buf[0] = 0x00; buf[1] = 0x00;
6056 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x32, dev->sensor_flags, buf);
6057 // Writes to sensor registers 0x20: Read Mode
6058 // 0x21: RESERVED
6059 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad frames) + UNDOCUMENTED
6060 buf[2] = 0x00; buf[3] = 0x00;
6061 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x20, dev->sensor_flags, buf);
6062 // Writes to sensor registers 0x22: RESERVED
6063 // 0x23: UNDOCUMENTED
6064 buf[0] = 0x00; buf[1] = 0x00;
6065 buf[2] = 0x00; buf[3] = 0x00;
6066 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x22, dev->sensor_flags, buf);
6067 // Writes to sensor registers 0x24: UNDOCUMENTED
6068 // 0x25: UNDOCUMENTED
6069 buf[0] = 0x00; buf[1] = 0x00;
6070 buf[2] = 0x00; buf[3] = 0x00;
6071 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x24, dev->sensor_flags, buf);
6072 // Writes to sensor registers 0x26: UNDOCUMENTED
6073 // 0x27: RESERVED
6074 buf[0] = 0x00; buf[1] = 0x00;
6075 buf[2] = 0x00; buf[3] = 0x24;
6076 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x26, dev->sensor_flags, buf);
6077 // "Dummy" write to sensor Register 0x30: RESERVED
6078 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x30, dev->sensor_flags, NULL);
6079 // Writes to sensor registers 0x2f: RESERVED
6080 // 0x30: RESERVED
6081 buf[0] = 0xf7; buf[1] = 0xb0;
6082 buf[2] = 0x00; buf[3] = 0x05;
6083 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2f, dev->sensor_flags, buf);
6084 // Writes to sensor registers 0x31: RESERVED
6085 // 0x32: RESERVED
6086 buf[0] = 0x00; buf[1] = 0x00;
6087 buf[2] = 0x00; buf[3] = 0x00;
6088 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x31, dev->sensor_flags, buf);
6089 // Writes to sensor registers 0x33: RESERVED
6090 // 0x34: RESERVED
6091 buf[0] = 0x00; buf[1] = 0x00;
6092 buf[2] = 0x01; buf[3] = 0x00;
6093 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x33, dev->sensor_flags, buf);
6094 // "Dummy" write to sensor Register 0x3b: RESERVED
6095 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x3b, dev->sensor_flags, NULL);
6096 // Write to sensor register 0x3d: RESERVED
6097 buf[0] = 0x06; buf[1] = 0x8f;
6098 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x3d, dev->sensor_flags, buf);
6099 // Writes to sensor registers 0x40: RESERVED
6100 // 0x41: RESERVED
6101 buf[0] = 0x01; buf[1] = 0xe0;
6102 buf[2] = 0x00; buf[3] = 0xd1;
6103 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x40, dev->sensor_flags, buf);
6104 // Write to sensor register 0x44: UNDOCUMENTED
6105 buf[0] = 0x00; buf[1] = 0x82;
6106 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x44, dev->sensor_flags, buf);
6107 // Writes to sensor registers 0x5a: RESERVED
6108 // 0x5b: RESERVED
6109 buf[0] = 0x00; buf[1] = 0x00;
6110 buf[2] = 0x00; buf[3] = 0x00;
6111 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5a, dev->sensor_flags, buf);
6112 // Writes to sensor registers 0x5c: RESERVED
6113 // 0x5d: RESERVED
6114 buf[0] = 0x00; buf[1] = 0x00;
6115 buf[2] = 0x00; buf[3] = 0x00;
6116 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5c, dev->sensor_flags, buf);
6117 // Writes to sensor registers 0x5e: RESERVED
6118 // 0x5f: RESERVED
6119 buf[0] = 0x00; buf[1] = 0x00;
6120 buf[2] = 0xa3; buf[3] = 0x1d;
6121 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5e, dev->sensor_flags, buf);
6122 // "Dummy" write to sensor Register 0x68: UNDOCUMENTED
6123 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x68, dev->sensor_flags, NULL);
6124 // Write to sensor register 0x62: RESERVED
6125 buf[0] = 0x06; buf[1] = 0x11;
6126 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x62, dev->sensor_flags, buf);
6128 if (retI2C < 0)
6130 UDIA_INFO("1 or more errors occured in I2C-message-block 1 !\n");
6131 return -1;
6133 // END OF I2C MESSAGES
6134 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6136 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6138 buf[0] = 0x40;
6139 usb_microdia_control_write(dev, 0x1007, buf, 8);
6140 buf[0] = 0x40;
6141 usb_microdia_control_write(dev, 0x1006, buf, 8);
6145 // *** TEMPORARY SWITCH TO SLAVE ADDRESS 0x50, I2C READ ATTEMPT:
6146 // - WE CURRENTLY KNOW NO 6270 CAM THAT IS SUCCESSFULLY READ HERE
6147 // - IF READ FAILS, THIS IS NEVER DONE AGAIN (IN NEXT CYCLE OR FURTHER STARTS)
6148 usb_microdia_control_read(dev, 0x10c1, buf, 1); // returns 0x5c
6149 buf[0] = 0x50;
6150 usb_microdia_control_write(dev, 0x10c1, buf, 1);
6151 retI2C = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, SN9C20X_I2C_2WIRE, buf);
6152 if (retI2C >= 0)
6153 UDIA_INFO("Read of address 0x00 from slave 0x50 successful:\n=> Please report this to microdia@googlegroups.com (http://groups.google.com/group/microdia) !\n");
6154 buf[0] = 0x5c;
6155 usb_microdia_control_write(dev, 0x10c1, buf, 1);
6158 buf[0] = 0x47; // ALEX: 0x44
6159 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2045
6160 buf[0] = 0x47; // ALEX: 0x04
6161 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2046
6162 buf[0] = 0xc6;
6163 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2047
6164 buf[0] = 0xc4;
6165 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2048
6166 buf[0] = 0x84; // ALEX: 0xc0
6167 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2049
6168 /* ALEX:
6169 buf[0] = 0x40;
6170 usb_microdia_control_write(dev, 0x1001, buf, 1);
6173 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6175 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6176 // I2C MESSAGES
6177 retI2C = 0;
6178 // Writes to sensor registers 0x02: Column Start
6179 // 0x03: Window Height
6180 buf[0] = 0x00; buf[1] = 0x16; // coulmn 22
6181 buf[2] = 0x01; buf[3] = 0xe1; // 481
6182 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); // URBs 2050-2052
6183 // Writes to sensor registers 0x04: Window Width
6184 // 0x05: Horizontal Blanking
6185 buf[0] = 0x02; buf[1] = 0x81; // 641
6186 buf[2] = 0x00; buf[3] = 0x04; // 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00
6187 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); // URBs 2053-2055
6188 // Writes to sensor registers 0x06: Vertical Blanking
6189 // 0x07: Output Control
6190 buf[0] = 0x00; buf[1] = 0x00; // 0 rows
6191 buf[2] = 0x30; buf[3] = 0x02; // normal operation + chip enable + RESERVED options
6192 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); // URBs 2056-2058
6193 // Write to sensor register 0x0e: UNDOCUMENTED
6194 buf[0] = 0x00; buf[1] = 0x08;
6195 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); // URBs 2059-2061
6196 if (retI2C < 0)
6198 UDIA_INFO("1 or more errors occured in I2C-message-block 2 !\n");
6199 return -1;
6201 // END OF I2C MESSAGES
6202 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6205 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
6206 buf[4] = 0x28; buf[5] = 0x3c;
6207 usb_microdia_control_write(dev, 0x1180, buf, 6); // URB 2062
6208 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6209 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 2063
6210 buf[0] = 0x0c;
6211 usb_microdia_control_write(dev, 0x1189, buf, 1); // URB 2064
6212 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
6213 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 2065
6214 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
6215 usb_microdia_control_write(dev, 0x11ab, buf, 4); // URB 2066
6216 buf[0] = 0x78; // ALEX: 0x7c
6217 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 2067
6218 buf[0] = 0x18; // ALEX: 0x1c
6219 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2068
6220 buf[0] = 0x18; // ALEX: 0x1c
6221 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2069
6222 buf[0] = 0x38;
6223 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2070
6224 buf[0] = 0x04;
6225 usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 2071
6226 buf[0] = 0x04;
6227 usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 2072
6229 buf[0] = 0x78;
6230 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2073
6231 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2074 // 0x38
6232 if (buf[0] == 0x38)
6233 buf[0] = 0x79;
6234 else if (buf[0] == 0xb8)
6235 buf[0] = 0xf9;
6236 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2075
6237 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2076 // 0xb9
6238 if (buf[0] == 0x39)
6239 buf[0] = 0x7a;
6240 else if (buf[0] == 0xb9)
6241 buf[0] = 0xfa;
6242 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2077
6243 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2078
6244 if (buf[0] == 0x3a)
6245 buf[0] = 0x7b;
6246 else if (buf[0] == 0xba)
6247 buf[0] = 0xfb;
6248 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2079
6249 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2080 // 0x3b
6250 if (buf[0] == 0x3b)
6251 buf[0] = 0x7c;
6252 else if (buf[0] == 0xbb)
6253 buf[0] = 0xfc;
6254 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2081
6255 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2082 // 0x3c
6256 if (buf[0] == 0x3c)
6257 buf[0] = 0x7d;
6258 else if (buf[0] == 0xbc)
6259 buf[0] = 0xfd;
6260 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2083
6261 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2084 // 0x3d
6262 last_11b8[0] = buf[0];
6263 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6265 if (buf[0] == 0x3d)
6266 buf[0] = 0x7e;
6267 else if (buf[0] == 0xbd)
6268 buf[0] = 0xfe;
6269 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2085
6270 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2086
6271 if (buf[0] == 0x3e)
6272 buf[0] = 0x7f;
6273 else if (buf[0] == 0xbe)
6274 buf[0] = 0xff;
6275 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2087
6276 usb_microdia_control_read(dev, 0x11b8, last_11b8, 1); // URB 2088
6278 buf[0] = last_11b8[0] & 0xf0; // 0xf0 or 0x70
6279 buf[0] = buf[0] | 0x0d; // 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES
6280 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2089
6283 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6284 // I2C MESSAGES
6285 retI2C = 0;
6286 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6288 // Write to sensor register 0x06: Vertical Blanking
6289 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6290 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); // URBs 2090-2092
6291 // Write to sensor register 0x05: Horizontal Blanking
6292 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks)
6293 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); // URBs 2093-2095
6294 // Write to sensor register 0x20: Read Mode
6295 buf[0] = 0x00; buf[1] = 0x00; // normal readout
6296 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2096-2098
6298 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6300 // Write to sensor register 0x0a: Pixel Clock Speed
6301 buf[0] = 0x00; buf[1] = 0x00; // default
6302 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0a, dev->sensor_flags, buf);
6303 // Write to sensor register 0x06: Vertical Blanking
6304 buf[0] = 0x00; buf[1] = 0x29; // 41 rows
6305 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6306 // Write to sensor register 0x05: Horizontal Blanking
6307 buf[0] = 0x00; buf[1] = 0x09; // 9 columns (pixel clocks)
6308 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
6309 // Write to sensor register 0x20: Read Mode
6310 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad ones) + UNKNOWN
6311 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
6313 if (retI2C < 0)
6315 UDIA_INFO("1 or more errors occured in I2C-message-block 3 !\n");
6316 return -1;
6318 // END OF I2C MESSAGES
6319 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6322 buf[0] = 0x02;
6323 usb_microdia_control_write(dev, 0x1180, buf, 1); // URB 2099
6325 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6326 // I2C MESSAGE
6327 retI2C = 0;
6328 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6330 // Write to sensor register 0x20: Read Mode
6331 buf[0] = 0x00; buf[1] = 0x00; // normal readout
6332 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2100-2102
6334 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6336 // Write to sensor register 0x20: Read Mode
6337 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad ones) + UNKNOWN
6338 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
6340 if (retI2C < 0)
6342 UDIA_INFO("1 or more errors occured in I2C-message-block 4 !\n");
6343 return -1;
6345 // END OF I2C MESSAGES
6346 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6349 buf[0] = 0x02;
6350 usb_microdia_control_write(dev, 0x1182, buf, 1); // URB 2103
6353 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6354 // I2C MESSAGES
6355 retI2C = 0;
6356 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6358 // Write to sensor register 0x09: Shutter Width
6359 buf[0] = 0x00; buf[1] = 0x64; // integration of 100 rows
6360 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf); // URBs 2104-2106
6361 // Write to sensor register 0x2b: Green 1 Gain
6362 // 0x2c: Blue Gain
6363 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6364 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6365 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf); // URBs 2107-2109
6366 // Write to sensor register 0x2d: Red Gain
6367 // 0x2e: Green 2 Gain
6368 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6369 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6370 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf); // URBs 2110-2112
6371 // "Dummy" write to sensor Register 0x33: RESERVED
6372 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL); // URBs 2113-2114
6374 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6376 // Write to sensor register 0x09: Shutter Width
6377 buf[0] = 0x00; buf[1] = 0x64; // integration of 100 rows
6378 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf);
6379 // Write to sensor register 0x07: Output Control
6380 buf[0] = 0x00; buf[1] = 0x03; // dont update changes until bit0=0, chip enable, normal operation
6381 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6382 // Write to sensor register 0x2b: Green 1 Gain
6383 // 0x2c: Blue Gain
6384 buf[0] = 0x00; buf[1] = 0x33; // 51*0.03125*1 = 1.59375
6385 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6386 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf);
6387 // Write to sensor register 0x2d: Red Gain
6388 // 0x2e: Green 2 Gain
6389 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6390 buf[2] = 0x00; buf[3] = 0x33; // 51*0.03125*1 = 1.59375
6391 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf);
6392 // "Dummy" write to sensor Register 0x33: RESERVED
6393 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL);
6394 // Write to sensor register 0x07: Output Control
6395 buf[0] = 0x00; buf[1] = 0x02; // chip enable, normal operation
6396 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6398 if (retI2C < 0)
6400 UDIA_INFO("1 or more errors occured in I2C-message-block 5 !\n");
6401 return -1;
6403 // END OF I2C MESSAGES
6404 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6407 buf[0] = 0x20;
6408 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2115
6409 buf[0] = 0x20;
6410 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2116
6411 buf[0] = 0x20;
6412 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2117
6413 buf[0] = 0x20;
6414 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2118
6415 buf[0] = 0x0a;
6416 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2119
6417 buf[0] = 0x20;
6418 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2120
6419 buf[0] = 0x20;
6420 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2121
6421 buf[0] = 0x20;
6422 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2122
6423 buf[0] = 0x20;
6424 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2123
6426 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6428 buf[0] = 0x14;
6430 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6432 buf[0] = 0x0a;
6434 usb_microdia_control_write(dev, 0x118b, buf, 1); // URB 2124
6437 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6439 buf[0] = 0x0a; buf[1] = 0x36; buf[2] = 0x56; buf[3] = 0x6e;
6440 buf[4] = 0x7f; buf[5] = 0x8d; buf[6] = 0x9b; buf[7] = 0xa8;
6441 buf[8] = 0xb4; buf[9] = 0xbd; buf[10] = 0xc7; buf[11] = 0xd0;
6442 buf[12] = 0xd9; buf[13] = 0xe2; buf[14] = 0xec; buf[15] = 0xf0;
6443 buf[16] = 0xf5;
6445 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6447 buf[0] = 0x08; buf[1] = 0x35; buf[2] = 0x5a; buf[3] = 0x6d;
6448 buf[4] = 0x7d; buf[5] = 0x8b; buf[6] = 0x97; buf[7] = 0xa3;
6449 buf[8] = 0xad; buf[9] = 0xb7; buf[10] = 0xc1; buf[11] = 0xca;
6450 buf[12] = 0xd3; buf[13] = 0xdb; buf[14] = 0xe3; buf[15] = 0xeb;
6451 buf[16] = 0xf2;
6453 usb_microdia_control_write(dev, 0x1190, buf, 17); // URB 2125
6455 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6457 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6458 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf6; buf[7] = 0x0f;
6459 buf[8] = 0xd2; buf[9] = 0x0f; buf[10] = 0x38; buf[11] = 0x00;
6460 buf[12] = 0x34; buf[13] = 0x00; buf[14] = 0xcf; buf[15] = 0x0f;
6461 buf[16] = 0xfd; buf[17] = 0x0f; buf[18] = 0x00; buf[19] = 0x00;
6462 buf[20] = 0x00;
6464 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6466 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6467 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf0; buf[7] = 0x0f;
6468 buf[8] = 0xd0; buf[9] = 0x0f; buf[10] = 0x41; buf[11] = 0x00;
6469 buf[12] = 0x38; buf[13] = 0x00; buf[14] = 0xc7; buf[15] = 0x0f;
6470 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
6471 buf[20] = 0x00;
6473 for (k=0; k<9; k++) // AT FIRST START + FIRST CYCLE: first 8 writes 21 bytes 0x00
6475 usb_microdia_control_write(dev, 0x10e1, buf, 21); // URB 2126 - 2134
6478 buf[0] = 0x07;
6479 usb_microdia_control_write(dev, 0x10f7, buf, 1); // URB 2135
6480 buf[0] = 0x18; // ALEX: 0x00
6481 usb_microdia_control_write(dev, 0x10f6, buf, 1); // URB 2136
6483 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6485 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6486 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf6; buf[7] = 0x0f;
6487 buf[8] = 0xd2; buf[9] = 0x0f; buf[10] = 0x38; buf[11] = 0x00;
6488 buf[12] = 0x34; buf[13] = 0x00; buf[14] = 0xcf; buf[15] = 0x0f;
6489 buf[16] = 0xfd; buf[17] = 0x0f; buf[18] = 0x00; buf[19] = 0x00;
6490 buf[20] = 0x00;
6492 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6494 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6495 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf0; buf[7] = 0x0f;
6496 buf[8] = 0xd0; buf[9] = 0x0f; buf[10] = 0x41; buf[11] = 0x00;
6497 buf[12] = 0x38; buf[13] = 0x00; buf[14] = 0xc7; buf[15] = 0x0f;
6498 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
6499 buf[20] = 0x00;
6501 usb_microdia_control_write(dev, 0x10e1, buf, 21); // URB 2137
6503 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6505 buf[0] = 0x01;
6507 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6509 buf[0] = 0x14;
6511 usb_microdia_control_write(dev, 0x10f8, buf, 1); // URB 2138
6513 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6515 buf[0] = 0x0a;
6517 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6519 buf[0] = 0xff;
6521 usb_microdia_control_write(dev, 0x10fa, buf, 1); // URB 2139
6523 buf[0] = 0x00;
6524 usb_microdia_control_write(dev, 0x10f9, buf, 1); // URB 2140
6525 buf[0] = 0x00;
6526 usb_microdia_control_write(dev, 0x10f9, buf, 1); // URB 2141
6527 buf[0] = 0x0a;
6528 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2142
6529 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
6530 usb_microdia_control_write(dev, 0x11bc, buf, 4); // URB 2143
6531 for (k=0; k<48; k++) buf[k] = 0x00;
6532 usb_microdia_control_write(dev, 0x11c0, buf, 48); // URB 2144
6533 buf[0] = 0x20;
6534 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2145
6535 buf[0] = 0x20;
6536 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2146
6537 buf[0] = 0x20;
6538 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2147
6539 buf[0] = 0x20;
6540 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2148
6541 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
6542 buf[4] = 0x04; buf[5] = 0x3f;
6543 usb_microdia_control_write(dev, 0x11a5, buf, 6); // URB 2149
6545 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6547 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
6549 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6551 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
6553 usb_microdia_control_write(dev, 0x11af, buf, 4); // URB 2150
6555 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
6556 usb_microdia_control_write(dev, 0x11b3, buf, 4); // URB 2151
6557 buf[0] = 0x47; // ALEX: 0x04
6558 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2152
6559 buf[0] = 0x01;
6560 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2153
6561 buf[0] = 0x67; // ALEX: 0x24
6562 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2154
6563 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
6564 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
6565 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
6566 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
6567 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
6568 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
6569 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
6570 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
6571 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
6572 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
6573 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
6574 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
6575 buf[48]= 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
6576 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
6577 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
6578 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
6579 usb_microdia_control_write(dev, 0x1100, buf, 64); // URB 2155
6580 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
6581 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
6582 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
6583 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
6584 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
6585 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
6586 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
6587 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
6588 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
6589 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
6590 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
6591 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
6592 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
6593 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
6594 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
6595 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
6596 usb_microdia_control_write(dev, 0x1140, buf, 64); // URB 2156
6597 buf[0] = 0x47; // ALEX: 0x04
6598 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2157
6599 buf[0] = 0x03;
6600 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2158
6601 buf[0] = 0x4b; // ALEX: 0x08
6602 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2159
6604 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6606 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6607 // I2C MESSAGES
6608 retI2C = 0;
6609 // Writes to sensor registers 0x02: Column Start
6610 // 0x03: Window Hight
6611 buf[0] = 0x00; buf[1] = 0x16; // coulmn 22
6612 buf[2] = 0x01; buf[3] = 0xe1; // 481
6613 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); // URBs 2160-2162
6614 // Writes to sensor registers 0x04: Window Width
6615 // 0x05: Horizontal Blanking
6616 buf[0] = 0x02; buf[1] = 0x81; // 641
6617 buf[2] = 0x00; buf[3] = 0x04; // 4 columns (pixel clocks)
6618 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); // URBs 2163-2165
6619 // Writes to sensor registers 0x06: Vertical Blanking
6620 // 0x07: Output Control
6621 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6622 buf[2] = 0x30; buf[3] = 0x02; // RESERVED options
6623 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); // URBs 2166-2167
6624 // Writes to sensor register 0x0e: UNDOCUMENTED
6625 buf[0] = 0x00; buf[1] = 0x08;
6626 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); // URBs 2168-2170
6627 if (retI2C < 0)
6629 UDIA_INFO("1 or more errors occured in I2C-message-block 6 !\n");
6630 return -1;
6632 // END OF I2C MESSAGES
6633 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6635 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6637 buf[0] = 0x40;
6638 usb_microdia_control_write(dev, 0x1007, buf, 1);
6639 buf[0] = 0x40;
6640 usb_microdia_control_write(dev, 0x1006, buf, 1);
6644 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
6645 buf[4] = 0x28; buf[5] = 0x3c;
6646 usb_microdia_control_write(dev, 0x1180, buf, 6); // URB 2171
6647 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6648 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 2172
6649 buf[0] = 0x0c;
6650 usb_microdia_control_write(dev, 0x1189, buf, 1); // URB 2173
6651 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
6652 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 2174
6653 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
6654 usb_microdia_control_write(dev, 0x11ab, buf, 4); // URB 2175
6655 buf[0] = 0x03;
6656 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2176
6657 buf[0] = 0x0a;
6658 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2177
6659 buf[0] = 0x00;
6660 usb_microdia_control_write(dev, 0x11b9, buf, 1); // URB 2178
6661 buf[0] = 0x0b;
6662 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2179
6663 buf[0] = 0x01;
6664 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2180
6665 buf[0] = 0x78; // ALEX: 0x7c
6666 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 2181
6667 buf[0] = 0x18; // ALEX: 0x1c
6668 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2182
6669 buf[0] = 0x18; // ALEX: 0x1c
6670 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2183
6671 buf[0] = 0x7d; // ALEX: 0xfc
6672 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2184
6673 buf[0] = 0x04;
6674 usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 2185
6675 buf[0] = 0x04;
6676 usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 2186
6678 if ((last_11b8[0] == 0x3d) || (last_11b8[0] == 0x3f))
6679 buf[0] = 0x78;
6680 else if ((last_11b8[0] == 0xbd) || (last_11b8[0] == 0xbf))
6681 buf[0] = 0xf8;
6682 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2187
6683 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2188 // 0x38
6684 if (buf[0] == 0x38)
6685 buf[0] = 0x79;
6686 else if (buf[0] == 0xb8)
6687 buf[0] = 0xf9;
6688 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2189
6689 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2190 // 0xb9
6690 if (buf[0] == 0x39)
6691 buf[0] = 0x7a;
6692 else if (buf[0] == 0xb9)
6693 buf[0] = 0xfa;
6694 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2191
6695 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2192 // 0xba
6696 if (buf[0] == 0x3a)
6697 buf[0] = 0x7b;
6698 else if (buf[0] == 0xba)
6699 buf[0] = 0xfb;
6700 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2193
6701 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2194 // 0x3b
6702 if (buf[0] == 0x3b)
6703 buf[0] = 0x7c;
6704 else if (buf[0] == 0xbb)
6705 buf[0] = 0xfc;
6706 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2195
6707 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2196 // 0x3c
6708 if (buf[0] == 0x3c)
6709 buf[0] = 0x7d;
6710 else if (buf[0] == 0xbc)
6711 buf[0] = 0xfd;
6712 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2197
6713 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2198 // 0x3d
6714 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6716 if (buf[0] == 0x3d)
6717 buf[0] = 0x7e;
6718 else if (buf[0] == 0xbd)
6719 buf[0] = 0xfe;
6720 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2199
6721 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2200
6722 if (buf[0] == 0x3e)
6723 buf[0] = 0x7f;
6724 else if (buf[0] == 0xbe)
6725 buf[0] = 0xff;
6726 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2201
6727 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2202
6729 buf[0] = buf[0] & 0xf0; // 0xf0 or 0x70
6730 buf[0] = buf[0] | 0x0d; // 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES
6731 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2089
6733 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6734 // I2C MESSAGES
6735 retI2C = 0;
6736 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6738 // Write to sensor register 0x06: Vertical Blanking
6739 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6740 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); // URBs 2204-2206
6741 // Write to sensor register 0x05: Horizontal Blanking
6742 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks)
6743 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); // URBs 2207-2209
6744 // Read of sensor register 0x36: Chip Version (mirror of reg0xff)
6745 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x36, dev->sensor_flags, buf); // URBs 2211-2215 // 0x82 0x3a
6747 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6749 // Write to sensor register 0x0a: Pixel Clock Speed
6750 buf[0] = 0x00; buf[1] = 0x00; // default
6751 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6752 // Write to sensor register 0x06: Vertical Blanking
6753 buf[0] = 0x00; buf[1] = 0x29; // 41 rows
6754 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6755 // Write to sensor register 0x05: Horizontal Blanking
6756 buf[0] = 0x00; buf[1] = 0x09; // 9 columns (pixel clocks)
6757 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
6758 // Read of sensor register 0x00: Chip Version (=reg0xff)
6759 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x00, dev->sensor_flags, buf); // 0x82 0x43
6761 if (retI2C < 0)
6763 UDIA_INFO("1 or more errors occured in I2C-message-block 7 !\n");
6764 return -1;
6766 // END OF I2C MESSAGES
6767 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6770 buf[0] = 0x03;
6771 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2216
6774 /*** NOW DRIVER DOES STOP-SEQUENCE
6775 - WITHOUT WRITES TO 0x1007 AND 0x1006 (URBs 3544-3550) => MT9V111
6776 - WRITING 0x40 INSTEAD OF 0x60 TO 0x1007 AND 0x1006 => MT9V011
6777 ***/
6778 /*** 2nd, 3rd, ... CYCLE: ALL MESSAGES (URBs 1953 - URBs 2216) ARE REPEATED ***/
6779 /*** ----- WE DON'T DO THIS, IT SEEMS TO BE UNNECESSARY ----- ***/
6781 // Setup IFP registers for AE and AWB (new, not in the logs):
6782 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6784 mt9v111_setup_autoexposure(dev);
6785 mt9v111_setup_autowhitebalance(dev);
6786 mt9v111_set_autocorrections(dev, 1);
6789 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6791 buf[0] = 0x20;
6793 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6795 buf[0] = 0x60;
6797 usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 2489
6798 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6800 buf[0] = 0x00;
6802 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6804 buf[0] = 0x40;
6806 usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 2490
6807 // => These two writes seem to cause the cam to start sending isochronus USB messages
6809 return 0;
6812 int microdia_627b_start_stream(struct usb_microdia *dev)
6814 int ret;
6815 /* int actual; */
6816 __u16 reg;
6817 __u8 buf[64];
6819 buf[0] = 0x00; /** Will have to be set for every single interrupt. */
6821 ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000); // URB 43
6824 reg = 0x1066;
6825 buf[0] = 0x00;
6826 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 44 */
6827 if (ret < 0)
6828 goto err;
6831 //ret = usb_set_interface(dev->udev, 0, 8);
6832 //if(ret < 0) goto err;
6834 //buf[0] = 0x00; // Will have to be set for every single interrupt
6835 //ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000); // URB 45
6838 reg = 0x1000;
6839 buf[0] = 0x78;
6840 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 46 */
6841 if (ret < 0)
6842 goto err;
6844 reg = 0x1001;
6845 buf[0] = 0xc7;
6846 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 47 */
6847 if (ret < 0)
6848 goto err;
6850 reg = 0x1002;
6851 buf[0] = 0x18;
6852 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 48 */
6853 if (ret < 0)
6854 goto err;
6856 reg = 0x1061;
6857 buf[0] = 0x01;
6858 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 49 */
6859 if (ret < 0)
6860 goto err;
6862 reg = 0x1020;
6863 buf[0] = 0x80;
6864 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 50 */
6865 if (ret < 0)
6866 goto err;
6868 reg = 0x1067;
6869 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
6870 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 51 */
6871 if (ret < 0)
6872 goto err;
6874 reg = 0x10c0;
6875 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
6876 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
6877 buf[8] = 0x03;
6878 ret = usb_microdia_control_write(dev, reg, buf, 9); /* URB 52 */
6879 if (ret < 0)
6880 goto err;
6882 /* transferbufferlength is 18, but data is 24 bytes long, what to do ? */
6883 reg = 0x10e0;
6884 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30; buf[4] = 0x00;
6885 buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed; buf[8] = 0x0f; buf[9] = 0xda;
6886 buf[10] = 0x0f; buf[11] = 0x3a; buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00;
6887 buf[15] = 0xd0; buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
6888 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
6889 ret = usb_microdia_control_write(dev, reg, buf, 24); /* URB 53 */
6890 if (ret < 0)
6891 goto err;
6893 reg = 0x10f8;
6894 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
6895 ret = usb_microdia_control_write(dev, reg, buf, 3); /* URB 54 */
6896 if (ret < 0)
6897 goto err;
6899 reg = 0x10fb;
6900 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6901 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 55 */
6902 if (ret < 0)
6903 goto err;
6905 reg = 0x1188;
6906 buf[0] = 0x86; buf[1] = 0x8c; buf[2] = 0x08;
6907 ret = usb_microdia_control_write(dev, reg, buf, 3); /* URB 56 */
6908 if (ret < 0)
6909 goto err;
6911 reg = 0x118b;
6912 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20; buf[4] = 0x20;
6913 buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b; buf[8] = 0x4f; buf[9] = 0x61;
6914 buf[10] = 0x71; buf[11] = 0x80; buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab;
6915 buf[15] = 0xb8; buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
6916 buf[20] = 0xf4; buf[21] = 0xff;
6917 ret = usb_microdia_control_write(dev, reg, buf, 22); /* URB 57 */
6918 if (ret < 0)
6919 goto err;
6921 reg = 0x11a1;
6922 buf[0] = 0x00; buf[1] = 0x00;
6923 ret = usb_microdia_control_write(dev, reg, buf, 2); /* URB 58 */
6924 if (ret < 0)
6925 goto err;
6927 reg = 0x11b7;
6928 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08; buf[4] = 0x00;
6929 buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
6930 ret = usb_microdia_control_write(dev, reg, buf, 9); /* URB 59 */
6931 if (ret < 0)
6932 goto err;
6934 reg = 0x11b8;
6935 buf[0] = 0x38;
6936 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 60 */
6937 if (ret < 0)
6938 goto err;
6940 reg = 0x1000;
6941 buf[0] = 0x78;
6942 ret = usb_microdia_control_write(dev, reg, buf, 1);
6943 if (ret < 0)
6944 goto err;
6946 buf[0] = 0x80;
6947 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
6948 OV7660_CTL_COM7, dev->sensor_flags, buf);
6949 if (ret < 0)
6950 goto errI2C;
6952 buf[0] = 0x01; buf[1] = 0x74; buf[2] = 0x92; buf[3] = 0x00;
6953 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6954 OV7660_CTL_GAIN, dev->sensor_flags, buf);
6955 if (ret < 0)
6956 goto errI2C;
6958 buf[0] = 0x00; buf[1] = 0x7d; buf[2] = 0x62; buf[3] = 0x00;
6959 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6960 OV7660_CTL_COM1, dev->sensor_flags, buf);
6961 if (ret < 0)
6962 goto errI2C;
6964 buf[0] = 0x83; buf[1] = 0x01;
6965 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
6966 OV7660_CTL_RAVE, dev->sensor_flags, buf);
6967 if (ret < 0)
6968 goto errI2C;
6970 buf[0] = 0x00; buf[1] = 0x08; buf[2] = 0x04; buf[3] = 0x62;
6971 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6972 OV7660_CTL_COM3, dev->sensor_flags, buf);
6973 if (ret < 0)
6974 goto errI2C;
6976 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x05; buf[3] = 0xf8;
6977 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6978 OV7660_CTL_AECH, dev->sensor_flags, buf);
6979 if (ret < 0)
6980 goto errI2C;
6982 buf[0] = 0x2e; buf[1] = 0x00; buf[2] = 0x02;
6983 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3,
6984 OV7660_CTL_COM9, dev->sensor_flags, buf);
6985 if (ret < 0)
6986 goto errI2C;
6988 buf[0] = 0x10; buf[1] = 0x60; buf[2] = 0x02; buf[3] = 0x7b;
6989 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6990 OV7660_CTL_HSTART, dev->sensor_flags, buf);
6991 if (ret < 0)
6992 goto errI2C;
6994 buf[0] = 0x06;
6995 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
6996 OV7660_CTL_PSHFT, dev->sensor_flags, buf);
6997 if (ret < 0)
6998 goto errI2C;
7000 buf[0] = 0x01; buf[1] = 0x0e;
7001 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
7002 OV7660_CTL_MVFP, dev->sensor_flags, buf);
7003 if (ret < 0)
7004 goto errI2C;
7006 buf[0] = 0x07; buf[1] = 0x07; buf[2] = 0x07; buf[3] = 0x07;
7007 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7008 OV7660_CTL_BOS, dev->sensor_flags, buf);
7009 if (ret < 0)
7010 goto errI2C;
7012 buf[0] = 0x68; buf[1] = 0x58; buf[2] = 0xd4; buf[3] = 0x80;
7013 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7014 OV7660_CTL_AEW, dev->sensor_flags, buf);
7015 if (ret < 0)
7016 goto errI2C;
7018 buf[0] = 0x80; buf[1] = 0x3c; buf[2] = 0x00; buf[3] = 0x00;
7019 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7020 OV7660_CTL_GbBIAS, dev->sensor_flags, buf);
7021 if (ret < 0)
7022 goto errI2C;
7024 buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x62;
7025 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7026 OV7660_CTL_RBIAS, dev->sensor_flags, buf);
7027 if (ret < 0)
7028 goto errI2C;
7030 buf[0] = 0x08; buf[1] = 0x30; buf[2] = 0xb4;
7031 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3,
7032 OV7660_CTL_HSYST, dev->sensor_flags, buf);
7033 if (ret < 0)
7034 goto errI2C;
7036 buf[0] = 0x00; buf[1] = 0x07; buf[2] = 0x84; buf[3] = 0x00;
7037 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7038 OV7660_CTL_CHLF, dev->sensor_flags, buf);
7039 if (ret < 0)
7040 goto errI2C;
7042 buf[0] = 0x0c; buf[1] = 0x02; buf[2] = 0x43; buf[3] = 0x00;
7043 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7044 OV7660_CTL_ADC, dev->sensor_flags, buf);
7045 if (ret < 0)
7046 goto errI2C;
7048 buf[0] = 0x02; buf[1] = 0x6c; buf[2] = 0x19; buf[3] = 0x0e;
7049 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7050 OV7660_CTL_COM11, dev->sensor_flags, buf);
7051 if (ret < 0)
7052 goto errI2C;
7054 buf[0] = 0x41; buf[1] = 0xc1; buf[2] = 0x22; buf[3] = 0x08;
7055 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7056 OV7660_CTL_EDGE, dev->sensor_flags, buf);
7057 if (ret < 0)
7058 goto errI2C;
7060 /* "Dummy" write */
7061 reg = 0x43; /* RSVD 0x43 is Reserved */
7062 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7063 reg, dev->sensor_flags, NULL);
7064 if (ret < 0)
7065 goto errI2C;
7067 reg = 0x43; /* RSVD 0x43 is Reserved */
7068 buf[0] = 0xf0; buf[1] = 0x10; buf[2] = 0x78; buf[3] = 0xa8;
7069 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7070 dev->sensor_flags, buf);
7071 if (ret < 0)
7072 goto errI2C;
7074 reg = 0x47; /* RSVD 0x47 is Reserved */
7075 buf[0] = 0x60; buf[1] = 0x80; buf[2] = 0x00; buf[3] = 0x00;
7076 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7077 dev->sensor_flags, buf);
7078 if (ret < 0)
7079 goto errI2C;
7081 reg = 0x4b; /* RSVD 0x4b is Reserved */
7082 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
7083 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7084 dev->sensor_flags, buf);
7085 if (ret < 0)
7086 goto errI2C;
7088 /* "Dummy" write */
7089 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7090 OV7660_CTL_MTX1, dev->sensor_flags, NULL);
7091 if (ret < 0)
7092 goto errI2C;
7094 reg = 0x59; /* RSVD 0x59 is Reserved */
7095 buf[0] = 0xba; buf[1] = 0x9a; buf[2] = 0x22; buf[3] = 0xb9;
7096 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7097 reg, dev->sensor_flags, buf);
7098 if (ret < 0)
7099 goto errI2C;
7101 reg = 0x5d; /* RSVD 0x5d is Reserved */
7102 buf[0] = 0x9b; buf[1] = 0x10; buf[2] = 0xf0; buf[3] = 0x05;
7103 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7104 reg, dev->sensor_flags, buf);
7105 if (ret < 0)
7106 goto errI2C;
7108 reg = 0x61; /* RSVD 0x61 is Reserved */
7109 buf[0] = 0x60;
7110 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7111 reg, dev->sensor_flags, buf);
7112 if (ret < 0)
7113 goto errI2C;
7115 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x30;
7116 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7117 OV7660_CTL_LCC1, dev->sensor_flags, buf);
7118 if (ret < 0)
7119 goto errI2C;
7121 buf[0] = 0x00;
7122 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7123 OV7660_CTL_LCC5, dev->sensor_flags, buf);
7124 if (ret < 0)
7125 goto errI2C;
7127 buf[0] = 0x80; buf[1] = 0x7a; buf[2] = 0x90; buf[3] = 0x80;
7128 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7129 OV7660_CTL_MANU, dev->sensor_flags, buf);
7130 if (ret < 0)
7131 goto errI2C;
7133 buf[0] = 0x0a;
7134 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7135 OV7660_CTL_DBLV, dev->sensor_flags, buf);
7136 if (ret < 0)
7137 goto errI2C;
7139 reg = 0x8b; /* RSVD 0x8b is Reserved */
7140 buf[0] = 0x99; buf[1] = 0x99; buf[2] = 0xcf;
7141 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, reg,
7142 dev->sensor_flags, buf);
7143 if (ret < 0)
7144 goto errI2C;
7146 buf[0] = 0x00; buf[1] = 0x00;
7147 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
7148 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
7149 if (ret < 0)
7150 goto errI2C;
7152 reg = 0x1007;
7153 buf[0] = 0x40;
7154 ret = usb_microdia_control_write(dev, reg, buf, 1);
7155 if (ret < 0)
7156 goto err;
7158 reg = 0x1006;
7159 buf[0] = 0x00;
7160 ret = usb_microdia_control_write(dev, reg, buf, 1);
7161 if (ret < 0)
7162 goto err;
7164 reg = 0x10c1;
7165 ret = usb_microdia_control_read(dev, reg, buf, 1);
7166 if (ret < 0)
7167 goto err;
7169 reg = 0x10c1;
7170 buf[0] = 0x50;
7171 ret = usb_microdia_control_write(dev, reg, buf, 1);
7172 if (ret < 0)
7173 goto err;
7175 /* TRY TO READ FROM EEPROM: */
7176 reg = 0x00;
7177 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, reg, SN9C20X_I2C_2WIRE, buf);
7178 if (ret < 0)
7179 UDIA_INFO("No EEPROM found\n");
7180 else
7181 UDIA_INFO("Read from EEPROM successful\n");
7183 reg = 0x10c1;
7184 buf[0] = 0x21;
7185 ret = usb_microdia_control_write(dev, reg, buf, 1);
7186 if (ret < 0)
7187 goto err;
7189 reg = 0x10e0;
7190 buf[0] = 0x47;
7191 ret = usb_microdia_control_write(dev, reg, buf, 1);
7192 if (ret < 0)
7193 goto err;
7195 reg = 0x10e0;
7196 buf[0] = 0x47;
7197 ret = usb_microdia_control_write(dev, reg, buf, 1);
7198 if (ret < 0)
7199 goto err;
7201 reg = 0x1001;
7202 buf[0] = 0xc6;
7203 ret = usb_microdia_control_write(dev, reg, buf, 1);
7204 if (ret < 0)
7205 goto err;
7207 reg = 0x1001;
7208 buf[0] = 0xc4;
7209 ret = usb_microdia_control_write(dev, reg, buf, 1);
7210 if (ret < 0)
7211 goto err;
7213 reg = 0x1001;
7214 buf[0] = 0x84;
7215 ret = usb_microdia_control_write(dev, reg, buf, 1);
7216 if (ret < 0)
7217 goto err;
7219 buf[0] = 0x08;
7220 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7221 OV7660_CTL_VREF, dev->sensor_flags, buf);
7222 if (ret < 0)
7223 goto errI2C;
7225 buf[0] = 0x10; buf[1] = 0x61; buf[2] = 0x02; buf[3] = 0x7a;
7226 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7227 OV7660_CTL_HSTART, dev->sensor_flags, buf);
7228 if (ret < 0)
7229 goto errI2C;
7231 /* "Dummy" write: */
7232 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7233 OV7660_CTL_PSHFT, dev->sensor_flags, NULL);
7234 if (ret < 0)
7235 goto errI2C;
7237 buf[0] = 0x84;
7238 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7239 OV7660_CTL_HREF, dev->sensor_flags, buf);
7240 if (ret < 0)
7241 goto errI2C;
7243 buf[0] = 0x84;
7244 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7245 OV7660_CTL_HREF, dev->sensor_flags, buf);
7246 if (ret < 0)
7247 goto errI2C;
7249 buf[0] = 0x84;
7250 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7251 OV7660_CTL_HREF, dev->sensor_flags, buf);
7252 if (ret < 0)
7253 goto errI2C;
7255 buf[0] = 0x84;
7256 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7257 OV7660_CTL_HREF, dev->sensor_flags, buf);
7258 if (ret < 0)
7259 goto errI2C;
7261 buf[0] = 0x84;
7262 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7263 OV7660_CTL_HREF, dev->sensor_flags, buf);
7264 if (ret < 0)
7265 goto errI2C;
7267 reg = 0x1180;
7268 buf[0] = 0x01; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x28;
7269 buf[5] = 0x3c;
7270 ret = usb_microdia_control_write(dev, reg, buf, 6);
7271 if (ret < 0)
7272 goto err;
7274 reg = 0x10fb;
7275 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
7276 ret = usb_microdia_control_write(dev, reg, buf, 5);
7277 if (ret < 0)
7278 goto err;
7280 reg = 0x1189;
7281 buf[0] = 0x8c;
7282 ret = usb_microdia_control_write(dev, reg, buf, 1);
7283 if (ret < 0)
7284 goto err;
7286 reg = 0x11a1;
7287 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
7288 ret = usb_microdia_control_write(dev, reg, buf, 4);
7289 if (ret < 0)
7290 goto err;
7292 reg = 0x11ab;
7293 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
7294 ret = usb_microdia_control_write(dev, reg, buf, 4);
7295 if (ret < 0)
7296 goto err;
7298 reg = 0x1000;
7299 buf[0] = 0x78;
7300 ret = usb_microdia_control_write(dev, reg, buf, 1);
7301 if (ret < 0)
7302 goto err;
7304 reg = 0x1002;
7305 buf[0] = 0x18;
7306 ret = usb_microdia_control_write(dev, reg, buf, 1);
7307 if (ret < 0)
7308 goto err;
7310 reg = 0x1002;
7311 buf[0] = 0x18;
7312 ret = usb_microdia_control_write(dev, reg, buf, 1);
7313 if (ret < 0)
7314 goto err;
7316 reg = 0x11b8;
7317 buf[0] = 0x38;
7318 ret = usb_microdia_control_write(dev, reg, buf, 1);
7319 if (ret < 0)
7320 goto err;
7322 reg = 0x118a;
7323 buf[0] = 0x04;
7324 ret = usb_microdia_control_write(dev, reg, buf, 1);
7325 if (ret < 0)
7326 goto err;
7328 reg = 0x0395;
7329 buf[0] = 0x04;
7330 ret = usb_microdia_control_write(dev, reg, buf, 1);
7331 if (ret < 0)
7332 goto err;
7334 reg = 0x11b8;
7335 buf[0] = 0x78;
7336 ret = usb_microdia_control_write(dev, reg, buf, 1);
7337 if (ret < 0)
7338 goto err;
7339 ret = usb_microdia_control_read(dev, reg, buf, 1);
7340 if (ret < 0)
7341 goto err;
7343 reg = 0x11b8;
7344 buf[0] = 0xf9;
7345 ret = usb_microdia_control_write(dev, reg, buf, 1);
7346 if (ret < 0)
7347 goto err;
7348 ret = usb_microdia_control_read(dev, reg, buf, 1);
7349 if (ret < 0)
7350 goto err;
7352 reg = 0x11b8;
7353 buf[0] = 0xfa;
7354 ret = usb_microdia_control_write(dev, reg, buf, 1);
7355 if (ret < 0)
7356 goto err;
7357 ret = usb_microdia_control_read(dev, reg, buf, 1);
7358 if (ret < 0)
7359 goto err;
7361 reg = 0x11b8;
7362 buf[0] = 0x7b;
7363 ret = usb_microdia_control_write(dev, reg, buf, 1);
7364 if (ret < 0)
7365 goto err;
7366 ret = usb_microdia_control_read(dev, reg, buf, 1);
7367 if (ret < 0)
7368 goto err;
7370 reg = 0x11b8;
7371 buf[0] = 0x7c;
7372 ret = usb_microdia_control_write(dev, reg, buf, 1);
7373 if (ret < 0)
7374 goto err;
7375 ret = usb_microdia_control_read(dev, reg, buf, 1);
7376 if (ret < 0)
7377 goto err;
7379 reg = 0x11b8;
7380 buf[0] = 0x7d;
7381 ret = usb_microdia_control_write(dev, reg, buf, 1);
7382 if (ret < 0)
7383 goto err;
7384 ret = usb_microdia_control_read(dev, reg, buf, 1);
7385 if (ret < 0)
7386 goto err;
7388 reg = 0x11b8;
7389 buf[0] = 0x7b;
7390 ret = usb_microdia_control_write(dev, reg, buf, 1);
7391 if (ret < 0)
7392 goto err;
7395 //ret = usb_microdia_control_read(dev, reg, buf, 1);
7396 //if(ret < 0) goto err;
7399 buf[0] = 0x40;
7400 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7401 OV7660_CTL_CLKRC, dev->sensor_flags, buf);
7402 if (ret < 0)
7403 goto errI2C;
7405 buf[0] = 0x00;
7406 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7407 OV7660_CTL_EXHCH, dev->sensor_flags, buf);
7408 if (ret < 0)
7409 goto errI2C;
7411 buf[0] = 0x00;
7412 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7413 OV7660_CTL_EXHCL, dev->sensor_flags, buf);
7414 if (ret < 0)
7415 goto errI2C;
7417 buf[0] = 0x00;
7418 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7419 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
7420 if (ret < 0)
7421 goto errI2C;
7423 buf[0] = 0x00;
7424 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7425 OV7660_CTL_DM_LNH, dev->sensor_flags, buf);
7426 if (ret < 0)
7427 goto errI2C;
7429 buf[0] = 0x01;
7430 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7431 OV7660_CTL_MVFP, dev->sensor_flags, buf);
7432 if (ret < 0)
7433 goto errI2C;
7435 buf[0] = 0x01;
7436 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7437 OV7660_CTL_MVFP, dev->sensor_flags, buf);
7438 if (ret < 0)
7439 goto errI2C;
7441 buf[0] = 0x08;
7442 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7443 OV7660_CTL_VREF, dev->sensor_flags, buf);
7444 if (ret < 0)
7445 goto errI2C;
7447 buf[0] = 0x00;
7448 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7449 OV7660_CTL_VREF, dev->sensor_flags, buf);
7450 if (ret < 0)
7451 goto errI2C;
7453 buf[0] = 0x7f;
7454 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7455 OV7660_CTL_AECH, dev->sensor_flags, buf);
7456 if (ret < 0)
7457 goto errI2C;
7459 buf[0] = 0x00;
7460 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7461 OV7660_CTL_COM1, dev->sensor_flags, buf);
7462 if (ret < 0)
7463 goto errI2C;
7465 buf[0] = 0x00;
7466 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7467 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
7468 if (ret < 0)
7469 goto errI2C;
7471 buf[0] = 0x00;
7472 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7473 OV7660_CTL_ADVFH, dev->sensor_flags, buf);
7474 if (ret < 0)
7475 goto errI2C;
7477 buf[0] = 0x00;
7478 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7479 OV7660_CTL_GAIN, dev->sensor_flags, buf);
7480 if (ret < 0)
7481 goto errI2C;
7483 buf[0] = 0x78; buf[1] = 0x78;
7484 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
7485 OV7660_CTL_BLUE, dev->sensor_flags, buf);
7486 if (ret < 0)
7487 goto errI2C;
7489 reg = 0x118c;
7490 buf[0] = 0x20;
7491 ret = usb_microdia_control_write(dev, reg, buf, 1);
7492 if (ret < 0)
7493 goto err;
7495 reg = 0x118d;
7496 buf[0] = 0x20;
7497 ret = usb_microdia_control_write(dev, reg, buf, 1);
7498 if (ret < 0)
7499 goto err;
7501 reg = 0x118e;
7502 buf[0] = 0x20;
7503 ret = usb_microdia_control_write(dev, reg, buf, 1);
7504 if (ret < 0)
7505 goto err;
7507 reg = 0x118f;
7508 buf[0] = 0x20;
7509 ret = usb_microdia_control_write(dev, reg, buf, 1);
7510 if (ret < 0)
7511 goto err;
7513 reg = 0x11ba;
7514 buf[0] = 0x0a;
7515 ret = usb_microdia_control_write(dev, reg, buf, 1);
7516 if (ret < 0)
7517 goto err;
7519 reg = 0x118c;
7520 buf[0] = 0x20;
7521 ret = usb_microdia_control_write(dev, reg, buf, 1);
7522 if (ret < 0)
7523 goto err;
7525 reg = 0x118d;
7526 buf[0] = 0x20;
7527 ret = usb_microdia_control_write(dev, reg, buf, 1);
7528 if (ret < 0)
7529 goto err;
7531 reg = 0x118e;
7532 buf[0] = 0x20;
7533 ret = usb_microdia_control_write(dev, reg, buf, 1);
7534 if (ret < 0)
7535 goto err;
7537 reg = 0x118f;
7538 buf[0] = 0x20;
7539 ret = usb_microdia_control_write(dev, reg, buf, 1);
7540 if (ret < 0)
7541 goto err;
7543 reg = 0x118b;
7544 buf[0] = 0x0c;
7545 ret = usb_microdia_control_write(dev, reg, buf, 1);
7546 if (ret < 0)
7547 goto err;
7549 reg = 0x1190;
7550 buf[0] = 0x00; buf[1] = 0x33; buf[2] = 0x53; buf[3] = 0x6b; buf[4] = 0x7c;
7551 buf[5] = 0x8b; buf[6] = 0x99; buf[7] = 0xa6; buf[8] = 0xb2; buf[9] = 0xbd;
7552 buf[10] = 0xc8; buf[11] = 0xd2; buf[12] = 0xdc; buf[13] = 0xe5; buf[14] = 0xee;
7553 buf[15] = 0xf7; buf[16] = 0xff;
7554 ret = usb_microdia_control_write(dev, reg, buf, 17);
7555 if (ret < 0)
7556 goto err;
7557 /* transferbufferlength was only 11 ? */
7559 reg = 0x10e1;
7560 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7561 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7562 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7563 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7564 buf[20] = 0x00;
7565 ret = usb_microdia_control_write(dev, reg, buf, 21);
7566 if (ret < 0)
7567 goto err;
7568 /* transferbufferlength was only 15 ? */
7570 reg = 0x10e1;
7571 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7572 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7573 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7574 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7575 buf[20] = 0x00;
7576 ret = usb_microdia_control_write(dev, reg, buf, 21);
7577 if (ret < 0)
7578 goto err;
7579 /* transferbufferlength was only 15 ? */
7581 reg = 0x10e1;
7582 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7583 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7584 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7585 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7586 buf[20] = 0x00;
7587 ret = usb_microdia_control_write(dev, reg, buf, 21);
7588 if (ret < 0)
7589 goto err;
7590 /* transferbufferlength was only 15 ? */
7592 reg = 0x10e1;
7593 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7594 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7595 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7596 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7597 buf[20] = 0x00;
7598 ret = usb_microdia_control_write(dev, reg, buf, 21);
7599 if (ret < 0)
7600 goto err;
7601 /* transferbufferlength was only 15 ? */
7603 reg = 0x10e1;
7604 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7605 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7606 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7607 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7608 buf[20] = 0x00;
7609 ret = usb_microdia_control_write(dev, reg, buf, 21);
7610 if (ret < 0)
7611 goto err;
7612 /* transferbufferlength was only 15 ? */
7614 reg = 0x10e1;
7615 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7616 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7617 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7618 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7619 buf[20] = 0x00;
7620 ret = usb_microdia_control_write(dev, reg, buf, 21);
7621 if (ret < 0)
7622 goto err;
7623 /* transferbufferlength was only 15 ? */
7625 reg = 0x10e1;
7626 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7627 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7628 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7629 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7630 buf[20] = 0x00;
7631 ret = usb_microdia_control_write(dev, reg, buf, 21);
7632 if (ret < 0)
7633 goto err;
7634 /* transferbufferlength was only 15 ? */
7636 reg = 0x10e1;
7637 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7638 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7639 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7640 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7641 buf[20] = 0x00;
7642 ret = usb_microdia_control_write(dev, reg, buf, 21);
7643 if (ret < 0)
7644 goto err;
7645 /* transferbufferlength was only 15 ? */
7647 reg = 0x10e1;
7648 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
7649 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7650 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7651 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7652 buf[20] = 0x00;
7653 ret = usb_microdia_control_write(dev, reg, buf, 21);
7654 if (ret < 0)
7655 goto err;
7656 /* transferbufferlength was only 15 ? */
7658 reg = 0x10f7;
7659 buf[0] = 0x05;
7660 ret = usb_microdia_control_write(dev, reg, buf, 1);
7661 if (ret < 0)
7662 goto err;
7664 reg = 0x10f6;
7665 buf[0] = 0x1b;
7666 ret = usb_microdia_control_write(dev, reg, buf, 1);
7667 if (ret < 0)
7668 goto err;
7670 reg = 0x10e1;
7671 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
7672 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7673 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7674 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7675 buf[20] = 0x00;
7676 ret = usb_microdia_control_write(dev, reg, buf, 21);
7677 if (ret < 0)
7678 goto err;
7679 /* transferbufferlength was only 15 ? */
7681 reg = 0x10f8;
7682 buf[0] = 0x14;
7683 ret = usb_microdia_control_write(dev, reg, buf, 1);
7684 if (ret < 0)
7685 goto err;
7687 reg = 0x10fa;
7688 buf[0] = 0xff;
7689 ret = usb_microdia_control_write(dev, reg, buf, 1);
7690 if (ret < 0)
7691 goto err;
7693 reg = 0x10f9;
7694 buf[0] = 0x00;
7695 ret = usb_microdia_control_write(dev, reg, buf, 1);
7696 if (ret < 0)
7697 goto err;
7699 reg = 0x10f9;
7700 buf[0] = 0x00;
7701 ret = usb_microdia_control_write(dev, reg, buf, 1);
7702 if (ret < 0)
7703 goto err;
7705 reg = 0x11ba;
7706 buf[0] = 0x0a;
7707 ret = usb_microdia_control_write(dev, reg, buf, 1);
7708 if (ret < 0)
7709 goto err;
7711 reg = 0x11bc;
7712 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
7713 ret = usb_microdia_control_write(dev, reg, buf, 4);
7714 if (ret < 0)
7715 goto err;
7717 reg = 0x11c0;
7718 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7719 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7720 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7721 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
7722 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00; buf[24] = 0x00;
7723 buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00; buf[28] = 0x00; buf[29] = 0x00;
7724 buf[30] = 0x00; buf[31] = 0x00; buf[32] = 0x00;
7725 ret = usb_microdia_control_write(dev, reg, buf, 33);
7726 if (ret < 0)
7727 goto err;
7728 /* transferbufferlength was only 30 ? */
7730 reg = 0x118c;
7731 buf[0] = 0x20;
7732 ret = usb_microdia_control_write(dev, reg, buf, 1);
7733 if (ret < 0)
7734 goto err;
7736 reg = 0x118d;
7737 buf[0] = 0x20;
7738 ret = usb_microdia_control_write(dev, reg, buf, 1);
7739 if (ret < 0)
7740 goto err;
7742 reg = 0x118e;
7743 buf[0] = 0x20;
7744 ret = usb_microdia_control_write(dev, reg, buf, 1);
7745 if (ret < 0)
7746 goto err;
7748 reg = 0x118f;
7749 buf[0] = 0x20;
7750 ret = usb_microdia_control_write(dev, reg, buf, 1);
7751 if (ret < 0)
7752 goto err;
7754 reg = 0x11a5;
7755 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04;
7756 buf[5] = 0x3f;
7757 ret = usb_microdia_control_write(dev, reg, buf, 6);
7758 if (ret < 0)
7759 goto err;
7761 reg = 0x11af;
7762 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
7763 ret = usb_microdia_control_write(dev, reg, buf, 4);
7764 if (ret < 0)
7765 goto err;
7767 reg = 0x11b3;
7768 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
7769 ret = usb_microdia_control_write(dev, reg, buf, 4);
7770 if (ret < 0)
7771 goto err;
7773 reg = 0x10e0;
7774 buf[0] = 0x47;
7775 ret = usb_microdia_control_write(dev, reg, buf, 1);
7776 if (ret < 0)
7777 goto err;
7779 reg = 0x1061;
7780 buf[0] = 0x01;
7781 ret = usb_microdia_control_write(dev, reg, buf, 1);
7782 if (ret < 0)
7783 goto err;
7785 reg = 0x10e0;
7786 buf[0] = 0x67;
7787 ret = usb_microdia_control_write(dev, reg, buf, 1);
7788 if (ret < 0)
7789 goto err;
7791 reg = 0x1100;
7792 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d; buf[4] = 0x08;
7793 buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d; buf[8] = 0x0d; buf[9] = 0x0d;
7794 buf[10] = 0x11; buf[11] = 0x0d; buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15;
7795 buf[15] = 0x21; buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
7796 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d; buf[24] = 0x19;
7797 buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a; buf[28] = 0x32; buf[29] = 0x32;
7798 buf[30] = 0x2e; buf[31] = 0x2a; buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36;
7799 buf[35] = 0x3a; buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
7800 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e; buf[44] = 0x43;
7801 buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47; buf[48] = 0x4f; buf[49] = 0x53;
7802 buf[50] = 0x58; buf[51] = 0x58; buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f;
7803 buf[55] = 0x60; buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
7804 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
7805 ret = usb_microdia_control_write(dev, reg, buf, 64);
7806 if (ret < 0)
7807 goto err;
7808 /* transferbufferlength is only 40 ? */
7810 reg = 0x1140;
7811 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15; buf[4] = 0x11;
7812 buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15; buf[8] = 0x15; buf[9] = 0x26;
7813 buf[10] = 0x53; buf[11] = 0x36; buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53;
7814 buf[15] = 0x53; buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
7815 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53; buf[24] = 0x53;
7816 buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53; buf[28] = 0x53; buf[29] = 0x53;
7817 buf[30] = 0x53; buf[31] = 0x53; buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53;
7818 buf[35] = 0x53; buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
7819 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53; buf[44] = 0x53;
7820 buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53; buf[48] = 0x53; buf[49] = 0x53;
7821 buf[50] = 0x53; buf[51] = 0x53; buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53;
7822 buf[55] = 0x53; buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
7823 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
7824 ret = usb_microdia_control_write(dev, reg, buf, 64);
7825 if (ret < 0)
7826 goto err;
7827 /* transferbufferlength is only 40 ? */
7829 reg = 0x10e0;
7830 buf[0] = 0x47;
7831 ret = usb_microdia_control_write(dev, reg, buf, 1);
7832 if (ret < 0)
7833 goto err;
7835 reg = 0x1061;
7836 buf[0] = 0x03;
7837 ret = usb_microdia_control_write(dev, reg, buf, 1);
7838 if (ret < 0)
7839 goto err;
7841 reg = 0x10e0;
7842 buf[0] = 0x4b;
7843 ret = usb_microdia_control_write(dev, reg, buf, 1);
7844 if (ret < 0)
7845 goto err;
7847 buf[0] = 0x08;
7848 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7849 OV7660_CTL_VREF, dev->sensor_flags, buf);
7850 if (ret < 0)
7851 goto errI2C;
7853 reg = 0x1180;
7854 buf[0] = 0x01; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x28;
7855 buf[5] = 0x3c;
7856 ret = usb_microdia_control_write(dev, reg, buf, 6);
7857 if (ret < 0)
7858 goto err;
7860 reg = 0x10fb;
7861 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
7862 ret = usb_microdia_control_write(dev, reg, buf, 5);
7863 if (ret < 0)
7864 goto err;
7866 reg = 0x1189;
7867 buf[0] = 0x8c;
7868 ret = usb_microdia_control_write(dev, reg, buf, 1);
7869 if (ret < 0)
7870 goto err;
7872 reg = 0x11a1;
7873 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
7874 ret = usb_microdia_control_write(dev, reg, buf, 4);
7875 if (ret < 0)
7876 goto err;
7878 reg = 0x11ab;
7879 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
7880 ret = usb_microdia_control_write(dev, reg, buf, 4);
7881 if (ret < 0)
7882 goto err;
7884 reg = 0x1061;
7885 buf[0] = 0x03;
7886 ret = usb_microdia_control_write(dev, reg, buf, 1);
7887 if (ret < 0)
7888 goto err;
7890 reg = 0x11ba;
7891 buf[0] = 0x0a;
7892 ret = usb_microdia_control_write(dev, reg, buf, 1);
7893 if (ret < 0)
7894 goto err;
7896 reg = 0x11b9;
7897 buf[0] = 0x00;
7898 ret = usb_microdia_control_write(dev, reg, buf, 1);
7899 if (ret < 0)
7900 goto err;
7902 reg = 0x11ba;
7903 buf[0] = 0x0b;
7904 ret = usb_microdia_control_write(dev, reg, buf, 1);
7905 if (ret < 0)
7906 goto err;
7908 reg = 0x1061;
7909 buf[0] = 0x01;
7910 ret = usb_microdia_control_write(dev, reg, buf, 1);
7911 if (ret < 0)
7912 goto err;
7914 reg = 0x1000;
7915 buf[0] = 0x78;
7916 ret = usb_microdia_control_write(dev, reg, buf, 1);
7917 if (ret < 0)
7918 goto err;
7920 reg = 0x1002;
7921 buf[0] = 0x18;
7922 ret = usb_microdia_control_write(dev, reg, buf, 1);
7923 if (ret < 0)
7924 goto err;
7926 reg = 0x1002;
7927 buf[0] = 0x18;
7928 ret = usb_microdia_control_write(dev, reg, buf, 1);
7929 if (ret < 0)
7930 goto err;
7932 reg = 0x11b8;
7933 buf[0] = 0x7b;
7934 ret = usb_microdia_control_write(dev, reg, buf, 1);
7935 if (ret < 0)
7936 goto err;
7938 reg = 0x118a;
7939 buf[0] = 0x04;
7940 ret = usb_microdia_control_write(dev, reg, buf, 1);
7941 if (ret < 0)
7942 goto err;
7944 reg = 0x0395;
7945 buf[0] = 0x04;
7946 ret = usb_microdia_control_write(dev, reg, buf, 1);
7947 if (ret < 0)
7948 goto err;
7950 reg = 0x11b8;
7951 buf[0] = 0x78;
7952 ret = usb_microdia_control_write(dev, reg, buf, 1);
7953 if (ret < 0)
7954 goto err;
7955 ret = usb_microdia_control_read(dev, reg, buf, 1);
7956 if (ret < 0)
7957 goto err;
7959 reg = 0x11b8;
7960 buf[0] = 0xf9;
7961 ret = usb_microdia_control_write(dev, reg, buf, 1);
7962 if (ret < 0)
7963 goto err;
7964 ret = usb_microdia_control_read(dev, reg, buf, 1);
7965 if (ret < 0)
7966 goto err;
7968 reg = 0x11b8;
7969 buf[0] = 0xfa;
7970 ret = usb_microdia_control_write(dev, reg, buf, 1);
7971 if (ret < 0)
7972 goto err;
7973 ret = usb_microdia_control_read(dev, reg, buf, 1);
7974 if (ret < 0)
7975 goto err;
7977 reg = 0x11b8;
7978 buf[0] = 0x7b;
7979 ret = usb_microdia_control_write(dev, reg, buf, 1);
7980 if (ret < 0)
7981 goto err;
7982 ret = usb_microdia_control_read(dev, reg, buf, 1);
7983 if (ret < 0)
7984 goto err;
7986 reg = 0x11b8;
7987 buf[0] = 0x7c;
7988 ret = usb_microdia_control_write(dev, reg, buf, 1);
7989 if (ret < 0)
7990 goto err;
7991 ret = usb_microdia_control_read(dev, reg, buf, 1);
7992 if (ret < 0)
7993 goto err;
7995 reg = 0x11b8;
7996 buf[0] = 0x7d;
7997 ret = usb_microdia_control_write(dev, reg, buf, 1);
7998 if (ret < 0)
7999 goto err;
8000 ret = usb_microdia_control_read(dev, reg, buf, 1);
8001 if (ret < 0)
8002 goto err;
8004 reg = 0x11b8;
8005 buf[0] = 0x7b;
8006 ret = usb_microdia_control_write(dev, reg, buf, 1);
8007 if (ret < 0)
8008 goto err;
8010 buf[0] = 0x40;
8011 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8012 OV7660_CTL_CLKRC, dev->sensor_flags, buf);
8013 if (ret < 0)
8014 goto errI2C;
8016 buf[0] = 0x00;
8017 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8018 OV7660_CTL_EXHCH, dev->sensor_flags, buf);
8019 if (ret < 0)
8020 goto errI2C;
8022 buf[0] = 0x00;
8023 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8024 OV7660_CTL_EXHCL, dev->sensor_flags, buf);
8025 if (ret < 0)
8026 goto errI2C;
8028 buf[0] = 0x00;
8029 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8030 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
8031 if (ret < 0)
8032 goto errI2C;
8034 buf[0] = 0x00;
8035 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8036 OV7660_CTL_DM_LNH, dev->sensor_flags, buf);
8037 if (ret < 0)
8038 goto errI2C;
8040 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8041 OV7660_CTL_PID, dev->sensor_flags, buf);
8042 if (ret < 0)
8043 goto errI2C;
8045 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8046 OV7660_CTL_VER, dev->sensor_flags, buf);
8047 if (ret < 0)
8048 goto errI2C;
8050 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8051 OV7660_CTL_MIDH, dev->sensor_flags, buf);
8052 if (ret < 0)
8053 goto errI2C;
8055 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8056 OV7660_CTL_MIDL, dev->sensor_flags, buf);
8057 if (ret < 0)
8058 goto errI2C;
8060 reg = 0x1061;
8061 buf[0] = 0x03;
8062 ret = usb_microdia_control_write(dev, reg, buf, 1);
8063 if (ret < 0)
8064 goto err;
8066 reg = 0x1007;
8067 buf[0] = 0x60;
8068 ret = usb_microdia_control_write(dev, reg, buf, 1);
8069 if (ret < 0)
8070 goto err;
8072 reg = 0x1006;
8073 buf[0] = 0x00;
8074 ret = usb_microdia_control_write(dev, reg, buf, 1);
8075 if (ret < 0)
8076 goto err;
8078 reg = 0x1007;
8079 buf[0] = 0x60;
8080 ret = usb_microdia_control_write(dev, reg, buf, 1);
8081 if (ret < 0)
8082 goto err;
8084 reg = 0x1006;
8085 buf[0] = 0x00;
8086 ret = usb_microdia_control_write(dev, reg, buf, 1);
8087 if (ret < 0)
8088 goto err;
8090 reg = 0x10e1;
8091 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8092 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8093 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8094 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8095 buf[20] = 0x00;
8096 ret = usb_microdia_control_write(dev, reg, buf, 21);
8097 if (ret < 0)
8098 goto err;
8099 /* transferbufferlength is only 15 ? */
8101 buf[0] = 0x7f;
8102 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8103 OV7660_CTL_AECH, dev->sensor_flags, buf);
8104 if (ret < 0)
8105 goto errI2C;
8107 buf[0] = 0x01;
8108 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8109 OV7660_CTL_COM1, dev->sensor_flags, buf);
8110 if (ret < 0)
8111 goto errI2C;
8113 reg = 0x10e1;
8114 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8115 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8116 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8117 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8118 buf[20] = 0x00;
8119 ret = usb_microdia_control_write(dev, reg, buf, 21);
8120 if (ret < 0)
8121 goto err;
8122 /* transferbufferlength is only 15 ? */
8124 buf[0] = 0x13;
8125 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8126 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8127 if (ret < 0)
8128 goto errI2C;
8130 reg = 0x10e1;
8131 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8132 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8133 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8134 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8135 buf[20] = 0x00;
8136 ret = usb_microdia_control_write(dev, reg, buf, 21);
8137 if (ret < 0)
8138 goto err;
8139 /* transferbufferlength is only 15 ? */
8141 buf[0] = 0x00; buf[1] = 0x01;
8142 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8143 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8144 if (ret < 0)
8145 goto errI2C;
8147 buf[0] = 0x1e;
8148 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8149 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8150 if (ret < 0)
8151 goto errI2C;
8153 buf[0] = 0x50; buf[1] = 0x60;
8154 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8155 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8156 if (ret < 0)
8157 goto errI2C;
8159 reg = 0x118c;
8160 buf[0] = 0x1e;
8161 ret = usb_microdia_control_write(dev, reg, buf, 1);
8162 if (ret < 0)
8163 goto err;
8165 reg = 0x118d;
8166 buf[0] = 0x20;
8167 ret = usb_microdia_control_write(dev, reg, buf, 1);
8168 if (ret < 0)
8169 goto err;
8171 reg = 0x118e;
8172 buf[0] = 0x20;
8173 ret = usb_microdia_control_write(dev, reg, buf, 1);
8174 if (ret < 0)
8175 goto err;
8177 reg = 0x118f;
8178 buf[0] = 0x21;
8179 ret = usb_microdia_control_write(dev, reg, buf, 1);
8180 if (ret < 0)
8181 goto err;
8183 buf[0] = 0xfc; buf[1] = 0x04;
8184 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8185 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8186 if (ret < 0)
8187 goto errI2C;
8189 reg = 0x10e1;
8190 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8191 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc8; buf[9] = 0x0f;
8192 buf[10] = 0x3f; buf[11] = 0x00; buf[12] = 0x3b; buf[13] = 0x00; buf[14] = 0xdb;
8193 buf[15] = 0x0f; buf[16] = 0xeb; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8194 buf[20] = 0x00;
8195 ret = usb_microdia_control_write(dev, reg, buf, 21);
8196 if (ret < 0)
8197 goto err;
8198 /* transferbufferlength is only 15 ? */
8200 buf[0] = 0x1f; buf[1] = 0x00;
8201 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8202 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8203 if (ret < 0)
8204 goto errI2C;
8206 buf[0] = 0x48; buf[1] = 0x58;
8207 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8208 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8209 if (ret < 0)
8210 goto errI2C;
8212 reg = 0x118c;
8213 buf[0] = 0x20;
8214 ret = usb_microdia_control_write(dev, reg, buf, 1);
8215 if (ret < 0)
8216 goto err;
8218 reg = 0x118d;
8219 buf[0] = 0x20;
8220 ret = usb_microdia_control_write(dev, reg, buf, 1);
8221 if (ret < 0)
8222 goto err;
8224 reg = 0x118e;
8225 buf[0] = 0x20;
8226 ret = usb_microdia_control_write(dev, reg, buf, 1);
8227 if (ret < 0)
8228 goto err;
8230 reg = 0x118f;
8231 buf[0] = 0x1f;
8232 ret = usb_microdia_control_write(dev, reg, buf, 1);
8233 if (ret < 0)
8234 goto err;
8236 buf[0] = 0xf6; buf[1] = 0x0b;
8237 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8238 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8239 if (ret < 0)
8240 goto errI2C;
8242 reg = 0x10e1;
8243 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8244 buf[5] = 0x00; buf[6] = 0xfc; buf[7] = 0x0f; buf[8] = 0xdc; buf[9] = 0x0f;
8245 buf[10] = 0x29; buf[11] = 0x00; buf[12] = 0x26; buf[13] = 0x00; buf[14] = 0xe8;
8246 buf[15] = 0x0f; buf[16] = 0xf3; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8247 buf[20] = 0x00;
8248 ret = usb_microdia_control_write(dev, reg, buf, 21);
8249 if (ret < 0)
8250 goto err;
8251 /* transferbufferlength is only 15 ? */
8253 reg = 0x118c;
8254 buf[0] = 0x21;
8255 ret = usb_microdia_control_write(dev, reg, buf, 1);
8256 if (ret < 0)
8257 goto err;
8259 reg = 0x118d;
8260 buf[0] = 0x20;
8261 ret = usb_microdia_control_write(dev, reg, buf, 1);
8262 if (ret < 0)
8263 goto err;
8265 reg = 0x118e;
8266 buf[0] = 0x20;
8267 ret = usb_microdia_control_write(dev, reg, buf, 1);
8268 if (ret < 0)
8269 goto err;
8271 reg = 0x118f;
8272 buf[0] = 0x21;
8273 ret = usb_microdia_control_write(dev, reg, buf, 1);
8274 if (ret < 0)
8275 goto err;
8277 reg = 0x1006;
8278 buf[0] = 0x40;
8279 ret = usb_microdia_control_write(dev, reg, buf, 1);
8280 if (ret < 0)
8281 goto err;
8283 buf[0] = 0x50; buf[1] = 0x60;
8284 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8285 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8286 if (ret < 0)
8287 goto errI2C;
8289 reg = 0x118c;
8290 buf[0] = 0x1f;
8291 ret = usb_microdia_control_write(dev, reg, buf, 1);
8292 if (ret < 0)
8293 goto err;
8295 reg = 0x118d;
8296 buf[0] = 0x20;
8297 ret = usb_microdia_control_write(dev, reg, buf, 1);
8298 if (ret < 0)
8299 goto err;
8301 reg = 0x118e;
8302 buf[0] = 0x20;
8303 ret = usb_microdia_control_write(dev, reg, buf, 1);
8304 if (ret < 0)
8305 goto err;
8307 reg = 0x118f;
8308 buf[0] = 0x20;
8309 ret = usb_microdia_control_write(dev, reg, buf, 1);
8310 if (ret < 0)
8311 goto err;
8313 return ret;
8314 err:
8315 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
8316 return ret;
8318 errI2C:
8319 UDIA_ERROR("r/w in sensor register %x failed (%d)!\n", reg, ret);
8320 return ret;
8324 /**
8325 * @brief From UsbSnoop-plugin-parsed.log
8327 * @param dev
8329 * @returns 0 (OK) or <0 (Error)
8331 * @author Vincent, Kuzja
8333 int microdia_6288_start_stream(struct usb_microdia *dev)
8335 int ret;
8336 __u16 reg;
8337 __u8 buf[64];
8341 reg = 0x1066 ;
8342 buf[0] = 0x00;
8343 ret = usb_microdia_control_write(dev, reg, buf, 1);
8344 if(ret < 0) goto err;
8346 reg = 0x1000 ;
8347 buf[0] = 0x78;
8348 ret = usb_microdia_control_write(dev, reg, buf, 1);
8349 if(ret < 0) goto err;
8351 reg = 0x1001 ;
8352 buf[0] = 0xc7;
8353 ret = usb_microdia_control_write(dev, reg, buf, 1);
8354 if(ret < 0) goto err;
8356 reg = 0x1002 ;
8357 buf[0] = 0x1c;
8358 ret = usb_microdia_control_write(dev, reg, buf, 1);
8359 if(ret < 0) goto err;
8361 reg = 0x1061 ;
8362 buf[0] = 0x01;
8363 ret = usb_microdia_control_write(dev, reg, buf, 1);
8364 if(ret < 0) goto err;
8366 reg = 0x1020 ;
8367 buf[0] = 0x80;
8368 ret = usb_microdia_control_write(dev, reg, buf, 1);
8369 if(ret < 0) goto err;
8371 reg = 0x1067 ;
8372 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
8373 ret = usb_microdia_control_write(dev, reg, buf, 5);
8374 if(ret < 0) goto err;
8376 reg = 0x10c0 ;
8377 buf[0] = 0x80; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
8378 ret = usb_microdia_control_write(dev, reg, buf, 9);
8379 if(ret < 0) goto err;
8381 reg = 0x10e0 ;
8382 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30; buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed; buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a; buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0; buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00; buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
8383 ret = usb_microdia_control_write(dev, reg, buf, 24);
8384 if(ret < 0) goto err;
8386 reg = 0x10f8 ;
8387 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
8388 ret = usb_microdia_control_write(dev, reg, buf, 3);
8389 if(ret < 0) goto err;
8391 reg = 0x10fb ;
8392 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
8393 ret = usb_microdia_control_write(dev, reg, buf, 5);
8394 if(ret < 0) goto err;
8396 reg = 0x1188 ;
8397 buf[0] = 0x86; buf[1] = 0xcc; buf[2] = 0x08;
8398 ret = usb_microdia_control_write(dev, reg, buf, 3);
8399 if(ret < 0) goto err;
8401 reg = 0x118b ;
8402 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20; buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b; buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80; buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8; buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9; buf[20] = 0xf4; buf[21] = 0xff;
8403 ret = usb_microdia_control_write(dev, reg, buf, 22);
8404 if(ret < 0) goto err;
8406 reg = 0x11a1 ;
8407 buf[0] = 0x00; buf[1] = 0x00;
8408 ret = usb_microdia_control_write(dev, reg, buf, 2);
8409 if(ret < 0) goto err;
8411 reg = 0x11b7 ;
8412 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
8413 ret = usb_microdia_control_write(dev, reg, buf, 9);
8414 if(ret < 0) goto err;
8416 reg = 0x11b8 ;
8417 buf[0] = 0x30;
8418 ret = usb_microdia_control_write(dev, reg, buf, 1);
8419 if(ret < 0) goto err;
8421 reg = 0x1000 ;
8422 buf[0] = 0x78;
8423 ret = usb_microdia_control_write(dev, reg, buf, 1);
8424 if(ret < 0) goto err;
8426 reg = 0x10c0 ;
8427 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8428 ret = usb_microdia_control_write(dev, reg, buf, 8);
8429 if(ret < 0) goto err;
8431 reg = 0x10c0 ;
8432 ret = usb_microdia_control_read(dev, reg, buf, 1);
8433 if(ret < 0) goto err;
8435 reg = 0x10c0 ;
8436 ret = usb_microdia_control_read(dev, reg, buf, 1);
8437 if(ret < 0) goto err;
8439 reg = 0x10c0 ;
8440 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8441 ret = usb_microdia_control_write(dev, reg, buf, 8);
8442 if(ret < 0) goto err;
8444 reg = 0x10c0 ;
8445 ret = usb_microdia_control_read(dev, reg, buf, 1);
8446 if(ret < 0) goto err;
8448 reg = 0x10c0 ;
8449 ret = usb_microdia_control_read(dev, reg, buf, 1);
8450 if(ret < 0) goto err;
8452 reg = 0x10c0 ;
8453 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8454 ret = usb_microdia_control_write(dev, reg, buf, 8);
8455 if(ret < 0) goto err;
8457 reg = 0x10c0 ;
8458 ret = usb_microdia_control_read(dev, reg, buf, 1);
8459 if(ret < 0) goto err;
8461 reg = 0x10c0 ;
8462 ret = usb_microdia_control_read(dev, reg, buf, 1);
8463 if(ret < 0) goto err;
8465 reg = 0x10c0 ;
8466 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0e; buf[3] = 0x61; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8467 ret = usb_microdia_control_write(dev, reg, buf, 8);
8468 if(ret < 0) goto err;
8470 reg = 0x10c0 ;
8471 ret = usb_microdia_control_read(dev, reg, buf, 1);
8472 if(ret < 0) goto err;
8474 reg = 0x10c0 ;
8475 ret = usb_microdia_control_read(dev, reg, buf, 1);
8476 if(ret < 0) goto err;
8478 reg = 0x10c0 ;
8479 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8480 ret = usb_microdia_control_write(dev, reg, buf, 8);
8481 if(ret < 0) goto err;
8483 reg = 0x10c0 ;
8484 ret = usb_microdia_control_read(dev, reg, buf, 1);
8485 if(ret < 0) goto err;
8487 reg = 0x10c0 ;
8488 ret = usb_microdia_control_read(dev, reg, buf, 1);
8489 if(ret < 0) goto err;
8491 reg = 0x10c0 ;
8492 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x13; buf[3] = 0xb8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8493 ret = usb_microdia_control_write(dev, reg, buf, 8);
8494 if(ret < 0) goto err;
8496 reg = 0x10c0 ;
8497 ret = usb_microdia_control_read(dev, reg, buf, 1);
8498 if(ret < 0) goto err;
8500 reg = 0x10c0 ;
8501 ret = usb_microdia_control_read(dev, reg, buf, 1);
8502 if(ret < 0) goto err;
8504 reg = 0x10c0 ;
8505 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x14; buf[3] = 0x3e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8506 ret = usb_microdia_control_write(dev, reg, buf, 8);
8507 if(ret < 0) goto err;
8509 reg = 0x10c0 ;
8510 ret = usb_microdia_control_read(dev, reg, buf, 1);
8511 if(ret < 0) goto err;
8513 reg = 0x10c0 ;
8514 ret = usb_microdia_control_read(dev, reg, buf, 1);
8515 if(ret < 0) goto err;
8517 reg = 0x10c0 ;
8518 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x16; buf[3] = 0x24; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8519 ret = usb_microdia_control_write(dev, reg, buf, 8);
8520 if(ret < 0) goto err;
8522 reg = 0x10c0 ;
8523 ret = usb_microdia_control_read(dev, reg, buf, 1);
8524 if(ret < 0) goto err;
8526 reg = 0x10c0 ;
8527 ret = usb_microdia_control_read(dev, reg, buf, 1);
8528 if(ret < 0) goto err;
8530 reg = 0x10c0 ;
8531 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8532 ret = usb_microdia_control_write(dev, reg, buf, 8);
8533 if(ret < 0) goto err;
8535 reg = 0x10c0 ;
8536 ret = usb_microdia_control_read(dev, reg, buf, 1);
8537 if(ret < 0) goto err;
8539 reg = 0x10c0 ;
8540 ret = usb_microdia_control_read(dev, reg, buf, 1);
8541 if(ret < 0) goto err;
8543 reg = 0x10c0 ;
8544 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8545 ret = usb_microdia_control_write(dev, reg, buf, 8);
8546 if(ret < 0) goto err;
8548 reg = 0x10c0 ;
8549 ret = usb_microdia_control_read(dev, reg, buf, 1);
8550 if(ret < 0) goto err;
8552 reg = 0x10c0 ;
8553 ret = usb_microdia_control_read(dev, reg, buf, 1);
8554 if(ret < 0) goto err;
8556 reg = 0x10c0 ;
8557 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8558 ret = usb_microdia_control_write(dev, reg, buf, 8);
8559 if(ret < 0) goto err;
8561 reg = 0x10c0 ;
8562 ret = usb_microdia_control_read(dev, reg, buf, 1);
8563 if(ret < 0) goto err;
8565 reg = 0x10c0 ;
8566 ret = usb_microdia_control_read(dev, reg, buf, 1);
8567 if(ret < 0) goto err;
8569 reg = 0x10c0 ;
8570 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x27; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8571 ret = usb_microdia_control_write(dev, reg, buf, 8);
8572 if(ret < 0) goto err;
8574 reg = 0x10c0 ;
8575 ret = usb_microdia_control_read(dev, reg, buf, 1);
8576 if(ret < 0) goto err;
8578 reg = 0x10c0 ;
8579 ret = usb_microdia_control_read(dev, reg, buf, 1);
8580 if(ret < 0) goto err;
8582 reg = 0x10c0 ;
8583 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x28; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8584 ret = usb_microdia_control_write(dev, reg, buf, 8);
8585 if(ret < 0) goto err;
8587 reg = 0x10c0 ;
8588 ret = usb_microdia_control_read(dev, reg, buf, 1);
8589 if(ret < 0) goto err;
8591 reg = 0x10c0 ;
8592 ret = usb_microdia_control_read(dev, reg, buf, 1);
8593 if(ret < 0) goto err;
8595 reg = 0x10c0 ;
8596 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x29; buf[3] = 0x15; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8597 ret = usb_microdia_control_write(dev, reg, buf, 8);
8598 if(ret < 0) goto err;
8600 reg = 0x10c0 ;
8601 ret = usb_microdia_control_read(dev, reg, buf, 1);
8602 if(ret < 0) goto err;
8604 reg = 0x10c0 ;
8605 ret = usb_microdia_control_read(dev, reg, buf, 1);
8606 if(ret < 0) goto err;
8608 reg = 0x10c0 ;
8609 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2c; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8610 ret = usb_microdia_control_write(dev, reg, buf, 8);
8611 if(ret < 0) goto err;
8613 reg = 0x10c0 ;
8614 ret = usb_microdia_control_read(dev, reg, buf, 1);
8615 if(ret < 0) goto err;
8617 reg = 0x10c0 ;
8618 ret = usb_microdia_control_read(dev, reg, buf, 1);
8619 if(ret < 0) goto err;
8621 reg = 0x10c0 ;
8622 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8623 ret = usb_microdia_control_write(dev, reg, buf, 8);
8624 if(ret < 0) goto err;
8626 reg = 0x10c0 ;
8627 ret = usb_microdia_control_read(dev, reg, buf, 1);
8628 if(ret < 0) goto err;
8630 reg = 0x10c0 ;
8631 ret = usb_microdia_control_read(dev, reg, buf, 1);
8632 if(ret < 0) goto err;
8634 reg = 0x10c0 ;
8635 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x34; buf[3] = 0x3d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8636 ret = usb_microdia_control_write(dev, reg, buf, 8);
8637 if(ret < 0) goto err;
8639 reg = 0x10c0 ;
8640 ret = usb_microdia_control_read(dev, reg, buf, 1);
8641 if(ret < 0) goto err;
8643 reg = 0x10c0 ;
8644 ret = usb_microdia_control_read(dev, reg, buf, 1);
8645 if(ret < 0) goto err;
8647 reg = 0x10c0 ;
8648 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x35; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8649 ret = usb_microdia_control_write(dev, reg, buf, 8);
8650 if(ret < 0) goto err;
8652 reg = 0x10c0 ;
8653 ret = usb_microdia_control_read(dev, reg, buf, 1);
8654 if(ret < 0) goto err;
8656 reg = 0x10c0 ;
8657 ret = usb_microdia_control_read(dev, reg, buf, 1);
8658 if(ret < 0) goto err;
8660 reg = 0x10c0 ;
8661 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x36; buf[3] = 0xf8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8662 ret = usb_microdia_control_write(dev, reg, buf, 8);
8663 if(ret < 0) goto err;
8665 reg = 0x10c0 ;
8666 ret = usb_microdia_control_read(dev, reg, buf, 1);
8667 if(ret < 0) goto err;
8669 reg = 0x10c0 ;
8670 ret = usb_microdia_control_read(dev, reg, buf, 1);
8671 if(ret < 0) goto err;
8673 reg = 0x10c0 ;
8674 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x38; buf[3] = 0x12; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8675 ret = usb_microdia_control_write(dev, reg, buf, 8);
8676 if(ret < 0) goto err;
8678 reg = 0x10c0 ;
8679 ret = usb_microdia_control_read(dev, reg, buf, 1);
8680 if(ret < 0) goto err;
8682 reg = 0x10c0 ;
8683 ret = usb_microdia_control_read(dev, reg, buf, 1);
8684 if(ret < 0) goto err;
8686 reg = 0x10c0 ;
8687 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x39; buf[3] = 0x57; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8688 ret = usb_microdia_control_write(dev, reg, buf, 8);
8689 if(ret < 0) goto err;
8691 reg = 0x10c0 ;
8692 ret = usb_microdia_control_read(dev, reg, buf, 1);
8693 if(ret < 0) goto err;
8695 reg = 0x10c0 ;
8696 ret = usb_microdia_control_read(dev, reg, buf, 1);
8697 if(ret < 0) goto err;
8699 reg = 0x10c0 ;
8700 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8701 ret = usb_microdia_control_write(dev, reg, buf, 8);
8702 if(ret < 0) goto err;
8704 reg = 0x10c0 ;
8705 ret = usb_microdia_control_read(dev, reg, buf, 1);
8706 if(ret < 0) goto err;
8708 reg = 0x10c0 ;
8709 ret = usb_microdia_control_read(dev, reg, buf, 1);
8710 if(ret < 0) goto err;
8712 reg = 0x10c0 ;
8713 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3b; buf[3] = 0xcc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8714 ret = usb_microdia_control_write(dev, reg, buf, 8);
8715 if(ret < 0) goto err;
8717 reg = 0x10c0 ;
8718 ret = usb_microdia_control_read(dev, reg, buf, 1);
8719 if(ret < 0) goto err;
8721 reg = 0x10c0 ;
8722 ret = usb_microdia_control_read(dev, reg, buf, 1);
8723 if(ret < 0) goto err;
8725 reg = 0x10c0 ;
8726 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3c; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8727 ret = usb_microdia_control_write(dev, reg, buf, 8);
8728 if(ret < 0) goto err;
8730 reg = 0x10c0 ;
8731 ret = usb_microdia_control_read(dev, reg, buf, 1);
8732 if(ret < 0) goto err;
8734 reg = 0x10c0 ;
8735 ret = usb_microdia_control_read(dev, reg, buf, 1);
8736 if(ret < 0) goto err;
8738 reg = 0x10c0 ;
8739 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3d; buf[3] = 0x19; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8740 ret = usb_microdia_control_write(dev, reg, buf, 8);
8741 if(ret < 0) goto err;
8743 reg = 0x10c0 ;
8744 ret = usb_microdia_control_read(dev, reg, buf, 1);
8745 if(ret < 0) goto err;
8747 reg = 0x10c0 ;
8748 ret = usb_microdia_control_read(dev, reg, buf, 1);
8749 if(ret < 0) goto err;
8751 reg = 0x10c0 ;
8752 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3e; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8753 ret = usb_microdia_control_write(dev, reg, buf, 8);
8754 if(ret < 0) goto err;
8756 reg = 0x10c0 ;
8757 ret = usb_microdia_control_read(dev, reg, buf, 1);
8758 if(ret < 0) goto err;
8760 reg = 0x10c0 ;
8761 ret = usb_microdia_control_read(dev, reg, buf, 1);
8762 if(ret < 0) goto err;
8764 reg = 0x10c0 ;
8765 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3f; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8766 ret = usb_microdia_control_write(dev, reg, buf, 8);
8767 if(ret < 0) goto err;
8769 reg = 0x10c0 ;
8770 ret = usb_microdia_control_read(dev, reg, buf, 1);
8771 if(ret < 0) goto err;
8773 reg = 0x10c0 ;
8774 ret = usb_microdia_control_read(dev, reg, buf, 1);
8775 if(ret < 0) goto err;
8777 reg = 0x10c0 ;
8778 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x41; buf[3] = 0x40; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8779 ret = usb_microdia_control_write(dev, reg, buf, 8);
8780 if(ret < 0) goto err;
8782 reg = 0x10c0 ;
8783 ret = usb_microdia_control_read(dev, reg, buf, 1);
8784 if(ret < 0) goto err;
8786 reg = 0x10c0 ;
8787 ret = usb_microdia_control_read(dev, reg, buf, 1);
8788 if(ret < 0) goto err;
8790 reg = 0x10c0 ;
8791 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x42; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8792 ret = usb_microdia_control_write(dev, reg, buf, 8);
8793 if(ret < 0) goto err;
8795 reg = 0x10c0 ;
8796 ret = usb_microdia_control_read(dev, reg, buf, 1);
8797 if(ret < 0) goto err;
8799 reg = 0x10c0 ;
8800 ret = usb_microdia_control_read(dev, reg, buf, 1);
8801 if(ret < 0) goto err;
8803 reg = 0x10c0 ;
8804 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x45; buf[3] = 0x46; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8805 ret = usb_microdia_control_write(dev, reg, buf, 8);
8806 if(ret < 0) goto err;
8808 reg = 0x10c0 ;
8809 ret = usb_microdia_control_read(dev, reg, buf, 1);
8810 if(ret < 0) goto err;
8812 reg = 0x10c0 ;
8813 ret = usb_microdia_control_read(dev, reg, buf, 1);
8814 if(ret < 0) goto err;
8816 reg = 0x10c0 ;
8817 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x46; buf[3] = 0x62; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8818 ret = usb_microdia_control_write(dev, reg, buf, 8);
8819 if(ret < 0) goto err;
8821 reg = 0x10c0 ;
8822 ret = usb_microdia_control_read(dev, reg, buf, 1);
8823 if(ret < 0) goto err;
8825 reg = 0x10c0 ;
8826 ret = usb_microdia_control_read(dev, reg, buf, 1);
8827 if(ret < 0) goto err;
8829 reg = 0x10c0 ;
8830 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x47; buf[3] = 0x2a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8831 ret = usb_microdia_control_write(dev, reg, buf, 8);
8832 if(ret < 0) goto err;
8834 reg = 0x10c0 ;
8835 ret = usb_microdia_control_read(dev, reg, buf, 1);
8836 if(ret < 0) goto err;
8838 reg = 0x10c0 ;
8839 ret = usb_microdia_control_read(dev, reg, buf, 1);
8840 if(ret < 0) goto err;
8842 reg = 0x10c0 ;
8843 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x48; buf[3] = 0x3c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8844 ret = usb_microdia_control_write(dev, reg, buf, 8);
8845 if(ret < 0) goto err;
8847 reg = 0x10c0 ;
8848 ret = usb_microdia_control_read(dev, reg, buf, 1);
8849 if(ret < 0) goto err;
8851 reg = 0x10c0 ;
8852 ret = usb_microdia_control_read(dev, reg, buf, 1);
8853 if(ret < 0) goto err;
8855 reg = 0x10c0 ;
8856 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4a; buf[3] = 0xf0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8857 ret = usb_microdia_control_write(dev, reg, buf, 8);
8858 if(ret < 0) goto err;
8860 reg = 0x10c0 ;
8861 ret = usb_microdia_control_read(dev, reg, buf, 1);
8862 if(ret < 0) goto err;
8864 reg = 0x10c0 ;
8865 ret = usb_microdia_control_read(dev, reg, buf, 1);
8866 if(ret < 0) goto err;
8868 reg = 0x10c0 ;
8869 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4b; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8870 ret = usb_microdia_control_write(dev, reg, buf, 8);
8871 if(ret < 0) goto err;
8873 reg = 0x10c0 ;
8874 ret = usb_microdia_control_read(dev, reg, buf, 1);
8875 if(ret < 0) goto err;
8877 reg = 0x10c0 ;
8878 ret = usb_microdia_control_read(dev, reg, buf, 1);
8879 if(ret < 0) goto err;
8881 reg = 0x10c0 ;
8882 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4c; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8883 ret = usb_microdia_control_write(dev, reg, buf, 8);
8884 if(ret < 0) goto err;
8886 reg = 0x10c0 ;
8887 ret = usb_microdia_control_read(dev, reg, buf, 1);
8888 if(ret < 0) goto err;
8890 reg = 0x10c0 ;
8891 ret = usb_microdia_control_read(dev, reg, buf, 1);
8892 if(ret < 0) goto err;
8894 reg = 0x10c0 ;
8895 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4d; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8896 ret = usb_microdia_control_write(dev, reg, buf, 8);
8897 if(ret < 0) goto err;
8899 reg = 0x10c0 ;
8900 ret = usb_microdia_control_read(dev, reg, buf, 1);
8901 if(ret < 0) goto err;
8903 reg = 0x10c0 ;
8904 ret = usb_microdia_control_read(dev, reg, buf, 1);
8905 if(ret < 0) goto err;
8907 reg = 0x10c0 ;
8908 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4e; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8909 ret = usb_microdia_control_write(dev, reg, buf, 8);
8910 if(ret < 0) goto err;
8912 reg = 0x10c0 ;
8913 ret = usb_microdia_control_read(dev, reg, buf, 1);
8914 if(ret < 0) goto err;
8916 reg = 0x10c0 ;
8917 ret = usb_microdia_control_read(dev, reg, buf, 1);
8918 if(ret < 0) goto err;
8920 reg = 0x10c0 ;
8921 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x69; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8922 ret = usb_microdia_control_write(dev, reg, buf, 8);
8923 if(ret < 0) goto err;
8925 reg = 0x10c0 ;
8926 ret = usb_microdia_control_read(dev, reg, buf, 1);
8927 if(ret < 0) goto err;
8929 reg = 0x10c0 ;
8930 ret = usb_microdia_control_read(dev, reg, buf, 1);
8931 if(ret < 0) goto err;
8933 reg = 0x10c0 ;
8934 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6c; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8935 ret = usb_microdia_control_write(dev, reg, buf, 8);
8936 if(ret < 0) goto err;
8938 reg = 0x10c0 ;
8939 ret = usb_microdia_control_read(dev, reg, buf, 1);
8940 if(ret < 0) goto err;
8942 reg = 0x10c0 ;
8943 ret = usb_microdia_control_read(dev, reg, buf, 1);
8944 if(ret < 0) goto err;
8946 reg = 0x10c0 ;
8947 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6f; buf[3] = 0x9e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8948 ret = usb_microdia_control_write(dev, reg, buf, 8);
8949 if(ret < 0) goto err;
8951 reg = 0x10c0 ;
8952 ret = usb_microdia_control_read(dev, reg, buf, 1);
8953 if(ret < 0) goto err;
8955 reg = 0x10c0 ;
8956 ret = usb_microdia_control_read(dev, reg, buf, 1);
8957 if(ret < 0) goto err;
8959 reg = 0x10c0 ;
8960 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x70; buf[3] = 0x05; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8961 ret = usb_microdia_control_write(dev, reg, buf, 8);
8962 if(ret < 0) goto err;
8964 reg = 0x10c0 ;
8965 ret = usb_microdia_control_read(dev, reg, buf, 1);
8966 if(ret < 0) goto err;
8968 reg = 0x10c0 ;
8969 ret = usb_microdia_control_read(dev, reg, buf, 1);
8970 if(ret < 0) goto err;
8972 reg = 0x10c0 ;
8973 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x71; buf[3] = 0x78; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8974 ret = usb_microdia_control_write(dev, reg, buf, 8);
8975 if(ret < 0) goto err;
8977 reg = 0x10c0 ;
8978 ret = usb_microdia_control_read(dev, reg, buf, 1);
8979 if(ret < 0) goto err;
8981 reg = 0x10c0 ;
8982 ret = usb_microdia_control_read(dev, reg, buf, 1);
8983 if(ret < 0) goto err;
8985 reg = 0x10c0 ;
8986 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x77; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8987 ret = usb_microdia_control_write(dev, reg, buf, 8);
8988 if(ret < 0) goto err;
8990 reg = 0x10c0 ;
8991 ret = usb_microdia_control_read(dev, reg, buf, 1);
8992 if(ret < 0) goto err;
8994 reg = 0x10c0 ;
8995 ret = usb_microdia_control_read(dev, reg, buf, 1);
8996 if(ret < 0) goto err;
8998 reg = 0x10c0 ;
8999 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8a; buf[3] = 0x23; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9000 ret = usb_microdia_control_write(dev, reg, buf, 8);
9001 if(ret < 0) goto err;
9003 reg = 0x10c0 ;
9004 ret = usb_microdia_control_read(dev, reg, buf, 1);
9005 if(ret < 0) goto err;
9007 reg = 0x10c0 ;
9008 ret = usb_microdia_control_read(dev, reg, buf, 1);
9009 if(ret < 0) goto err;
9011 reg = 0x10c0 ;
9012 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8c; buf[3] = 0x0d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9013 ret = usb_microdia_control_write(dev, reg, buf, 8);
9014 if(ret < 0) goto err;
9016 reg = 0x10c0 ;
9017 ret = usb_microdia_control_read(dev, reg, buf, 1);
9018 if(ret < 0) goto err;
9020 reg = 0x10c0 ;
9021 ret = usb_microdia_control_read(dev, reg, buf, 1);
9022 if(ret < 0) goto err;
9024 reg = 0x10c0 ;
9025 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x90; buf[3] = 0x7e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9026 ret = usb_microdia_control_write(dev, reg, buf, 8);
9027 if(ret < 0) goto err;
9029 reg = 0x10c0 ;
9030 ret = usb_microdia_control_read(dev, reg, buf, 1);
9031 if(ret < 0) goto err;
9033 reg = 0x10c0 ;
9034 ret = usb_microdia_control_read(dev, reg, buf, 1);
9035 if(ret < 0) goto err;
9037 reg = 0x10c0 ;
9038 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x91; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9039 ret = usb_microdia_control_write(dev, reg, buf, 8);
9040 if(ret < 0) goto err;
9042 reg = 0x10c0 ;
9043 ret = usb_microdia_control_read(dev, reg, buf, 1);
9044 if(ret < 0) goto err;
9046 reg = 0x10c0 ;
9047 ret = usb_microdia_control_read(dev, reg, buf, 1);
9048 if(ret < 0) goto err;
9050 reg = 0x10c0 ;
9051 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x9f; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9052 ret = usb_microdia_control_write(dev, reg, buf, 8);
9053 if(ret < 0) goto err;
9055 reg = 0x10c0 ;
9056 ret = usb_microdia_control_read(dev, reg, buf, 1);
9057 if(ret < 0) goto err;
9059 reg = 0x10c0 ;
9060 ret = usb_microdia_control_read(dev, reg, buf, 1);
9061 if(ret < 0) goto err;
9063 reg = 0x10c0 ;
9064 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa0; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9065 ret = usb_microdia_control_write(dev, reg, buf, 8);
9066 if(ret < 0) goto err;
9068 reg = 0x10c0 ;
9069 ret = usb_microdia_control_read(dev, reg, buf, 1);
9070 if(ret < 0) goto err;
9072 reg = 0x10c0 ;
9073 ret = usb_microdia_control_read(dev, reg, buf, 1);
9074 if(ret < 0) goto err;
9076 reg = 0x10c0 ;
9077 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa4; buf[3] = 0x50; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9078 ret = usb_microdia_control_write(dev, reg, buf, 8);
9079 if(ret < 0) goto err;
9081 reg = 0x10c0 ;
9082 ret = usb_microdia_control_read(dev, reg, buf, 1);
9083 if(ret < 0) goto err;
9085 reg = 0x10c0 ;
9086 ret = usb_microdia_control_read(dev, reg, buf, 1);
9087 if(ret < 0) goto err;
9089 reg = 0x10c0 ;
9090 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa5; buf[3] = 0x68; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9091 ret = usb_microdia_control_write(dev, reg, buf, 8);
9092 if(ret < 0) goto err;
9094 reg = 0x10c0 ;
9095 ret = usb_microdia_control_read(dev, reg, buf, 1);
9096 if(ret < 0) goto err;
9098 reg = 0x10c0 ;
9099 ret = usb_microdia_control_read(dev, reg, buf, 1);
9100 if(ret < 0) goto err;
9102 reg = 0x10c0 ;
9103 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa6; buf[3] = 0x60; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9104 ret = usb_microdia_control_write(dev, reg, buf, 8);
9105 if(ret < 0) goto err;
9107 reg = 0x10c0 ;
9108 ret = usb_microdia_control_read(dev, reg, buf, 1);
9109 if(ret < 0) goto err;
9111 reg = 0x10c0 ;
9112 ret = usb_microdia_control_read(dev, reg, buf, 1);
9113 if(ret < 0) goto err;
9115 reg = 0x10c0 ;
9116 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa8; buf[3] = 0xc1; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9117 ret = usb_microdia_control_write(dev, reg, buf, 8);
9118 if(ret < 0) goto err;
9120 reg = 0x10c0 ;
9121 ret = usb_microdia_control_read(dev, reg, buf, 1);
9122 if(ret < 0) goto err;
9124 reg = 0x10c0 ;
9125 ret = usb_microdia_control_read(dev, reg, buf, 1);
9126 if(ret < 0) goto err;
9128 reg = 0x10c0 ;
9129 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa9; buf[3] = 0xfa; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9130 ret = usb_microdia_control_write(dev, reg, buf, 8);
9131 if(ret < 0) goto err;
9133 reg = 0x10c0 ;
9134 ret = usb_microdia_control_read(dev, reg, buf, 1);
9135 if(ret < 0) goto err;
9137 reg = 0x10c0 ;
9138 ret = usb_microdia_control_read(dev, reg, buf, 1);
9139 if(ret < 0) goto err;
9141 reg = 0x10c0 ;
9142 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaa; buf[3] = 0x92; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9143 ret = usb_microdia_control_write(dev, reg, buf, 8);
9144 if(ret < 0) goto err;
9146 reg = 0x10c0 ;
9147 ret = usb_microdia_control_read(dev, reg, buf, 1);
9148 if(ret < 0) goto err;
9150 reg = 0x10c0 ;
9151 ret = usb_microdia_control_read(dev, reg, buf, 1);
9152 if(ret < 0) goto err;
9154 reg = 0x10c0 ;
9155 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xab; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9156 ret = usb_microdia_control_write(dev, reg, buf, 8);
9157 if(ret < 0) goto err;
9159 reg = 0x10c0 ;
9160 ret = usb_microdia_control_read(dev, reg, buf, 1);
9161 if(ret < 0) goto err;
9163 reg = 0x10c0 ;
9164 ret = usb_microdia_control_read(dev, reg, buf, 1);
9165 if(ret < 0) goto err;
9167 reg = 0x10c0 ;
9168 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xac; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9169 ret = usb_microdia_control_write(dev, reg, buf, 8);
9170 if(ret < 0) goto err;
9172 reg = 0x10c0 ;
9173 ret = usb_microdia_control_read(dev, reg, buf, 1);
9174 if(ret < 0) goto err;
9176 reg = 0x10c0 ;
9177 ret = usb_microdia_control_read(dev, reg, buf, 1);
9178 if(ret < 0) goto err;
9180 reg = 0x10c0 ;
9181 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xad; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9182 ret = usb_microdia_control_write(dev, reg, buf, 8);
9183 if(ret < 0) goto err;
9185 reg = 0x10c0 ;
9186 ret = usb_microdia_control_read(dev, reg, buf, 1);
9187 if(ret < 0) goto err;
9189 reg = 0x10c0 ;
9190 ret = usb_microdia_control_read(dev, reg, buf, 1);
9191 if(ret < 0) goto err;
9193 reg = 0x10c0 ;
9194 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xae; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9195 ret = usb_microdia_control_write(dev, reg, buf, 8);
9196 if(ret < 0) goto err;
9198 reg = 0x10c0 ;
9199 ret = usb_microdia_control_read(dev, reg, buf, 1);
9200 if(ret < 0) goto err;
9202 reg = 0x10c0 ;
9203 ret = usb_microdia_control_read(dev, reg, buf, 1);
9204 if(ret < 0) goto err;
9206 reg = 0x10c0 ;
9207 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaf; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9208 ret = usb_microdia_control_write(dev, reg, buf, 8);
9209 if(ret < 0) goto err;
9211 reg = 0x10c0 ;
9212 ret = usb_microdia_control_read(dev, reg, buf, 1);
9213 if(ret < 0) goto err;
9215 reg = 0x10c0 ;
9216 ret = usb_microdia_control_read(dev, reg, buf, 1);
9217 if(ret < 0) goto err;
9219 reg = 0x10c0 ;
9220 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb2; buf[3] = 0xf2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9221 ret = usb_microdia_control_write(dev, reg, buf, 8);
9222 if(ret < 0) goto err;
9224 reg = 0x10c0 ;
9225 ret = usb_microdia_control_read(dev, reg, buf, 1);
9226 if(ret < 0) goto err;
9228 reg = 0x10c0 ;
9229 ret = usb_microdia_control_read(dev, reg, buf, 1);
9230 if(ret < 0) goto err;
9232 reg = 0x10c0 ;
9233 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb3; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9234 ret = usb_microdia_control_write(dev, reg, buf, 8);
9235 if(ret < 0) goto err;
9237 reg = 0x10c0 ;
9238 ret = usb_microdia_control_read(dev, reg, buf, 1);
9239 if(ret < 0) goto err;
9241 reg = 0x10c0 ;
9242 ret = usb_microdia_control_read(dev, reg, buf, 1);
9243 if(ret < 0) goto err;
9245 reg = 0x10c0 ;
9246 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb4; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9247 ret = usb_microdia_control_write(dev, reg, buf, 8);
9248 if(ret < 0) goto err;
9250 reg = 0x10c0 ;
9251 ret = usb_microdia_control_read(dev, reg, buf, 1);
9252 if(ret < 0) goto err;
9254 reg = 0x10c0 ;
9255 ret = usb_microdia_control_read(dev, reg, buf, 1);
9256 if(ret < 0) goto err;
9258 reg = 0x10c0 ;
9259 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb5; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9260 ret = usb_microdia_control_write(dev, reg, buf, 8);
9261 if(ret < 0) goto err;
9263 reg = 0x10c0 ;
9264 ret = usb_microdia_control_read(dev, reg, buf, 1);
9265 if(ret < 0) goto err;
9267 reg = 0x10c0 ;
9268 ret = usb_microdia_control_read(dev, reg, buf, 1);
9269 if(ret < 0) goto err;
9271 reg = 0x10c0 ;
9272 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb6; buf[3] = 0xaf; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9273 ret = usb_microdia_control_write(dev, reg, buf, 8);
9274 if(ret < 0) goto err;
9276 reg = 0x10c0 ;
9277 ret = usb_microdia_control_read(dev, reg, buf, 1);
9278 if(ret < 0) goto err;
9280 reg = 0x10c0 ;
9281 ret = usb_microdia_control_read(dev, reg, buf, 1);
9282 if(ret < 0) goto err;
9284 reg = 0x10c0 ;
9285 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbb; buf[3] = 0xae; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9286 ret = usb_microdia_control_write(dev, reg, buf, 8);
9287 if(ret < 0) goto err;
9289 reg = 0x10c0 ;
9290 ret = usb_microdia_control_read(dev, reg, buf, 1);
9291 if(ret < 0) goto err;
9293 reg = 0x10c0 ;
9294 ret = usb_microdia_control_read(dev, reg, buf, 1);
9295 if(ret < 0) goto err;
9297 reg = 0x10c0 ;
9298 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbc; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9299 ret = usb_microdia_control_write(dev, reg, buf, 8);
9300 if(ret < 0) goto err;
9302 reg = 0x10c0 ;
9303 ret = usb_microdia_control_read(dev, reg, buf, 1);
9304 if(ret < 0) goto err;
9306 reg = 0x10c0 ;
9307 ret = usb_microdia_control_read(dev, reg, buf, 1);
9308 if(ret < 0) goto err;
9310 reg = 0x10c0 ;
9311 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbd; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9312 ret = usb_microdia_control_write(dev, reg, buf, 8);
9313 if(ret < 0) goto err;
9315 reg = 0x10c0 ;
9316 ret = usb_microdia_control_read(dev, reg, buf, 1);
9317 if(ret < 0) goto err;
9319 reg = 0x10c0 ;
9320 ret = usb_microdia_control_read(dev, reg, buf, 1);
9321 if(ret < 0) goto err;
9323 reg = 0x10c0 ;
9324 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbe; buf[3] = 0x3b; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9325 ret = usb_microdia_control_write(dev, reg, buf, 8);
9326 if(ret < 0) goto err;
9328 reg = 0x10c0 ;
9329 ret = usb_microdia_control_read(dev, reg, buf, 1);
9330 if(ret < 0) goto err;
9332 reg = 0x10c0 ;
9333 ret = usb_microdia_control_read(dev, reg, buf, 1);
9334 if(ret < 0) goto err;
9336 reg = 0x10c0 ;
9337 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbf; buf[3] = 0x3a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9338 ret = usb_microdia_control_write(dev, reg, buf, 8);
9339 if(ret < 0) goto err;
9341 reg = 0x10c0 ;
9342 ret = usb_microdia_control_read(dev, reg, buf, 1);
9343 if(ret < 0) goto err;
9345 reg = 0x10c0 ;
9346 ret = usb_microdia_control_read(dev, reg, buf, 1);
9347 if(ret < 0) goto err;
9349 reg = 0x10c0 ;
9350 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc0; buf[3] = 0xe2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9351 ret = usb_microdia_control_write(dev, reg, buf, 8);
9352 if(ret < 0) goto err;
9354 reg = 0x10c0 ;
9355 ret = usb_microdia_control_read(dev, reg, buf, 1);
9356 if(ret < 0) goto err;
9358 reg = 0x10c0 ;
9359 ret = usb_microdia_control_read(dev, reg, buf, 1);
9360 if(ret < 0) goto err;
9362 reg = 0x10c0 ;
9363 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc1; buf[3] = 0xc8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9364 ret = usb_microdia_control_write(dev, reg, buf, 8);
9365 if(ret < 0) goto err;
9367 reg = 0x10c0 ;
9368 ret = usb_microdia_control_read(dev, reg, buf, 1);
9369 if(ret < 0) goto err;
9371 reg = 0x10c0 ;
9372 ret = usb_microdia_control_read(dev, reg, buf, 1);
9373 if(ret < 0) goto err;
9375 reg = 0x10c0 ;
9376 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc2; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9377 ret = usb_microdia_control_write(dev, reg, buf, 8);
9378 if(ret < 0) goto err;
9380 reg = 0x10c0 ;
9381 ret = usb_microdia_control_read(dev, reg, buf, 1);
9382 if(ret < 0) goto err;
9384 reg = 0x10c0 ;
9385 ret = usb_microdia_control_read(dev, reg, buf, 1);
9386 if(ret < 0) goto err;
9388 reg = 0x10c0 ;
9389 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc4; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9390 ret = usb_microdia_control_write(dev, reg, buf, 8);
9391 if(ret < 0) goto err;
9393 reg = 0x10c0 ;
9394 ret = usb_microdia_control_read(dev, reg, buf, 1);
9395 if(ret < 0) goto err;
9397 reg = 0x10c0 ;
9398 ret = usb_microdia_control_read(dev, reg, buf, 1);
9399 if(ret < 0) goto err;
9401 reg = 0x10c0 ;
9402 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc6; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9403 ret = usb_microdia_control_write(dev, reg, buf, 8);
9404 if(ret < 0) goto err;
9406 reg = 0x10c0 ;
9407 ret = usb_microdia_control_read(dev, reg, buf, 1);
9408 if(ret < 0) goto err;
9410 reg = 0x10c0 ;
9411 ret = usb_microdia_control_read(dev, reg, buf, 1);
9412 if(ret < 0) goto err;
9414 reg = 0x10c0 ;
9415 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc7; buf[3] = 0x81; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9416 ret = usb_microdia_control_write(dev, reg, buf, 8);
9417 if(ret < 0) goto err;
9419 reg = 0x10c0 ;
9420 ret = usb_microdia_control_read(dev, reg, buf, 1);
9421 if(ret < 0) goto err;
9423 reg = 0x10c0 ;
9424 ret = usb_microdia_control_read(dev, reg, buf, 1);
9425 if(ret < 0) goto err;
9427 reg = 0x10c0 ;
9428 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc9; buf[3] = 0xe0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9429 ret = usb_microdia_control_write(dev, reg, buf, 8);
9430 if(ret < 0) goto err;
9432 reg = 0x10c0 ;
9433 ret = usb_microdia_control_read(dev, reg, buf, 1);
9434 if(ret < 0) goto err;
9436 reg = 0x10c0 ;
9437 ret = usb_microdia_control_read(dev, reg, buf, 1);
9438 if(ret < 0) goto err;
9440 reg = 0x10c0 ;
9441 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xca; buf[3] = 0xe8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9442 ret = usb_microdia_control_write(dev, reg, buf, 8);
9443 if(ret < 0) goto err;
9445 reg = 0x10c0 ;
9446 ret = usb_microdia_control_read(dev, reg, buf, 1);
9447 if(ret < 0) goto err;
9449 reg = 0x10c0 ;
9450 ret = usb_microdia_control_read(dev, reg, buf, 1);
9451 if(ret < 0) goto err;
9453 reg = 0x10c0 ;
9454 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcc; buf[3] = 0xd8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9455 ret = usb_microdia_control_write(dev, reg, buf, 8);
9456 if(ret < 0) goto err;
9458 reg = 0x10c0 ;
9459 ret = usb_microdia_control_read(dev, reg, buf, 1);
9460 if(ret < 0) goto err;
9462 reg = 0x10c0 ;
9463 ret = usb_microdia_control_read(dev, reg, buf, 1);
9464 if(ret < 0) goto err;
9466 reg = 0x10c0 ;
9467 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcd; buf[3] = 0x93; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9468 ret = usb_microdia_control_write(dev, reg, buf, 8);
9469 if(ret < 0) goto err;
9471 reg = 0x10c0 ;
9472 ret = usb_microdia_control_read(dev, reg, buf, 1);
9473 if(ret < 0) goto err;
9475 reg = 0x10c0 ;
9476 ret = usb_microdia_control_read(dev, reg, buf, 1);
9477 if(ret < 0) goto err;
9479 reg = 0x10c1 ;
9480 ret = usb_microdia_control_read(dev, reg, buf, 1);
9481 if(ret < 0) goto err;
9483 reg = 0x10c1 ;
9484 buf[0] = 0x50;
9485 ret = usb_microdia_control_write(dev, reg, buf, 1);
9486 if(ret < 0) goto err;
9488 reg = 0x10c0 ;
9489 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9490 ret = usb_microdia_control_write(dev, reg, buf, 8);
9491 if(ret < 0) goto err;
9493 reg = 0x10c0 ;
9494 ret = usb_microdia_control_read(dev, reg, buf, 1);
9495 if(ret < 0) goto err;
9497 reg = 0x10c0 ;
9498 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9499 ret = usb_microdia_control_write(dev, reg, buf, 8);
9500 if(ret < 0) goto err;
9502 reg = 0x10c0 ;
9503 ret = usb_microdia_control_read(dev, reg, buf, 1);
9504 if(ret < 0) goto err;
9506 reg = 0x10c0 ;
9507 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9508 ret = usb_microdia_control_write(dev, reg, buf, 8);
9509 if(ret < 0) goto err;
9511 reg = 0x10c0 ;
9512 ret = usb_microdia_control_read(dev, reg, buf, 1);
9513 if(ret < 0) goto err;
9515 reg = 0x10c0 ;
9516 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9517 ret = usb_microdia_control_write(dev, reg, buf, 8);
9518 if(ret < 0) goto err;
9520 reg = 0x10c0 ;
9521 ret = usb_microdia_control_read(dev, reg, buf, 1);
9522 if(ret < 0) goto err;
9524 reg = 0x10c0 ;
9525 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9526 ret = usb_microdia_control_write(dev, reg, buf, 8);
9527 if(ret < 0) goto err;
9529 reg = 0x10c0 ;
9530 ret = usb_microdia_control_read(dev, reg, buf, 1);
9531 if(ret < 0) goto err;
9533 reg = 0x10c0 ;
9534 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9535 ret = usb_microdia_control_write(dev, reg, buf, 8);
9536 if(ret < 0) goto err;
9538 reg = 0x10c0 ;
9539 ret = usb_microdia_control_read(dev, reg, buf, 1);
9540 if(ret < 0) goto err;
9542 reg = 0x10c0 ;
9543 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9544 ret = usb_microdia_control_write(dev, reg, buf, 8);
9545 if(ret < 0) goto err;
9547 reg = 0x10c0 ;
9548 ret = usb_microdia_control_read(dev, reg, buf, 1);
9549 if(ret < 0) goto err;
9551 reg = 0x10c0 ;
9552 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9553 ret = usb_microdia_control_write(dev, reg, buf, 8);
9554 if(ret < 0) goto err;
9556 reg = 0x10c0 ;
9557 ret = usb_microdia_control_read(dev, reg, buf, 1);
9558 if(ret < 0) goto err;
9560 reg = 0x10c0 ;
9561 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9562 ret = usb_microdia_control_write(dev, reg, buf, 8);
9563 if(ret < 0) goto err;
9565 reg = 0x10c0 ;
9566 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9567 ret = usb_microdia_control_write(dev, reg, buf, 8);
9568 if(ret < 0) goto err;
9570 reg = 0x10c0 ;
9571 ret = usb_microdia_control_read(dev, reg, buf, 1);
9572 if(ret < 0) goto err;
9574 reg = 0x10c0 ;
9575 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9576 ret = usb_microdia_control_write(dev, reg, buf, 8);
9577 if(ret < 0) goto err;
9579 reg = 0x10c0 ;
9580 ret = usb_microdia_control_read(dev, reg, buf, 1);
9581 if(ret < 0) goto err;
9583 reg = 0x10c0 ;
9584 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9585 ret = usb_microdia_control_write(dev, reg, buf, 8);
9586 if(ret < 0) goto err;
9588 reg = 0x10c0 ;
9589 ret = usb_microdia_control_read(dev, reg, buf, 1);
9590 if(ret < 0) goto err;
9592 reg = 0x10c0 ;
9593 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9594 ret = usb_microdia_control_write(dev, reg, buf, 8);
9595 if(ret < 0) goto err;
9597 reg = 0x10c0 ;
9598 ret = usb_microdia_control_read(dev, reg, buf, 1);
9599 if(ret < 0) goto err;
9601 reg = 0x10c0 ;
9602 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9603 ret = usb_microdia_control_write(dev, reg, buf, 8);
9604 if(ret < 0) goto err;
9606 reg = 0x10c0 ;
9607 ret = usb_microdia_control_read(dev, reg, buf, 1);
9608 if(ret < 0) goto err;
9610 reg = 0x10c0 ;
9611 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9612 ret = usb_microdia_control_write(dev, reg, buf, 8);
9613 if(ret < 0) goto err;
9615 reg = 0x10c0 ;
9616 ret = usb_microdia_control_read(dev, reg, buf, 1);
9617 if(ret < 0) goto err;
9619 reg = 0x10c0 ;
9620 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9621 ret = usb_microdia_control_write(dev, reg, buf, 8);
9622 if(ret < 0) goto err;
9624 reg = 0x10c0 ;
9625 ret = usb_microdia_control_read(dev, reg, buf, 1);
9626 if(ret < 0) goto err;
9628 reg = 0x10c0 ;
9629 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9630 ret = usb_microdia_control_write(dev, reg, buf, 8);
9631 if(ret < 0) goto err;
9633 reg = 0x10c0 ;
9634 ret = usb_microdia_control_read(dev, reg, buf, 1);
9635 if(ret < 0) goto err;
9637 reg = 0x10c0 ;
9638 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9639 ret = usb_microdia_control_write(dev, reg, buf, 8);
9640 if(ret < 0) goto err;
9642 reg = 0x10c2 ;
9643 ret = usb_microdia_control_read(dev, reg, buf, 5);
9644 if(ret < 0) goto err;
9646 reg = 0x10c1 ;
9647 buf[0] = 0x30;
9648 ret = usb_microdia_control_write(dev, reg, buf, 1);
9649 if(ret < 0) goto err;
9651 reg = 0x10e0 ;
9652 buf[0] = 0x47;
9653 ret = usb_microdia_control_write(dev, reg, buf, 1);
9654 if(ret < 0) goto err;
9656 reg = 0x10e0 ;
9657 buf[0] = 0x47;
9658 ret = usb_microdia_control_write(dev, reg, buf, 1);
9659 if(ret < 0) goto err;
9661 reg = 0x1001 ;
9662 buf[0] = 0xc6;
9663 ret = usb_microdia_control_write(dev, reg, buf, 1);
9664 if(ret < 0) goto err;
9666 reg = 0x1001 ;
9667 buf[0] = 0xc4;
9668 ret = usb_microdia_control_write(dev, reg, buf, 1);
9669 if(ret < 0) goto err;
9671 reg = 0x1001 ;
9672 buf[0] = 0x84;
9673 ret = usb_microdia_control_write(dev, reg, buf, 1);
9674 if(ret < 0) goto err;
9676 reg = 0x1189 ;
9677 buf[0] = 0xcc;
9678 ret = usb_microdia_control_write(dev, reg, buf, 1);
9679 if(ret < 0) goto err;
9681 reg = 0x11bc ;
9682 buf[0] = 0x00;
9683 ret = usb_microdia_control_write(dev, reg, buf, 1);
9684 if(ret < 0) goto err;
9686 reg = 0x11bd ;
9687 buf[0] = 0x00;
9688 ret = usb_microdia_control_write(dev, reg, buf, 1);
9689 if(ret < 0) goto err;
9691 reg = 0x11be ;
9692 buf[0] = 0x00;
9693 ret = usb_microdia_control_write(dev, reg, buf, 1);
9694 if(ret < 0) goto err;
9696 reg = 0x11bf ;
9697 buf[0] = 0x00;
9698 ret = usb_microdia_control_write(dev, reg, buf, 1);
9699 if(ret < 0) goto err;
9701 reg = 0x10c0 ;
9702 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9703 ret = usb_microdia_control_write(dev, reg, buf, 8);
9704 if(ret < 0) goto err;
9706 reg = 0x10c0 ;
9707 ret = usb_microdia_control_read(dev, reg, buf, 1);
9708 if(ret < 0) goto err;
9710 reg = 0x10c0 ;
9711 ret = usb_microdia_control_read(dev, reg, buf, 1);
9712 if(ret < 0) goto err;
9714 reg = 0x10c0 ;
9715 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
9716 ret = usb_microdia_control_write(dev, reg, buf, 8);
9717 if(ret < 0) goto err;
9719 reg = 0x10c0 ;
9720 ret = usb_microdia_control_read(dev, reg, buf, 1);
9721 if(ret < 0) goto err;
9723 reg = 0x10c0 ;
9724 ret = usb_microdia_control_read(dev, reg, buf, 1);
9725 if(ret < 0) goto err;
9727 reg = 0x10c0 ;
9728 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9729 ret = usb_microdia_control_write(dev, reg, buf, 8);
9730 if(ret < 0) goto err;
9732 reg = 0x10c0 ;
9733 ret = usb_microdia_control_read(dev, reg, buf, 1);
9734 if(ret < 0) goto err;
9736 reg = 0x10c0 ;
9737 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9738 ret = usb_microdia_control_write(dev, reg, buf, 8);
9739 if(ret < 0) goto err;
9741 reg = 0x10c0 ;
9742 ret = usb_microdia_control_read(dev, reg, buf, 1);
9743 if(ret < 0) goto err;
9745 reg = 0x10c0 ;
9746 ret = usb_microdia_control_read(dev, reg, buf, 1);
9747 if(ret < 0) goto err;
9749 reg = 0x1180 ;
9750 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
9751 ret = usb_microdia_control_write(dev, reg, buf, 6);
9752 if(ret < 0) goto err;
9754 reg = 0x10fb ;
9755 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
9756 ret = usb_microdia_control_write(dev, reg, buf, 5);
9757 if(ret < 0) goto err;
9759 reg = 0x1189 ;
9760 buf[0] = 0xdc;
9761 ret = usb_microdia_control_write(dev, reg, buf, 1);
9762 if(ret < 0) goto err;
9764 reg = 0x1189 ;
9765 buf[0] = 0xd0;
9766 ret = usb_microdia_control_write(dev, reg, buf, 1);
9767 if(ret < 0) goto err;
9769 reg = 0x11a1 ;
9770 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
9771 ret = usb_microdia_control_write(dev, reg, buf, 4);
9772 if(ret < 0) goto err;
9774 reg = 0x11ab ;
9775 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
9776 ret = usb_microdia_control_write(dev, reg, buf, 4);
9777 if(ret < 0) goto err;
9779 reg = 0x1000 ;
9780 buf[0] = 0x78;
9781 ret = usb_microdia_control_write(dev, reg, buf, 1);
9782 if(ret < 0) goto err;
9784 reg = 0x1002 ;
9785 buf[0] = 0x18;
9786 ret = usb_microdia_control_write(dev, reg, buf, 1);
9787 if(ret < 0) goto err;
9789 reg = 0x1002 ;
9790 buf[0] = 0x08;
9791 ret = usb_microdia_control_write(dev, reg, buf, 1);
9792 if(ret < 0) goto err;
9794 reg = 0x11b8 ;
9795 buf[0] = 0x38;
9796 ret = usb_microdia_control_write(dev, reg, buf, 1);
9797 if(ret < 0) goto err;
9799 reg = 0x118a ;
9800 buf[0] = 0x02;
9801 ret = usb_microdia_control_write(dev, reg, buf, 1);
9802 if(ret < 0) goto err;
9804 reg = 0x0395 ;
9805 buf[0] = 0x02;
9806 ret = usb_microdia_control_write(dev, reg, buf, 1);
9807 if(ret < 0) goto err;
9809 reg = 0x11b8 ;
9810 buf[0] = 0x78;
9811 ret = usb_microdia_control_write(dev, reg, buf, 1);
9812 if(ret < 0) goto err;
9814 reg = 0x11b8 ;
9815 ret = usb_microdia_control_read(dev, reg, buf, 1);
9816 if(ret < 0) goto err;
9818 reg = 0x11b8 ;
9819 buf[0] = 0xf9;
9820 ret = usb_microdia_control_write(dev, reg, buf, 1);
9821 if(ret < 0) goto err;
9823 reg = 0x11b8 ;
9824 ret = usb_microdia_control_read(dev, reg, buf, 1);
9825 if(ret < 0) goto err;
9827 reg = 0x11b8 ;
9828 buf[0] = 0x7a;
9829 ret = usb_microdia_control_write(dev, reg, buf, 1);
9830 if(ret < 0) goto err;
9832 reg = 0x11b8 ;
9833 ret = usb_microdia_control_read(dev, reg, buf, 1);
9834 if(ret < 0) goto err;
9836 reg = 0x11b8 ;
9837 buf[0] = 0x7b;
9838 ret = usb_microdia_control_write(dev, reg, buf, 1);
9839 if(ret < 0) goto err;
9841 reg = 0x11b8 ;
9842 ret = usb_microdia_control_read(dev, reg, buf, 1);
9843 if(ret < 0) goto err;
9845 reg = 0x11b8 ;
9846 buf[0] = 0x7c;
9847 ret = usb_microdia_control_write(dev, reg, buf, 1);
9848 if(ret < 0) goto err;
9850 reg = 0x11b8 ;
9851 ret = usb_microdia_control_read(dev, reg, buf, 1);
9852 if(ret < 0) goto err;
9854 reg = 0x11b8 ;
9855 buf[0] = 0xfd;
9856 ret = usb_microdia_control_write(dev, reg, buf, 1);
9857 if(ret < 0) goto err;
9859 reg = 0x11b8 ;
9860 ret = usb_microdia_control_read(dev, reg, buf, 1);
9861 if(ret < 0) goto err;
9863 reg = 0x11b8 ;
9864 buf[0] = 0xfa;
9865 ret = usb_microdia_control_write(dev, reg, buf, 1);
9866 if(ret < 0) goto err;
9868 reg = 0x10c0 ;
9869 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9870 ret = usb_microdia_control_write(dev, reg, buf, 8);
9871 if(ret < 0) goto err;
9873 reg = 0x10c0 ;
9874 ret = usb_microdia_control_read(dev, reg, buf, 1);
9875 if(ret < 0) goto err;
9877 reg = 0x10c0 ;
9878 ret = usb_microdia_control_read(dev, reg, buf, 1);
9879 if(ret < 0) goto err;
9881 reg = 0x10c0 ;
9882 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9883 ret = usb_microdia_control_write(dev, reg, buf, 8);
9884 if(ret < 0) goto err;
9886 reg = 0x10c0 ;
9887 ret = usb_microdia_control_read(dev, reg, buf, 1);
9888 if(ret < 0) goto err;
9890 reg = 0x10c0 ;
9891 ret = usb_microdia_control_read(dev, reg, buf, 1);
9892 if(ret < 0) goto err;
9894 reg = 0x10c0 ;
9895 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9896 ret = usb_microdia_control_write(dev, reg, buf, 8);
9897 if(ret < 0) goto err;
9899 reg = 0x10c0 ;
9900 ret = usb_microdia_control_read(dev, reg, buf, 1);
9901 if(ret < 0) goto err;
9903 reg = 0x10c0 ;
9904 ret = usb_microdia_control_read(dev, reg, buf, 1);
9905 if(ret < 0) goto err;
9907 reg = 0x10c0 ;
9908 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9909 ret = usb_microdia_control_write(dev, reg, buf, 8);
9910 if(ret < 0) goto err;
9912 reg = 0x10c0 ;
9913 ret = usb_microdia_control_read(dev, reg, buf, 1);
9914 if(ret < 0) goto err;
9916 reg = 0x10c0 ;
9917 ret = usb_microdia_control_read(dev, reg, buf, 1);
9918 if(ret < 0) goto err;
9920 reg = 0x10c0 ;
9921 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9922 ret = usb_microdia_control_write(dev, reg, buf, 8);
9923 if(ret < 0) goto err;
9925 reg = 0x10c0 ;
9926 ret = usb_microdia_control_read(dev, reg, buf, 1);
9927 if(ret < 0) goto err;
9929 reg = 0x10c0 ;
9930 ret = usb_microdia_control_read(dev, reg, buf, 1);
9931 if(ret < 0) goto err;
9933 reg = 0x10c0 ;
9934 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9935 ret = usb_microdia_control_write(dev, reg, buf, 8);
9936 if(ret < 0) goto err;
9938 reg = 0x10c0 ;
9939 ret = usb_microdia_control_read(dev, reg, buf, 1);
9940 if(ret < 0) goto err;
9942 reg = 0x10c0 ;
9943 ret = usb_microdia_control_read(dev, reg, buf, 1);
9944 if(ret < 0) goto err;
9946 reg = 0x10c0 ;
9947 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9948 ret = usb_microdia_control_write(dev, reg, buf, 8);
9949 if(ret < 0) goto err;
9951 reg = 0x10c0 ;
9952 ret = usb_microdia_control_read(dev, reg, buf, 1);
9953 if(ret < 0) goto err;
9955 reg = 0x10c0 ;
9956 ret = usb_microdia_control_read(dev, reg, buf, 1);
9957 if(ret < 0) goto err;
9959 reg = 0x1182 ;
9960 buf[0] = 0x01;
9961 ret = usb_microdia_control_write(dev, reg, buf, 1);
9962 if(ret < 0) goto err;
9964 reg = 0x10c0 ;
9965 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x7d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9966 ret = usb_microdia_control_write(dev, reg, buf, 8);
9967 if(ret < 0) goto err;
9969 reg = 0x10c0 ;
9970 ret = usb_microdia_control_read(dev, reg, buf, 1);
9971 if(ret < 0) goto err;
9973 reg = 0x10c0 ;
9974 ret = usb_microdia_control_read(dev, reg, buf, 1);
9975 if(ret < 0) goto err;
9977 reg = 0x10c0 ;
9978 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9979 ret = usb_microdia_control_write(dev, reg, buf, 8);
9980 if(ret < 0) goto err;
9982 reg = 0x10c0 ;
9983 ret = usb_microdia_control_read(dev, reg, buf, 1);
9984 if(ret < 0) goto err;
9986 reg = 0x10c0 ;
9987 ret = usb_microdia_control_read(dev, reg, buf, 1);
9988 if(ret < 0) goto err;
9990 reg = 0x10c0 ;
9991 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9992 ret = usb_microdia_control_write(dev, reg, buf, 8);
9993 if(ret < 0) goto err;
9995 reg = 0x10c0 ;
9996 ret = usb_microdia_control_read(dev, reg, buf, 1);
9997 if(ret < 0) goto err;
9999 reg = 0x10c0 ;
10000 ret = usb_microdia_control_read(dev, reg, buf, 1);
10001 if(ret < 0) goto err;
10003 reg = 0x10c0 ;
10004 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10005 ret = usb_microdia_control_write(dev, reg, buf, 8);
10006 if(ret < 0) goto err;
10008 reg = 0x10c0 ;
10009 ret = usb_microdia_control_read(dev, reg, buf, 1);
10010 if(ret < 0) goto err;
10012 reg = 0x10c0 ;
10013 ret = usb_microdia_control_read(dev, reg, buf, 1);
10014 if(ret < 0) goto err;
10016 reg = 0x10c0 ;
10017 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10018 ret = usb_microdia_control_write(dev, reg, buf, 8);
10019 if(ret < 0) goto err;
10021 reg = 0x10c0 ;
10022 ret = usb_microdia_control_read(dev, reg, buf, 1);
10023 if(ret < 0) goto err;
10025 reg = 0x10c0 ;
10026 ret = usb_microdia_control_read(dev, reg, buf, 1);
10027 if(ret < 0) goto err;
10029 reg = 0x10c0 ;
10030 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10031 ret = usb_microdia_control_write(dev, reg, buf, 8);
10032 if(ret < 0) goto err;
10034 reg = 0x10c0 ;
10035 ret = usb_microdia_control_read(dev, reg, buf, 1);
10036 if(ret < 0) goto err;
10038 reg = 0x10c0 ;
10039 ret = usb_microdia_control_read(dev, reg, buf, 1);
10040 if(ret < 0) goto err;
10042 reg = 0x10c0 ;
10043 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10044 ret = usb_microdia_control_write(dev, reg, buf, 8);
10045 if(ret < 0) goto err;
10047 reg = 0x10c0 ;
10048 ret = usb_microdia_control_read(dev, reg, buf, 1);
10049 if(ret < 0) goto err;
10051 reg = 0x10c0 ;
10052 ret = usb_microdia_control_read(dev, reg, buf, 1);
10053 if(ret < 0) goto err;
10055 reg = 0x10c0 ;
10056 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10057 ret = usb_microdia_control_write(dev, reg, buf, 8);
10058 if(ret < 0) goto err;
10060 reg = 0x10c0 ;
10061 ret = usb_microdia_control_read(dev, reg, buf, 1);
10062 if(ret < 0) goto err;
10064 reg = 0x10c0 ;
10065 ret = usb_microdia_control_read(dev, reg, buf, 1);
10066 if(ret < 0) goto err;
10068 reg = 0x118c ;
10069 buf[0] = 0x20;
10070 ret = usb_microdia_control_write(dev, reg, buf, 1);
10071 if(ret < 0) goto err;
10073 reg = 0x118d ;
10074 buf[0] = 0x20;
10075 ret = usb_microdia_control_write(dev, reg, buf, 1);
10076 if(ret < 0) goto err;
10078 reg = 0x118e ;
10079 buf[0] = 0x20;
10080 ret = usb_microdia_control_write(dev, reg, buf, 1);
10081 if(ret < 0) goto err;
10083 reg = 0x118f ;
10084 buf[0] = 0x20;
10085 ret = usb_microdia_control_write(dev, reg, buf, 1);
10086 if(ret < 0) goto err;
10088 reg = 0x11ba ;
10089 buf[0] = 0x0a;
10090 ret = usb_microdia_control_write(dev, reg, buf, 1);
10091 if(ret < 0) goto err;
10093 reg = 0x118c ;
10094 buf[0] = 0x20;
10095 ret = usb_microdia_control_write(dev, reg, buf, 1);
10096 if(ret < 0) goto err;
10098 reg = 0x118d ;
10099 buf[0] = 0x20;
10100 ret = usb_microdia_control_write(dev, reg, buf, 1);
10101 if(ret < 0) goto err;
10103 reg = 0x118e ;
10104 buf[0] = 0x20;
10105 ret = usb_microdia_control_write(dev, reg, buf, 1);
10106 if(ret < 0) goto err;
10108 reg = 0x118f ;
10109 buf[0] = 0x20;
10110 ret = usb_microdia_control_write(dev, reg, buf, 1);
10111 if(ret < 0) goto err;
10113 reg = 0x118b ;
10114 buf[0] = 0x10;
10115 ret = usb_microdia_control_write(dev, reg, buf, 1);
10116 if(ret < 0) goto err;
10118 reg = 0x1190 ;
10119 buf[0] = 0x08; buf[1] = 0x2f; buf[2] = 0x46; buf[3] = 0x58; buf[4] = 0x69; buf[5] = 0x78; buf[6] = 0x86; buf[7] = 0x94; buf[8] = 0xa0; buf[9] = 0xac; buf[10] = 0xb8; buf[11] = 0xc3; buf[12] = 0xce; buf[13] = 0xd9; buf[14] = 0xe3; buf[15] = 0xed; buf[16] = 0xf7;
10120 ret = usb_microdia_control_write(dev, reg, buf, 17);
10121 if(ret < 0) goto err;
10123 reg = 0x10e1 ;
10124 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10125 ret = usb_microdia_control_write(dev, reg, buf, 21);
10126 if(ret < 0) goto err;
10128 reg = 0x10e1 ;
10129 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10130 ret = usb_microdia_control_write(dev, reg, buf, 21);
10131 if(ret < 0) goto err;
10133 reg = 0x10e1 ;
10134 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10135 ret = usb_microdia_control_write(dev, reg, buf, 21);
10136 if(ret < 0) goto err;
10138 reg = 0x10e1 ;
10139 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10140 ret = usb_microdia_control_write(dev, reg, buf, 21);
10141 if(ret < 0) goto err;
10143 reg = 0x10e1 ;
10144 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10145 ret = usb_microdia_control_write(dev, reg, buf, 21);
10146 if(ret < 0) goto err;
10148 reg = 0x10e1 ;
10149 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10150 ret = usb_microdia_control_write(dev, reg, buf, 21);
10151 if(ret < 0) goto err;
10153 reg = 0x10e1 ;
10154 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10155 ret = usb_microdia_control_write(dev, reg, buf, 21);
10156 if(ret < 0) goto err;
10158 reg = 0x10e1 ;
10159 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10160 ret = usb_microdia_control_write(dev, reg, buf, 21);
10161 if(ret < 0) goto err;
10163 reg = 0x10e1 ;
10164 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10165 ret = usb_microdia_control_write(dev, reg, buf, 21);
10166 if(ret < 0) goto err;
10168 reg = 0x10f7 ;
10169 buf[0] = 0x05;
10170 ret = usb_microdia_control_write(dev, reg, buf, 1);
10171 if(ret < 0) goto err;
10173 reg = 0x10f6 ;
10174 buf[0] = 0x20;
10175 ret = usb_microdia_control_write(dev, reg, buf, 1);
10176 if(ret < 0) goto err;
10178 reg = 0x10e1 ;
10179 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10180 ret = usb_microdia_control_write(dev, reg, buf, 21);
10181 if(ret < 0) goto err;
10183 reg = 0x10f8 ;
10184 buf[0] = 0x14;
10185 ret = usb_microdia_control_write(dev, reg, buf, 1);
10186 if(ret < 0) goto err;
10188 reg = 0x10fa ;
10189 buf[0] = 0xff;
10190 ret = usb_microdia_control_write(dev, reg, buf, 1);
10191 if(ret < 0) goto err;
10193 reg = 0x10f9 ;
10194 buf[0] = 0x00;
10195 ret = usb_microdia_control_write(dev, reg, buf, 1);
10196 if(ret < 0) goto err;
10198 reg = 0x10f9 ;
10199 buf[0] = 0x00;
10200 ret = usb_microdia_control_write(dev, reg, buf, 1);
10201 if(ret < 0) goto err;
10203 reg = 0x11ba ;
10204 buf[0] = 0x0a;
10205 ret = usb_microdia_control_write(dev, reg, buf, 1);
10206 if(ret < 0) goto err;
10208 reg = 0x11bc ;
10209 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
10210 ret = usb_microdia_control_write(dev, reg, buf, 4);
10211 if(ret < 0) goto err;
10213 reg = 0x11c0 ;
10214 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00; buf[24] = 0x00; buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00; buf[28] = 0x00; buf[29] = 0x00; buf[30] = 0x00; buf[31] = 0x00; buf[32] = 0x00; buf[33] = 0x00; buf[34] = 0x00; buf[35] = 0x00; buf[36] = 0x00; buf[37] = 0x00; buf[38] = 0x00; buf[39] = 0x00; buf[40] = 0x00; buf[41] = 0x00; buf[42] = 0x00; buf[43] = 0x00; buf[44] = 0x00; buf[45] = 0x00; buf[46] = 0x00; buf[47] = 0x00;
10215 ret = usb_microdia_control_write(dev, reg, buf, 48);
10216 if(ret < 0) goto err;
10218 reg = 0x118c ;
10219 buf[0] = 0x20;
10220 ret = usb_microdia_control_write(dev, reg, buf, 1);
10221 if(ret < 0) goto err;
10223 reg = 0x118d ;
10224 buf[0] = 0x20;
10225 ret = usb_microdia_control_write(dev, reg, buf, 1);
10226 if(ret < 0) goto err;
10228 reg = 0x118e ;
10229 buf[0] = 0x20;
10230 ret = usb_microdia_control_write(dev, reg, buf, 1);
10231 if(ret < 0) goto err;
10233 reg = 0x118f ;
10234 buf[0] = 0x20;
10235 ret = usb_microdia_control_write(dev, reg, buf, 1);
10236 if(ret < 0) goto err;
10238 reg = 0x11a5 ;
10239 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
10240 ret = usb_microdia_control_write(dev, reg, buf, 6);
10241 if(ret < 0) goto err;
10243 reg = 0x11af ;
10244 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
10245 ret = usb_microdia_control_write(dev, reg, buf, 4);
10246 if(ret < 0) goto err;
10248 reg = 0x11b3 ;
10249 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
10250 ret = usb_microdia_control_write(dev, reg, buf, 4);
10251 if(ret < 0) goto err;
10253 reg = 0x10e0 ;
10254 buf[0] = 0x47;
10255 ret = usb_microdia_control_write(dev, reg, buf, 1);
10256 if(ret < 0) goto err;
10258 reg = 0x1061 ;
10259 buf[0] = 0x01;
10260 ret = usb_microdia_control_write(dev, reg, buf, 1);
10261 if(ret < 0) goto err;
10263 reg = 0x10e0 ;
10264 buf[0] = 0x67;
10265 ret = usb_microdia_control_write(dev, reg, buf, 1);
10266 if(ret < 0) goto err;
10268 reg = 0x1100 ;
10269 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d; buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d; buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d; buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21; buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11; buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d; buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a; buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a; buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a; buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a; buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e; buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47; buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58; buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60; buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64; buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
10270 ret = usb_microdia_control_write(dev, reg, buf, 64);
10271 if(ret < 0) goto err;
10273 reg = 0x1140 ;
10274 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15; buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15; buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36; buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53; buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53; buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53; buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53; buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53; buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53; buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53; buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53; buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53; buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53; buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53; buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53; buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
10275 ret = usb_microdia_control_write(dev, reg, buf, 64);
10276 if(ret < 0) goto err;
10278 reg = 0x10e0 ;
10279 buf[0] = 0x47;
10280 ret = usb_microdia_control_write(dev, reg, buf, 1);
10281 if(ret < 0) goto err;
10283 reg = 0x1061 ;
10284 buf[0] = 0x03;
10285 ret = usb_microdia_control_write(dev, reg, buf, 1);
10286 if(ret < 0) goto err;
10288 reg = 0x10e0 ;
10289 buf[0] = 0x4b;
10290 ret = usb_microdia_control_write(dev, reg, buf, 1);
10291 if(ret < 0) goto err;
10293 reg = 0x1189 ;
10294 buf[0] = 0xd0;
10295 ret = usb_microdia_control_write(dev, reg, buf, 1);
10296 if(ret < 0) goto err;
10298 reg = 0x11bc ;
10299 buf[0] = 0x00;
10300 ret = usb_microdia_control_write(dev, reg, buf, 1);
10301 if(ret < 0) goto err;
10303 reg = 0x11bd ;
10304 buf[0] = 0x00;
10305 ret = usb_microdia_control_write(dev, reg, buf, 1);
10306 if(ret < 0) goto err;
10308 reg = 0x11be ;
10309 buf[0] = 0x00;
10310 ret = usb_microdia_control_write(dev, reg, buf, 1);
10311 if(ret < 0) goto err;
10313 reg = 0x11bf ;
10314 buf[0] = 0x00;
10315 ret = usb_microdia_control_write(dev, reg, buf, 1);
10316 if(ret < 0) goto err;
10318 reg = 0x10c0 ;
10319 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10320 ret = usb_microdia_control_write(dev, reg, buf, 8);
10321 if(ret < 0) goto err;
10323 reg = 0x10c0 ;
10324 ret = usb_microdia_control_read(dev, reg, buf, 1);
10325 if(ret < 0) goto err;
10327 reg = 0x10c0 ;
10328 ret = usb_microdia_control_read(dev, reg, buf, 1);
10329 if(ret < 0) goto err;
10331 reg = 0x10c0 ;
10332 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
10333 ret = usb_microdia_control_write(dev, reg, buf, 8);
10334 if(ret < 0) goto err;
10336 reg = 0x10c0 ;
10337 ret = usb_microdia_control_read(dev, reg, buf, 1);
10338 if(ret < 0) goto err;
10340 reg = 0x10c0 ;
10341 ret = usb_microdia_control_read(dev, reg, buf, 1);
10342 if(ret < 0) goto err;
10344 reg = 0x10c0 ;
10345 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10346 ret = usb_microdia_control_write(dev, reg, buf, 8);
10347 if(ret < 0) goto err;
10349 reg = 0x10c0 ;
10350 ret = usb_microdia_control_read(dev, reg, buf, 1);
10351 if(ret < 0) goto err;
10353 reg = 0x10c0 ;
10354 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10355 ret = usb_microdia_control_write(dev, reg, buf, 8);
10356 if(ret < 0) goto err;
10358 reg = 0x10c0 ;
10359 ret = usb_microdia_control_read(dev, reg, buf, 1);
10360 if(ret < 0) goto err;
10362 reg = 0x10c0 ;
10363 ret = usb_microdia_control_read(dev, reg, buf, 1);
10364 if(ret < 0) goto err;
10366 reg = 0x1180 ;
10367 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
10368 ret = usb_microdia_control_write(dev, reg, buf, 6);
10369 if(ret < 0) goto err;
10371 reg = 0x10fb ;
10372 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
10373 ret = usb_microdia_control_write(dev, reg, buf, 5);
10374 if(ret < 0) goto err;
10376 reg = 0x1189 ;
10377 buf[0] = 0xd0;
10378 ret = usb_microdia_control_write(dev, reg, buf, 1);
10379 if(ret < 0) goto err;
10381 reg = 0x11a1 ;
10382 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
10383 ret = usb_microdia_control_write(dev, reg, buf, 4);
10384 if(ret < 0) goto err;
10386 reg = 0x11ab ;
10387 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
10388 ret = usb_microdia_control_write(dev, reg, buf, 4);
10389 if(ret < 0) goto err;
10391 reg = 0x1061 ;
10392 buf[0] = 0x03;
10393 ret = usb_microdia_control_write(dev, reg, buf, 1);
10394 if(ret < 0) goto err;
10396 reg = 0x11ba ;
10397 buf[0] = 0x0a;
10398 ret = usb_microdia_control_write(dev, reg, buf, 1);
10399 if(ret < 0) goto err;
10401 reg = 0x11b9 ;
10402 buf[0] = 0x00;
10403 ret = usb_microdia_control_write(dev, reg, buf, 1);
10404 if(ret < 0) goto err;
10406 reg = 0x11ba ;
10407 buf[0] = 0x0b;
10408 ret = usb_microdia_control_write(dev, reg, buf, 1);
10409 if(ret < 0) goto err;
10411 reg = 0x1061 ;
10412 buf[0] = 0x01;
10413 ret = usb_microdia_control_write(dev, reg, buf, 1);
10414 if(ret < 0) goto err;
10416 reg = 0x1000 ;
10417 buf[0] = 0x78;
10418 ret = usb_microdia_control_write(dev, reg, buf, 1);
10419 if(ret < 0) goto err;
10421 reg = 0x1002 ;
10422 buf[0] = 0x08;
10423 ret = usb_microdia_control_write(dev, reg, buf, 1);
10424 if(ret < 0) goto err;
10426 reg = 0x1002 ;
10427 buf[0] = 0x08;
10428 ret = usb_microdia_control_write(dev, reg, buf, 1);
10429 if(ret < 0) goto err;
10431 reg = 0x11b8 ;
10432 buf[0] = 0xfa;
10433 ret = usb_microdia_control_write(dev, reg, buf, 1);
10434 if(ret < 0) goto err;
10436 reg = 0x118a ;
10437 buf[0] = 0x02;
10438 ret = usb_microdia_control_write(dev, reg, buf, 1);
10439 if(ret < 0) goto err;
10441 reg = 0x0395 ;
10442 buf[0] = 0x02;
10443 ret = usb_microdia_control_write(dev, reg, buf, 1);
10444 if(ret < 0) goto err;
10446 reg = 0x11b8 ;
10447 buf[0] = 0xf8;
10448 ret = usb_microdia_control_write(dev, reg, buf, 1);
10449 if(ret < 0) goto err;
10451 reg = 0x11b8 ;
10452 ret = usb_microdia_control_read(dev, reg, buf, 1);
10453 if(ret < 0) goto err;
10455 reg = 0x11b8 ;
10456 buf[0] = 0xf9;
10457 ret = usb_microdia_control_write(dev, reg, buf, 1);
10458 if(ret < 0) goto err;
10460 reg = 0x11b8 ;
10461 ret = usb_microdia_control_read(dev, reg, buf, 1);
10462 if(ret < 0) goto err;
10464 reg = 0x11b8 ;
10465 buf[0] = 0x7a;
10466 ret = usb_microdia_control_write(dev, reg, buf, 1);
10467 if(ret < 0) goto err;
10469 reg = 0x11b8 ;
10470 ret = usb_microdia_control_read(dev, reg, buf, 1);
10471 if(ret < 0) goto err;
10473 reg = 0x11b8 ;
10474 buf[0] = 0x7b;
10475 ret = usb_microdia_control_write(dev, reg, buf, 1);
10476 if(ret < 0) goto err;
10478 reg = 0x11b8 ;
10479 ret = usb_microdia_control_read(dev, reg, buf, 1);
10480 if(ret < 0) goto err;
10482 reg = 0x11b8 ;
10483 buf[0] = 0x7c;
10484 ret = usb_microdia_control_write(dev, reg, buf, 1);
10485 if(ret < 0) goto err;
10487 reg = 0x11b8 ;
10488 ret = usb_microdia_control_read(dev, reg, buf, 1);
10489 if(ret < 0) goto err;
10491 reg = 0x11b8 ;
10492 buf[0] = 0xfd;
10493 ret = usb_microdia_control_write(dev, reg, buf, 1);
10494 if(ret < 0) goto err;
10496 reg = 0x11b8 ;
10497 ret = usb_microdia_control_read(dev, reg, buf, 1);
10498 if(ret < 0) goto err;
10500 reg = 0x11b8 ;
10501 buf[0] = 0xfa;
10502 ret = usb_microdia_control_write(dev, reg, buf, 1);
10503 if(ret < 0) goto err;
10505 reg = 0x10c0 ;
10506 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10507 ret = usb_microdia_control_write(dev, reg, buf, 8);
10508 if(ret < 0) goto err;
10510 reg = 0x10c0 ;
10511 ret = usb_microdia_control_read(dev, reg, buf, 1);
10512 if(ret < 0) goto err;
10514 reg = 0x10c0 ;
10515 ret = usb_microdia_control_read(dev, reg, buf, 1);
10516 if(ret < 0) goto err;
10518 reg = 0x10c0 ;
10519 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10520 ret = usb_microdia_control_write(dev, reg, buf, 8);
10521 if(ret < 0) goto err;
10523 reg = 0x10c0 ;
10524 ret = usb_microdia_control_read(dev, reg, buf, 1);
10525 if(ret < 0) goto err;
10527 reg = 0x10c0 ;
10528 ret = usb_microdia_control_read(dev, reg, buf, 1);
10529 if(ret < 0) goto err;
10531 reg = 0x10c0 ;
10532 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x70; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10533 ret = usb_microdia_control_write(dev, reg, buf, 8);
10534 if(ret < 0) goto err;
10536 reg = 0x10c0 ;
10537 ret = usb_microdia_control_read(dev, reg, buf, 1);
10538 if(ret < 0) goto err;
10540 reg = 0x10c0 ;
10541 ret = usb_microdia_control_read(dev, reg, buf, 1);
10542 if(ret < 0) goto err;
10544 reg = 0x10c0 ;
10545 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10546 ret = usb_microdia_control_write(dev, reg, buf, 8);
10547 if(ret < 0) goto err;
10549 reg = 0x10c0 ;
10550 ret = usb_microdia_control_read(dev, reg, buf, 1);
10551 if(ret < 0) goto err;
10553 reg = 0x10c0 ;
10554 ret = usb_microdia_control_read(dev, reg, buf, 1);
10555 if(ret < 0) goto err;
10557 reg = 0x10c0 ;
10558 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10559 ret = usb_microdia_control_write(dev, reg, buf, 8);
10560 if(ret < 0) goto err;
10562 reg = 0x10c0 ;
10563 ret = usb_microdia_control_read(dev, reg, buf, 1);
10564 if(ret < 0) goto err;
10566 reg = 0x10c0 ;
10567 ret = usb_microdia_control_read(dev, reg, buf, 1);
10568 if(ret < 0) goto err;
10570 reg = 0x10c0 ;
10571 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10572 ret = usb_microdia_control_write(dev, reg, buf, 8);
10573 if(ret < 0) goto err;
10575 reg = 0x10c0 ;
10576 ret = usb_microdia_control_read(dev, reg, buf, 1);
10577 if(ret < 0) goto err;
10579 reg = 0x10c0 ;
10580 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10581 ret = usb_microdia_control_write(dev, reg, buf, 8);
10582 if(ret < 0) goto err;
10584 reg = 0x10c0 ;
10585 ret = usb_microdia_control_read(dev, reg, buf, 1);
10586 if(ret < 0) goto err;
10588 reg = 0x10c2 ;
10589 ret = usb_microdia_control_read(dev, reg, buf, 5);
10590 if(ret < 0) goto err;
10592 reg = 0x10c0 ;
10593 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10594 ret = usb_microdia_control_write(dev, reg, buf, 8);
10595 if(ret < 0) goto err;
10597 reg = 0x10c0 ;
10598 ret = usb_microdia_control_read(dev, reg, buf, 1);
10599 if(ret < 0) goto err;
10601 reg = 0x10c0 ;
10602 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10603 ret = usb_microdia_control_write(dev, reg, buf, 8);
10604 if(ret < 0) goto err;
10606 reg = 0x10c0 ;
10607 ret = usb_microdia_control_read(dev, reg, buf, 1);
10608 if(ret < 0) goto err;
10610 reg = 0x10c2 ;
10611 ret = usb_microdia_control_read(dev, reg, buf, 5);
10612 if(ret < 0) goto err;
10614 reg = 0x10c0 ;
10615 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1c; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10616 ret = usb_microdia_control_write(dev, reg, buf, 8);
10617 if(ret < 0) goto err;
10619 reg = 0x10c0 ;
10620 ret = usb_microdia_control_read(dev, reg, buf, 1);
10621 if(ret < 0) goto err;
10623 reg = 0x10c0 ;
10624 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10625 ret = usb_microdia_control_write(dev, reg, buf, 8);
10626 if(ret < 0) goto err;
10628 reg = 0x10c0 ;
10629 ret = usb_microdia_control_read(dev, reg, buf, 1);
10630 if(ret < 0) goto err;
10632 reg = 0x10c2 ;
10633 ret = usb_microdia_control_read(dev, reg, buf, 5);
10634 if(ret < 0) goto err;
10636 reg = 0x10c0 ;
10637 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10638 ret = usb_microdia_control_write(dev, reg, buf, 8);
10639 if(ret < 0) goto err;
10641 reg = 0x10c0 ;
10642 ret = usb_microdia_control_read(dev, reg, buf, 1);
10643 if(ret < 0) goto err;
10645 reg = 0x10c0 ;
10646 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10647 ret = usb_microdia_control_write(dev, reg, buf, 8);
10648 if(ret < 0) goto err;
10650 reg = 0x10c0 ;
10651 ret = usb_microdia_control_read(dev, reg, buf, 1);
10652 if(ret < 0) goto err;
10654 reg = 0x10c2 ;
10655 ret = usb_microdia_control_read(dev, reg, buf, 5);
10656 if(ret < 0) goto err;
10658 reg = 0x1061 ;
10659 buf[0] = 0x03;
10660 ret = usb_microdia_control_write(dev, reg, buf, 1);
10661 if(ret < 0) goto err;
10663 reg = 0x1007 ;
10664 buf[0] = 0x20;
10665 ret = usb_microdia_control_write(dev, reg, buf, 1);
10666 if(ret < 0) goto err;
10668 reg = 0x1006 ;
10669 buf[0] = 0x00;
10670 ret = usb_microdia_control_write(dev, reg, buf, 1);
10671 if(ret < 0) goto err;
10673 reg = 0x10e1 ;
10674 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10675 ret = usb_microdia_control_write(dev, reg, buf, 21);
10676 if(ret < 0) goto err;
10678 reg = 0x10c0 ;
10679 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10680 ret = usb_microdia_control_write(dev, reg, buf, 8);
10681 if(ret < 0) goto err;
10683 reg = 0x10c0 ;
10684 ret = usb_microdia_control_read(dev, reg, buf, 1);
10685 if(ret < 0) goto err;
10687 reg = 0x10c0 ;
10688 ret = usb_microdia_control_read(dev, reg, buf, 1);
10689 if(ret < 0) goto err;
10691 reg = 0x10c0 ;
10692 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10693 ret = usb_microdia_control_write(dev, reg, buf, 8);
10694 if(ret < 0) goto err;
10696 reg = 0x10c0 ;
10697 ret = usb_microdia_control_read(dev, reg, buf, 1);
10698 if(ret < 0) goto err;
10700 reg = 0x10c0 ;
10701 ret = usb_microdia_control_read(dev, reg, buf, 1);
10702 if(ret < 0) goto err;
10704 reg = 0x10c0 ;
10705 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10706 ret = usb_microdia_control_write(dev, reg, buf, 8);
10707 if(ret < 0) goto err;
10709 reg = 0x10c0 ;
10710 ret = usb_microdia_control_read(dev, reg, buf, 1);
10711 if(ret < 0) goto err;
10713 reg = 0x10c0 ;
10714 ret = usb_microdia_control_read(dev, reg, buf, 1);
10715 if(ret < 0) goto err;
10717 reg = 0x10c0 ;
10718 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x36; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10719 ret = usb_microdia_control_write(dev, reg, buf, 8);
10720 if(ret < 0) goto err;
10722 reg = 0x10c0 ;
10723 ret = usb_microdia_control_read(dev, reg, buf, 1);
10724 if(ret < 0) goto err;
10726 reg = 0x10c0 ;
10727 ret = usb_microdia_control_read(dev, reg, buf, 1);
10728 if(ret < 0) goto err;
10730 reg = 0x10c0 ;
10731 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10732 ret = usb_microdia_control_write(dev, reg, buf, 8);
10733 if(ret < 0) goto err;
10735 reg = 0x10c0 ;
10736 ret = usb_microdia_control_read(dev, reg, buf, 1);
10737 if(ret < 0) goto err;
10739 reg = 0x10c0 ;
10740 ret = usb_microdia_control_read(dev, reg, buf, 1);
10741 if(ret < 0) goto err;
10743 reg = 0x10e1 ;
10744 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10745 ret = usb_microdia_control_write(dev, reg, buf, 21);
10746 if(ret < 0) goto err;
10748 reg = 0x10c0 ;
10749 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10750 ret = usb_microdia_control_write(dev, reg, buf, 8);
10751 if(ret < 0) goto err;
10753 reg = 0x10c0 ;
10754 ret = usb_microdia_control_read(dev, reg, buf, 1);
10755 if(ret < 0) goto err;
10757 reg = 0x10c0 ;
10758 ret = usb_microdia_control_read(dev, reg, buf, 1);
10759 if(ret < 0) goto err;
10761 reg = 0x10e1 ;
10762 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10763 ret = usb_microdia_control_write(dev, reg, buf, 21);
10764 if(ret < 0) goto err;
10766 reg = 0x10c0 ;
10767 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10768 ret = usb_microdia_control_write(dev, reg, buf, 8);
10769 if(ret < 0) goto err;
10771 reg = 0x10c0 ;
10772 ret = usb_microdia_control_read(dev, reg, buf, 1);
10773 if(ret < 0) goto err;
10775 reg = 0x10c0 ;
10776 ret = usb_microdia_control_read(dev, reg, buf, 1);
10777 if(ret < 0) goto err;
10779 reg = 0x10c0 ;
10780 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x94; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10781 ret = usb_microdia_control_write(dev, reg, buf, 8);
10782 if(ret < 0) goto err;
10784 reg = 0x10c0 ;
10785 ret = usb_microdia_control_read(dev, reg, buf, 1);
10786 if(ret < 0) goto err;
10788 reg = 0x10c0 ;
10789 ret = usb_microdia_control_read(dev, reg, buf, 1);
10790 if(ret < 0) goto err;
10792 reg = 0x10c0 ;
10793 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x8d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10794 ret = usb_microdia_control_write(dev, reg, buf, 8);
10795 if(ret < 0) goto err;
10797 reg = 0x10c0 ;
10798 ret = usb_microdia_control_read(dev, reg, buf, 1);
10799 if(ret < 0) goto err;
10801 reg = 0x10c0 ;
10802 ret = usb_microdia_control_read(dev, reg, buf, 1);
10803 if(ret < 0) goto err;
10805 reg = 0x118c ;
10806 buf[0] = 0x20;
10807 ret = usb_microdia_control_write(dev, reg, buf, 1);
10808 if(ret < 0) goto err;
10810 reg = 0x118d ;
10811 buf[0] = 0x20;
10812 ret = usb_microdia_control_write(dev, reg, buf, 1);
10813 if(ret < 0) goto err;
10815 reg = 0x118e ;
10816 buf[0] = 0x20;
10817 ret = usb_microdia_control_write(dev, reg, buf, 1);
10818 if(ret < 0) goto err;
10820 reg = 0x118f ;
10821 buf[0] = 0x20;
10822 ret = usb_microdia_control_write(dev, reg, buf, 1);
10823 if(ret < 0) goto err;
10825 reg = 0x10c0 ;
10826 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x09; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10827 ret = usb_microdia_control_write(dev, reg, buf, 8);
10828 if(ret < 0) goto err;
10830 reg = 0x10c0 ;
10831 ret = usb_microdia_control_read(dev, reg, buf, 1);
10832 if(ret < 0) goto err;
10834 reg = 0x10c0 ;
10835 ret = usb_microdia_control_read(dev, reg, buf, 1);
10836 if(ret < 0) goto err;
10838 reg = 0x10c0 ;
10839 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x95; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10840 ret = usb_microdia_control_write(dev, reg, buf, 8);
10841 if(ret < 0) goto err;
10843 reg = 0x10c0 ;
10844 ret = usb_microdia_control_read(dev, reg, buf, 1);
10845 if(ret < 0) goto err;
10847 reg = 0x10c0 ;
10848 ret = usb_microdia_control_read(dev, reg, buf, 1);
10849 if(ret < 0) goto err;
10851 reg = 0x10c0 ;
10852 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10853 ret = usb_microdia_control_write(dev, reg, buf, 8);
10854 if(ret < 0) goto err;
10856 reg = 0x10c0 ;
10857 ret = usb_microdia_control_read(dev, reg, buf, 1);
10858 if(ret < 0) goto err;
10860 reg = 0x10c0 ;
10861 ret = usb_microdia_control_read(dev, reg, buf, 1);
10862 if(ret < 0) goto err;
10864 reg = 0x118c ;
10865 buf[0] = 0x20;
10866 ret = usb_microdia_control_write(dev, reg, buf, 1);
10867 if(ret < 0) goto err;
10869 reg = 0x118d ;
10870 buf[0] = 0x20;
10871 ret = usb_microdia_control_write(dev, reg, buf, 1);
10872 if(ret < 0) goto err;
10874 reg = 0x118e ;
10875 buf[0] = 0x20;
10876 ret = usb_microdia_control_write(dev, reg, buf, 1);
10877 if(ret < 0) goto err;
10879 reg = 0x118f ;
10880 buf[0] = 0x20;
10881 ret = usb_microdia_control_write(dev, reg, buf, 1);
10882 if(ret < 0) goto err;
10884 reg = 0x10c0 ;
10885 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10886 ret = usb_microdia_control_write(dev, reg, buf, 8);
10887 if(ret < 0) goto err;
10889 reg = 0x10c0 ;
10890 ret = usb_microdia_control_read(dev, reg, buf, 1);
10891 if(ret < 0) goto err;
10893 reg = 0x10c0 ;
10894 ret = usb_microdia_control_read(dev, reg, buf, 1);
10895 if(ret < 0) goto err;
10897 reg = 0x10c0 ;
10898 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x96; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10899 ret = usb_microdia_control_write(dev, reg, buf, 8);
10900 if(ret < 0) goto err;
10902 reg = 0x10c0 ;
10903 ret = usb_microdia_control_read(dev, reg, buf, 1);
10904 if(ret < 0) goto err;
10906 reg = 0x10c0 ;
10907 ret = usb_microdia_control_read(dev, reg, buf, 1);
10908 if(ret < 0) goto err;
10910 reg = 0x10c0 ;
10911 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10912 ret = usb_microdia_control_write(dev, reg, buf, 8);
10913 if(ret < 0) goto err;
10915 reg = 0x10c0 ;
10916 ret = usb_microdia_control_read(dev, reg, buf, 1);
10917 if(ret < 0) goto err;
10919 reg = 0x10c0 ;
10920 ret = usb_microdia_control_read(dev, reg, buf, 1);
10921 if(ret < 0) goto err;
10923 reg = 0x118c ;
10924 buf[0] = 0x20;
10925 ret = usb_microdia_control_write(dev, reg, buf, 1);
10926 if(ret < 0) goto err;
10928 reg = 0x118d ;
10929 buf[0] = 0x20;
10930 ret = usb_microdia_control_write(dev, reg, buf, 1);
10931 if(ret < 0) goto err;
10933 reg = 0x118e ;
10934 buf[0] = 0x20;
10935 ret = usb_microdia_control_write(dev, reg, buf, 1);
10936 if(ret < 0) goto err;
10938 reg = 0x118f ;
10939 buf[0] = 0x20;
10940 ret = usb_microdia_control_write(dev, reg, buf, 1);
10941 if(ret < 0) goto err;
10943 reg = 0x10c0 ;
10944 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10945 ret = usb_microdia_control_write(dev, reg, buf, 8);
10946 if(ret < 0) goto err;
10948 reg = 0x10c0 ;
10949 ret = usb_microdia_control_read(dev, reg, buf, 1);
10950 if(ret < 0) goto err;
10952 reg = 0x10c0 ;
10953 ret = usb_microdia_control_read(dev, reg, buf, 1);
10954 if(ret < 0) goto err;
10956 reg = 0x118c ;
10957 buf[0] = 0x20;
10958 ret = usb_microdia_control_write(dev, reg, buf, 1);
10959 if(ret < 0) goto err;
10961 reg = 0x118d ;
10962 buf[0] = 0x20;
10963 ret = usb_microdia_control_write(dev, reg, buf, 1);
10964 if(ret < 0) goto err;
10966 reg = 0x118e ;
10967 buf[0] = 0x20;
10968 ret = usb_microdia_control_write(dev, reg, buf, 1);
10969 if(ret < 0) goto err;
10971 reg = 0x118f ;
10972 buf[0] = 0x20;
10973 ret = usb_microdia_control_write(dev, reg, buf, 1);
10974 if(ret < 0) goto err;
10976 reg = 0x1007 ;
10977 buf[0] = 0x20;
10978 ret = usb_microdia_control_write(dev, reg, buf, 1);
10979 if(ret < 0) goto err;
10981 reg = 0x1006 ;
10982 buf[0] = 0x20;
10983 ret = usb_microdia_control_write(dev, reg, buf, 1);
10984 if(ret < 0) goto err;
10989 /* END OF MICRODIA 6288 START STREAM */
10991 return 0;
10992 err:
10993 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
10994 return ret;
10997 /**
10998 * @brief From UsbSnoop-plugin-parsed.log
11000 * @param dev
11002 * @returns 0 if all OK
11004 * this function starts video stream Microdia 6128 webcam
11005 * Bridge SN9C325 + OM6802 CMOS sensor
11006 * note: comments are my observations so they could be wrong
11008 int microdia_6128_start_stream(struct usb_microdia *dev)
11010 int i;
11011 int ret = 0;
11012 __u8 buf[8];
11014 __u8 data_15[] = {
11015 0x00, 0x1a, 0x34, 0x27, 0x20, 0xa0, 0x34, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00
11018 __u8 data_17[] = {
11019 0x08, 0x22, 0x44, 0x63, 0x7d, 0x92, 0xa3, 0xaf, 0xbc, 0xc4, 0xcd, 0xd5, 0xdc, 0xe1, 0xe8, 0xef,
11020 0xf7
11023 __u8 data_21[] = {
11024 0x15, 0x00, 0x2b, 0x00, 0x08, 0x00, 0xeb, 0x0f, 0xd7, 0x0f, 0x43, 0x00, 0x3d, 0x00, 0xca, 0x0f,
11025 0xf7, 0x0f, 0x0c, 0x00, 0x00
11028 __u8 qtable_1[] = {
11029 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0a, 0x10,
11030 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x13, 0x0e, 0x0e, 0x0c, 0x10, 0x17, 0x13, 0x17, 0x17, 0x15, 0x13,
11031 0x15, 0x15, 0x19, 0x1b, 0x23, 0x1f, 0x19, 0x1b, 0x21, 0x1b, 0x15, 0x15, 0x1f, 0x2b, 0x1f, 0x21,
11032 0x25, 0x27, 0x29, 0x29, 0x29, 0x17, 0x1d, 0x2d, 0x2f, 0x2b, 0x27, 0x2f, 0x23, 0x27, 0x29, 0x27
11036 __u8 qtable_2[] = {
11037 0x06, 0x08, 0x08, 0x0a, 0x08, 0x0a, 0x12, 0x0a, 0x0a, 0x12, 0x27, 0x19, 0x15, 0x19, 0x27, 0x27,
11038 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11039 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11040 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11043 __u8 om6802_sensor[][8] = {
11044 {0xa0, dev->sensor_slave_address, 0xd6, 0x02, 0x00, 0x00, 0x00, 0x10},
11045 {0xa0, dev->sensor_slave_address, 0xae, 0xe2, 0x00, 0x00, 0x00, 0x10},
11046 {0xa0, dev->sensor_slave_address, 0xdf, 0x6d, 0x00, 0x00, 0x00, 0x10}, // Enter factory mode
11047 {0xa0, dev->sensor_slave_address, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10}, // RGB, uyvy1,Raw RGB, n/1/2, n/clp
11048 {0xa0, dev->sensor_slave_address, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10},
11049 {0xa0, dev->sensor_slave_address, 0xfb, 0x11, 0x00, 0x00, 0x00, 0x10},
11050 {0xa0, dev->sensor_slave_address, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x10},
11051 {0xa0, dev->sensor_slave_address, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x10},
11052 {0xa0, dev->sensor_slave_address, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10},
11053 {0xa0, dev->sensor_slave_address, 0xfb, 0xee, 0x00, 0x00, 0x00, 0x10},
11054 {0xa0, dev->sensor_slave_address, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10},
11055 {0xa0, dev->sensor_slave_address, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10},
11056 {0xa0, dev->sensor_slave_address, 0x72, 0x00, 0x00, 0x00, 0x00, 0x10},
11057 {0xa0, dev->sensor_slave_address, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10},
11058 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
11059 {0xa0, dev->sensor_slave_address, 0x71, 0x18, 0x00, 0x00, 0x00, 0x10},
11060 {0xa0, dev->sensor_slave_address, 0x72, 0x04, 0x00, 0x00, 0x00, 0x10},
11061 {0xa0, dev->sensor_slave_address, 0x68, 0xde, 0x00, 0x00, 0x00, 0x10},
11062 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10}, // 18
11063 {0xa0, dev->sensor_slave_address, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10},
11064 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
11065 {0, 0, 0, 0, 0, 0, 0, 0} // Terminating string
11068 buf[0] = 0x00;
11069 ret += usb_microdia_control_write(dev, 0xf1, buf, 1); // Reset cam
11071 buf[0] = 0x23;
11072 ret += usb_microdia_control_write(dev, 0x01, buf, 1); // Sensor off, video off, clk 12MHz
11074 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // Check if cam is working, must write 0x12 in buf[0]
11076 if(buf[0] != 0x12){
11077 UDIA_ERROR("Microdia 6128 webcam not connected or working !!!\n");
11078 return -ENODEV;
11081 ret += usb_microdia_control_read(dev, 0x01, buf, 1); // Must read 23
11083 if(buf[0] != 0x23){
11084 UDIA_ERROR("Microdia 6128 webcam is not initialized !!!\n");
11085 return -ENODEV;
11088 buf[0] = 0x23; buf[1] = 0x72;
11089 ret += usb_microdia_control_write(dev, 0x01, buf, 2); // Configure GPIO
11091 buf[0] = 0x34; buf[1] = 0x27; buf[2] = 0x20; buf[3] = 0xa0; buf[4] = 0x34;
11092 ret += usb_microdia_control_write(dev, 0x05, buf, 5);
11094 buf[0] = 0x44; buf[1] = 0x45; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
11095 ret += usb_microdia_control_write(dev, 0x17, buf, 5);
11097 buf[0] = 0x08; buf[1] = 0x40; buf[2] = 0x20; buf[3] = 0x00; buf[4] = 0x00;
11098 ret += usb_microdia_control_write(dev, 0x9a, buf, 5);
11100 buf[0] = 0x60; buf[1] = 0x00; buf[2] = 0x00;
11101 ret += usb_microdia_control_write(dev, 0xd4, buf, 3);
11102 ret += usb_microdia_control_write(dev, 0x03, data_15, 15);
11104 buf[0] = 0x73;
11105 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11107 buf[0] = 0x64;
11108 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11110 buf[0] = 0x22; buf[1] = 0x62;
11111 ret += usb_microdia_control_write(dev, 0x01, &buf[0], 1);
11112 ret += usb_microdia_control_write(dev, 0x01, &buf[1], 1);
11114 buf[0] = 0x64;
11115 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11116 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11118 buf[0] = 0x42; // Sensor on, clk 24MHz, video off
11119 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11120 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11122 // Sensor stuff
11123 for (i = 0; i < 2; i++){
11124 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11125 msleep(1);
11128 buf[0] = 0x71;
11129 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11131 // Sensor stuff
11132 for (i = 2; i < 11; i++){
11133 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11134 msleep(1);
11137 buf[0] = 0x71;
11138 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11139 ret += usb_microdia_control_write(dev, 0x02, buf, 1); // URB 1780
11141 buf[0] = 0x28;
11142 ret += usb_microdia_control_write(dev, 0x15, buf, 1);
11144 buf[0] = 0x1e;
11145 ret += usb_microdia_control_write(dev, 0x16, buf, 1);
11147 buf[0] = 0x51;
11148 ret += usb_microdia_control_write(dev, 0x12, buf, 1);
11150 buf[0] = 0x01;
11151 ret += usb_microdia_control_write(dev, 0x13, buf, 1);
11153 buf[0] = 0x45;
11154 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11156 buf[0] = 0x6a;
11157 ret += usb_microdia_control_write(dev, 0xd2, buf, 1);
11159 buf[0] = 0x50;
11160 ret += usb_microdia_control_write(dev, 0xd3, buf, 1);
11162 buf[0] = 0x00;
11163 ret += usb_microdia_control_write(dev, 0xc6, buf, 1);
11164 ret += usb_microdia_control_write(dev, 0xc7, buf, 1);
11166 buf[0] = 0x50;
11167 ret += usb_microdia_control_write(dev, 0xc8, buf, 1);
11169 buf[0] = 0x3c;
11170 ret += usb_microdia_control_write(dev, 0xc9, buf, 1);
11172 buf[0] = 0x45;
11173 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11175 buf[0] = 0x64;
11176 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11178 buf[0] = 0x20;
11179 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11180 ret += usb_microdia_control_write(dev, 0x07, buf, 1);
11181 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11183 buf[0] = 0x00;
11184 ret += usb_microdia_control_write(dev, 0x14, buf, 1);
11186 ret += usb_microdia_control_write(dev, 0x20, data_17, 17);
11187 ret += usb_microdia_control_write(dev, 0x20, data_17, 17);
11189 for (i = 0; i < 8; ++i) // writing the same buffer 8 times, why ??
11190 ret += usb_microdia_control_write(dev, 0x84, data_21, 21);
11192 data_21[0] = 0x16; data_21[10] = 40; data_21[12] = 0x3f;
11193 ret += usb_microdia_control_write(dev, 0x84, data_21, 21);
11195 buf[0] = 0x08;
11196 ret += usb_microdia_control_write(dev, 0x9a, buf, 1);
11198 buf[0] = 0x10;
11199 ret += usb_microdia_control_write(dev, 0x99, buf, 1);
11201 ret += usb_microdia_control_write(dev, 0x84, data_21, 21); // URB 1811
11203 buf[0] = 0x20;
11204 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11205 ret += usb_microdia_control_write(dev, 0x07, buf, 1);
11206 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11208 // Sensor Stuff
11209 for (i = 11; i < 15; i++){
11210 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11211 msleep(1);
11214 buf[0] = 0x34;
11215 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11216 buf[0] = 0x27;
11217 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11219 buf[0] = buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
11220 ret += usb_microdia_control_write(dev, 0xc0, buf, 6);
11222 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
11223 ret += usb_microdia_control_write(dev, 0xca, buf, 4);
11225 buf[0] = 0x1e; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xe7;
11226 ret += usb_microdia_control_write(dev, 0xce, buf, 4);
11228 buf[0] = 0x42;
11229 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11231 buf[0] = 0x64;
11232 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11234 // Sensor Stuff
11235 for (i = 15; i < 19; i++){
11236 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11237 msleep(1);
11240 buf[0] = 0x28;
11241 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11243 buf[0] = 0x54;
11244 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11246 // This changes the mode (VGA = 0 , CIF = 1)
11247 // buf = 0x40 | 0x05 | (mode << 4) 45 or 55
11248 buf[0] = 0x45;
11249 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11251 // This is the Q table
11252 ret += usb_microdia_control_write(dev, 0x0100, qtable_1, 64); // first time
11253 ret += usb_microdia_control_write(dev, 0x0140, qtable_2, 64); // second time
11255 // mode: VGA = 0, CIF = 1
11256 // buf = 0x05 | (mode << 4) 05 or 15
11257 buf[0] = 0x05;
11258 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11260 buf[0] = 0x71;
11261 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11262 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11264 buf[0] = 0x42; // Sensor on, Video disabled, clk 24MHz
11265 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11267 buf[0] = 0x64;
11268 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11270 // Command to start streaming
11271 // Sensor on, clk 24MHz, video enabled
11272 buf[0] = 0x46;
11273 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11275 // When the device reads 46 from reg 0x01 it means that
11276 // camera is streaming
11277 ret += usb_microdia_control_read(dev, 0x01, buf, 1); // Must read 0x46
11279 if (ret != 624)
11280 UDIA_DEBUG("Some read or write were not successful in Start Stream\n");
11282 return 0;
11286 int dev_microdia_stop_stream(struct usb_microdia *dev)
11288 int ret = -ENODEV;
11289 if(dev && dev->stop_stream)
11290 ret = dev->stop_stream(dev);
11292 return ret;
11296 * @brief From stop.htm
11298 * @param dev
11300 * @returns 0
11302 * @author GWater
11304 * For SN9C201 with MI1310.
11305 * This function has not been tested yet.
11307 int microdia_6242_stop_stream(struct usb_microdia *dev)
11309 __u8 buf[3];
11311 __u8 only10c0[3] = {0x0d, 0x00, 0x00};
11313 buf[0] = 0x01;
11314 usb_microdia_control_write(dev, 0x1061, buf, 1);
11316 buf[0] = 0x60;
11317 usb_microdia_control_write(dev, 0x1007, buf, 1);
11319 buf[0] = 0x00;
11320 usb_microdia_control_write(dev, 0x1006, buf, 1);
11322 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
11323 only10c0[0], dev->sensor_flags, &only10c0[1]);
11325 buf[0] = 0x38;
11326 usb_microdia_control_write(dev, 0x1000, buf, 1);
11328 buf[0] = 0x6b;
11329 usb_microdia_control_write(dev, 0x11b8, buf, 1);
11331 buf[0] = 0x60;
11332 usb_microdia_control_write(dev, 0x1007, buf, 1);
11334 buf[0] = 0x20;
11335 usb_microdia_control_write(dev, 0x1006, buf, 1);
11338 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11339 usb_microdia_control_write(dev, 0x1000, buf, 3);
11342 * After the select alternate setting 0 is actually another transfer:
11343 * buf[0] = 0x00;
11344 * usb_microdia_control_write(dev, 0x1066, buf, 1);
11347 return 0;
11350 /**
11351 * @brief From stopstream.log
11353 * @param dev
11355 * @returns 0
11357 * @author GWater
11359 * For SN9C201 with SOI968.
11360 * I don't whether the function really stops the stream.
11361 * Nevertheless the LED on the webcam now stops glowing.
11362 * The function is very similar to "microdia_624f_stop_stream".
11364 int microdia_624e_stop_stream(struct usb_microdia *dev)
11366 __u8 buf[3];
11368 buf[0] = 0x01;
11369 usb_microdia_control_write(dev, 0x1061, buf, 1);
11371 /* Next two writes added because it works better.
11372 * The LED stops glowing and I think the stream does too.
11373 * 0x20 = 0b00100000 which is the minimal of what the other stopstreams have in common.
11375 buf[0] = 0x20;
11376 usb_microdia_control_write(dev, 0x1007, buf, 1);
11378 buf[0] = 0x20;
11379 usb_microdia_control_write(dev, 0x1006, buf, 1);
11381 buf[0] = 0x3c;
11382 usb_microdia_control_write(dev, 0x1000, buf, 1);
11384 buf[0] = 0x6a;
11385 usb_microdia_control_write(dev, 0x11b8, buf, 1);
11387 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11388 usb_microdia_control_write(dev, 0x1000, buf, 3);
11390 usb_microdia_control_read(dev, 0x1066, buf, 1);
11392 return 0;
11395 int microdia_624f_stop_stream(struct usb_microdia *dev)
11397 int ret;
11398 __u16 command;
11399 __u8 buf[3];
11401 buf[0] = 0x02;
11402 command = 0x1066;
11403 ret = usb_microdia_control_write(dev, command, buf, 1);
11404 if(ret < 0) goto err;
11406 buf[0] = 0x01;
11407 command = 0x1061;
11408 ret = usb_microdia_control_write(dev, command, buf, 1);
11409 if(ret < 0) goto err;
11411 buf[0] = 0x38;
11412 command = 0x1000;
11413 ret = usb_microdia_control_write(dev, command, buf, 1);
11414 if(ret < 0) goto err;
11416 buf[0] = 0x6a;
11417 command = 0x11b8;
11418 ret = usb_microdia_control_write(dev, command, buf, 1);
11419 if(ret < 0) goto err;
11421 buf[0] = 0x20;
11422 command = 0x1007;
11423 ret = usb_microdia_control_write(dev, command, buf, 1);
11424 if(ret < 0) goto err;
11426 buf[0] = 0x20;
11427 command = 0x1006;
11428 ret = usb_microdia_control_write(dev, command, buf, 1);
11429 if(ret < 0) goto err;
11431 buf[0] = 0x98;
11432 buf[1] = 0xe7;
11433 buf[2] = 0x11;
11434 command = 0x1000;
11435 ret = usb_microdia_control_write(dev, command, buf, 3);
11436 if(ret < 0) goto err;
11438 command = 0x1045;
11439 ret = usb_microdia_control_read(dev, command, buf, 1);
11440 if(ret < 0) goto err;
11442 buf[0] = 0x0f;
11443 ret = usb_microdia_control_write(dev, command, buf, 1);
11444 if(ret < 0) goto err;
11446 return ret;
11448 err:
11449 UDIA_ERROR("command %x failed (%d)!\n", command, ret);
11450 return ret;
11453 int microdia_6260_stop_stream(struct usb_microdia *dev)
11455 int ret;
11456 __u8 buf[32];
11458 buf[0] = 0x01;
11459 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
11460 buf[0] = 0x38;
11461 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
11462 buf[0] = 0x6b;
11463 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
11464 buf[0] = 0x20;
11465 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
11466 buf[0] = 0x20;
11467 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
11469 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11470 ret = usb_microdia_control_write(dev, 0x1000, buf, 3);
11472 buf[0] = 0x00;
11473 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
11474 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
11475 buf[0] = 0x0f;
11476 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
11477 buf[0] = 0x00;
11478 ret = usb_microdia_control_write(dev, 0x10c8, buf, 1);
11479 buf[0] = 0x80;
11480 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
11482 return ret;
11486 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
11488 * @param dev
11490 * @returns 0 (ok) or -1 (error)
11492 * @author Comer352l
11494 * Windows driver version: 5.7.23.000
11495 * Windows versions: 2000 and XP
11496 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
11497 * All logs were made using AMCAP with 640x480, RGB24
11499 int microdia_6270_stop_stream(struct usb_microdia *dev)
11501 int ret = 0;
11502 int retI2C = 0;
11503 __u8 buf[3];
11505 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
11507 buf[0] = 0x20;
11508 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 3541
11509 buf[0] = 0x20;
11510 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 3542
11511 // => These two writes seem to cause the cam to stop sending isochronus USB messages
11513 buf[0] = 0x01;
11514 ret += usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 3544
11515 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
11517 buf[0] = 0x60;
11518 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 3541
11519 buf[0] = 0x60;
11520 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 3542
11522 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
11524 // Write to sensor register 0x07: Output Control
11525 buf[0] = 0x00; buf[1] = 0x00; // stop sensor readout, normal operation
11526 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
11528 buf[0] = 0x38; // ALEX: 0x3c
11529 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 3545
11530 buf[0] = 0x6d; // ALEX: 0xec; FRANK: also 0x6c
11531 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 3546
11532 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11533 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); // URB 3547
11535 // INTERRUPT COMMING BACK (URB 2227)
11536 // SELECT ALTERNATE SETTINGS (URB 3548)
11537 // INTERRUPT GOING DOWN (URB 3549)
11539 buf[0] = 0x00;
11540 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 3550
11542 if (ret < 9)
11544 UDIA_INFO("One ore more errors occured while stopping stream !\n");
11545 return -1;
11547 else
11548 return 0;
11551 int microdia_627b_stop_stream(struct usb_microdia *dev)
11553 int ret = 0;
11554 __u16 reg;
11555 __u8 buf[3];
11557 reg = 0x1007;
11558 buf[0] = 0x60;
11559 ret = usb_microdia_control_write(dev, reg, buf, 1);
11560 if (ret < 0)
11561 goto err;
11563 reg = 0x1006;
11564 buf[0] = 0x20;
11565 ret = usb_microdia_control_write(dev, reg, buf, 1);
11566 if (ret < 0)
11567 goto err;
11570 //reg = 0x1007;
11571 //buf[0] = 0x60;
11572 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11573 //if(ret < 0) goto err;
11575 //reg = 0x1006;
11576 //buf[0] = 0x20;
11577 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11578 //if(ret < 0) goto err;
11581 reg = 0x1061;
11582 buf[0] = 0x01;
11583 ret = usb_microdia_control_write(dev, reg, buf, 1);
11584 if (ret < 0)
11585 goto err;
11588 //reg = 0x1007;
11589 //buf[0] = 0x60;
11590 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11591 //if(ret < 0) goto err;
11593 //reg = 0x1006;
11594 //buf[0] = 0x20;
11595 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11596 //if(ret < 0) goto err;
11599 reg = 0x1000;
11600 buf[0] = 0x38;
11601 ret = usb_microdia_control_write(dev, reg, buf, 1);
11602 if (ret < 0)
11603 goto err;
11605 reg = 0x11b8;
11606 buf[0] = 0x6b;
11607 ret = usb_microdia_control_write(dev, reg, buf, 1);
11608 if (ret < 0)
11609 goto err;
11611 reg = 0x1000;
11612 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11613 ret = usb_microdia_control_write(dev, reg, buf, 3);
11614 if (ret < 0)
11615 goto err;
11617 reg = 0x1066;
11618 buf[0] = 0x00;
11619 ret = usb_microdia_control_write(dev, reg, buf, 1);
11620 if (ret < 0)
11621 goto err;
11623 return ret;
11624 err:
11625 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
11626 return ret;
11629 /**
11630 * @brief From UsbSnoop-plugin-parsed.log
11632 * @param dev
11634 * @returns 0 (OK) or <0 (Error)
11636 * @author Vincent, Kuzja
11638 int microdia_6288_stop_stream(struct usb_microdia *dev)
11640 int ret = 0;
11641 __u16 reg;
11642 __u8 buf[8];
11644 reg = 0x1061 ;
11645 buf[0] = 0x01;
11646 ret = usb_microdia_control_write(dev, reg, buf, 1);
11647 if(ret < 0) goto err;
11649 reg = 0x1000 ;
11650 buf[0] = 0x38;
11651 ret = usb_microdia_control_write(dev, reg, buf, 1);
11652 if(ret < 0) goto err;
11654 reg = 0x11b8 ;
11655 buf[0] = 0xe9;
11656 ret = usb_microdia_control_write(dev, reg, buf, 1);
11657 if(ret < 0) goto err;
11659 reg = 0x1007 ;
11660 buf[0] = 0x20;
11661 ret = usb_microdia_control_write(dev, reg, buf, 1);
11662 if(ret < 0) goto err;
11664 reg = 0x1006 ;
11665 buf[0] = 0x20;
11666 ret = usb_microdia_control_write(dev, reg, buf, 1);
11667 if(ret < 0) goto err;
11669 reg = 0x1000 ;
11670 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11671 ret = usb_microdia_control_write(dev, reg, buf, 3);
11672 if(ret < 0) goto err;
11674 reg = 0x1066 ;
11675 buf[0] = 0x00;
11676 ret = usb_microdia_control_write(dev, reg, buf, 1);
11677 if(ret < 0) goto err;
11679 return 0;
11680 err:
11681 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
11682 return ret;
11685 /**
11686 * @brief From UsbSnoop-plugin-parsed.log
11688 * @param dev
11690 * @returns 0 if all OK
11692 * This function stops the video stream for microdia 6128
11693 * Bridge SN9C325 + OM6802 CMOS sensor
11694 * note: comments are my observations so they could be wrong
11696 int microdia_6128_stop_stream(struct usb_microdia *dev)
11698 int ret = 0;
11699 __u8 data;
11701 ret += usb_microdia_control_read(dev, 0x00, &data, 1);
11703 // Stop stream command
11704 data = 0x00;
11705 ret += usb_microdia_control_write(dev, 0x01, &data, 1);
11707 data = 0x00;
11708 ret += usb_microdia_control_write(dev, 0xf1, &data, 1);
11710 data = 0x01;
11711 ret += usb_microdia_control_write(dev, 0xf1, &data, 1);
11713 if(ret != 4)
11714 UDIA_DEBUG("Some read or write were not successful in Stop Stream\n");
11716 return 0;
11721 int microdia_624f_set_exposure(struct usb_microdia *dev)
11723 int ret = 0;
11724 __u8 v1 = (dev->vsettings.exposure >> 4) & 0xff;
11725 __u8 v2 = dev->vsettings.exposure >> 12;
11727 ret |= sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x2d,
11728 dev->sensor_flags, &v1);
11730 ret |= sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x2e,
11731 dev->sensor_flags, &v2);
11733 return ret;
11736 int microdia_624f_flip_detect(struct usb_microdia *dev)
11738 int ret = 0;
11739 __u8 val;
11741 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
11742 if (ret < 0) return -EAGAIN;
11743 if (val & 0x01) {
11744 dev->vsettings.vflip = 1;
11746 else {
11747 dev->vsettings.vflip = 0;
11750 return ret;
11753 int microdia_6260_flip_detect(struct usb_microdia *dev)
11755 const __u8 flip_bit = 0x01;
11756 int ret = 0;
11757 __u8 val;
11758 static __u8 flip_reg = flip_bit;
11759 __u8 vflip;
11761 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
11762 if (ret < 0)
11763 return -EAGAIN;
11764 if (flip_reg != (val & flip_bit)) {
11765 if (val & flip_bit)
11766 vflip = 0;
11767 else
11768 vflip = 1;
11769 ret = ov7670_auto_flip(dev, vflip);
11770 flip_reg = (val & flip_bit);
11773 return ret;