Update and partially rewrite README
[microdia.git] / microdia-dev.c
blob13ab317bfff15515c8957386bcf35f501d9fb9be
1 /**
2 * @file microdia-dev.c
3 * @author Nicolas VIVIEN
4 * @date 2008-02-01
6 * @brief Device specific functions
8 * @note Copyright (C) Nicolas VIVIEN
10 * @par Licences
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27 #include <linux/errno.h>
28 #include <linux/string.h>
29 #include <stdarg.h>
31 #include "microdia.h"
32 #include "sn9c20x.h"
33 #include "ov7670.h"
34 #include "ov965x.h"
35 #include "mt9vx11.h"
36 #include "ov7660.h"
38 /**
39 * @brief Set USB-bandwidth to maximum
41 * @param dev Pointer to device structure
43 * @returns 0 or negative error value
45 int dev_microdia_camera_on(struct usb_microdia *dev)
47 int ret = -1;
48 struct usb_device *udev = dev->udev;
50 ret = usb_set_interface(udev, 0, 8);
52 if (ret < 0)
53 UDIA_ERROR("usb_set_interface failed !\n");
55 return ret;
58 /**
59 * @brief Set USB-bandwidth to minimum
61 * @param dev Pointer to device structure
63 * @returns 0 or negative error value
65 int dev_microdia_camera_off(struct usb_microdia *dev)
67 int ret = -1;
68 struct usb_device *udev = dev->udev;
70 ret = usb_set_interface(udev, 0, 0);
72 if (ret < 0)
73 UDIA_ERROR("usb_set_interface failed !\n");
75 return 0;
78 /**
79 * @brief Wrapper function for camera-setting functions
81 * @param dev Pointer to device structure
83 * @returns 0
85 int dev_microdia_camera_settings(struct usb_microdia *dev)
87 dev_microdia_camera_set_contrast(dev);
88 dev_microdia_camera_set_brightness(dev);
89 dev_microdia_camera_set_gamma(dev);
90 dev_microdia_camera_set_exposure(dev);
91 dev_microdia_camera_set_hvflip(dev);
92 dev_microdia_camera_set_sharpness(dev);
93 dev_microdia_camera_set_rgb_gain(dev);
94 dev_microdia_camera_set_auto_exposure(dev);
95 dev_microdia_camera_set_auto_whitebalance(dev);
96 return 0;
99 /**
100 * @brief Wrapper function for device-specific contrast functions
102 * @param dev Pointer to device structure
104 * @returns 0 or negative error value
106 int dev_microdia_camera_set_contrast(struct usb_microdia *dev)
108 int ret = -ENODEV;
109 if (dev && dev->set_contrast)
110 ret = dev->set_contrast(dev);
111 return ret;
115 * @brief Wrapper function for device-specific brightness functions
117 * @param dev Pointer to device structure
119 * @returns 0 or negative error value
121 int dev_microdia_camera_set_brightness(struct usb_microdia *dev)
123 int ret = -ENODEV;
124 if (dev && dev->set_brightness)
125 ret = dev->set_brightness(dev);
126 return ret;
130 * @brief Wrapper function for device-specific gamma functions
132 * @param dev Pointer to device structure
134 * @returns 0 or negative error value
136 int dev_microdia_camera_set_gamma(struct usb_microdia *dev)
138 int ret = -ENODEV;
139 if (dev && dev->set_gamma)
140 ret = dev->set_gamma(dev);
141 return ret;
145 * @brief Wrapper function for device-specific exposure functions
147 * @param dev Pointer to device structure
149 * @returns 0 or negative error value
151 int dev_microdia_camera_set_exposure(struct usb_microdia *dev)
153 if (dev->set_exposure != NULL)
154 return dev->set_exposure(dev);
156 return 0;
160 * @brief Wrapper function for device-specific hvflip functions
162 * @param dev Pointer to device structure
164 * @returns 0 or negative error value
166 int dev_microdia_camera_set_hvflip(struct usb_microdia *dev)
168 int ret = -ENODEV;
169 if (dev && dev->set_hvflip)
170 ret = dev->set_hvflip(dev);
172 return ret;
176 * @brief Wrapper function for device-specific sharpness functions
178 * @param dev Pointer to device structure
180 * @returns 0 or negative error value
182 int dev_microdia_camera_set_sharpness(struct usb_microdia *dev)
184 int ret = -ENODEV;
185 if (dev && dev->set_sharpness)
186 ret = dev->set_sharpness(dev);
188 return ret;
192 * @brief Wrapper function for device-specific rgb-gain functions
194 * @param dev Pointer to device structure
196 * @returns 0 or negative error value
198 int dev_microdia_camera_set_rgb_gain(struct usb_microdia *dev)
200 int ret = -ENODEV;
201 if (dev && dev->set_rgb_gain)
202 ret = dev->set_rgb_gain(dev);
204 return ret;
208 * @brief Wrapper function for device-specific auto-exposure functions
210 * @param dev Pointer to device structure
212 * @returns 0 or negative error value
214 int dev_microdia_camera_set_auto_exposure(struct usb_microdia *dev)
216 int ret = -ENODEV;
217 if (dev && dev->set_auto_exposure)
218 ret = dev->set_auto_exposure(dev);
220 return ret;
224 * @brief Wrapper function for device-specific auto-whitebalance functions
226 * @param dev Pointer to device structure
228 * @returns 0 or negative error value
230 int dev_microdia_camera_set_auto_whitebalance(struct usb_microdia *dev)
232 int ret = -ENODEV;
233 if (dev && dev->set_auto_whitebalance)
234 ret = dev->set_auto_whitebalance(dev);
236 return ret;
241 * @brief Wrapper function for device-specific initialization functions
243 * @param dev Pointer to device structure
245 * @returns 0 or negative error value
247 int dev_microdia_initialize_device(struct usb_microdia *dev)
249 int ret = -ENODEV;
251 if (dev && dev->initialize)
252 ret = dev->initialize(dev);
254 return ret;
258 * @brief From init-physical-replug.log
260 * @param dev
262 * @returns 0
264 * @author psnel
266 * For SN9C201 with MI1300.
269 int microdia_6240_initialize(struct usb_microdia *dev)
271 return 0;
275 * @brief From start.log (14 jun 2008)
277 * @param dev
279 * @returns 0
281 * @author psnel
283 * For SN9C201 with MI1300.
286 int microdia_6240_start_stream(struct usb_microdia *dev)
288 int ret = 0;
289 int i;
290 __u16 reg;
291 __u8 value[1];
293 /* Setup the bridge registers */
294 static __u16 bridge6240_init[][2] = {
295 {0x1020, 0x80},
296 {0x1066, 0x00},
297 {0x1007, 0x20},
298 {0x1006, 0x00},
299 {0x1000, 0x78},
300 {0x1001, 0xc7},
301 {0x1002, 0x18},
302 {0x1006, 0x80},
303 {0x1007, 0xa0},
304 {0x1061, 0x01},
305 {0x1020, 0x80},
306 {0x1067, 0x40},
307 {0x1068, 0x30},
308 {0x1069, 0x20},
309 {0x1070, 0x10},
310 {0x1071, 0x08},
311 {0x10e0, 0x45},
312 {0x10f5, 0x60},
313 {0x10f8, 0x00},
314 {0x10f9, 0x00},
315 {0x10fa, 0x00},
316 {0x10fb, 0x00},
317 {0x10fc, 0xa0},
318 {0x10fd, 0x00},
319 {0x10fe, 0xf0},
320 {0x10ff, 0x00},
321 {0x1188, 0x06},
322 {0x1189, 0x4c},
323 {0x1190, 0x08},
324 {0x118b, 0x00},
325 {0x118c, 0x20},
326 {0x118d, 0x20},
327 {0x118e, 0x20},
328 {0x118f, 0x20},
329 {0x1190, 0x00},
330 {0x1191, 0x24},
331 {0x1192, 0x3b},
332 {0x1193, 0x4f},
333 {0x1194, 0x61},
334 {0x1195, 0x71},
335 {0x1196, 0x80},
336 {0x1197, 0x8f},
337 {0x1198, 0x9d},
338 {0x1199, 0xab},
339 {0x119a, 0xb8},
340 {0x119b, 0xc4},
341 {0x119c, 0xd1},
342 {0x119d, 0xdd},
343 {0x119e, 0xe9},
344 {0x119f, 0xf4},
345 {0x11a0, 0xff},
346 {0x11a1, 0x00},
347 {0x11a2, 0x00},
348 {0x11b8, 0x60},
349 {0x11b9, 0x28},
350 {0x11ba, 0x00},
351 {0x11bb, 0x08},
352 {0x11bc, 0x00},
353 {0x11bd, 0x00},
354 {0x11be, 0x00},
355 {0x11bf, 0x00},
356 {0x11c0, 0x00},
357 {0x11b8, 0x38},
358 {0x1000, 0x78},
359 {0x10e0, 0x47},
360 {0x10e0, 0x07},
361 {0x1001, 0xc6},
362 {0x1001, 0xc4},
363 {0x1001, 0x44},
364 {0x1189, 0x0c},
365 {0x11bc, 0x00},
366 {0x11bd, 0x00},
367 {0x11be, 0x00},
368 {0x11bf, 0x00},
369 {0x1180, 0x02},
370 {0x1181, 0x00},
371 {0x1182, 0x02},
372 {0x1183, 0x00},
373 {0x1184, 0x28},
374 {0x1185, 0x3c},
375 {0x11fb, 0x00},
376 {0x11fc, 0xa0},
377 {0x11fd, 0x00},
378 {0x11fe, 0xf0},
379 {0x11ff, 0x00},
380 {0x1189, 0x0c},
381 {0x11a1, 0x00},
382 {0x11a2, 0x00},
383 {0x11a3, 0x6a},
384 {0x11a4, 0x50},
385 {0x11ab, 0x00},
386 {0x11ac, 0x00},
387 {0x11ad, 0x50},
388 {0x11ae, 0x3c},
389 {0x1000, 0x7c},
390 {0x1002, 0x1c},
391 {0x1002, 0x1c},
392 {0x11b8, 0x38},
393 {0x118a, 0x05},
394 {0x0395, 0x05},
395 {0x11b8, 0x78},
396 {0x11b8, 0x79},
397 {0x11b8, 0x7a},
398 {0x11b8, 0x7b},
399 {0x11b8, 0xfc},
400 {0x11b8, 0x78},
401 {0x11ba, 0x0a},
402 {0x118b, 0x0a},
403 {0x10f7, 0x07},
404 {0x10f8, 0x14},
405 {0x10fa, 0xff},
406 {0x10f9, 0x00},
407 {0x10f9, 0x00},
408 {0x11ba, 0x0a},
409 {0x11bc, 0x00},
410 {0x11bd, 0x00},
411 {0x11be, 0x00},
412 {0x11bf, 0x00},
413 {0x11c0, 0x00},
414 {0x11c1, 0x00},
415 {0x11c2, 0x00},
416 {0x11c3, 0x00},
417 {0x11c4, 0x00},
418 {0x11c5, 0x00},
419 {0x11c6, 0x00},
420 {0x11c7, 0x00},
421 {0x11c8, 0x00},
422 {0x11c9, 0x00},
423 {0x11ca, 0x00},
424 {0x11cb, 0x00},
425 {0x11cc, 0x00},
426 {0x11cd, 0x00},
427 {0x11ce, 0x00},
428 {0x11cf, 0x00},
429 {0x11d0, 0x00},
430 {0x11d1, 0x00},
431 {0x11d2, 0x00},
432 {0x11d3, 0x00},
433 {0x11d4, 0x00},
434 {0x11d5, 0x00},
435 {0x11d6, 0x00},
436 {0x11d7, 0x00},
437 {0x11d8, 0x00},
438 {0x11d9, 0x00},
439 {0x11da, 0x00},
440 {0x11db, 0x00},
441 {0x11dc, 0x00},
442 {0x11dd, 0x00},
443 {0x11de, 0x00},
444 {0x11df, 0x00},
445 {0x11e0, 0x00},
446 {0x11e1, 0x00},
447 {0x11e2, 0x00},
448 {0x11e3, 0x00},
449 {0x11e4, 0x00},
450 {0x11e5, 0x00},
451 {0x11e6, 0x00},
452 {0x11e7, 0x00},
453 {0x11e8, 0x00},
454 {0x11e9, 0x00},
455 {0x11ea, 0x00},
456 {0x11eb, 0x00},
457 {0x11ec, 0x00},
458 {0x11ed, 0x00},
459 {0x11ee, 0x00},
460 {0x11ef, 0x00},
461 {0x1180, 0x02},
462 {0x11a5, 0x2d},
463 {0x11a6, 0x2d},
464 {0x11a7, 0x3a},
465 {0x11a8, 0x05},
466 {0x11a9, 0x04},
467 {0x11aa, 0x3f},
468 {0x11af, 0x28},
469 {0x11b0, 0xd8},
470 {0x11b1, 0x14},
471 {0x11b2, 0xec},
472 {0x11b3, 0x32},
473 {0x11b4, 0xdd},
474 {0x11b5, 0x2d},
475 {0x11b6, 0xdd},
476 {0x10e0, 0x07},
477 {0x10e0, 0x27},
478 {0x1100, 0x0d},
479 {0x1101, 0x08},
480 {0x1102, 0x08},
481 {0x1103, 0x0d},
482 {0x1104, 0x08},
483 {0x1105, 0x08},
484 {0x1106, 0x0d},
485 {0x1107, 0x0d},
486 {0x1108, 0x0d},
487 {0x1109, 0x0d},
488 {0x110a, 0x11},
489 {0x110b, 0x0d},
490 {0x110c, 0x0d},
491 {0x110d, 0x11},
492 {0x110e, 0x15},
493 {0x110f, 0x21},
494 {0x1110, 0x15},
495 {0x1111, 0x15},
496 {0x1112, 0x11},
497 {0x1113, 0x11},
498 {0x1114, 0x15},
499 {0x1115, 0x2a},
500 {0x1116, 0x1d},
501 {0x1117, 0x1d},
502 {0x1118, 0x19},
503 {0x1119, 0x21},
504 {0x111a, 0x32},
505 {0x111b, 0x2a},
506 {0x111c, 0x32},
507 {0x111d, 0x32},
508 {0x111e, 0x2e},
509 {0x111f, 0x2a},
510 {0x1120, 0x2e},
511 {0x1121, 0x2e},
512 {0x1122, 0x36},
513 {0x1123, 0x3a},
514 {0x1124, 0x4b},
515 {0x1125, 0x43},
516 {0x1126, 0x36},
517 {0x1127, 0x3a},
518 {0x1128, 0x47},
519 {0x1129, 0x3a},
520 {0x112a, 0x2e},
521 {0x112b, 0x2e},
522 {0x112c, 0x43},
523 {0x112d, 0x5c},
524 {0x112e, 0x43},
525 {0x112f, 0x47},
526 {0x1130, 0x4f},
527 {0x1131, 0x54},
528 {0x1132, 0x58},
529 {0x1133, 0x58},
530 {0x1134, 0x58},
531 {0x1135, 0x32},
532 {0x1136, 0x3f},
533 {0x1137, 0x60},
534 {0x1138, 0x64},
535 {0x1139, 0x5c},
536 {0x113a, 0x54},
537 {0x113b, 0x64},
538 {0x113c, 0x4b},
539 {0x113d, 0x54},
540 {0x113e, 0x58},
541 {0x113f, 0x54},
542 {0x1140, 0x0d},
543 {0x1141, 0x11},
544 {0x1142, 0x11},
545 {0x1143, 0x15},
546 {0x1144, 0x11},
547 {0x1145, 0x15},
548 {0x1146, 0x26},
549 {0x1147, 0x15},
550 {0x1148, 0x15},
551 {0x1149, 0x26},
552 {0x114a, 0x54},
553 {0x114b, 0x36},
554 {0x114c, 0x2e},
555 {0x114d, 0x36},
556 {0x114e, 0x54},
557 {0x114f, 0x54},
558 {0x1150, 0x54},
559 {0x1151, 0x54},
560 {0x1152, 0x54},
561 {0x1153, 0x54},
562 {0x1154, 0x54},
563 {0x1155, 0x54},
564 {0x1156, 0x54},
565 {0x1157, 0x54},
566 {0x1158, 0x54},
567 {0x1159, 0x54},
568 {0x115a, 0x54},
569 {0x115b, 0x54},
570 {0x115c, 0x54},
571 {0x115d, 0x54},
572 {0x115e, 0x54},
573 {0x115f, 0x54},
574 {0x1160, 0x54},
575 {0x1161, 0x54},
576 {0x1162, 0x54},
577 {0x1163, 0x54},
578 {0x1164, 0x54},
579 {0x1165, 0x54},
580 {0x1166, 0x54},
581 {0x1167, 0x54},
582 {0x1168, 0x54},
583 {0x1169, 0x54},
584 {0x116a, 0x54},
585 {0x116b, 0x54},
586 {0x116c, 0x54},
587 {0x116d, 0x54},
588 {0x116e, 0x54},
589 {0x116f, 0x54},
590 {0x1170, 0x54},
591 {0x1171, 0x54},
592 {0x1172, 0x54},
593 {0x1173, 0x54},
594 {0x1174, 0x54},
595 {0x1175, 0x54},
596 {0x1176, 0x54},
597 {0x1177, 0x54},
598 {0x1178, 0x54},
599 {0x1179, 0x54},
600 {0x117a, 0x54},
601 {0x117b, 0x54},
602 {0x117c, 0x54},
603 {0x117d, 0x54},
604 {0x117e, 0x54},
605 {0x117f, 0x54},
606 {0x11e0, 0x07},
607 {0x11e0, 0x0b},
608 {0x1189, 0x0c},
609 {0x11bc, 0x00},
610 {0x11bd, 0x00},
611 {0x11be, 0x00},
612 {0x11bf, 0x00},
613 {0x1180, 0x02},
614 {0x1181, 0x00},
615 {0x1182, 0x02},
616 {0x1183, 0x00},
617 {0x1184, 0x28},
618 {0x1185, 0x3c},
619 {0x10fb, 0x00},
620 {0x10fc, 0xa0},
621 {0x10fd, 0x00},
622 {0x10fe, 0xf0},
623 {0x10ff, 0x00},
624 {0x1189, 0x0c},
625 {0x11a1, 0x00},
626 {0x11a2, 0x00},
627 {0x11a3, 0x6a},
628 {0x11a4, 0x50},
629 {0x11ab, 0x00},
630 {0x11ac, 0x00},
631 {0x11ad, 0x50},
632 {0x11ae, 0x3c},
633 {0x1061, 0x03},
634 {0x11ba, 0x0a},
635 {0x11b9, 0x00},
636 {0x11ba, 0x0b},
637 {0x1061, 0x01},
638 {0x1000, 0x7c},
639 {0x1002, 0x1c},
640 {0x1002, 0x1c},
641 {0x11b8, 0x78},
642 {0x118a, 0x05},
643 {0x0395, 0x05},
644 {0x11b8, 0x78},
645 {0x11b8, 0x79},
646 {0x11b8, 0x7a},
647 {0x11b8, 0x7b},
648 {0x11b8, 0xfc},
649 {0x11b8, 0x78},
650 {0x1061, 0x03},
651 {0x1061, 0x01},
652 {0x1000, 0x3c},
653 {0x11b8, 0x68},
654 {0x1007, 0xa0},
655 {0x1006, 0xa0},
656 {0x1000, 0x98},
657 {0x1001, 0xef},
658 {0x1002, 0x11},
659 {0x1066, 0x00},
660 {0x1066, 0x01},
661 {0x1007, 0xa0},
662 {0x1006, 0x80},
663 {0x1000, 0x78},
664 {0x1001, 0xc7},
665 {0x1002, 0x18},
666 {0x1006, 0x80},
667 {0x1007, 0xa0},
668 {0x1061, 0x01},
669 {0x1020, 0x80},
670 {0x1067, 0x40},
671 {0x1068, 0x30},
672 {0x1069, 0x20},
673 {0x106a, 0x10},
674 {0x106b, 0x08},
675 {0x10e0, 0x45},
676 {0x10f5, 0x60},
677 {0x10f8, 0x00},
678 {0x10f9, 0x00},
679 {0x10fa, 0x00},
680 {0x10fb, 0x00},
681 {0x10fc, 0xa0},
682 {0x10fd, 0x00},
683 {0x10fe, 0xf0},
684 {0x10ff, 0x00},
685 {0x1188, 0x06},
686 {0x1189, 0x4c},
687 {0x118a, 0x08},
688 {0x118b, 0x00},
689 {0x118c, 0x20},
690 {0x118d, 0x20},
691 {0x118e, 0x20},
692 {0x118f, 0x20},
693 {0x1190, 0x00},
694 {0x1191, 0x24},
695 {0x1192, 0x3b},
696 {0x1193, 0x4f},
697 {0x1194, 0x61},
698 {0x1195, 0x71},
699 {0x1196, 0x80},
700 {0x1197, 0x8f},
701 {0x1198, 0x9d},
702 {0x119a, 0xab},
703 {0x119b, 0xb8},
704 {0x119c, 0xc4},
705 {0x119d, 0xd1},
706 {0x119e, 0xdd},
707 {0x119f, 0xe9},
708 {0x1200, 0xf4},
709 {0x1201, 0xff},
710 {0x11a1, 0x00},
711 {0x11a2, 0x00},
712 {0x11b7, 0x60},
713 {0x11b8, 0x28},
714 {0x11b9, 0x00},
715 {0x11ba, 0x08},
716 {0x11bb, 0x00},
717 {0x11bc, 0x00},
718 {0x11bd, 0x00},
719 {0x11be, 0x00},
720 {0x11bf, 0x00},
721 {0x11b8, 0x38},
722 {0x1000, 0x78},
723 {0x10e0, 0x47},
724 {0x10e0, 0x07},
725 {0x1001, 0xc6},
726 {0x1001, 0xc4},
727 {0x1001, 0x44},
728 {0x1189, 0x0c},
729 {0x11bc, 0x00},
730 {0x11bd, 0x00},
731 {0x11be, 0x00},
732 {0x11bf, 0x00},
733 {0x1180, 0x02},
734 {0x1181, 0x00},
735 {0x1182, 0x02},
736 {0x1183, 0x00},
737 {0x1184, 0x28},
738 {0x1185, 0x3c},
739 {0x10fb, 0x00},
740 {0x10fc, 0xa0},
741 {0x10fd, 0x00},
742 {0x10fe, 0xf0},
743 {0x10ff, 0x00},
744 {0x1189, 0x0c},
745 {0x11a1, 0x00},
746 {0x11a2, 0x00},
747 {0x11a3, 0x6a},
748 {0x11a4, 0x50},
749 {0x11ab, 0x00},
750 {0x11ac, 0x00},
751 {0x11ad, 0x50},
752 {0x11ae, 0x3c},
753 {0x1000, 0x7c},
754 {0x1002, 0x1c},
755 {0x1002, 0x1c},
756 {0x11b8, 0x38},
757 {0x118a, 0x05},
758 {0x0395, 0x05},
759 {0x11b8, 0x78},
760 {0x11b8, 0x79},
761 {0x11b8, 0x7a},
762 {0x11b8, 0x7b},
763 {0x11b8, 0xfc},
764 {0x11b8, 0x78},
765 {0x11ba, 0x0a},
766 {0x118b, 0x0a},
767 {0x10f7, 0x07},
768 {0x10f8, 0x14},
769 {0x10fa, 0xff},
770 {0x10f9, 0x00},
771 {0x10f9, 0x00},
772 {0x11ba, 0x0a},
773 {0x11bc, 0x00},
774 {0x11bd, 0x00},
775 {0x11be, 0x00},
776 {0x11bf, 0x00},
777 {0x11c0, 0x00},
778 {0x11c1, 0x00},
779 {0x11c2, 0x00},
780 {0x11c3, 0x00},
781 {0x11c4, 0x00},
782 {0x11c5, 0x00},
783 {0x11c6, 0x00},
784 {0x11c7, 0x00},
785 {0x11c8, 0x00},
786 {0x11c9, 0x00},
787 {0x11ca, 0x00},
788 {0x11cb, 0x00},
789 {0x11cc, 0x00},
790 {0x11cd, 0x00},
791 {0x11ce, 0x00},
792 {0x11cf, 0x00},
793 {0x11d0, 0x00},
794 {0x11d1, 0x00},
795 {0x11d2, 0x00},
796 {0x11d3, 0x00},
797 {0x11d4, 0x00},
798 {0x11d5, 0x00},
799 {0x11d6, 0x00},
800 {0x11d7, 0x00},
801 {0x11d8, 0x00},
802 {0x11d9, 0x00},
803 {0x11da, 0x00},
804 {0x11db, 0x00},
805 {0x11dc, 0x00},
806 {0x11dd, 0x00},
807 {0x11de, 0x00},
808 {0x11df, 0x00},
809 {0x11e0, 0x00},
810 {0x11e1, 0x00},
811 {0x11e2, 0x00},
812 {0x11e3, 0x00},
813 {0x11e4, 0x00},
814 {0x11e5, 0x00},
815 {0x11e6, 0x00},
816 {0x11e7, 0x00},
817 {0x11e8, 0x00},
818 {0x11e9, 0x00},
819 {0x11ea, 0x00},
820 {0x11eb, 0x00},
821 {0x11ec, 0x00},
822 {0x11ed, 0x00},
823 {0x11ee, 0x00},
824 {0x11ef, 0x00},
825 {0x1180, 0x02},
826 {0x1182, 0x02},
827 {0x11a5, 0x2d},
828 {0x11a6, 0x2d},
829 {0x11a7, 0x3a},
830 {0x11a8, 0x05},
831 {0x11a9, 0x04},
832 {0x11aa, 0x3f},
833 {0x11af, 0x28},
834 {0x11b0, 0xd8},
835 {0x11b1, 0x14},
836 {0x11b2, 0xec},
837 {0x11b3, 0x32},
838 {0x11b4, 0xdd},
839 {0x11b5, 0x2d},
840 {0x11b6, 0xdd},
841 {0x11e0, 0x07},
842 {0x11e0, 0x27},
843 {0x1100, 0x0d},
844 {0x1101, 0x08},
845 {0x1102, 0x08},
846 {0x1103, 0x0d},
847 {0x1104, 0x08},
848 {0x1105, 0x08},
849 {0x1106, 0x0d},
850 {0x1107, 0x0d},
851 {0x1108, 0x0d},
852 {0x1109, 0x0d},
853 {0x110a, 0x11},
854 {0x110b, 0x0d},
855 {0x110c, 0x0d},
856 {0x110d, 0x11},
857 {0x110e, 0x15},
858 {0x110f, 0x21},
859 {0x1110, 0x15},
860 {0x1111, 0x15},
861 {0x1112, 0x11},
862 {0x1113, 0x11},
863 {0x1114, 0x15},
864 {0x1115, 0x2a},
865 {0x1116, 0x1d},
866 {0x1117, 0x1d},
867 {0x1118, 0x19},
868 {0x1119, 0x21},
869 {0x111a, 0x32},
870 {0x111b, 0x2a},
871 {0x111c, 0x32},
872 {0x111d, 0x32},
873 {0x111e, 0x2e},
874 {0x111f, 0x2a},
875 {0x1120, 0x2e},
876 {0x1121, 0x2e},
877 {0x1122, 0x36},
878 {0x1123, 0x3a},
879 {0x1124, 0x4b},
880 {0x1125, 0x43},
881 {0x1126, 0x36},
882 {0x1127, 0x3a},
883 {0x1128, 0x47},
884 {0x1129, 0x3a},
885 {0x112a, 0x2e},
886 {0x112b, 0x2e},
887 {0x112c, 0x43},
888 {0x112d, 0x5c},
889 {0x112e, 0x43},
890 {0x112f, 0x47},
891 {0x1130, 0x4f},
892 {0x1131, 0x54},
893 {0x1132, 0x58},
894 {0x1133, 0x58},
895 {0x1134, 0x58},
896 {0x1135, 0x32},
897 {0x1136, 0x3f},
898 {0x1137, 0x60},
899 {0x1138, 0x64},
900 {0x1139, 0x5c},
901 {0x113a, 0x54},
902 {0x113b, 0x64},
903 {0x113c, 0x4b},
904 {0x113d, 0x54},
905 {0x113e, 0x58},
906 {0x113f, 0x54},
907 {0x1140, 0x0d},
908 {0x1141, 0x11},
909 {0x1142, 0x11},
910 {0x1143, 0x15},
911 {0x1144, 0x11},
912 {0x1145, 0x15},
913 {0x1146, 0x26},
914 {0x1147, 0x15},
915 {0x1148, 0x15},
916 {0x1149, 0x26},
917 {0x114a, 0x54},
918 {0x114b, 0x36},
919 {0x114c, 0x2e},
920 {0x114d, 0x36},
921 {0x114e, 0x54},
922 {0x114f, 0x54},
923 {0x1150, 0x54},
924 {0x1151, 0x54},
925 {0x1152, 0x54},
926 {0x1153, 0x54},
927 {0x1154, 0x54},
928 {0x1155, 0x54},
929 {0x1156, 0x54},
930 {0x1157, 0x54},
931 {0x1158, 0x54},
932 {0x1159, 0x54},
933 {0x115a, 0x54},
934 {0x115b, 0x54},
935 {0x115c, 0x54},
936 {0x115d, 0x54},
937 {0x115e, 0x54},
938 {0x115f, 0x54},
939 {0x1160, 0x54},
940 {0x1161, 0x54},
941 {0x1162, 0x54},
942 {0x1163, 0x54},
943 {0x1164, 0x54},
944 {0x1165, 0x54},
945 {0x1166, 0x54},
946 {0x1167, 0x54},
947 {0x1168, 0x54},
948 {0x1169, 0x54},
949 {0x116a, 0x54},
950 {0x116b, 0x54},
951 {0x116c, 0x54},
952 {0x116d, 0x54},
953 {0x116e, 0x54},
954 {0x116f, 0x54},
955 {0x1170, 0x54},
956 {0x1171, 0x54},
957 {0x1172, 0x54},
958 {0x1173, 0x54},
959 {0x1174, 0x54},
960 {0x1175, 0x54},
961 {0x1176, 0x54},
962 {0x1177, 0x54},
963 {0x1178, 0x54},
964 {0x1179, 0x54},
965 {0x117a, 0x54},
966 {0x117b, 0x54},
967 {0x117c, 0x54},
968 {0x117d, 0x54},
969 {0x117e, 0x54},
970 {0x117f, 0x54},
971 {0x11e0, 0x07},
972 {0x11e0, 0x0b},
973 {0x1189, 0x0c},
974 {0x1189, 0x00},
975 {0x11bc, 0x00},
976 {0x11bd, 0x00},
977 {0x11be, 0x00},
978 {0x11bf, 0x00},
979 {0x1180, 0x02},
980 {0x1181, 0x00},
981 {0x1182, 0x02},
982 {0x1183, 0x00},
983 {0x1184, 0x28},
984 {0x1185, 0x3c},
985 {0x10fb, 0x00},
986 {0x10fc, 0xa0},
987 {0x10fd, 0x00},
988 {0x10fe, 0xf0},
989 {0x10ff, 0x00},
990 {0x1189, 0x0c},
991 {0x11a1, 0x00},
992 {0x11a2, 0x00},
993 {0x11a3, 0x6a},
994 {0x11a4, 0x50},
995 {0x11ab, 0x00},
996 {0x11ac, 0x00},
997 {0x11ad, 0x50},
998 {0x11ae, 0x3c},
999 {0x1061, 0x03},
1000 {0x11ba, 0x0a},
1001 {0x11b9, 0x00},
1002 {0x11ba, 0x0b},
1003 {0x1061, 0x01},
1004 {0x1000, 0x7c},
1005 {0x1002, 0x1c},
1006 {0x1002, 0x1c},
1007 {0x11b8, 0x78},
1008 {0x118a, 0x05},
1009 {0x0395, 0x05},
1010 {0x11b8, 0x78},
1011 {0x11b8, 0x79},
1012 {0x11b8, 0x7a},
1013 {0x11b8, 0x7b},
1014 {0x11b8, 0xfc},
1015 {0x11b8, 0x78},
1016 {0x1061, 0x03},
1019 static __u8 mi1300_init[][2] = {
1020 {0x07, 0x00},
1021 {0x08, 0x02},
1022 {0x0d, 0x00},
1023 {0x0e, 0x01},
1024 {0x0d, 0x00},
1025 {0x0e, 0x00},
1026 {0x01, 0x00},
1027 {0x02, 0x0e},
1028 {0x03, 0x00},
1029 {0x04, 0x14},
1030 {0x03, 0x03},
1031 {0x04, 0xc1},
1032 {0x05, 0x05},
1033 {0x06, 0x01},
1034 {0x05, 0x00},
1035 {0x06, 0x83},
1036 {0x07, 0x00},
1037 {0x08, 0x06},
1038 {0x0d, 0x00},
1039 {0x0e, 0x02},
1040 {0x09, 0x00},
1041 {0x0a, 0x00},
1042 {0x0b, 0x00},
1043 {0x0c, 0x00},
1044 {0x0b, 0x00},
1045 {0x0c, 0x00},
1046 {0x0d, 0x00},
1047 {0x0e, 0x00},
1048 {0x11, 0x00},
1049 {0x12, 0x00},
1050 {0x1e, 0x80},
1051 {0x1f, 0x00},
1052 {0x20, 0x11},
1053 {0x21, 0x05},
1054 {0x2b, 0x00},
1055 {0x2c, 0x08},
1056 {0x2d, 0x00},
1057 {0x2e, 0x10},
1058 {0x2d, 0x00},
1059 {0x2e, 0x14},
1060 {0x2f, 0x00},
1061 {0x30, 0x08},
1062 {0x5f, 0x89},
1063 {0x60, 0x04},
1064 {0x60, 0x00},
1065 {0x61, 0x00},
1066 {0x62, 0x00},
1067 {0x63, 0x00},
1068 {0x62, 0x04},
1069 {0x63, 0x98},
1070 {0x64, 0x00},
1071 {0x65, 0x00},
1072 {0x68, 0x00},
1073 {0x69, 0x00},
1074 {0x20, 0x11},
1075 {0x21, 0x1d},
1076 {0x06, 0x00},
1077 {0x07, 0xf2},
1078 {0x05, 0x00},
1079 {0x06, 0x13},
1080 {0x20, 0x11},
1081 {0x21, 0x1d},
1082 {0x20, 0x11},
1083 {0x21, 0x1d},
1084 {0x09, 0x03},
1085 {0x0a, 0xe8},
1086 {0x07, 0x00},
1087 {0x08, 0x03},
1088 {0x2b, 0x00},
1089 {0x2c, 0x10},
1090 {0x2d, 0x00},
1091 {0x2e, 0x10},
1092 {0x2d, 0x00},
1093 {0x2e, 0x10},
1094 {0x2f, 0x00},
1095 {0x30, 0x10},
1096 {0x07, 0x00},
1097 {0x08, 0x02},
1098 {0x07, 0x00},
1099 {0x08, 0x03},
1100 {0x2c, 0x00},
1101 {0x2d, 0x1d},
1102 {0x2e, 0x00},
1103 {0x2f, 0x1d},
1104 {0x07, 0x00},
1105 {0x08, 0x02},
1106 {0x06, 0x00},
1107 {0x07, 0xf2},
1108 {0x05, 0x00},
1109 {0x06, 0x13},
1110 {0x00, 0x00},
1111 {0x07, 0x00},
1112 {0x08, 0x00},
1113 {0x07, 0x00},
1114 {0x08, 0x00},
1115 {0x07, 0x00},
1116 {0x08, 0x02},
1117 {0x0d, 0x00},
1118 {0x0e, 0x01},
1119 {0x0d, 0x00},
1120 {0x0e, 0x00},
1121 {0x01, 0x00},
1122 {0x02, 0x0e},
1123 {0x03, 0x00},
1124 {0x04, 0x14},
1125 {0x03, 0x03},
1126 {0x04, 0xc1},
1127 {0x05, 0x05},
1128 {0x06, 0x01},
1129 {0x05, 0x00},
1130 {0x06, 0x83},
1131 {0x07, 0x00},
1132 {0x08, 0x06},
1133 {0x0d, 0x00},
1134 {0x0e, 0x02},
1135 {0x09, 0x00},
1136 {0x0a, 0x00},
1137 {0x0b, 0x00},
1138 {0x0c, 0x00},
1139 {0x0b, 0x00},
1140 {0x0c, 0x00},
1141 {0x0d, 0x00},
1142 {0x0e, 0x00},
1143 {0x11, 0x00},
1144 {0x12, 0x00},
1145 {0x1e, 0x80},
1146 {0x1f, 0x00},
1147 {0x20, 0x11},
1148 {0x21, 0x05},
1149 {0x2b, 0x00},
1150 {0x2c, 0x08},
1151 {0x2d, 0x00},
1152 {0x2e, 0x10},
1153 {0x2d, 0x00},
1154 {0x2e, 0x14},
1155 {0x2f, 0x00},
1156 {0x30, 0x08},
1157 {0x5f, 0x89},
1158 {0x60, 0x04},
1159 {0x60, 0x00},
1160 {0x61, 0x00},
1161 {0x62, 0x00},
1162 {0x63, 0x00},
1163 {0x62, 0x00},
1164 {0x63, 0x98},
1165 {0x64, 0x00},
1166 {0x65, 0x00},
1167 {0x68, 0x00},
1168 {0x69, 0x00},
1169 {0x20, 0x11},
1170 {0x21, 0x1d},
1171 {0x06, 0x00},
1172 {0x07, 0xf2},
1173 {0x05, 0x00},
1174 {0x06, 0x13},
1175 {0x20, 0x11},
1176 {0x21, 0x1d},
1177 {0x20, 0x11},
1178 {0x21, 0x1d},
1179 {0x07, 0x00},
1180 {0x08, 0x03},
1181 {0x2b, 0x00},
1182 {0x2c, 0x10},
1183 {0x2d, 0x00},
1184 {0x2e, 0x10},
1185 {0x2d, 0x00},
1186 {0x2e, 0x10},
1187 {0x2f, 0x00},
1188 {0x30, 0x10},
1189 {0x07, 0x00},
1190 {0x08, 0x02},
1191 {0x07, 0x00},
1192 {0x08, 0x03},
1193 {0x2c, 0x00},
1194 {0x2d, 0x1d},
1195 {0x2e, 0x00},
1196 {0x2f, 0x1d},
1197 {0x07, 0x00},
1198 {0x08, 0x02},
1199 {0x06, 0x00},
1200 {0x07, 0xf2},
1201 {0x05, 0x00},
1202 {0x06, 0x13},
1203 {0x00, 0x00},
1206 /* initialize SN9C201 for 6240 */
1207 for (i = 0; i < ARRAY_SIZE(bridge6240_init); i++) {
1208 reg = bridge6240_init[i][0];
1209 value[0] = bridge6240_init[i][1];
1210 ret = usb_microdia_control_write(dev, reg, value, 1);
1211 if (ret < 0) {
1212 UDIA_INFO("6240 Bridge: Inititialization Error (%d) on array line %d\n", ret, i);
1213 break;
1217 /* initialize the Bridge to I2C interface */
1218 ret = sn9c20x_i2c_initialize(dev);
1220 /* initialize the Sensor MI 1300 */
1221 for (i = 0; i < ARRAY_SIZE(mi1300_init); i++) {
1222 reg = mi1300_init[i][0];
1223 value[0] = mi1300_init[i][1];
1224 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
1225 reg, dev->sensor_flags, value);
1226 if (ret < 0) {
1227 UDIA_INFO("Sensor MI 1300: Inititialization Error (%d) on array line %d\n", ret, i);
1228 break;
1232 UDIA_INFO("...start function completed without errors.\n");
1233 return ret;
1237 * @brief From stop-close-amcap.log
1239 * @param dev
1241 * @returns 0
1243 * @author psnel
1245 * For SN9C201 with MI1300. Comments from parser-usbsnoop(updated_13Mar2008).pl output
1248 int microdia_6240_stop_stream(struct usb_microdia *dev)
1250 int ret = 0;
1251 int i;
1252 __u16 reg;
1253 __u8 value[1];
1255 static __u8 mi1300_stop[][2] = {
1256 {0x07, 0x00},
1257 {0x08, 0x00},
1260 static __u16 bridge6240_stop[][2] = {
1261 {0x1061, 0x01},
1262 {0x1000, 0x3c},
1263 {0x11b8, 0x68},
1264 {0x1007, 0xa0},
1265 {0x1006, 0xa0},
1266 {0x1000, 0x98},
1267 {0x1001, 0xef},
1268 {0x1002, 0x11},
1269 {0x1066, 0x00},
1272 UDIA_INFO("Stopping camera...\n");
1274 for (i = 0; i < ARRAY_SIZE(mi1300_stop); i++) {
1275 reg = mi1300_stop[i][0];
1276 value[0] = mi1300_stop[i][1];
1277 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
1278 reg, dev->sensor_flags, value);
1279 if (ret < 0) {
1280 UDIA_INFO("Sensor MI 1300: Stop Sequence Error (%d) on array line %d\n", ret, i);
1281 break;
1285 for (i = 0; i < ARRAY_SIZE(bridge6240_stop); i++) {
1286 reg = bridge6240_stop[i][0];
1287 value[0] = bridge6240_stop[i][1];
1288 ret = usb_microdia_control_write(dev, reg, value, 1);
1289 if (ret < 0) {
1290 UDIA_INFO("6240 Bridge: Stop Sequence Error (%d) on array line %d\n", ret, i);
1291 break;
1295 return 0;
1299 * @brief From init.sequence.log
1301 * @param dev
1303 * @returns 0
1305 * @author GWater
1307 * For SN9C201 with SOI968.
1308 * Tests showed this function is actually unnecessary.
1309 * Nevertheless the reads may give us valuable values we don't know about yet.
1311 int microdia_624e_initialize(struct usb_microdia *dev)
1313 __u8 buf;
1315 usb_microdia_control_read(dev, 0x130d, &buf, 1);
1316 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1318 return 0;
1322 * @brief From UsbSnoop-plugin-parsed.log
1324 * @param dev
1326 * @returns
1328 int microdia_624f_initialize(struct usb_microdia *dev)
1330 /* Do nothing here */
1331 return 0;
1335 * @brief From UsbSnoop-plugin-parsed.log
1337 * @param dev
1339 * @returns
1341 int microdia_6260_initialize(struct usb_microdia *dev)
1343 __u8 buf;
1345 usb_microdia_control_read(dev, 0x130d, &buf, 1);
1346 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1347 buf = 0x00;
1348 usb_microdia_control_write(dev, 0x10c8, &buf, 1);
1349 usb_microdia_control_read(dev, 0x100a, &buf, 1);
1350 buf = 0x04;
1351 usb_microdia_control_write(dev, 0x100a, &buf, 1);
1352 usb_microdia_control_read(dev, 0x100b, &buf, 1);
1353 buf = 0x04;
1354 usb_microdia_control_write(dev, 0x100b, &buf, 1);
1355 usb_microdia_control_read(dev, 0x1001, &buf, 1);
1356 buf = 0xc7;
1357 usb_microdia_control_write(dev, 0x1001, &buf, 1);
1358 usb_microdia_control_read(dev, 0x1040, &buf, 1);
1359 buf = 0x00;
1360 usb_microdia_control_write(dev, 0x1040, &buf, 1);
1361 usb_microdia_control_read(dev, 0x1045, &buf, 1);
1362 buf = 0x04;
1363 usb_microdia_control_write(dev, 0x1045, &buf, 1);
1364 usb_microdia_control_read(dev, 0x1046, &buf, 1);
1365 buf = 0x10;
1366 usb_microdia_control_write(dev, 0x1046, &buf, 1);
1367 buf = 0x14;
1368 usb_microdia_control_write(dev, 0x1045, &buf, 1);
1369 buf = 0x01;
1370 usb_microdia_control_write(dev, 0x1040, &buf, 1);
1371 buf = 0x80;
1372 usb_microdia_control_write(dev, 0x1020, &buf, 1);
1374 return 0;
1378 * @brief From 6 init-logs
1380 * @param dev
1382 * @returns 0 (ok) or -1 (error)
1384 * @author Comer352l
1386 * Windows driver versions: 5.5.8.12 and 5.7.23.000
1387 * Windows versions: 2000 and XP
1388 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
1390 * Comments behind read oprations contain HEX-values that appeared in the logs
1392 int microdia_6270_initialize(struct usb_microdia *dev)
1394 /* int actual; */
1395 int ret = 0;
1396 int retSP = 0;
1397 int retASS = 0;
1398 __u8 buf[8];
1399 __u8 buf_0395[1];
1400 __u8 buf_1000[5];
1401 __u8 buf_1060[2];
1402 __u8 buf_11b8[1];
1404 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); /* URB 5 0x81,0x85,0x04,0x8b,0x02,... */
1406 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); /* URB 6 0xe4,0xc4,0xa4,0x44,... */
1409 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
1410 * buf[0]=0x00;
1411 * usb_microdia_control_write(dev, 0x10c8, buf, 1);
1414 ret += usb_microdia_control_read(dev, 0x118a, buf, 1); /* URB 7 0x05,0x7b,0x01,0x04,... */
1416 ret += usb_microdia_control_read(dev, 0x0395, buf_0395, 1); /* URB 8 0xc2,0x82,0x38,0x98,0x04,... */
1417 /* => this value will be rewritten to 0x118a and 0x0395 later (URBs 81+82) */
1419 buf[0] = 0x05;
1420 ret += usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 9 */
1422 ret += usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 10 */
1424 ret += usb_microdia_control_read(dev, 0x11b8, buf_11b8, 1); /* URB 11 0xa0,0x00,0x24,... */
1425 /* => this value will be rewritten to 0x11b8 later (URB 83) */
1427 buf[0] = 0x10;
1428 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 12 */
1430 ret += usb_microdia_control_read(dev, 0x1000, buf_1000, 5); /* URB 13 0x30 0xCF 0x00 0x03 (0x02 or 0x00) */
1431 /* => these values will be rewritten to 0x1000 later (URB 84) */
1433 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
1434 ret += usb_microdia_control_write(dev, 0x1000, buf, 5); /* URB 14 */
1436 ret += usb_microdia_control_read(dev, 0x1060, buf_1060, 2); /* URB 15 0x08 0x00 (always ???) */
1437 /* => this value will be rewritten to 0x1060 later (URB 85) */
1439 buf[0] = 0x00; buf[1] = 0x03;
1440 ret += usb_microdia_control_write(dev, 0x1060, buf, 2); /* URB 16 */
1442 /* initialize I2C registers to avoid getting no ACK at first I2C operation: */
1443 ret += sn9c20x_i2c_initialize(dev);
1445 /* enable I2C communication (bit 0) */
1446 buf[0] = 0x21; /* THE OLD DRIVER 5.5.8.12 WRITES 0x5d */
1447 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); /* URB 17 */
1449 /* probe sensor model: */
1450 retSP = mt9vx11_sensor_probe(dev); /* substitutes URBs 18-48 */
1451 if ((retSP == 0) && (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS))
1452 /* switch (back) to IFP address space: */
1453 retASS = mt9v111_select_address_space(dev, MT9V111_ADDRESSSPACE_IFP);
1455 ret += usb_microdia_control_write(dev, 0x118a, buf_0395, 1); /* URB 81 => write value read with URB 8 */
1457 ret += usb_microdia_control_write(dev, 0x0395, buf_0395, 1); /* URB 82 => write value read with URB 8 */
1459 ret += usb_microdia_control_write(dev, 0x11b8, buf_11b8, 1); /* URB 83 => write value read with URB 11 */
1461 ret += usb_microdia_control_write(dev, 0x1000, buf_1000, 5); /* URB 84 => write value read with URB 13 */
1463 ret += usb_microdia_control_write(dev, 0x1060, buf_1060, 2); /* URB 85 => write value read with URB 15; (always 08 00 ???) */
1465 /* USB-interrupt-message: doesn't work yet (returns error -110) */
1466 /* 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 */
1469 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
1470 * wbuf[0]=0x80;
1471 * usb_microdia_control_write(dev, 0x1020, wbuf, 1);
1474 if ((retSP != 0) || (retASS != 0) || (ret < 33)) {
1475 if (ret < 33)
1476 UDIA_INFO("One ore more errors occured during initialization !\n");
1477 return -1;
1478 } else {
1479 return 0;
1485 * @brief From UsbSnoop-plugin-parsed.log
1487 * @param dev
1489 * @returns
1491 int microdia_627b_initialize(struct usb_microdia *dev)
1493 /* Apparently we don't need to write anything here */
1494 return 0;
1498 * @brief From init-start-stop-log (made by Víctor M. Hernández Rocamora)
1500 * @param dev
1502 * @returns 0 (ok) or -1 (error)
1504 * @author Comer352l
1506 * USB-Logger: SniffUSB 2.0
1508 * Comments behind read oprations contain HEX-values that appeared in the log
1510 int microdia_627f_initialize(struct usb_microdia *dev)
1512 __u8 buf[1];
1513 int ret = 0;
1515 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); /* URB 5 0x81 */
1517 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); /* URB 6 0xe4 */
1519 buf[0] = 0x00;
1520 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); /* URB 7 */
1522 buf[0] = 0x80;
1523 ret += usb_microdia_control_write(dev, 0x1020, buf, 1); /* URB 8 */
1525 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 9 0x0f */
1527 buf[0] = 0x1f;
1528 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 10 */
1530 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 11 0x1f */
1532 buf[0] = 0x0f;
1533 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 12 */
1535 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); /* URB 13 0x0f */
1537 buf[0] = 0x1f;
1538 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); /* URB 14 */
1540 if (ret < 10) {
1541 UDIA_INFO("One ore more errors occured during initialization !\n");
1542 return -1;
1544 return 0;
1548 * @brief From UsbSnoop-plugin-parsed.log
1550 * @param dev
1552 * @returns 0 (OK) or <0 (Error)
1554 * @author Vincent, Kuzja
1556 int microdia_6288_initialize(struct usb_microdia *dev)
1559 int ret;
1560 __u16 reg;
1561 __u8 buf[2];
1563 reg = 0x130d ;
1564 ret = usb_microdia_control_read(dev, reg, buf, 1);
1565 if (ret < 0)
1566 goto err;
1568 reg = 0x1040 ;
1569 ret = usb_microdia_control_read(dev, reg, buf, 1);
1570 if (ret < 0)
1571 goto err;
1573 if (ret < 0)
1574 return ret;
1575 else
1576 return 0;
1577 err:
1578 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
1579 return ret;
1583 * @brief Wrapper function for device-specific startstream functions
1585 * @param dev Pointer to device structure
1587 * @returns 0
1589 int dev_microdia_start_stream(struct usb_microdia *dev)
1591 int ret = -ENODEV;
1592 if (dev && dev->start_stream)
1593 ret = dev->start_stream(dev);
1595 return ret;
1599 * @brief From start.htm
1601 * @param dev
1603 * @returns 0
1605 * @author GWater
1607 * For SN9C201 with MI1310.
1608 * This function has not been tested yet.
1610 int microdia_6242_start_stream(struct usb_microdia *dev)
1612 int i = -1;
1613 __u8 buf[48];
1615 __u8 urb10[24] = {
1616 0x01, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
1617 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
1618 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
1620 __u8 urb13[11] = {
1621 0x02, 0x00, 0x02, 0x00, 0x50, 0x78, 0x00, 0x00,
1622 0x07, 0xc0, 0x0a};
1624 __u8 urb14[22] = {
1625 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
1626 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
1627 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
1629 __u8 qtable1[64] = {
1630 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
1631 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
1632 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
1633 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
1634 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
1635 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
1636 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
1637 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54};
1639 __u8 qtable2[64] = {
1640 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
1641 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
1642 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1643 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1644 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1645 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1646 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
1647 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54};
1649 __u8 first10c0[7][3] = {
1650 {0x0d, 0x00, 0x08},
1651 {0x0d, 0x00, 0x09},
1652 {0x0d, 0x00, 0x08},
1653 {0xf0, 0x00, 0x01},
1654 {0x3a, 0x73, 0x00},
1655 {0x06, 0x30, 0x8c},
1656 {0xf0, 0x00, 0x00}
1659 __u8 second10c0a[2][5] = {
1660 {0x01, 0x00, 0x0e, 0x00, 0x14},
1661 {0x03, 0x03, 0xc4, 0x05, 0x14}
1664 __u8 second10c0b[3] =
1665 {0xc8, 0x00, 0x03};
1667 __u8 third10c0[4][3] = {
1668 {0x0a, 0x00, 0x01},
1669 {0x06, 0x00, 0x29},
1670 {0x05, 0x00, 0x72},
1671 {0x20, 0x00, 0x00}
1674 __u8 fourth10c0a[3][3] = {
1675 {0x20, 0x00, 0x00},
1676 {0x09, 0x01, 0x90},
1677 {0x0d, 0x80, 0x08}
1680 __u8 fourth10c0b[2][5] = {
1681 {0x2b, 0x01, 0x88, 0x01, 0x88},
1682 {0x2d, 0x01, 0x88, 0x01, 0x88}
1685 __u8 fifth10c0[4][3] = {
1686 {0x0a, 0x00, 0x01},
1687 {0x06, 0x00, 0x29},
1688 {0x05, 0x00, 0x72}
1691 /* interrupt down */
1693 buf[0] = 0x00;
1694 usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 1 */
1696 /* interrupt up */
1697 /* interrupt down */
1699 buf[0] = 0x60;
1700 usb_microdia_control_write(dev, 0x1007, buf, 1);
1702 buf[0] = 0x00;
1703 usb_microdia_control_write(dev, 0x1006, buf, 1);
1705 buf[0] = 0x78;
1706 usb_microdia_control_write(dev, 0x1000, buf, 1);
1708 buf[0] = 0xc7;
1709 usb_microdia_control_write(dev, 0x1001, buf, 1);
1711 buf[0] = 0x1c;
1712 usb_microdia_control_write(dev, 0x1002, buf, 1);
1714 buf[0] = 0x01;
1715 usb_microdia_control_write(dev, 0x1061, buf, 1);
1717 buf[0] = 0x80;
1718 usb_microdia_control_write(dev, 0x1020, buf, 1);
1720 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
1721 buf[3] = 0x10; buf[4] = 0x08;
1722 usb_microdia_control_write(dev, 0x1067, buf, 5);
1724 buf[0] = 0xb0; buf[1] = dev->sensor_slave_address; buf[2] = 0x0d;
1725 buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00;
1726 buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
1727 usb_microdia_control_write(dev, 0x10c0, buf, 9);
1729 usb_microdia_control_write(dev, 0x10e0, urb10, 24); /* URB 10 */
1731 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
1732 usb_microdia_control_write(dev, 0x10f8, buf, 3);
1734 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00;
1735 buf[3] = 0xe0; buf[4] = 0x03;
1736 usb_microdia_control_write(dev, 0x10fb, buf, 5);
1738 usb_microdia_control_write(dev, 0x1180, urb13, 11);
1740 usb_microdia_control_write(dev, 0x118b, urb14, 22);
1742 buf[0] = 0x00; buf[1] = 0x00;
1743 usb_microdia_control_write(dev, 0x11a1, buf, 2);
1745 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
1746 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00;
1747 buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00;
1748 usb_microdia_control_write(dev, 0x11b7, buf, 9);
1750 buf[0] = 0x30;
1751 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1753 buf[0] = 0x78;
1754 usb_microdia_control_write(dev, 0x1000, buf, 1);
1756 for (i = 0; i < 7; i++)
1757 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1758 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]); /* URB 9-48 */
1760 buf[0] = 0x60;
1761 usb_microdia_control_write(dev, 0x1007, buf, 1);
1763 buf[0] = 0x00;
1764 usb_microdia_control_write(dev, 0x1006, buf, 1);
1766 buf[0] = 0x03;
1767 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 50 */
1769 buf[0] = 0x03;
1770 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1772 buf[0] = 0xc6;
1773 usb_microdia_control_write(dev, 0x1001, buf, 1);
1775 buf[0] = 0xc4;
1776 usb_microdia_control_write(dev, 0x1001, buf, 1);
1778 buf[0] = 0x44;
1779 usb_microdia_control_write(dev, 0x1001, buf, 1);
1781 buf[0] = 0x80;
1782 usb_microdia_control_write(dev, 0x1189, buf, 1);
1784 buf[0] = 0x00;
1785 usb_microdia_control_write(dev, 0x11bc, buf, 1);
1787 buf[0] = 0x00;
1788 usb_microdia_control_write(dev, 0x11bd, buf, 1);
1790 buf[0] = 0x00;
1791 usb_microdia_control_write(dev, 0x11be, buf, 1);
1793 buf[0] = 0x00;
1794 usb_microdia_control_write(dev, 0x11bf, buf, 1);
1796 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1797 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
1799 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1800 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
1802 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
1803 0x09, dev->sensor_flags, NULL);
1805 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1806 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
1808 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
1809 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
1810 usb_microdia_control_write(dev, 0x1180, buf, 6);
1812 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
1813 buf[3] = 0xf0; buf[4] = 0x00;
1814 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 70 */
1816 buf[0] = 0x8c;
1817 usb_microdia_control_write(dev, 0x1189, buf, 1);
1819 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
1820 usb_microdia_control_write(dev, 0x11a1, buf, 4);
1822 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
1823 usb_microdia_control_write(dev, 0x11ab, buf, 4);
1825 buf[0] = 0x78;
1826 usb_microdia_control_write(dev, 0x1000, buf, 1);
1828 buf[0] = 0x18;
1829 usb_microdia_control_write(dev, 0x1002, buf, 1);
1831 buf[0] = 0x18;
1832 usb_microdia_control_write(dev, 0x1002, buf, 1);
1834 buf[0] = 0x38;
1835 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1837 buf[0] = 0x02;
1838 usb_microdia_control_write(dev, 0x118a, buf, 1);
1840 buf[0] = 0x02;
1841 usb_microdia_control_write(dev, 0x0395, buf, 1);
1843 buf[0] = 0x78;
1844 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 80 */
1845 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1847 buf[0] = 0xf9;
1848 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1849 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1851 buf[0] = 0xfa;
1852 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1853 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1855 buf[0] = 0x7b;
1856 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1857 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1859 buf[0] = 0x7c;
1860 usb_microdia_control_write(dev, 0x11b8, buf, 1);
1861 usb_microdia_control_read(dev, 0x11b8, buf, 1);
1863 buf[0] = 0x7b;
1864 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 90 */
1866 for (i = 0; i < 4; i++)
1867 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1868 third10c0[i][0], dev->sensor_flags, &third10c0[i][1]); /* URB 97-106 */
1870 buf[0] = 0x06;
1871 usb_microdia_control_write(dev, 0x1180, buf, 1);
1873 for (i = 0; i < 3; i++)
1874 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1875 fourth10c0a[i][0], dev->sensor_flags, &fourth10c0a[i][1]);
1877 for (i = 0; i < 2; i++)
1878 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1879 fourth10c0b[i][0], dev->sensor_flags, &fourth10c0b[i][1]);
1881 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
1882 0x33, dev->sensor_flags, NULL);
1884 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1885 first10c0[0][0], dev->sensor_flags, &first10c0[0][1]);
1887 buf[0] = 0x0a;
1888 usb_microdia_control_write(dev, 0x11ba, buf, 1);
1890 buf[0] = 0x10;
1891 usb_microdia_control_write(dev, 0x118b, buf, 1);
1893 buf[0] = 0x05;
1894 usb_microdia_control_write(dev, 0x10f7, buf, 1);
1896 buf[0] = 0x14;
1897 usb_microdia_control_write(dev, 0x10f8, buf, 1);
1899 buf[0] = 0xff;
1900 usb_microdia_control_write(dev, 0x10fa, buf, 1);
1902 buf[0] = 0x00;
1903 usb_microdia_control_write(dev, 0x10f9, buf, 1);
1905 buf[0] = 0x00;
1906 usb_microdia_control_write(dev, 0x10f9, buf, 1);
1908 buf[0] = 0x0a;
1909 usb_microdia_control_write(dev, 0x11ba, buf, 1);
1911 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
1912 usb_microdia_control_write(dev, 0x11bc, buf, 4);
1914 /* Set whole array buf to 0x00 */
1915 memset(buf, 0x00, 48);
1916 usb_microdia_control_write(dev, 0x11c0, buf, 48);
1918 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
1919 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
1920 usb_microdia_control_write(dev, 0x11a5, buf, 6);
1922 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
1923 usb_microdia_control_write(dev, 0x11af, buf, 4);
1925 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
1926 usb_microdia_control_write(dev, 0x11b3, buf, 4);
1928 buf[0] = 0x07;
1929 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1931 buf[0] = 0x01;
1932 usb_microdia_control_write(dev, 0x1061, buf, 1);
1934 buf[0] = 0x27;
1935 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1937 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
1939 usb_microdia_control_write(dev, 0x1140, qtable2, 64); /* URB 150 */
1941 buf[0] = 0x07;
1942 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1944 buf[0] = 0x03;
1945 usb_microdia_control_write(dev, 0x1061, buf, 1);
1947 buf[0] = 0x0b;
1948 usb_microdia_control_write(dev, 0x10e0, buf, 1);
1950 buf[0] = 0x8c;
1951 usb_microdia_control_write(dev, 0x1189, buf, 1);
1953 buf[0] = 0x00;
1954 usb_microdia_control_write(dev, 0x11bc, buf, 1);
1956 buf[0] = 0x00;
1957 usb_microdia_control_write(dev, 0x11bd, buf, 1);
1959 buf[0] = 0x00;
1960 usb_microdia_control_write(dev, 0x11be, buf, 1);
1962 buf[0] = 0x00;
1963 usb_microdia_control_write(dev, 0x11bf, buf, 1);
1965 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1966 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
1968 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
1969 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
1971 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
1972 0x09, dev->sensor_flags, NULL);
1974 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
1975 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
1977 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
1978 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
1979 usb_microdia_control_write(dev, 0x1180, buf, 6);
1981 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
1982 buf[3] = 0xf0; buf[4] = 0x00;
1983 usb_microdia_control_write(dev, 0x10fb, buf, 5);
1985 buf[0] = 0x8c;
1986 usb_microdia_control_write(dev, 0x1189, buf, 1);
1988 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
1989 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 170 */
1991 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
1992 usb_microdia_control_write(dev, 0x11ab, buf, 4);
1994 buf[0] = 0x03;
1995 usb_microdia_control_write(dev, 0x1061, buf, 1);
1997 buf[0] = 0x0a;
1998 usb_microdia_control_write(dev, 0x11ba, buf, 1);
2000 buf[0] = 0x00;
2001 usb_microdia_control_write(dev, 0x11b9, buf, 1);
2003 buf[0] = 0x0b;
2004 usb_microdia_control_write(dev, 0x11ba, buf, 1);
2006 buf[0] = 0x01;
2007 usb_microdia_control_write(dev, 0x1061, buf, 1);
2009 buf[0] = 0x78;
2010 usb_microdia_control_write(dev, 0x1000, buf, 1);
2012 buf[0] = 0x18;
2013 usb_microdia_control_write(dev, 0x1002, buf, 1);
2015 buf[0] = 0x18;
2016 usb_microdia_control_write(dev, 0x1002, buf, 1);
2018 buf[0] = 0x7b;
2019 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 180 */
2021 buf[0] = 0x02;
2022 usb_microdia_control_write(dev, 0x118a, buf, 1);
2024 buf[0] = 0x02;
2025 usb_microdia_control_write(dev, 0x0395, buf, 1);
2027 buf[0] = 0x78;
2028 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2029 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2031 buf[0] = 0xf9;
2032 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2033 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2035 buf[0] = 0xfa;
2036 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2037 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2039 buf[0] = 0x7b;
2040 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2041 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 190 */
2043 buf[0] = 0x7c;
2044 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2045 usb_microdia_control_read(dev, 0x11b8, buf, 1);
2047 buf[0] = 0x7b;
2048 usb_microdia_control_write(dev, 0x11b8, buf, 1);
2050 for (i = 0; i < 3; i++)
2051 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
2052 fifth10c0[i][0], dev->sensor_flags, &fifth10c0[i][1]); /* URB 200-205 */
2054 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2,
2055 0x00, dev->sensor_flags, buf);
2056 /* __u8 result[2] = {buf[3], buf[4]}; */
2058 buf[0] = 0x03;
2059 usb_microdia_control_write(dev, 0x1061, buf, 1);
2061 return 0;
2066 * @brief From startstream.log
2068 * @param dev
2070 * @returns 0
2072 * @author GWater
2074 * For SN9C201 with SOI968.
2075 * This is function triggers a working stream of image data and a glowing LED.
2077 int microdia_624e_start_stream(struct usb_microdia *dev)
2079 int ret, i;
2080 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
2081 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
2083 __u16 reg;
2084 __u8 value;
2086 __u16 regs[][2] = {
2087 {0x1066, 0x00},
2088 {0x1000, 0x7c},
2089 {0x1001, 0x44},
2090 {0x1002, 0x1c},
2091 {0x1006, 0x80},
2092 {0x1007, 0xa0},
2093 {0x1061, 0x03},
2094 {0x1020, 0x80},
2095 {0x1067, 0x40},
2096 {0x1068, 0x30},
2097 {0x1069, 0x20},
2098 {0x106a, 0x10},
2099 {0x106b, 0x08},
2100 {0x10e0, 0x0b},
2101 {0x10f6, 0x60},
2102 {0x10f7, 0x07},
2103 {0x10f8, 0x14},
2104 {0x10f9, 0x00},
2105 {0x10fa, 0xff},
2106 {0x1188, 0x8a},
2107 {0x118b, 0x0a},
2108 {0x118c, 0x20},
2109 {0x118d, 0x20},
2110 {0x118e, 0x20},
2111 {0x118f, 0x20},
2112 {0x1190, 0x00},
2113 {0x1191, 0x24},
2114 {0x1192, 0x3b},
2115 {0x1193, 0x4f},
2116 {0x1194, 0x61},
2117 {0x1195, 0x71},
2118 {0x1196, 0x80},
2119 {0x1197, 0x8f},
2120 {0x1198, 0x9d},
2121 {0x1199, 0xab},
2122 {0x119a, 0xb8},
2123 {0x119b, 0xc4},
2124 {0x119c, 0xd1},
2125 {0x119d, 0xdd},
2126 {0x119e, 0xe9},
2127 {0x119f, 0xf4},
2128 {0x11a0, 0xff},
2129 {0x11a1, 0x00},
2130 {0x11a2, 0x00},
2131 {0x11b7, 0x60},
2132 {0x11b8, 0x7a},
2133 {0x11b9, 0x00},
2134 {0x11ba, 0x0f},
2135 {0x11bb, 0x00},
2136 {0x11bc, 0x00},
2137 {0x11bd, 0x00},
2138 {0x11be, 0x00},
2139 {0x11bf, 0x00},
2140 {0x1180, 0x3c},
2141 {0x1181, 0x00},
2142 {0x1182, 0x0b},
2143 {0x1183, 0x00},
2144 {0x1184, 0x28},
2145 {0x1185, 0x3c},
2146 {0x11a1, 0x00},
2147 {0x11a2, 0x00},
2148 {0x11a3, 0x6a},
2149 {0x11a4, 0x50},
2150 {0x11ab, 0x00},
2151 {0x11ac, 0x00},
2152 {0x11ad, 0x50},
2153 {0x11ae, 0x3c},
2154 {0x118a, 0x05},
2155 {0x0395, 0x05},
2156 {0x11a5, 0x2d},
2157 {0x11a6, 0x2d},
2158 {0x11a7, 0x3a},
2159 {0x11a8, 0x05},
2160 {0x11a9, 0x04},
2161 {0x11aa, 0x3f},
2162 {0x11af, 0x28},
2163 {0x11b0, 0xd8},
2164 {0x11b1, 0x14},
2165 {0x11b2, 0xec},
2166 {0x11b3, 0x32},
2167 {0x11b4, 0xdd},
2168 {0x11b5, 0x2d},
2169 {0x11b6, 0xdd},
2172 __u8 reg_11c0[48];
2174 __u8 qtable1[64] = {
2175 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
2176 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
2177 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
2178 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
2179 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
2180 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
2181 0x4f, 0x53, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
2182 0x64, 0x5c, 0x53, 0x64, 0x4b, 0x53, 0x58, 0x53
2185 __u8 qtable2[64] = {
2186 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
2187 0x15, 0x26, 0x53, 0x36, 0x2e, 0x36, 0x53, 0x53,
2188 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2189 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2190 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2191 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2192 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
2193 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53
2197 for (i = 0; i < ARRAY_SIZE(regs); i++) {
2198 reg = regs[i][0];
2199 value = regs[i][1];
2200 ret = usb_microdia_control_write(dev, reg, &value, 1);
2201 if (ret < 0) {
2202 UDIA_INFO("Bridge Init Error (%d). line %d\n", ret, i);
2203 goto err;
2207 memset(reg_11c0, 0x00, 48);
2208 ret = usb_microdia_control_write(dev, 0x11c0, reg_11c0, 48);
2209 if (ret < 0)
2210 goto err;
2212 ret = usb_microdia_control_write(dev, 0x1100, qtable1, 64);
2213 if (ret < 0)
2214 goto err;
2216 ret = usb_microdia_control_write(dev, 0x1140, qtable2, 64);
2217 if (ret < 0)
2218 goto err;
2220 /* this is the same register as the I2C write, not sure why
2221 * we're writing 9 bytes -- the SN9C102 docs say all writes
2222 * must be 8 bytes, but we don't have docs for SN9C20x */
2223 ret = usb_microdia_control_write(dev, 0x10c0, unknown1, 9);
2224 if (ret < 0)
2225 goto err;
2227 if (dev->sensor_init)
2228 dev->sensor_init(dev);
2230 return 0;
2232 err:
2233 UDIA_ERROR("start stream: failed (%d)!\n", ret);
2234 return ret;
2237 int microdia_624f_start_stream(struct usb_microdia *dev)
2239 int ret, i;
2240 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
2241 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
2243 __u16 reg;
2244 __u8 value;
2246 __u16 regs[][2] = {
2247 {0x1007, 0x20},
2248 {0x1006, 0x00},
2249 {0x1000, 0x78},
2250 {0x1001, 0x44},
2251 {0x1002, 0x1c},
2252 {0x1061, 0x01},
2253 {0x1020, 0x80},
2254 {0x1067, 0x40},
2255 {0x1068, 0x30},
2256 {0x1069, 0x20},
2257 {0x1070, 0x10},
2258 {0x1071, 0x08},
2259 {0x1188, 0x87},
2260 {0x11a1, 0x00},
2261 {0x11a2, 0x00},
2262 {0x11a3, 0x6a},
2263 {0x11a4, 0x50},
2264 {0x11ab, 0x00},
2265 {0x11ac, 0x00},
2266 {0x11ad, 0x50},
2267 {0x11ae, 0x3c},
2268 {0x118a, 0x04},
2269 {0x0395, 0x04},
2270 {0x11b8, 0x3a},
2271 {0x118b, 0x0e},
2272 {0x10f7, 0x05},
2273 {0x10f8, 0x14},
2274 {0x10fa, 0xff},
2275 {0x10f9, 0x00},
2276 {0x11ba, 0x0e},
2277 {0x11a5, 0x2d},
2278 {0x11a6, 0x2d},
2279 {0x11a7, 0x3a},
2280 {0x11a8, 0x05},
2281 {0x11a9, 0x04},
2282 {0x11aa, 0x3f},
2283 {0x11af, 0x28},
2284 {0x11b0, 0xd8},
2285 {0x11b1, 0x14},
2286 {0x11b2, 0xec},
2287 {0x11b3, 0x32},
2288 {0x11b4, 0xdd},
2289 {0x11b5, 0x32},
2290 {0x11b6, 0xdd},
2291 {0x10e0, 0x0b},
2292 {0x11bc, 0x40},
2293 {0x11bd, 0x01},
2294 {0x11be, 0xf0},
2295 {0x11bf, 0x00},
2296 {0x1180, 0x02},
2297 {0x1181, 0x00},
2298 {0x1182, 0x07},
2299 {0x1183, 0x00},
2300 {0x1184, 0x28},
2301 {0x1185, 0x3c},
2302 {0x1061, 0x03},
2305 __u8 reg_11c0[48] = {
2306 0x10, 0x21, 0x34, 0x40, 0x47, 0x4f, 0x57, 0x5f,
2307 0x64, 0x68, 0x6d, 0x73, 0x79, 0x80, 0x89, 0x97,
2308 0x0d, 0x1c, 0x2a, 0x33, 0x38, 0x3d, 0x44, 0x4a,
2309 0x4e, 0x52, 0x56, 0x5b, 0x61, 0x68, 0x6f, 0x7a,
2310 0x0d, 0x1a, 0x2a, 0x31, 0x36, 0x3b, 0x41, 0x47,
2311 0x4a, 0x4e, 0x53, 0x58, 0x5d, 0x64, 0x6b, 0x76
2314 __u8 qtable1[64] = {
2315 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
2316 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
2317 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
2318 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
2319 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
2320 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
2321 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
2322 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54
2325 __u8 qtable2[64] = {
2326 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
2327 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
2328 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2329 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2330 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2331 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2332 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
2333 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54
2336 for (i = 0; i < ARRAY_SIZE(regs); i++) {
2337 reg = regs[i][0];
2338 value = regs[i][1];
2339 ret = usb_microdia_control_write(dev, reg, &value, 1);
2340 if (ret < 0) {
2341 UDIA_INFO("Bridge Init Error (%d). line %d\n", ret, i);
2342 goto err;
2346 ret = usb_microdia_control_write(dev, 0x11c0, reg_11c0, 48);
2347 if (ret < 0)
2348 goto err;
2350 ret = usb_microdia_control_write(dev, 0x1100, qtable1, 64);
2351 if (ret < 0)
2352 goto err;
2354 ret = usb_microdia_control_write(dev, 0x1140, qtable2, 64);
2355 if (ret < 0)
2356 goto err;
2358 /* this is the same register as the I2C write, not sure why
2359 * we're writing 9 bytes -- the SN9C102 docs say all writes
2360 * must be 8 bytes, but we don't have docs for SN9C20x */
2361 ret = usb_microdia_control_write(dev, 0x10c0, unknown1, 9);
2362 if (ret < 0)
2363 goto err;
2365 if (dev->sensor_init)
2366 dev->sensor_init(dev);
2368 return 0;
2370 err:
2371 UDIA_ERROR("start stream: failed (%d)!\n", ret);
2372 return ret;
2375 int microdia_6260_start_stream(struct usb_microdia *dev)
2377 int ret;
2378 __u8 buf[32];
2380 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
2381 buf[0] = 0x1f;
2382 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
2383 buf[0] = 0x00;
2384 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
2385 buf[0] = 0x20;
2386 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
2387 buf[0] = 0x00;
2388 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
2389 buf[0] = 0x78;
2390 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2391 buf[0] = 0xc7;
2392 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2393 buf[0] = 0x18;
2394 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2395 buf[0] = 0x01;
2396 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2397 buf[0] = 0x80;
2398 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
2400 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10;
2401 buf[4] = 0x08;
2402 ret = usb_microdia_control_write(dev, 0x1067, buf, 5);
2404 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
2405 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
2406 buf[8] = 0x03;
2407 ret = usb_microdia_control_write(dev, 0x10c0, buf, 9);
2409 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
2410 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
2411 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
2412 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
2413 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
2414 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
2415 ret = usb_microdia_control_write(dev, 0x10e0, buf, 24);
2417 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
2418 ret = usb_microdia_control_write(dev, 0x10f8, buf, 3);
2420 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
2421 buf[4] = 0x00;
2422 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2424 buf[0] = 0x8a; buf[1] = 0x8c; buf[2] = 0x08;
2425 ret = usb_microdia_control_write(dev, 0x1188, buf, 3);
2427 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
2428 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
2429 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
2430 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
2431 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
2432 buf[20] = 0xf4; buf[21] = 0xff;
2433 ret = usb_microdia_control_write(dev, 0x118b, buf, 22);
2435 buf[0] = 0x00; buf[1] = 0x00;
2436 ret = usb_microdia_control_write(dev, 0x11a1, buf, 2);
2438 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x00;
2439 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
2440 buf[8] = 0x00;
2441 ret = usb_microdia_control_write(dev, 0x11b7, buf, 9);
2443 buf[0] = 0x78;
2444 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2446 buf[0] = 0x38;
2447 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2449 ret = ov7670_initialise(dev);
2450 if (ret < 0)
2451 return ret;
2453 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x3b, dev->sensor_flags, buf);
2454 ret = usb_microdia_control_read(dev, 0x10c1, buf, 1);
2455 buf[0] = 0x50;
2456 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
2458 /* TRY TO READ FROM EEPROM: */
2459 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, dev->sensor_flags, buf);
2460 if (ret < 0)
2461 UDIA_INFO("No EEPROM found\n");
2462 else
2463 UDIA_INFO("Read from EEPROM successful\n");
2465 buf[0] = 0x21;
2466 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
2467 buf[0] = 0x45;
2468 ret = usb_microdia_control_write(dev, 0x10e0, buf, 1);
2469 buf[0] = 0xc6;
2470 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2471 buf[0] = 0xc4;
2472 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
2474 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
2475 buf[4] = 0x50; buf[5] = 0x3c;
2476 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
2478 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
2479 buf[4] = 0x01;
2480 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2482 buf[0] = 0x80;
2483 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
2485 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
2486 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
2488 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
2489 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
2490 buf[0] = 0x78;
2491 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2492 buf[0] = 0x10;
2493 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2494 buf[0] = 0x00;
2495 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2496 buf[0] = 0x38;
2497 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2498 buf[0] = 0x04;
2499 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
2500 buf[0] = 0x04;
2501 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
2502 buf[0] = 0x78;
2503 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2504 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2505 buf[0] = 0xf9;
2506 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2507 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2508 buf[0] = 0xfa;
2509 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2510 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2511 buf[0] = 0x7b;
2512 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2513 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2514 buf[0] = 0x7c;
2515 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2516 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2517 buf[0] = 0x7d;
2518 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2519 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2520 buf[0] = 0x7b;
2521 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2523 /* OV7670 Intialise Part 2 */
2524 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
2525 buf[4] = 0x50; buf[5] = 0x3c;
2526 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
2528 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
2529 buf[4] = 0x01;
2530 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
2532 buf[0] = 0x80;
2533 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
2535 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
2536 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
2538 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
2539 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
2541 buf[0] = 0x03;
2542 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2543 buf[0] = 0x01;
2544 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2545 buf[0] = 0x78;
2546 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
2547 buf[0] = 0x00;
2548 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2549 buf[0] = 0x00;
2550 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
2551 buf[0] = 0x7b;
2552 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2553 buf[0] = 0x04;
2554 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
2555 buf[0] = 0x04;
2556 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
2557 buf[0] = 0x78;
2558 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2559 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2560 buf[0] = 0x79;
2561 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2562 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2563 buf[0] = 0x7a;
2564 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2565 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2566 buf[0] = 0x7b;
2567 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2568 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2569 buf[0] = 0x7c;
2570 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2571 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2572 buf[0] = 0x7d;
2573 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2574 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
2575 buf[0] = 0xfa;
2576 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
2578 /* OV7670 Initialisation Part 3 Goes Here */
2579 buf[0] = 0x03;
2580 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
2582 return ret;
2586 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
2588 * @param dev
2590 * @returns 0 (ok) or -1 (error)
2592 * @author Comer352l
2594 * Windows driver versions: 5.7.23.000
2595 * Windows versions: 2000 and XP
2596 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
2597 * All logs were made using AMCAP with 640x480, RGB24
2599 int microdia_6270_start_stream(struct usb_microdia *dev)
2601 __u8 buf[64];
2602 __u8 last_11b8[1];
2603 int k;
2604 int retI2C;
2606 /* Check if sensor slave address is valid: */
2607 if ((dev->sensor_slave_address != MT9V111_I2C_SLAVE_ADDRESS) && (dev->sensor_slave_address != MT9V011_I2C_SLAVE_ADDRESS)) {
2608 UDIA_INFO("microdia_6270_start_stream(): Invalid sensor slave address !\n");
2609 return -1;
2612 /* <= INTERRUPT COMING BACK (URB 1953) */
2613 /* SWITCH TO ALTERNATE SETTINGS 8 (URB 1954) // NOT IN ALEX'S LOG */
2614 /* => INTERRUPT GOING DOWN (URB 1955) */
2616 buf[0] = 0x00;
2617 usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 1956 */
2619 /* <= INTERRUPT COMING BACK (URB 1955) */
2620 /* => INTERRUPT GOING DOWN (URB 1957) */
2622 buf[0] = 0x78;
2623 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 1958 */
2624 buf[0] = 0xc7;
2625 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 1959 */
2626 buf[0] = 0x18;
2627 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 1960 */
2628 buf[0] = 0x01;
2629 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 1961 */
2630 buf[0] = 0x80;
2631 usb_microdia_control_write(dev, 0x1020, buf, 1); /* URB 1962 */
2632 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
2633 usb_microdia_control_write(dev, 0x1067, buf, 5); /* URB 1963 */
2635 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2636 /* STRANGE I2C MESSAGE: */
2637 /* - 9 bytes */
2638 /* - byte 8 = 0x00 at first start + first cycle */
2639 /* - procedure not complete: no wait/check for ack/error, no readout of 0x10c2 */
2640 /* - dummy writes at first cycle and read at second cycle, but there are many I2C messages in the meantime, so this should not work */
2641 /* */
2642 /* AT FIRST START + FIRST CYCLE: */
2643 buf[0] = 0x80; buf[1] = dev->sensor_slave_address; buf[2] = 0x00; buf[3] = 0x00;
2644 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
2645 /* AT ALL FURTHER STARTS + FIRST CYCLE: */
2646 /* MT9V111: I2C MESSAGE => IFP Register 0x33: Auto exposure */
2647 /* buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x33; buf[3] = 0x00; */
2648 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2649 /* MT9V011: ????????????????????????? */
2650 /* buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x07; buf[3] = 0x00; */
2651 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2652 /* ALWAYS AT 2nd AND FURTHER CYCLES: */
2653 /* MT9V111: */
2654 /* buf[0] = 0xa2; buf[1] = 0x5c; buf[2] = 0x00; buf[3] = 0x36; */
2655 /* buf[4] = 0x00; buf[5] = 0x82; buf[6] = 0x3a; buf[7] = 0x10; buf[8] = 0x03; */
2656 /* => buf[3] to buf[6] simply contain bytes read with URB 2215 */
2657 /* MT9V011: */
2658 /* buf[0] = 0xb0; buf[1] = 0x5d; buf[2] = 0x07; buf[3] = 0x00; */
2659 /* buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03; */
2660 usb_microdia_control_write(dev, 0x10c0, buf, 9); /* URB 1964 */
2661 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2663 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
2664 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
2665 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
2666 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
2667 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
2668 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
2669 usb_microdia_control_write(dev, 0x10e0, buf, 24); /* URB 1965 */
2670 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
2671 usb_microdia_control_write(dev, 0x10f8, buf, 3); /* URB 1966 */
2672 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
2673 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 1967 */
2674 buf[0] = 0x06; buf[1] = 0x0c; buf[2] = 0x08;
2675 usb_microdia_control_write(dev, 0x1188, buf, 3); /* URB 1968 */
2676 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
2677 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
2678 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
2679 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
2680 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
2681 buf[20] = 0xf4; buf[21] = 0xff;
2682 usb_microdia_control_write(dev, 0x118b, buf, 22); /* URB 1969 */
2683 buf[0] = 0x00; buf[1] = 0x00;
2684 usb_microdia_control_write(dev, 0x11a1, buf, 2); /* URB 1970 */
2685 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08;
2686 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
2687 buf[8] = 0x00;
2688 usb_microdia_control_write(dev, 0x11b7, buf, 9); /* URB 1971 */
2689 buf[0] = 0x38;
2690 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 1972 */
2691 buf[0] = 0x78;
2692 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 1973 */
2694 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2695 /* I2C MESSAGES */
2696 retI2C = 0;
2697 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
2698 /* Write to IFP register 0x0d: Color Correction Register 8 */
2699 buf[0] = 0x00; buf[1] = 0x01;
2700 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); /* URBs 1974-1976 */
2701 /* Write to IFP register 0x0d: Color Correction Register 8 */
2702 buf[0] = 0x00; buf[1] = 0x00; /* ??? */
2703 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); /* URBs 1977-1979 */
2704 /* Writes to IFP registers 0x01: Register Address Space Selection */
2705 /* 0x02: Color Correction Register 1 */
2706 buf[0] = 0x00; buf[1] = 0x01; /* select IFP address space */
2707 buf[2] = 0x00; buf[3] = 0x16; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2708 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); /* URBs 1980-1982 */
2709 /* Writes to IFP registers 0x03: Color Correction Register 3 */
2710 /* 0x04: Color Correction Register 4 */
2711 buf[0] = 0x01; buf[1] = 0xe1; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2712 buf[2] = 0x02; buf[3] = 0x81; /* ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2713 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); /* URBs 1983-1985 */
2714 /* Writes to IFP registers 0x05: Aperture Correction (Sharpening) */
2715 /* 0x06: Operating Mode Control */
2716 buf[0] = 0x00; buf[1] = 0x04; /* 100% sharpening, no automatic sharpness reduction at low light // AT FIRST START + FIRST CYCLE: 0x00 0x00: no sharpening */
2717 buf[2] = 0x00; buf[3] = 0x00; /* stop AWB at the current values, no on-the-fly defect correction, no auto exposure, + RESREVED option */
2718 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); /* URBs 1986-1988 */
2719 /* Writes to IFP registers 0x07: Image Flow Processor Soft Reset */
2720 /* 0x08: Output Format Control */
2721 buf[0] = 0x30; buf[1] = 0x02; /* reset // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2722 buf[2] = 0x04; buf[3] = 0x80; /* bypass entire image processing, raw 8+2 Bayer data output directly */
2723 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); /* URBs 1989-1991 */
2724 /* "Dummy" write to IFP Register 0x11: Color Correction Register 12 */
2725 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); /* URBs 1992-1993 */
2726 /* Write to register 0x01: Register address space selection */
2727 /* Write to sensor register 0x02: Column Start */
2728 buf[0] = 0x00; buf[1] = 0x04; /* select sensor address space */
2729 buf[2] = 0x00; buf[3] = 0x16; /* start with column 22 */
2730 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); /* URBs 1994-1996 */
2731 /* Writes to sensor registers 0x03: Window Height */
2732 /* 0x04: Window Width */
2733 buf[0] = 0x01; buf[1] = 0xe6; /* 486 */
2734 buf[2] = 0x02; buf[3] = 0x86; /* 646 */
2735 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); /* URBs 1997-1999 */
2736 /* Writes to sensor registers 0x05: Horizontal Blanking */
2737 /* 0x06: Vertical Blanking */
2738 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
2739 buf[2] = 0x00; buf[3] = 0x00; /* 0 rows */
2740 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); /* URBs 2000-2002 */
2741 /* Writes to sensor registers 0x07: Output Control */
2742 /* 0x08: Row Start */
2743 buf[0] = 0x30; buf[1] = 0x02; /* normal operation + chip enable + RESERVED options */
2744 buf[2] = 0x00; buf[3] = 0x08; /* row 8 */
2745 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); /* URBs 2003-2005 */
2746 /* "Dummy" write to sensor Register 0x11: UNDOCUMENTED */
2747 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); /* URBs 2006-2007 */
2748 /* Writes to sensor registers 0x0c: Shutter Delay */
2749 /* 0x0d: Reset (Soft) (from MT9V011 datasheet) */
2750 buf[0] = 0x00; buf[1] = 0x00; /* 0 master clocks */
2751 buf[2] = 0x00; buf[3] = 0x00; /* return to normal operation */
2752 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf); /* URBs 2008-2010 */
2753 /* Writes to sensor registers 0x0e: UNDOCUMENTED */
2754 /* 0x0f: UNDOCUMENTED */
2755 buf[0] = 0x00; buf[1] = 0x00;
2756 buf[2] = 0x00; buf[3] = 0x00;
2757 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf); /* URBs 2011-2013 */
2758 /* Writes to sensor registers 0x10: UNDOCUMENTED */
2759 /* 0x11: UNDOCUMENTED */
2760 buf[0] = 0x00; buf[1] = 0x00;
2761 buf[2] = 0x00; buf[3] = 0x00;
2762 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf); /* URBs 2014-2016 */
2763 /* Writes to sensor registers 0x12: 2X Zoom Col Start => 0x1e bit 0 must be set to activate zoom */
2764 /* 0x13: 2X Zoom Row Start => 0x1e bit 0 must be set to activate zoom */
2765 buf[0] = 0x00; buf[1] = 0xb0; /* column 176 */
2766 buf[2] = 0x00; buf[3] = 0x7c; /* row 124 */
2767 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf); /* URBs 2017-2018 */
2768 /* Writes to sensor registers 0x14: UNDOCUMENTED */
2769 /* 0x15: UNDOCUMENTED */
2770 buf[0] = 0x00; buf[1] = 0x00;
2771 buf[2] = 0x00; buf[3] = 0x00;
2772 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf); /* URBs 2019-2021 */
2773 /* Writes to sensor registers 0x16: UNDOCUMENTED */
2774 /* 0x17: UNDOCUMENTED */
2775 buf[0] = 0x00; buf[1] = 0x00;
2776 buf[2] = 0x00; buf[3] = 0x00;
2777 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf); /* URBs 2022-2024 */
2778 /* Writes to sensor registers 0x18: UNDOCUMENTED */
2779 /* 0x19: UNDOCUMENTED */
2780 buf[0] = 0x00; buf[1] = 0x00;
2781 buf[2] = 0x00; buf[3] = 0x00;
2782 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf); /* URBs 2025-2027 */
2783 /* Writes to sensor registers 0x1a: UNDOCUMENTED */
2784 /* 0x1b: UNDOCUMENTED */
2785 buf[0] = 0x00; buf[1] = 0x00;
2786 buf[2] = 0x00; buf[3] = 0x00;
2787 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf); /* URBs 2028-2030 */
2788 /* Writes to sensor registers 0x1c: UNDOCUMENTED */
2789 /* 0x1d: UNDOCUMENTED */
2790 buf[0] = 0x00; buf[1] = 0x00;
2791 buf[2] = 0x00; buf[3] = 0x00;
2792 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf); /* URBs 2031-2033 */
2793 /* Write to sensor register 0x30: RESERVED */
2794 buf[0] = 0x00; buf[1] = 0x00;
2795 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x30, dev->sensor_flags, buf); /* URBs 2034-2036 */
2796 /* Write to sensor register 0x20: Read Mode */
2797 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
2798 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2037-2039 */
2799 /* Writes to sensor registers 0x30: RESERVED */
2800 /* 0x31: RESERVED */
2801 buf[0] = 0x00; buf[1] = 0x05;
2802 buf[2] = 0x00; buf[3] = 0x00;
2803 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x30, dev->sensor_flags, buf); /* URBs 2040-2042 */
2804 /* "Dummy" write to sensor Register 0x34: RESERVED */
2805 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x34, dev->sensor_flags, NULL); /* URBs 2043-2044 */
2806 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
2807 /* Write to sensor register 0x07: Output Control */
2808 buf[0] = 0x00; buf[1] = 0x02; /* chip enable, normal operation */
2809 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
2810 /* Write to sensor register 0x0d: Soft Reset */
2811 buf[0] = 0x00; buf[1] = 0x01; /* reset */
2812 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2813 /* Write to sensor register 0x0d: Soft Reset */
2814 buf[0] = 0x00; buf[1] = 0x00; /* resume operation */
2815 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2816 /* Writes to sensor registers 0x01: Row start */
2817 /* 0x02: Column Start */
2818 buf[0] = 0x00; buf[1] = 0x08; /* start with row 8 */
2819 buf[2] = 0x00; buf[3] = 0x16; /* start with column 22 */
2820 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf);
2821 /* Writes to sensor registers 0x03: Window Height */
2822 /* 0x04: Window Width */
2823 buf[0] = 0x01; buf[1] = 0xe1; /* 481 */
2824 buf[2] = 0x02; buf[3] = 0x81; /* 641 */
2825 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf);
2826 /* Writes to sensor registers 0x05: Horizontal Blanking */
2827 /* 0x06: Vertical Blanking */
2828 buf[0] = 0x00; buf[1] = 0x83; /* 131 columns (pixel clocks) */
2829 buf[2] = 0x00; buf[3] = 0x06; /* 6 rows */
2830 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf);
2831 /* Write to sensor register 0x0d: Soft Reset */
2832 buf[0] = 0x00; buf[1] = 0x02; /* UNKNOWN */
2833 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
2834 /* Writes to sensor registers 0x0a: Pixel Clock Speed */
2835 /* 0x0b: Frame Restart */
2836 buf[0] = 0x00; buf[1] = 0x00; /* default */
2837 buf[2] = 0x00; buf[3] = 0x00; /* (has no effect/no restart) */
2838 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0a, dev->sensor_flags, buf);
2839 /* Writes to sensor registers 0x0c: Shutter Delay */
2840 /* 0x0d: Soft Reset */
2841 buf[0] = 0x00; buf[1] = 0x00; /* 0 master clocks */
2842 buf[2] = 0x00; buf[3] = 0x00; /* resume operation */
2843 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf);
2844 /* Writes to sensor registers 0x0e: UNDOCUMENTED */
2845 /* 0x0f: UNDOCUMENTED */
2846 buf[0] = 0x00; buf[1] = 0x00;
2847 buf[2] = 0x00; buf[3] = 0x00;
2848 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf);
2849 /* Writes to sensor registers 0x10: UNDOCUMENTED */
2850 /* 0x11: UNDOCUMENTED */
2851 buf[0] = 0x00; buf[1] = 0x00;
2852 buf[2] = 0x00; buf[3] = 0x00;
2853 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf);
2854 /* Writes to sensor registers 0x12: 2X Zoom Column Start (from MT9V111 datasheet) */
2855 /* 0x13: 2X Zoom Row Start (from MT9V111 datasheet) */
2856 buf[0] = 0x00; buf[1] = 0x00; /* column 0 => bit0 of reg 0x1e must be set to activate zoom */
2857 buf[2] = 0x00; buf[3] = 0x00; /* row 0 => bit0 of reg 0x1e must be set to activate zoom */
2858 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf);
2859 /* Writes to sensor registers 0x14: UNDOCUMENTED */
2860 /* 0x15: UNDOCUMENTED */
2861 buf[0] = 0x00; buf[1] = 0x00;
2862 buf[2] = 0x00; buf[3] = 0x00;
2863 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf);
2864 /* Writes to sensor registers 0x16: UNDOCUMENTED */
2865 /* 0x17: UNDOCUMENTED */
2866 buf[0] = 0x00; buf[1] = 0x00;
2867 buf[2] = 0x00; buf[3] = 0x00;
2868 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf);
2869 /* Writes to sensor registers 0x18: UNDOCUMENTED */
2870 /* 0x19: UNDOCUMENTED */
2871 buf[0] = 0x00; buf[1] = 0x00;
2872 buf[2] = 0x00; buf[3] = 0x00;
2873 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf);
2874 /* Writes to sensor registers 0x1a: UNDOCUMENTED */
2875 /* 0x1b: UNDOCUMENTED */
2876 buf[0] = 0x00; buf[1] = 0x00;
2877 buf[2] = 0x00; buf[3] = 0x00;
2878 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf);
2879 /* Writes to sensor registers 0x1c: UNDOCUMENTED */
2880 /* 0x1d: UNDOCUMENTED */
2881 buf[0] = 0x00; buf[1] = 0x00;
2882 buf[2] = 0x00; buf[3] = 0x00;
2883 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf);
2884 /* Write to sensor register 0x32: RESERVED */
2885 buf[0] = 0x00; buf[1] = 0x00;
2886 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x32, dev->sensor_flags, buf);
2887 /* Writes to sensor registers 0x20: Read Mode */
2888 /* 0x21: RESERVED */
2889 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad frames) + UNDOCUMENTED */
2890 buf[2] = 0x00; buf[3] = 0x00;
2891 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x20, dev->sensor_flags, buf);
2892 /* Writes to sensor registers 0x22: RESERVED */
2893 /* 0x23: UNDOCUMENTED */
2894 buf[0] = 0x00; buf[1] = 0x00;
2895 buf[2] = 0x00; buf[3] = 0x00;
2896 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x22, dev->sensor_flags, buf);
2897 /* Writes to sensor registers 0x24: UNDOCUMENTED */
2898 /* 0x25: UNDOCUMENTED */
2899 buf[0] = 0x00; buf[1] = 0x00;
2900 buf[2] = 0x00; buf[3] = 0x00;
2901 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x24, dev->sensor_flags, buf);
2902 /* Writes to sensor registers 0x26: UNDOCUMENTED */
2903 /* 0x27: RESERVED */
2904 buf[0] = 0x00; buf[1] = 0x00;
2905 buf[2] = 0x00; buf[3] = 0x24;
2906 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x26, dev->sensor_flags, buf);
2907 /* "Dummy" write to sensor Register 0x30: RESERVED */
2908 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x30, dev->sensor_flags, NULL);
2909 /* Writes to sensor registers 0x2f: RESERVED */
2910 /* 0x30: RESERVED */
2911 buf[0] = 0xf7; buf[1] = 0xb0;
2912 buf[2] = 0x00; buf[3] = 0x05;
2913 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2f, dev->sensor_flags, buf);
2914 /* Writes to sensor registers 0x31: RESERVED */
2915 /* 0x32: RESERVED */
2916 buf[0] = 0x00; buf[1] = 0x00;
2917 buf[2] = 0x00; buf[3] = 0x00;
2918 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x31, dev->sensor_flags, buf);
2919 /* Writes to sensor registers 0x33: RESERVED */
2920 /* 0x34: RESERVED */
2921 buf[0] = 0x00; buf[1] = 0x00;
2922 buf[2] = 0x01; buf[3] = 0x00;
2923 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x33, dev->sensor_flags, buf);
2924 /* "Dummy" write to sensor Register 0x3b: RESERVED */
2925 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x3b, dev->sensor_flags, NULL);
2926 /* Write to sensor register 0x3d: RESERVED */
2927 buf[0] = 0x06; buf[1] = 0x8f;
2928 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x3d, dev->sensor_flags, buf);
2929 /* Writes to sensor registers 0x40: RESERVED */
2930 /* 0x41: RESERVED */
2931 buf[0] = 0x01; buf[1] = 0xe0;
2932 buf[2] = 0x00; buf[3] = 0xd1;
2933 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x40, dev->sensor_flags, buf);
2934 /* Write to sensor register 0x44: UNDOCUMENTED */
2935 buf[0] = 0x00; buf[1] = 0x82;
2936 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x44, dev->sensor_flags, buf);
2937 /* Writes to sensor registers 0x5a: RESERVED */
2938 /* 0x5b: RESERVED */
2939 buf[0] = 0x00; buf[1] = 0x00;
2940 buf[2] = 0x00; buf[3] = 0x00;
2941 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5a, dev->sensor_flags, buf);
2942 /* Writes to sensor registers 0x5c: RESERVED */
2943 /* 0x5d: RESERVED */
2944 buf[0] = 0x00; buf[1] = 0x00;
2945 buf[2] = 0x00; buf[3] = 0x00;
2946 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5c, dev->sensor_flags, buf);
2947 /* Writes to sensor registers 0x5e: RESERVED */
2948 /* 0x5f: RESERVED */
2949 buf[0] = 0x00; buf[1] = 0x00;
2950 buf[2] = 0xa3; buf[3] = 0x1d;
2951 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5e, dev->sensor_flags, buf);
2952 /* "Dummy" write to sensor Register 0x68: UNDOCUMENTED */
2953 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x68, dev->sensor_flags, NULL);
2954 /* Write to sensor register 0x62: RESERVED */
2955 buf[0] = 0x06; buf[1] = 0x11;
2956 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x62, dev->sensor_flags, buf);
2958 if (retI2C < 0) {
2959 UDIA_INFO("1 or more errors occured in I2C-message-block 1 !\n");
2960 return -1;
2962 /* END OF I2C MESSAGES */
2963 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
2965 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
2966 buf[0] = 0x40;
2967 usb_microdia_control_write(dev, 0x1007, buf, 8);
2968 buf[0] = 0x40;
2969 usb_microdia_control_write(dev, 0x1006, buf, 8);
2973 /* *** TEMPORARY SWITCH TO SLAVE ADDRESS 0x50, I2C READ ATTEMPT: */
2974 /* - WE CURRENTLY KNOW NO 6270 CAM THAT IS SUCCESSFULLY READ HERE */
2975 /* - IF READ FAILS, THIS IS NEVER DONE AGAIN (IN NEXT CYCLE OR FURTHER STARTS) */
2976 usb_microdia_control_read(dev, 0x10c1, buf, 1); /* returns 0x5c */
2977 buf[0] = 0x50;
2978 usb_microdia_control_write(dev, 0x10c1, buf, 1);
2979 retI2C = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, SN9C20X_I2C_2WIRE, buf);
2980 if (retI2C >= 0)
2981 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");
2982 buf[0] = 0x5c;
2983 usb_microdia_control_write(dev, 0x10c1, buf, 1);
2986 buf[0] = 0x47; /* ALEX: 0x44 */
2987 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2045 */
2988 buf[0] = 0x47; /* ALEX: 0x04 */
2989 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2046 */
2990 buf[0] = 0xc6;
2991 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2047 */
2992 buf[0] = 0xc4;
2993 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2048 */
2994 buf[0] = 0x84; /* ALEX: 0xc0 */
2995 usb_microdia_control_write(dev, 0x1001, buf, 1); /* URB 2049 */
2996 /* ALEX:
2997 buf[0] = 0x40;
2998 usb_microdia_control_write(dev, 0x1001, buf, 1);
3001 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3002 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3003 /* I2C MESSAGES */
3004 retI2C = 0;
3005 /* Writes to sensor registers 0x02: Column Start */
3006 /* 0x03: Window Height */
3007 buf[0] = 0x00; buf[1] = 0x16; /* coulmn 22 */
3008 buf[2] = 0x01; buf[3] = 0xe1; /* 481 */
3009 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); /* URBs 2050-2052 */
3010 /* Writes to sensor registers 0x04: Window Width */
3011 /* 0x05: Horizontal Blanking */
3012 buf[0] = 0x02; buf[1] = 0x81; /* 641 */
3013 buf[2] = 0x00; buf[3] = 0x04; /* 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00 */
3014 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); /* URBs 2053-2055 */
3015 /* Writes to sensor registers 0x06: Vertical Blanking */
3016 /* 0x07: Output Control */
3017 buf[0] = 0x00; buf[1] = 0x00; /* 0 rows */
3018 buf[2] = 0x30; buf[3] = 0x02; /* normal operation + chip enable + RESERVED options */
3019 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); /* URBs 2056-2058 */
3020 /* Write to sensor register 0x0e: UNDOCUMENTED */
3021 buf[0] = 0x00; buf[1] = 0x08;
3022 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); /* URBs 2059-2061 */
3023 if (retI2C < 0) {
3024 UDIA_INFO("1 or more errors occured in I2C-message-block 2 !\n");
3025 return -1;
3027 /* END OF I2C MESSAGES */
3028 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3031 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
3032 buf[4] = 0x28; buf[5] = 0x3c;
3033 usb_microdia_control_write(dev, 0x1180, buf, 6); /* URB 2062 */
3034 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3035 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 2063 */
3036 buf[0] = 0x0c;
3037 usb_microdia_control_write(dev, 0x1189, buf, 1); /* URB 2064 */
3038 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3039 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 2065 */
3040 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3041 usb_microdia_control_write(dev, 0x11ab, buf, 4); /* URB 2066 */
3042 buf[0] = 0x78; /* ALEX: 0x7c */
3043 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 2067 */
3044 buf[0] = 0x18; /* ALEX: 0x1c */
3045 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2068 */
3046 buf[0] = 0x18; /* ALEX: 0x1c */
3047 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2069 */
3048 buf[0] = 0x38;
3049 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2070 */
3050 buf[0] = 0x04;
3051 usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 2071 */
3052 buf[0] = 0x04;
3053 usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 2072 */
3055 buf[0] = 0x78;
3056 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2073 */
3057 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2074 // 0x38 */
3058 if (buf[0] == 0x38)
3059 buf[0] = 0x79;
3060 else if (buf[0] == 0xb8)
3061 buf[0] = 0xf9;
3062 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2075 */
3063 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2076 // 0xb9 */
3064 if (buf[0] == 0x39)
3065 buf[0] = 0x7a;
3066 else if (buf[0] == 0xb9)
3067 buf[0] = 0xfa;
3068 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2077 */
3069 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2078 */
3070 if (buf[0] == 0x3a)
3071 buf[0] = 0x7b;
3072 else if (buf[0] == 0xba)
3073 buf[0] = 0xfb;
3074 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2079 */
3075 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2080 // 0x3b */
3076 if (buf[0] == 0x3b)
3077 buf[0] = 0x7c;
3078 else if (buf[0] == 0xbb)
3079 buf[0] = 0xfc;
3080 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2081 */
3081 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2082 // 0x3c */
3082 if (buf[0] == 0x3c)
3083 buf[0] = 0x7d;
3084 else if (buf[0] == 0xbc)
3085 buf[0] = 0xfd;
3086 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2083 */
3087 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2084 // 0x3d */
3088 last_11b8[0] = buf[0];
3089 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3090 if (buf[0] == 0x3d)
3091 buf[0] = 0x7e;
3092 else if (buf[0] == 0xbd)
3093 buf[0] = 0xfe;
3094 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2085 */
3095 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2086 */
3096 if (buf[0] == 0x3e)
3097 buf[0] = 0x7f;
3098 else if (buf[0] == 0xbe)
3099 buf[0] = 0xff;
3100 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2087 */
3101 usb_microdia_control_read(dev, 0x11b8, last_11b8, 1); /* URB 2088 */
3103 buf[0] = last_11b8[0] & 0xf0; /* 0xf0 or 0x70 */
3104 buf[0] = buf[0] | 0x0d; /* 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES */
3105 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2089 */
3108 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3109 /* I2C MESSAGES */
3110 retI2C = 0;
3111 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3112 /* Write to sensor register 0x06: Vertical Blanking */
3113 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3114 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); /* URBs 2090-2092 */
3115 /* Write to sensor register 0x05: Horizontal Blanking */
3116 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) */
3117 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); /* URBs 2093-2095 */
3118 /* Write to sensor register 0x20: Read Mode */
3119 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
3120 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2096-2098 */
3121 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3122 /* Write to sensor register 0x0a: Pixel Clock Speed */
3123 buf[0] = 0x00; buf[1] = 0x00; /* default */
3124 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0a, dev->sensor_flags, buf);
3125 /* Write to sensor register 0x06: Vertical Blanking */
3126 buf[0] = 0x00; buf[1] = 0x29; /* 41 rows */
3127 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3128 /* Write to sensor register 0x05: Horizontal Blanking */
3129 buf[0] = 0x00; buf[1] = 0x09; /* 9 columns (pixel clocks) */
3130 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
3131 /* Write to sensor register 0x20: Read Mode */
3132 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad ones) + UNKNOWN */
3133 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
3135 if (retI2C < 0) {
3136 UDIA_INFO("1 or more errors occured in I2C-message-block 3 !\n");
3137 return -1;
3139 /* END OF I2C MESSAGES */
3140 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3143 buf[0] = 0x02;
3144 usb_microdia_control_write(dev, 0x1180, buf, 1); /* URB 2099 */
3146 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3147 /* I2C MESSAGE */
3148 retI2C = 0;
3149 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3150 /* Write to sensor register 0x20: Read Mode */
3151 buf[0] = 0x00; buf[1] = 0x00; /* normal readout */
3152 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); /* URBs 2100-2102 */
3153 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3154 /* Write to sensor register 0x20: Read Mode */
3155 buf[0] = 0x11; buf[1] = 0x01; /* output all frames (including bad ones) + UNKNOWN */
3156 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
3158 if (retI2C < 0) {
3159 UDIA_INFO("1 or more errors occured in I2C-message-block 4 !\n");
3160 return -1;
3162 /* END OF I2C MESSAGES */
3163 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3166 buf[0] = 0x02;
3167 usb_microdia_control_write(dev, 0x1182, buf, 1); /* URB 2103 */
3170 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3171 /* I2C MESSAGES */
3172 retI2C = 0;
3173 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3174 /* Write to sensor register 0x09: Shutter Width */
3175 buf[0] = 0x00; buf[1] = 0x64; /* integration of 100 rows */
3176 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf); /* URBs 2104-2106 */
3177 /* Write to sensor register 0x2b: Green 1 Gain */
3178 /* 0x2c: Blue Gain */
3179 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3180 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3181 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf); /* URBs 2107-2109 */
3182 /* Write to sensor register 0x2d: Red Gain */
3183 /* 0x2e: Green 2 Gain */
3184 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3185 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3186 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf); /* URBs 2110-2112 */
3187 /* "Dummy" write to sensor Register 0x33: RESERVED */
3188 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL); /* URBs 2113-2114 */
3189 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3190 /* Write to sensor register 0x09: Shutter Width */
3191 buf[0] = 0x00; buf[1] = 0x64; /* integration of 100 rows */
3192 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf);
3193 /* Write to sensor register 0x07: Output Control */
3194 buf[0] = 0x00; buf[1] = 0x03; /* dont update changes until bit0=0, chip enable, normal operation */
3195 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
3196 /* Write to sensor register 0x2b: Green 1 Gain */
3197 /* 0x2c: Blue Gain */
3198 buf[0] = 0x00; buf[1] = 0x33; /* 51*0.03125*1 = 1.59375 */
3199 buf[2] = 0x00; buf[3] = 0xa0; /* 32*0.03125*2 = 2 */
3200 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf);
3201 /* Write to sensor register 0x2d: Red Gain */
3202 /* 0x2e: Green 2 Gain */
3203 buf[0] = 0x00; buf[1] = 0xa0; /* 32*0.03125*2 = 2 */
3204 buf[2] = 0x00; buf[3] = 0x33; /* 51*0.03125*1 = 1.59375 */
3205 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf);
3206 /* "Dummy" write to sensor Register 0x33: RESERVED */
3207 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL);
3208 /* Write to sensor register 0x07: Output Control */
3209 buf[0] = 0x00; buf[1] = 0x02; /* chip enable, normal operation */
3210 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
3212 if (retI2C < 0) {
3213 UDIA_INFO("1 or more errors occured in I2C-message-block 5 !\n");
3214 return -1;
3216 /* END OF I2C MESSAGES */
3217 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3219 buf[0] = 0x0a;
3220 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2119 */
3222 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3223 buf[0] = 0x14;
3224 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3225 buf[0] = 0x0a;
3226 usb_microdia_control_write(dev, 0x118b, buf, 1); /* URB 2124 */
3228 buf[0] = 0x07;
3229 usb_microdia_control_write(dev, 0x10f7, buf, 1); /* URB 2135 */
3231 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3232 buf[0] = 0x01;
3233 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3234 buf[0] = 0x14;
3235 usb_microdia_control_write(dev, 0x10f8, buf, 1); /* URB 2138 */
3237 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3238 buf[0] = 0x0a;
3239 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3240 buf[0] = 0xff;
3241 usb_microdia_control_write(dev, 0x10fa, buf, 1); /* URB 2139 */
3243 buf[0] = 0x00;
3244 usb_microdia_control_write(dev, 0x10f9, buf, 1); /* URB 2140 */
3245 buf[0] = 0x00;
3246 usb_microdia_control_write(dev, 0x10f9, buf, 1); /* URB 2141 */
3247 buf[0] = 0x0a;
3248 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2142 */
3249 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
3250 usb_microdia_control_write(dev, 0x11bc, buf, 4); /* URB 2143 */
3251 for (k = 0; k < 48; k++)
3252 buf[k] = 0x00;
3253 usb_microdia_control_write(dev, 0x11c0, buf, 48); /* URB 2144 */
3255 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
3256 buf[4] = 0x04; buf[5] = 0x3f;
3257 usb_microdia_control_write(dev, 0x11a5, buf, 6); /* URB 2149 */
3259 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3260 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
3261 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3262 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
3264 usb_microdia_control_write(dev, 0x11af, buf, 4); /* URB 2150 */
3266 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
3267 usb_microdia_control_write(dev, 0x11b3, buf, 4); /* URB 2151 */
3268 buf[0] = 0x47; /* ALEX: 0x04 */
3269 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2152 */
3270 buf[0] = 0x01;
3271 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2153 */
3272 buf[0] = 0x67; /* ALEX: 0x24 */
3273 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2154 */
3274 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
3275 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
3276 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
3277 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
3278 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
3279 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
3280 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
3281 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
3282 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
3283 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
3284 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
3285 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
3286 buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
3287 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
3288 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
3289 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
3290 usb_microdia_control_write(dev, 0x1100, buf, 64); /* URB 2155 */
3291 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
3292 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
3293 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
3294 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
3295 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
3296 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
3297 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
3298 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
3299 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
3300 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
3301 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
3302 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
3303 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
3304 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
3305 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
3306 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
3307 usb_microdia_control_write(dev, 0x1140, buf, 64); /* URB 2156 */
3308 buf[0] = 0x47; /* ALEX: 0x04 */
3309 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2157 */
3310 buf[0] = 0x03;
3311 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2158 */
3312 buf[0] = 0x4b; /* ALEX: 0x08 */
3313 usb_microdia_control_write(dev, 0x10e0, buf, 1); /* URB 2159 */
3315 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3316 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3317 /* I2C MESSAGES */
3318 retI2C = 0;
3319 /* Writes to sensor registers 0x02: Column Start */
3320 /* 0x03: Window Hight */
3321 buf[0] = 0x00; buf[1] = 0x16; /* coulmn 22 */
3322 buf[2] = 0x01; buf[3] = 0xe1; /* 481 */
3323 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); /* URBs 2160-2162 */
3324 /* Writes to sensor registers 0x04: Window Width */
3325 /* 0x05: Horizontal Blanking */
3326 buf[0] = 0x02; buf[1] = 0x81; /* 641 */
3327 buf[2] = 0x00; buf[3] = 0x04; /* 4 columns (pixel clocks) */
3328 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); /* URBs 2163-2165 */
3329 /* Writes to sensor registers 0x06: Vertical Blanking */
3330 /* 0x07: Output Control */
3331 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3332 buf[2] = 0x30; buf[3] = 0x02; /* RESERVED options */
3333 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); /* URBs 2166-2167 */
3334 /* Writes to sensor register 0x0e: UNDOCUMENTED */
3335 buf[0] = 0x00; buf[1] = 0x08;
3336 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); /* URBs 2168-2170 */
3337 if (retI2C < 0) {
3338 UDIA_INFO("1 or more errors occured in I2C-message-block 6 !\n");
3339 return -1;
3341 /* END OF I2C MESSAGES */
3342 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3343 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3344 buf[0] = 0x40;
3345 usb_microdia_control_write(dev, 0x1007, buf, 1);
3346 buf[0] = 0x40;
3347 usb_microdia_control_write(dev, 0x1006, buf, 1);
3351 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
3352 buf[4] = 0x28; buf[5] = 0x3c;
3353 usb_microdia_control_write(dev, 0x1180, buf, 6); /* URB 2171 */
3354 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3355 usb_microdia_control_write(dev, 0x10fb, buf, 5); /* URB 2172 */
3356 buf[0] = 0x0c;
3357 usb_microdia_control_write(dev, 0x1189, buf, 1); /* URB 2173 */
3358 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3359 usb_microdia_control_write(dev, 0x11a1, buf, 4); /* URB 2174 */
3360 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3361 usb_microdia_control_write(dev, 0x11ab, buf, 4); /* URB 2175 */
3362 buf[0] = 0x03;
3363 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2176 */
3364 buf[0] = 0x0a;
3365 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2177 */
3366 buf[0] = 0x00;
3367 usb_microdia_control_write(dev, 0x11b9, buf, 1); /* URB 2178 */
3368 buf[0] = 0x0b;
3369 usb_microdia_control_write(dev, 0x11ba, buf, 1); /* URB 2179 */
3370 buf[0] = 0x01;
3371 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2180 */
3372 buf[0] = 0x78; /* ALEX: 0x7c */
3373 usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 2181 */
3374 buf[0] = 0x18; /* ALEX: 0x1c */
3375 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2182 */
3376 buf[0] = 0x18; /* ALEX: 0x1c */
3377 usb_microdia_control_write(dev, 0x1002, buf, 1); /* URB 2183 */
3378 buf[0] = 0x7d; /* ALEX: 0xfc */
3379 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2184 */
3380 buf[0] = 0x04;
3381 usb_microdia_control_write(dev, 0x118a, buf, 1); /* URB 2185 */
3382 buf[0] = 0x04;
3383 usb_microdia_control_write(dev, 0x0395, buf, 1); /* URB 2186 */
3385 if ((last_11b8[0] == 0x3d) || (last_11b8[0] == 0x3f))
3386 buf[0] = 0x78;
3387 else if ((last_11b8[0] == 0xbd) || (last_11b8[0] == 0xbf))
3388 buf[0] = 0xf8;
3389 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2187 */
3390 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2188 // 0x38 */
3391 if (buf[0] == 0x38)
3392 buf[0] = 0x79;
3393 else if (buf[0] == 0xb8)
3394 buf[0] = 0xf9;
3395 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2189 */
3396 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2190 // 0xb9 */
3397 if (buf[0] == 0x39)
3398 buf[0] = 0x7a;
3399 else if (buf[0] == 0xb9)
3400 buf[0] = 0xfa;
3401 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2191 */
3402 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2192 // 0xba */
3403 if (buf[0] == 0x3a)
3404 buf[0] = 0x7b;
3405 else if (buf[0] == 0xba)
3406 buf[0] = 0xfb;
3407 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2193 */
3408 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2194 // 0x3b */
3409 if (buf[0] == 0x3b)
3410 buf[0] = 0x7c;
3411 else if (buf[0] == 0xbb)
3412 buf[0] = 0xfc;
3413 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2195 */
3414 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2196 // 0x3c */
3415 if (buf[0] == 0x3c)
3416 buf[0] = 0x7d;
3417 else if (buf[0] == 0xbc)
3418 buf[0] = 0xfd;
3419 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2197 */
3420 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2198 // 0x3d */
3421 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3422 if (buf[0] == 0x3d)
3423 buf[0] = 0x7e;
3424 else if (buf[0] == 0xbd)
3425 buf[0] = 0xfe;
3426 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2199 */
3427 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2200 */
3428 if (buf[0] == 0x3e)
3429 buf[0] = 0x7f;
3430 else if (buf[0] == 0xbe)
3431 buf[0] = 0xff;
3432 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2201 */
3433 usb_microdia_control_read(dev, 0x11b8, buf, 1); /* URB 2202 */
3435 buf[0] = buf[0] & 0xf0; /* 0xf0 or 0x70 */
3436 buf[0] = buf[0] | 0x0d; /* 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES */
3437 usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 2089 */
3439 /* ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3440 /* I2C MESSAGES */
3441 retI2C = 0;
3442 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3443 /* Write to sensor register 0x06: Vertical Blanking */
3444 buf[0] = 0x00; buf[1] = 0x2d; /* 45 rows */
3445 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); /* URBs 2204-2206 */
3446 /* Write to sensor register 0x05: Horizontal Blanking */
3447 buf[0] = 0x00; buf[1] = 0x04; /* 4 columns (pixel clocks) */
3448 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); /* URBs 2207-2209 */
3449 /* Read of sensor register 0x36: Chip Version (mirror of reg0xff) */
3450 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x36, dev->sensor_flags, buf); /* URBs 2211-2215 // 0x82 0x3a */
3451 } else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
3452 /* Write to sensor register 0x0a: Pixel Clock Speed */
3453 buf[0] = 0x00; buf[1] = 0x00; /* default */
3454 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3455 /* Write to sensor register 0x06: Vertical Blanking */
3456 buf[0] = 0x00; buf[1] = 0x29; /* 41 rows */
3457 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
3458 /* Write to sensor register 0x05: Horizontal Blanking */
3459 buf[0] = 0x00; buf[1] = 0x09; /* 9 columns (pixel clocks) */
3460 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
3461 /* Read of sensor register 0x00: Chip Version (=reg0xff) */
3462 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x00, dev->sensor_flags, buf); /* 0x82 0x43 */
3464 if (retI2C < 0) {
3465 UDIA_INFO("1 or more errors occured in I2C-message-block 7 !\n");
3466 return -1;
3468 /* END OF I2C MESSAGES */
3469 /* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
3472 buf[0] = 0x03;
3473 usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 2216 */
3476 /*** NOW DRIVER DOES STOP-SEQUENCE
3477 - WITHOUT WRITES TO 0x1007 AND 0x1006 (URBs 3544-3550) => MT9V111
3478 - WRITING 0x40 INSTEAD OF 0x60 TO 0x1007 AND 0x1006 => MT9V011
3479 ***/
3480 /*** 2nd, 3rd, ... CYCLE: ALL MESSAGES (URBs 1953 - URBs 2216) ARE REPEATED ***/
3481 /*** ----- WE DON'T DO THIS, IT SEEMS TO BE UNNECESSARY ----- ***/
3483 /* Setup IFP registers for AE and AWB (new, not in the logs): */
3484 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
3485 mt9v111_setup_autoexposure(dev);
3486 mt9v111_setup_autowhitebalance(dev);
3487 mt9v111_set_autocorrections(dev, 1);
3490 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3491 buf[0] = 0x20;
3492 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3493 buf[0] = 0x60;
3494 usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 2489 */
3495 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
3496 buf[0] = 0x00;
3497 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
3498 buf[0] = 0x40;
3499 usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 2490 */
3500 /* => These two writes seem to cause the cam to start sending isochronus USB messages */
3502 return 0;
3505 int microdia_627b_start_stream(struct usb_microdia *dev)
3507 int ret;
3508 /* Initialize the Bridge Controller */
3509 ret = sn9c20x_initialize(dev);
3510 /* Initialize the I2C interface in the Bridge */
3511 ret = sn9c20x_i2c_initialize(dev);
3512 /* Finally, Initialize the Sensor array */
3513 if (dev->sensor_init)
3514 dev->sensor_init(dev);
3515 return ret;
3519 * @brief From UsbSnoop-plugin-parsed.log
3521 * @param dev
3523 * @returns 0 (OK) or <0 (Error)
3525 * @author Vincent, Kuzja
3527 int microdia_6288_start_stream(struct usb_microdia *dev)
3529 int ret;
3530 __u16 reg;
3531 __u8 buf[64];
3535 reg = 0x1066 ;
3536 buf[0] = 0x00;
3537 ret = usb_microdia_control_write(dev, reg, buf, 1);
3538 if (ret < 0)
3539 goto err;
3541 reg = 0x1000 ;
3542 buf[0] = 0x78;
3543 ret = usb_microdia_control_write(dev, reg, buf, 1);
3544 if (ret < 0)
3545 goto err;
3547 reg = 0x1001 ;
3548 buf[0] = 0xc7;
3549 ret = usb_microdia_control_write(dev, reg, buf, 1);
3550 if (ret < 0)
3551 goto err;
3553 reg = 0x1002 ;
3554 buf[0] = 0x1c;
3555 ret = usb_microdia_control_write(dev, reg, buf, 1);
3556 if (ret < 0)
3557 goto err;
3559 reg = 0x1061 ;
3560 buf[0] = 0x01;
3561 ret = usb_microdia_control_write(dev, reg, buf, 1);
3562 if (ret < 0)
3563 goto err;
3565 reg = 0x1020 ;
3566 buf[0] = 0x80;
3567 ret = usb_microdia_control_write(dev, reg, buf, 1);
3568 if (ret < 0)
3569 goto err;
3571 reg = 0x1067 ;
3572 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3573 buf[3] = 0x10; buf[4] = 0x08;
3574 ret = usb_microdia_control_write(dev, reg, buf, 5);
3575 if (ret < 0)
3576 goto err;
3578 reg = 0x10c0 ;
3579 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;
3580 ret = usb_microdia_control_write(dev, reg, buf, 9);
3581 if (ret < 0)
3582 goto err;
3584 reg = 0x10e0 ;
3585 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
3586 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
3587 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
3588 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
3589 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
3590 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
3591 ret = usb_microdia_control_write(dev, reg, buf, 24);
3592 if (ret < 0)
3593 goto err;
3595 reg = 0x10f8 ;
3596 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
3597 ret = usb_microdia_control_write(dev, reg, buf, 3);
3598 if (ret < 0)
3599 goto err;
3601 reg = 0x10fb ;
3602 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
3603 ret = usb_microdia_control_write(dev, reg, buf, 5);
3604 if (ret < 0)
3605 goto err;
3607 reg = 0x1188 ;
3608 buf[0] = 0x86; buf[1] = 0xcc; buf[2] = 0x08;
3609 ret = usb_microdia_control_write(dev, reg, buf, 3);
3610 if (ret < 0)
3611 goto err;
3613 reg = 0x118b ;
3614 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
3615 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
3616 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
3617 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
3618 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
3619 buf[20] = 0xf4; buf[21] = 0xff;
3620 ret = usb_microdia_control_write(dev, reg, buf, 22);
3621 if (ret < 0)
3622 goto err;
3624 reg = 0x11a1 ;
3625 buf[0] = 0x00; buf[1] = 0x00;
3626 ret = usb_microdia_control_write(dev, reg, buf, 2);
3627 if (ret < 0)
3628 goto err;
3630 reg = 0x11b7 ;
3631 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08;
3632 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
3633 buf[8] = 0x00;
3634 ret = usb_microdia_control_write(dev, reg, buf, 9);
3635 if (ret < 0)
3636 goto err;
3638 reg = 0x11b8 ;
3639 buf[0] = 0x30;
3640 ret = usb_microdia_control_write(dev, reg, buf, 1);
3641 if (ret < 0)
3642 goto err;
3644 reg = 0x1000 ;
3645 buf[0] = 0x78;
3646 ret = usb_microdia_control_write(dev, reg, buf, 1);
3647 if (ret < 0)
3648 goto err;
3650 reg = 0x10c0 ;
3651 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3652 ret = usb_microdia_control_write(dev, reg, buf, 8);
3653 if (ret < 0)
3654 goto err;
3656 reg = 0x10c0 ;
3657 ret = usb_microdia_control_read(dev, reg, buf, 1);
3658 if (ret < 0)
3659 goto err;
3661 reg = 0x10c0 ;
3662 ret = usb_microdia_control_read(dev, reg, buf, 1);
3663 if (ret < 0)
3664 goto err;
3666 reg = 0x10c0 ;
3667 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3668 ret = usb_microdia_control_write(dev, reg, buf, 8);
3669 if (ret < 0)
3670 goto err;
3672 reg = 0x10c0 ;
3673 ret = usb_microdia_control_read(dev, reg, buf, 1);
3674 if (ret < 0)
3675 goto err;
3677 reg = 0x10c0 ;
3678 ret = usb_microdia_control_read(dev, reg, buf, 1);
3679 if (ret < 0)
3680 goto err;
3682 reg = 0x10c0 ;
3683 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3684 ret = usb_microdia_control_write(dev, reg, buf, 8);
3685 if (ret < 0)
3686 goto err;
3688 reg = 0x10c0 ;
3689 ret = usb_microdia_control_read(dev, reg, buf, 1);
3690 if (ret < 0)
3691 goto err;
3693 reg = 0x10c0 ;
3694 ret = usb_microdia_control_read(dev, reg, buf, 1);
3695 if (ret < 0)
3696 goto err;
3698 reg = 0x10c0 ;
3699 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0e; buf[3] = 0x61; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3700 ret = usb_microdia_control_write(dev, reg, buf, 8);
3701 if (ret < 0)
3702 goto err;
3704 reg = 0x10c0 ;
3705 ret = usb_microdia_control_read(dev, reg, buf, 1);
3706 if (ret < 0)
3707 goto err;
3709 reg = 0x10c0 ;
3710 ret = usb_microdia_control_read(dev, reg, buf, 1);
3711 if (ret < 0)
3712 goto err;
3714 reg = 0x10c0 ;
3715 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3716 ret = usb_microdia_control_write(dev, reg, buf, 8);
3717 if (ret < 0)
3718 goto err;
3720 reg = 0x10c0 ;
3721 ret = usb_microdia_control_read(dev, reg, buf, 1);
3722 if (ret < 0)
3723 goto err;
3725 reg = 0x10c0 ;
3726 ret = usb_microdia_control_read(dev, reg, buf, 1);
3727 if (ret < 0)
3728 goto err;
3730 reg = 0x10c0 ;
3731 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x13; buf[3] = 0xb8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3732 ret = usb_microdia_control_write(dev, reg, buf, 8);
3733 if (ret < 0)
3734 goto err;
3736 reg = 0x10c0 ;
3737 ret = usb_microdia_control_read(dev, reg, buf, 1);
3738 if (ret < 0)
3739 goto err;
3741 reg = 0x10c0 ;
3742 ret = usb_microdia_control_read(dev, reg, buf, 1);
3743 if (ret < 0)
3744 goto err;
3746 reg = 0x10c0 ;
3747 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x14; buf[3] = 0x3e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3748 ret = usb_microdia_control_write(dev, reg, buf, 8);
3749 if (ret < 0)
3750 goto err;
3752 reg = 0x10c0 ;
3753 ret = usb_microdia_control_read(dev, reg, buf, 1);
3754 if (ret < 0)
3755 goto err;
3757 reg = 0x10c0 ;
3758 ret = usb_microdia_control_read(dev, reg, buf, 1);
3759 if (ret < 0)
3760 goto err;
3762 reg = 0x10c0 ;
3763 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x16; buf[3] = 0x24; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3764 ret = usb_microdia_control_write(dev, reg, buf, 8);
3765 if (ret < 0)
3766 goto err;
3768 reg = 0x10c0 ;
3769 ret = usb_microdia_control_read(dev, reg, buf, 1);
3770 if (ret < 0)
3771 goto err;
3773 reg = 0x10c0 ;
3774 ret = usb_microdia_control_read(dev, reg, buf, 1);
3775 if (ret < 0)
3776 goto err;
3778 reg = 0x10c0 ;
3779 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3780 ret = usb_microdia_control_write(dev, reg, buf, 8);
3781 if (ret < 0)
3782 goto err;
3784 reg = 0x10c0 ;
3785 ret = usb_microdia_control_read(dev, reg, buf, 1);
3786 if (ret < 0)
3787 goto err;
3789 reg = 0x10c0 ;
3790 ret = usb_microdia_control_read(dev, reg, buf, 1);
3791 if (ret < 0)
3792 goto err;
3794 reg = 0x10c0 ;
3795 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3796 ret = usb_microdia_control_write(dev, reg, buf, 8);
3797 if (ret < 0)
3798 goto err;
3800 reg = 0x10c0 ;
3801 ret = usb_microdia_control_read(dev, reg, buf, 1);
3802 if (ret < 0)
3803 goto err;
3805 reg = 0x10c0 ;
3806 ret = usb_microdia_control_read(dev, reg, buf, 1);
3807 if (ret < 0)
3808 goto err;
3810 reg = 0x10c0 ;
3811 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3812 ret = usb_microdia_control_write(dev, reg, buf, 8);
3813 if (ret < 0)
3814 goto err;
3816 reg = 0x10c0 ;
3817 ret = usb_microdia_control_read(dev, reg, buf, 1);
3818 if (ret < 0)
3819 goto err;
3821 reg = 0x10c0 ;
3822 ret = usb_microdia_control_read(dev, reg, buf, 1);
3823 if (ret < 0)
3824 goto err;
3826 reg = 0x10c0 ;
3827 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x27; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3828 ret = usb_microdia_control_write(dev, reg, buf, 8);
3829 if (ret < 0)
3830 goto err;
3832 reg = 0x10c0 ;
3833 ret = usb_microdia_control_read(dev, reg, buf, 1);
3834 if (ret < 0)
3835 goto err;
3837 reg = 0x10c0 ;
3838 ret = usb_microdia_control_read(dev, reg, buf, 1);
3839 if (ret < 0)
3840 goto err;
3842 reg = 0x10c0 ;
3843 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x28; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3844 ret = usb_microdia_control_write(dev, reg, buf, 8);
3845 if (ret < 0)
3846 goto err;
3848 reg = 0x10c0 ;
3849 ret = usb_microdia_control_read(dev, reg, buf, 1);
3850 if (ret < 0)
3851 goto err;
3853 reg = 0x10c0 ;
3854 ret = usb_microdia_control_read(dev, reg, buf, 1);
3855 if (ret < 0)
3856 goto err;
3858 reg = 0x10c0 ;
3859 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x29; buf[3] = 0x15; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3860 ret = usb_microdia_control_write(dev, reg, buf, 8);
3861 if (ret < 0)
3862 goto err;
3864 reg = 0x10c0 ;
3865 ret = usb_microdia_control_read(dev, reg, buf, 1);
3866 if (ret < 0)
3867 goto err;
3869 reg = 0x10c0 ;
3870 ret = usb_microdia_control_read(dev, reg, buf, 1);
3871 if (ret < 0)
3872 goto err;
3874 reg = 0x10c0 ;
3875 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2c; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3876 ret = usb_microdia_control_write(dev, reg, buf, 8);
3877 if (ret < 0)
3878 goto err;
3880 reg = 0x10c0 ;
3881 ret = usb_microdia_control_read(dev, reg, buf, 1);
3882 if (ret < 0)
3883 goto err;
3885 reg = 0x10c0 ;
3886 ret = usb_microdia_control_read(dev, reg, buf, 1);
3887 if (ret < 0)
3888 goto err;
3890 reg = 0x10c0 ;
3891 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3892 ret = usb_microdia_control_write(dev, reg, buf, 8);
3893 if (ret < 0)
3894 goto err;
3896 reg = 0x10c0 ;
3897 ret = usb_microdia_control_read(dev, reg, buf, 1);
3898 if (ret < 0)
3899 goto err;
3901 reg = 0x10c0 ;
3902 ret = usb_microdia_control_read(dev, reg, buf, 1);
3903 if (ret < 0)
3904 goto err;
3906 reg = 0x10c0 ;
3907 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x34; buf[3] = 0x3d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3908 ret = usb_microdia_control_write(dev, reg, buf, 8);
3909 if (ret < 0)
3910 goto err;
3912 reg = 0x10c0 ;
3913 ret = usb_microdia_control_read(dev, reg, buf, 1);
3914 if (ret < 0)
3915 goto err;
3917 reg = 0x10c0 ;
3918 ret = usb_microdia_control_read(dev, reg, buf, 1);
3919 if (ret < 0)
3920 goto err;
3922 reg = 0x10c0 ;
3923 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x35; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3924 ret = usb_microdia_control_write(dev, reg, buf, 8);
3925 if (ret < 0)
3926 goto err;
3928 reg = 0x10c0 ;
3929 ret = usb_microdia_control_read(dev, reg, buf, 1);
3930 if (ret < 0)
3931 goto err;
3933 reg = 0x10c0 ;
3934 ret = usb_microdia_control_read(dev, reg, buf, 1);
3935 if (ret < 0)
3936 goto err;
3938 reg = 0x10c0 ;
3939 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x36; buf[3] = 0xf8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3940 ret = usb_microdia_control_write(dev, reg, buf, 8);
3941 if (ret < 0)
3942 goto err;
3944 reg = 0x10c0 ;
3945 ret = usb_microdia_control_read(dev, reg, buf, 1);
3946 if (ret < 0)
3947 goto err;
3949 reg = 0x10c0 ;
3950 ret = usb_microdia_control_read(dev, reg, buf, 1);
3951 if (ret < 0)
3952 goto err;
3954 reg = 0x10c0 ;
3955 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x38; buf[3] = 0x12; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3956 ret = usb_microdia_control_write(dev, reg, buf, 8);
3957 if (ret < 0)
3958 goto err;
3960 reg = 0x10c0 ;
3961 ret = usb_microdia_control_read(dev, reg, buf, 1);
3962 if (ret < 0)
3963 goto err;
3965 reg = 0x10c0 ;
3966 ret = usb_microdia_control_read(dev, reg, buf, 1);
3967 if (ret < 0)
3968 goto err;
3970 reg = 0x10c0 ;
3971 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x39; buf[3] = 0x57; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3972 ret = usb_microdia_control_write(dev, reg, buf, 8);
3973 if (ret < 0)
3974 goto err;
3976 reg = 0x10c0 ;
3977 ret = usb_microdia_control_read(dev, reg, buf, 1);
3978 if (ret < 0)
3979 goto err;
3981 reg = 0x10c0 ;
3982 ret = usb_microdia_control_read(dev, reg, buf, 1);
3983 if (ret < 0)
3984 goto err;
3986 reg = 0x10c0 ;
3987 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
3988 ret = usb_microdia_control_write(dev, reg, buf, 8);
3989 if (ret < 0)
3990 goto err;
3992 reg = 0x10c0 ;
3993 ret = usb_microdia_control_read(dev, reg, buf, 1);
3994 if (ret < 0)
3995 goto err;
3997 reg = 0x10c0 ;
3998 ret = usb_microdia_control_read(dev, reg, buf, 1);
3999 if (ret < 0)
4000 goto err;
4002 reg = 0x10c0 ;
4003 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3b; buf[3] = 0xcc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4004 ret = usb_microdia_control_write(dev, reg, buf, 8);
4005 if (ret < 0)
4006 goto err;
4008 reg = 0x10c0 ;
4009 ret = usb_microdia_control_read(dev, reg, buf, 1);
4010 if (ret < 0)
4011 goto err;
4013 reg = 0x10c0 ;
4014 ret = usb_microdia_control_read(dev, reg, buf, 1);
4015 if (ret < 0)
4016 goto err;
4018 reg = 0x10c0 ;
4019 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3c; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4020 ret = usb_microdia_control_write(dev, reg, buf, 8);
4021 if (ret < 0)
4022 goto err;
4024 reg = 0x10c0 ;
4025 ret = usb_microdia_control_read(dev, reg, buf, 1);
4026 if (ret < 0)
4027 goto err;
4029 reg = 0x10c0 ;
4030 ret = usb_microdia_control_read(dev, reg, buf, 1);
4031 if (ret < 0)
4032 goto err;
4034 reg = 0x10c0 ;
4035 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3d; buf[3] = 0x19; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4036 ret = usb_microdia_control_write(dev, reg, buf, 8);
4037 if (ret < 0)
4038 goto err;
4040 reg = 0x10c0 ;
4041 ret = usb_microdia_control_read(dev, reg, buf, 1);
4042 if (ret < 0)
4043 goto err;
4045 reg = 0x10c0 ;
4046 ret = usb_microdia_control_read(dev, reg, buf, 1);
4047 if (ret < 0)
4048 goto err;
4050 reg = 0x10c0 ;
4051 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3e; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4052 ret = usb_microdia_control_write(dev, reg, buf, 8);
4053 if (ret < 0)
4054 goto err;
4056 reg = 0x10c0 ;
4057 ret = usb_microdia_control_read(dev, reg, buf, 1);
4058 if (ret < 0)
4059 goto err;
4061 reg = 0x10c0 ;
4062 ret = usb_microdia_control_read(dev, reg, buf, 1);
4063 if (ret < 0)
4064 goto err;
4066 reg = 0x10c0 ;
4067 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3f; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4068 ret = usb_microdia_control_write(dev, reg, buf, 8);
4069 if (ret < 0)
4070 goto err;
4072 reg = 0x10c0 ;
4073 ret = usb_microdia_control_read(dev, reg, buf, 1);
4074 if (ret < 0)
4075 goto err;
4077 reg = 0x10c0 ;
4078 ret = usb_microdia_control_read(dev, reg, buf, 1);
4079 if (ret < 0)
4080 goto err;
4082 reg = 0x10c0 ;
4083 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x41; buf[3] = 0x40; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4084 ret = usb_microdia_control_write(dev, reg, buf, 8);
4085 if (ret < 0)
4086 goto err;
4088 reg = 0x10c0 ;
4089 ret = usb_microdia_control_read(dev, reg, buf, 1);
4090 if (ret < 0)
4091 goto err;
4093 reg = 0x10c0 ;
4094 ret = usb_microdia_control_read(dev, reg, buf, 1);
4095 if (ret < 0)
4096 goto err;
4098 reg = 0x10c0 ;
4099 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x42; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4100 ret = usb_microdia_control_write(dev, reg, buf, 8);
4101 if (ret < 0)
4102 goto err;
4104 reg = 0x10c0 ;
4105 ret = usb_microdia_control_read(dev, reg, buf, 1);
4106 if (ret < 0)
4107 goto err;
4109 reg = 0x10c0 ;
4110 ret = usb_microdia_control_read(dev, reg, buf, 1);
4111 if (ret < 0)
4112 goto err;
4114 reg = 0x10c0 ;
4115 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x45; buf[3] = 0x46; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4116 ret = usb_microdia_control_write(dev, reg, buf, 8);
4117 if (ret < 0)
4118 goto err;
4120 reg = 0x10c0 ;
4121 ret = usb_microdia_control_read(dev, reg, buf, 1);
4122 if (ret < 0)
4123 goto err;
4125 reg = 0x10c0 ;
4126 ret = usb_microdia_control_read(dev, reg, buf, 1);
4127 if (ret < 0)
4128 goto err;
4130 reg = 0x10c0 ;
4131 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x46; buf[3] = 0x62; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4132 ret = usb_microdia_control_write(dev, reg, buf, 8);
4133 if (ret < 0)
4134 goto err;
4136 reg = 0x10c0 ;
4137 ret = usb_microdia_control_read(dev, reg, buf, 1);
4138 if (ret < 0)
4139 goto err;
4141 reg = 0x10c0 ;
4142 ret = usb_microdia_control_read(dev, reg, buf, 1);
4143 if (ret < 0)
4144 goto err;
4146 reg = 0x10c0 ;
4147 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x47; buf[3] = 0x2a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4148 ret = usb_microdia_control_write(dev, reg, buf, 8);
4149 if (ret < 0)
4150 goto err;
4152 reg = 0x10c0 ;
4153 ret = usb_microdia_control_read(dev, reg, buf, 1);
4154 if (ret < 0)
4155 goto err;
4157 reg = 0x10c0 ;
4158 ret = usb_microdia_control_read(dev, reg, buf, 1);
4159 if (ret < 0)
4160 goto err;
4162 reg = 0x10c0 ;
4163 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x48; buf[3] = 0x3c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4164 ret = usb_microdia_control_write(dev, reg, buf, 8);
4165 if (ret < 0)
4166 goto err;
4168 reg = 0x10c0 ;
4169 ret = usb_microdia_control_read(dev, reg, buf, 1);
4170 if (ret < 0)
4171 goto err;
4173 reg = 0x10c0 ;
4174 ret = usb_microdia_control_read(dev, reg, buf, 1);
4175 if (ret < 0)
4176 goto err;
4178 reg = 0x10c0 ;
4179 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4a; buf[3] = 0xf0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4180 ret = usb_microdia_control_write(dev, reg, buf, 8);
4181 if (ret < 0)
4182 goto err;
4184 reg = 0x10c0 ;
4185 ret = usb_microdia_control_read(dev, reg, buf, 1);
4186 if (ret < 0)
4187 goto err;
4189 reg = 0x10c0 ;
4190 ret = usb_microdia_control_read(dev, reg, buf, 1);
4191 if (ret < 0)
4192 goto err;
4194 reg = 0x10c0 ;
4195 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4b; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4196 ret = usb_microdia_control_write(dev, reg, buf, 8);
4197 if (ret < 0)
4198 goto err;
4200 reg = 0x10c0 ;
4201 ret = usb_microdia_control_read(dev, reg, buf, 1);
4202 if (ret < 0)
4203 goto err;
4205 reg = 0x10c0 ;
4206 ret = usb_microdia_control_read(dev, reg, buf, 1);
4207 if (ret < 0)
4208 goto err;
4210 reg = 0x10c0 ;
4211 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4c; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4212 ret = usb_microdia_control_write(dev, reg, buf, 8);
4213 if (ret < 0)
4214 goto err;
4216 reg = 0x10c0 ;
4217 ret = usb_microdia_control_read(dev, reg, buf, 1);
4218 if (ret < 0)
4219 goto err;
4221 reg = 0x10c0 ;
4222 ret = usb_microdia_control_read(dev, reg, buf, 1);
4223 if (ret < 0)
4224 goto err;
4226 reg = 0x10c0 ;
4227 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4d; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4228 ret = usb_microdia_control_write(dev, reg, buf, 8);
4229 if (ret < 0)
4230 goto err;
4232 reg = 0x10c0 ;
4233 ret = usb_microdia_control_read(dev, reg, buf, 1);
4234 if (ret < 0)
4235 goto err;
4237 reg = 0x10c0 ;
4238 ret = usb_microdia_control_read(dev, reg, buf, 1);
4239 if (ret < 0)
4240 goto err;
4242 reg = 0x10c0 ;
4243 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4e; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4244 ret = usb_microdia_control_write(dev, reg, buf, 8);
4245 if (ret < 0)
4246 goto err;
4248 reg = 0x10c0 ;
4249 ret = usb_microdia_control_read(dev, reg, buf, 1);
4250 if (ret < 0)
4251 goto err;
4253 reg = 0x10c0 ;
4254 ret = usb_microdia_control_read(dev, reg, buf, 1);
4255 if (ret < 0)
4256 goto err;
4258 reg = 0x10c0 ;
4259 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x69; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4260 ret = usb_microdia_control_write(dev, reg, buf, 8);
4261 if (ret < 0)
4262 goto err;
4264 reg = 0x10c0 ;
4265 ret = usb_microdia_control_read(dev, reg, buf, 1);
4266 if (ret < 0)
4267 goto err;
4269 reg = 0x10c0 ;
4270 ret = usb_microdia_control_read(dev, reg, buf, 1);
4271 if (ret < 0)
4272 goto err;
4274 reg = 0x10c0 ;
4275 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6c; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4276 ret = usb_microdia_control_write(dev, reg, buf, 8);
4277 if (ret < 0)
4278 goto err;
4280 reg = 0x10c0 ;
4281 ret = usb_microdia_control_read(dev, reg, buf, 1);
4282 if (ret < 0)
4283 goto err;
4285 reg = 0x10c0 ;
4286 ret = usb_microdia_control_read(dev, reg, buf, 1);
4287 if (ret < 0)
4288 goto err;
4290 reg = 0x10c0 ;
4291 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6f; buf[3] = 0x9e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4292 ret = usb_microdia_control_write(dev, reg, buf, 8);
4293 if (ret < 0)
4294 goto err;
4296 reg = 0x10c0 ;
4297 ret = usb_microdia_control_read(dev, reg, buf, 1);
4298 if (ret < 0)
4299 goto err;
4301 reg = 0x10c0 ;
4302 ret = usb_microdia_control_read(dev, reg, buf, 1);
4303 if (ret < 0)
4304 goto err;
4306 reg = 0x10c0 ;
4307 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x70; buf[3] = 0x05; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4308 ret = usb_microdia_control_write(dev, reg, buf, 8);
4309 if (ret < 0)
4310 goto err;
4312 reg = 0x10c0 ;
4313 ret = usb_microdia_control_read(dev, reg, buf, 1);
4314 if (ret < 0)
4315 goto err;
4317 reg = 0x10c0 ;
4318 ret = usb_microdia_control_read(dev, reg, buf, 1);
4319 if (ret < 0)
4320 goto err;
4322 reg = 0x10c0 ;
4323 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x71; buf[3] = 0x78; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4324 ret = usb_microdia_control_write(dev, reg, buf, 8);
4325 if (ret < 0)
4326 goto err;
4328 reg = 0x10c0 ;
4329 ret = usb_microdia_control_read(dev, reg, buf, 1);
4330 if (ret < 0)
4331 goto err;
4333 reg = 0x10c0 ;
4334 ret = usb_microdia_control_read(dev, reg, buf, 1);
4335 if (ret < 0)
4336 goto err;
4338 reg = 0x10c0 ;
4339 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x77; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4340 ret = usb_microdia_control_write(dev, reg, buf, 8);
4341 if (ret < 0)
4342 goto err;
4344 reg = 0x10c0 ;
4345 ret = usb_microdia_control_read(dev, reg, buf, 1);
4346 if (ret < 0)
4347 goto err;
4349 reg = 0x10c0 ;
4350 ret = usb_microdia_control_read(dev, reg, buf, 1);
4351 if (ret < 0)
4352 goto err;
4354 reg = 0x10c0 ;
4355 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8a; buf[3] = 0x23; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4356 ret = usb_microdia_control_write(dev, reg, buf, 8);
4357 if (ret < 0)
4358 goto err;
4360 reg = 0x10c0 ;
4361 ret = usb_microdia_control_read(dev, reg, buf, 1);
4362 if (ret < 0)
4363 goto err;
4365 reg = 0x10c0 ;
4366 ret = usb_microdia_control_read(dev, reg, buf, 1);
4367 if (ret < 0)
4368 goto err;
4370 reg = 0x10c0 ;
4371 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8c; buf[3] = 0x0d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4372 ret = usb_microdia_control_write(dev, reg, buf, 8);
4373 if (ret < 0)
4374 goto err;
4376 reg = 0x10c0 ;
4377 ret = usb_microdia_control_read(dev, reg, buf, 1);
4378 if (ret < 0)
4379 goto err;
4381 reg = 0x10c0 ;
4382 ret = usb_microdia_control_read(dev, reg, buf, 1);
4383 if (ret < 0)
4384 goto err;
4386 reg = 0x10c0 ;
4387 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x90; buf[3] = 0x7e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4388 ret = usb_microdia_control_write(dev, reg, buf, 8);
4389 if (ret < 0)
4390 goto err;
4392 reg = 0x10c0 ;
4393 ret = usb_microdia_control_read(dev, reg, buf, 1);
4394 if (ret < 0)
4395 goto err;
4397 reg = 0x10c0 ;
4398 ret = usb_microdia_control_read(dev, reg, buf, 1);
4399 if (ret < 0)
4400 goto err;
4402 reg = 0x10c0 ;
4403 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x91; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4404 ret = usb_microdia_control_write(dev, reg, buf, 8);
4405 if (ret < 0)
4406 goto err;
4408 reg = 0x10c0 ;
4409 ret = usb_microdia_control_read(dev, reg, buf, 1);
4410 if (ret < 0)
4411 goto err;
4413 reg = 0x10c0 ;
4414 ret = usb_microdia_control_read(dev, reg, buf, 1);
4415 if (ret < 0)
4416 goto err;
4418 reg = 0x10c0 ;
4419 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x9f; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4420 ret = usb_microdia_control_write(dev, reg, buf, 8);
4421 if (ret < 0)
4422 goto err;
4424 reg = 0x10c0 ;
4425 ret = usb_microdia_control_read(dev, reg, buf, 1);
4426 if (ret < 0)
4427 goto err;
4429 reg = 0x10c0 ;
4430 ret = usb_microdia_control_read(dev, reg, buf, 1);
4431 if (ret < 0)
4432 goto err;
4434 reg = 0x10c0 ;
4435 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa0; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4436 ret = usb_microdia_control_write(dev, reg, buf, 8);
4437 if (ret < 0)
4438 goto err;
4440 reg = 0x10c0 ;
4441 ret = usb_microdia_control_read(dev, reg, buf, 1);
4442 if (ret < 0)
4443 goto err;
4445 reg = 0x10c0 ;
4446 ret = usb_microdia_control_read(dev, reg, buf, 1);
4447 if (ret < 0)
4448 goto err;
4450 reg = 0x10c0 ;
4451 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa4; buf[3] = 0x50; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4452 ret = usb_microdia_control_write(dev, reg, buf, 8);
4453 if (ret < 0)
4454 goto err;
4456 reg = 0x10c0 ;
4457 ret = usb_microdia_control_read(dev, reg, buf, 1);
4458 if (ret < 0)
4459 goto err;
4461 reg = 0x10c0 ;
4462 ret = usb_microdia_control_read(dev, reg, buf, 1);
4463 if (ret < 0)
4464 goto err;
4466 reg = 0x10c0 ;
4467 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa5; buf[3] = 0x68; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4468 ret = usb_microdia_control_write(dev, reg, buf, 8);
4469 if (ret < 0)
4470 goto err;
4472 reg = 0x10c0 ;
4473 ret = usb_microdia_control_read(dev, reg, buf, 1);
4474 if (ret < 0)
4475 goto err;
4477 reg = 0x10c0 ;
4478 ret = usb_microdia_control_read(dev, reg, buf, 1);
4479 if (ret < 0)
4480 goto err;
4482 reg = 0x10c0 ;
4483 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa6; buf[3] = 0x60; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4484 ret = usb_microdia_control_write(dev, reg, buf, 8);
4485 if (ret < 0)
4486 goto err;
4488 reg = 0x10c0 ;
4489 ret = usb_microdia_control_read(dev, reg, buf, 1);
4490 if (ret < 0)
4491 goto err;
4493 reg = 0x10c0 ;
4494 ret = usb_microdia_control_read(dev, reg, buf, 1);
4495 if (ret < 0)
4496 goto err;
4498 reg = 0x10c0 ;
4499 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa8; buf[3] = 0xc1; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4500 ret = usb_microdia_control_write(dev, reg, buf, 8);
4501 if (ret < 0)
4502 goto err;
4504 reg = 0x10c0 ;
4505 ret = usb_microdia_control_read(dev, reg, buf, 1);
4506 if (ret < 0)
4507 goto err;
4509 reg = 0x10c0 ;
4510 ret = usb_microdia_control_read(dev, reg, buf, 1);
4511 if (ret < 0)
4512 goto err;
4514 reg = 0x10c0 ;
4515 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa9; buf[3] = 0xfa; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4516 ret = usb_microdia_control_write(dev, reg, buf, 8);
4517 if (ret < 0)
4518 goto err;
4520 reg = 0x10c0 ;
4521 ret = usb_microdia_control_read(dev, reg, buf, 1);
4522 if (ret < 0)
4523 goto err;
4525 reg = 0x10c0 ;
4526 ret = usb_microdia_control_read(dev, reg, buf, 1);
4527 if (ret < 0)
4528 goto err;
4530 reg = 0x10c0 ;
4531 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaa; buf[3] = 0x92; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4532 ret = usb_microdia_control_write(dev, reg, buf, 8);
4533 if (ret < 0)
4534 goto err;
4536 reg = 0x10c0 ;
4537 ret = usb_microdia_control_read(dev, reg, buf, 1);
4538 if (ret < 0)
4539 goto err;
4541 reg = 0x10c0 ;
4542 ret = usb_microdia_control_read(dev, reg, buf, 1);
4543 if (ret < 0)
4544 goto err;
4546 reg = 0x10c0 ;
4547 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xab; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4548 ret = usb_microdia_control_write(dev, reg, buf, 8);
4549 if (ret < 0)
4550 goto err;
4552 reg = 0x10c0 ;
4553 ret = usb_microdia_control_read(dev, reg, buf, 1);
4554 if (ret < 0)
4555 goto err;
4557 reg = 0x10c0 ;
4558 ret = usb_microdia_control_read(dev, reg, buf, 1);
4559 if (ret < 0)
4560 goto err;
4562 reg = 0x10c0 ;
4563 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xac; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4564 ret = usb_microdia_control_write(dev, reg, buf, 8);
4565 if (ret < 0)
4566 goto err;
4568 reg = 0x10c0 ;
4569 ret = usb_microdia_control_read(dev, reg, buf, 1);
4570 if (ret < 0)
4571 goto err;
4573 reg = 0x10c0 ;
4574 ret = usb_microdia_control_read(dev, reg, buf, 1);
4575 if (ret < 0)
4576 goto err;
4578 reg = 0x10c0 ;
4579 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xad; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4580 ret = usb_microdia_control_write(dev, reg, buf, 8);
4581 if (ret < 0)
4582 goto err;
4584 reg = 0x10c0 ;
4585 ret = usb_microdia_control_read(dev, reg, buf, 1);
4586 if (ret < 0)
4587 goto err;
4589 reg = 0x10c0 ;
4590 ret = usb_microdia_control_read(dev, reg, buf, 1);
4591 if (ret < 0)
4592 goto err;
4594 reg = 0x10c0 ;
4595 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xae; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4596 ret = usb_microdia_control_write(dev, reg, buf, 8);
4597 if (ret < 0)
4598 goto err;
4600 reg = 0x10c0 ;
4601 ret = usb_microdia_control_read(dev, reg, buf, 1);
4602 if (ret < 0)
4603 goto err;
4605 reg = 0x10c0 ;
4606 ret = usb_microdia_control_read(dev, reg, buf, 1);
4607 if (ret < 0)
4608 goto err;
4610 reg = 0x10c0 ;
4611 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaf; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4612 ret = usb_microdia_control_write(dev, reg, buf, 8);
4613 if (ret < 0)
4614 goto err;
4616 reg = 0x10c0 ;
4617 ret = usb_microdia_control_read(dev, reg, buf, 1);
4618 if (ret < 0)
4619 goto err;
4621 reg = 0x10c0 ;
4622 ret = usb_microdia_control_read(dev, reg, buf, 1);
4623 if (ret < 0)
4624 goto err;
4626 reg = 0x10c0 ;
4627 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb2; buf[3] = 0xf2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4628 ret = usb_microdia_control_write(dev, reg, buf, 8);
4629 if (ret < 0)
4630 goto err;
4632 reg = 0x10c0 ;
4633 ret = usb_microdia_control_read(dev, reg, buf, 1);
4634 if (ret < 0)
4635 goto err;
4637 reg = 0x10c0 ;
4638 ret = usb_microdia_control_read(dev, reg, buf, 1);
4639 if (ret < 0)
4640 goto err;
4642 reg = 0x10c0 ;
4643 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb3; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4644 ret = usb_microdia_control_write(dev, reg, buf, 8);
4645 if (ret < 0)
4646 goto err;
4648 reg = 0x10c0 ;
4649 ret = usb_microdia_control_read(dev, reg, buf, 1);
4650 if (ret < 0)
4651 goto err;
4653 reg = 0x10c0 ;
4654 ret = usb_microdia_control_read(dev, reg, buf, 1);
4655 if (ret < 0)
4656 goto err;
4658 reg = 0x10c0 ;
4659 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb4; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4660 ret = usb_microdia_control_write(dev, reg, buf, 8);
4661 if (ret < 0)
4662 goto err;
4664 reg = 0x10c0 ;
4665 ret = usb_microdia_control_read(dev, reg, buf, 1);
4666 if (ret < 0)
4667 goto err;
4669 reg = 0x10c0 ;
4670 ret = usb_microdia_control_read(dev, reg, buf, 1);
4671 if (ret < 0)
4672 goto err;
4674 reg = 0x10c0 ;
4675 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb5; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4676 ret = usb_microdia_control_write(dev, reg, buf, 8);
4677 if (ret < 0)
4678 goto err;
4680 reg = 0x10c0 ;
4681 ret = usb_microdia_control_read(dev, reg, buf, 1);
4682 if (ret < 0)
4683 goto err;
4685 reg = 0x10c0 ;
4686 ret = usb_microdia_control_read(dev, reg, buf, 1);
4687 if (ret < 0)
4688 goto err;
4690 reg = 0x10c0 ;
4691 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb6; buf[3] = 0xaf; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4692 ret = usb_microdia_control_write(dev, reg, buf, 8);
4693 if (ret < 0)
4694 goto err;
4696 reg = 0x10c0 ;
4697 ret = usb_microdia_control_read(dev, reg, buf, 1);
4698 if (ret < 0)
4699 goto err;
4701 reg = 0x10c0 ;
4702 ret = usb_microdia_control_read(dev, reg, buf, 1);
4703 if (ret < 0)
4704 goto err;
4706 reg = 0x10c0 ;
4707 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbb; buf[3] = 0xae; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4708 ret = usb_microdia_control_write(dev, reg, buf, 8);
4709 if (ret < 0)
4710 goto err;
4712 reg = 0x10c0 ;
4713 ret = usb_microdia_control_read(dev, reg, buf, 1);
4714 if (ret < 0)
4715 goto err;
4717 reg = 0x10c0 ;
4718 ret = usb_microdia_control_read(dev, reg, buf, 1);
4719 if (ret < 0)
4720 goto err;
4722 reg = 0x10c0 ;
4723 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbc; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4724 ret = usb_microdia_control_write(dev, reg, buf, 8);
4725 if (ret < 0)
4726 goto err;
4728 reg = 0x10c0 ;
4729 ret = usb_microdia_control_read(dev, reg, buf, 1);
4730 if (ret < 0)
4731 goto err;
4733 reg = 0x10c0 ;
4734 ret = usb_microdia_control_read(dev, reg, buf, 1);
4735 if (ret < 0)
4736 goto err;
4738 reg = 0x10c0 ;
4739 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbd; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4740 ret = usb_microdia_control_write(dev, reg, buf, 8);
4741 if (ret < 0)
4742 goto err;
4744 reg = 0x10c0 ;
4745 ret = usb_microdia_control_read(dev, reg, buf, 1);
4746 if (ret < 0)
4747 goto err;
4749 reg = 0x10c0 ;
4750 ret = usb_microdia_control_read(dev, reg, buf, 1);
4751 if (ret < 0)
4752 goto err;
4754 reg = 0x10c0 ;
4755 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbe; buf[3] = 0x3b; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4756 ret = usb_microdia_control_write(dev, reg, buf, 8);
4757 if (ret < 0)
4758 goto err;
4760 reg = 0x10c0 ;
4761 ret = usb_microdia_control_read(dev, reg, buf, 1);
4762 if (ret < 0)
4763 goto err;
4765 reg = 0x10c0 ;
4766 ret = usb_microdia_control_read(dev, reg, buf, 1);
4767 if (ret < 0)
4768 goto err;
4770 reg = 0x10c0 ;
4771 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbf; buf[3] = 0x3a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4772 ret = usb_microdia_control_write(dev, reg, buf, 8);
4773 if (ret < 0)
4774 goto err;
4776 reg = 0x10c0 ;
4777 ret = usb_microdia_control_read(dev, reg, buf, 1);
4778 if (ret < 0)
4779 goto err;
4781 reg = 0x10c0 ;
4782 ret = usb_microdia_control_read(dev, reg, buf, 1);
4783 if (ret < 0)
4784 goto err;
4786 reg = 0x10c0 ;
4787 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc0; buf[3] = 0xe2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4788 ret = usb_microdia_control_write(dev, reg, buf, 8);
4789 if (ret < 0)
4790 goto err;
4792 reg = 0x10c0 ;
4793 ret = usb_microdia_control_read(dev, reg, buf, 1);
4794 if (ret < 0)
4795 goto err;
4797 reg = 0x10c0 ;
4798 ret = usb_microdia_control_read(dev, reg, buf, 1);
4799 if (ret < 0)
4800 goto err;
4802 reg = 0x10c0 ;
4803 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc1; buf[3] = 0xc8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4804 ret = usb_microdia_control_write(dev, reg, buf, 8);
4805 if (ret < 0)
4806 goto err;
4808 reg = 0x10c0 ;
4809 ret = usb_microdia_control_read(dev, reg, buf, 1);
4810 if (ret < 0)
4811 goto err;
4813 reg = 0x10c0 ;
4814 ret = usb_microdia_control_read(dev, reg, buf, 1);
4815 if (ret < 0)
4816 goto err;
4818 reg = 0x10c0 ;
4819 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc2; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4820 ret = usb_microdia_control_write(dev, reg, buf, 8);
4821 if (ret < 0)
4822 goto err;
4824 reg = 0x10c0 ;
4825 ret = usb_microdia_control_read(dev, reg, buf, 1);
4826 if (ret < 0)
4827 goto err;
4829 reg = 0x10c0 ;
4830 ret = usb_microdia_control_read(dev, reg, buf, 1);
4831 if (ret < 0)
4832 goto err;
4834 reg = 0x10c0 ;
4835 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc4; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4836 ret = usb_microdia_control_write(dev, reg, buf, 8);
4837 if (ret < 0)
4838 goto err;
4840 reg = 0x10c0 ;
4841 ret = usb_microdia_control_read(dev, reg, buf, 1);
4842 if (ret < 0)
4843 goto err;
4845 reg = 0x10c0 ;
4846 ret = usb_microdia_control_read(dev, reg, buf, 1);
4847 if (ret < 0)
4848 goto err;
4850 reg = 0x10c0 ;
4851 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc6; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4852 ret = usb_microdia_control_write(dev, reg, buf, 8);
4853 if (ret < 0)
4854 goto err;
4856 reg = 0x10c0 ;
4857 ret = usb_microdia_control_read(dev, reg, buf, 1);
4858 if (ret < 0)
4859 goto err;
4861 reg = 0x10c0 ;
4862 ret = usb_microdia_control_read(dev, reg, buf, 1);
4863 if (ret < 0)
4864 goto err;
4866 reg = 0x10c0 ;
4867 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc7; buf[3] = 0x81; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4868 ret = usb_microdia_control_write(dev, reg, buf, 8);
4869 if (ret < 0)
4870 goto err;
4872 reg = 0x10c0 ;
4873 ret = usb_microdia_control_read(dev, reg, buf, 1);
4874 if (ret < 0)
4875 goto err;
4877 reg = 0x10c0 ;
4878 ret = usb_microdia_control_read(dev, reg, buf, 1);
4879 if (ret < 0)
4880 goto err;
4882 reg = 0x10c0 ;
4883 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc9; buf[3] = 0xe0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4884 ret = usb_microdia_control_write(dev, reg, buf, 8);
4885 if (ret < 0)
4886 goto err;
4888 reg = 0x10c0 ;
4889 ret = usb_microdia_control_read(dev, reg, buf, 1);
4890 if (ret < 0)
4891 goto err;
4893 reg = 0x10c0 ;
4894 ret = usb_microdia_control_read(dev, reg, buf, 1);
4895 if (ret < 0)
4896 goto err;
4898 reg = 0x10c0 ;
4899 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xca; buf[3] = 0xe8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4900 ret = usb_microdia_control_write(dev, reg, buf, 8);
4901 if (ret < 0)
4902 goto err;
4904 reg = 0x10c0 ;
4905 ret = usb_microdia_control_read(dev, reg, buf, 1);
4906 if (ret < 0)
4907 goto err;
4909 reg = 0x10c0 ;
4910 ret = usb_microdia_control_read(dev, reg, buf, 1);
4911 if (ret < 0)
4912 goto err;
4914 reg = 0x10c0 ;
4915 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcc; buf[3] = 0xd8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4916 ret = usb_microdia_control_write(dev, reg, buf, 8);
4917 if (ret < 0)
4918 goto err;
4920 reg = 0x10c0 ;
4921 ret = usb_microdia_control_read(dev, reg, buf, 1);
4922 if (ret < 0)
4923 goto err;
4925 reg = 0x10c0 ;
4926 ret = usb_microdia_control_read(dev, reg, buf, 1);
4927 if (ret < 0)
4928 goto err;
4930 reg = 0x10c0 ;
4931 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcd; buf[3] = 0x93; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4932 ret = usb_microdia_control_write(dev, reg, buf, 8);
4933 if (ret < 0)
4934 goto err;
4936 reg = 0x10c0 ;
4937 ret = usb_microdia_control_read(dev, reg, buf, 1);
4938 if (ret < 0)
4939 goto err;
4941 reg = 0x10c0 ;
4942 ret = usb_microdia_control_read(dev, reg, buf, 1);
4943 if (ret < 0)
4944 goto err;
4946 reg = 0x10c1 ;
4947 ret = usb_microdia_control_read(dev, reg, buf, 1);
4948 if (ret < 0)
4949 goto err;
4951 reg = 0x10c1 ;
4952 buf[0] = 0x50;
4953 ret = usb_microdia_control_write(dev, reg, buf, 1);
4954 if (ret < 0)
4955 goto err;
4957 reg = 0x10c0 ;
4958 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4959 ret = usb_microdia_control_write(dev, reg, buf, 8);
4960 if (ret < 0)
4961 goto err;
4963 reg = 0x10c0 ;
4964 ret = usb_microdia_control_read(dev, reg, buf, 1);
4965 if (ret < 0)
4966 goto err;
4968 reg = 0x10c0 ;
4969 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4970 ret = usb_microdia_control_write(dev, reg, buf, 8);
4971 if (ret < 0)
4972 goto err;
4974 reg = 0x10c0 ;
4975 ret = usb_microdia_control_read(dev, reg, buf, 1);
4976 if (ret < 0)
4977 goto err;
4979 reg = 0x10c0 ;
4980 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4981 ret = usb_microdia_control_write(dev, reg, buf, 8);
4982 if (ret < 0)
4983 goto err;
4985 reg = 0x10c0 ;
4986 ret = usb_microdia_control_read(dev, reg, buf, 1);
4987 if (ret < 0)
4988 goto err;
4990 reg = 0x10c0 ;
4991 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
4992 ret = usb_microdia_control_write(dev, reg, buf, 8);
4993 if (ret < 0)
4994 goto err;
4996 reg = 0x10c0 ;
4997 ret = usb_microdia_control_read(dev, reg, buf, 1);
4998 if (ret < 0)
4999 goto err;
5001 reg = 0x10c0 ;
5002 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5003 ret = usb_microdia_control_write(dev, reg, buf, 8);
5004 if (ret < 0)
5005 goto err;
5007 reg = 0x10c0 ;
5008 ret = usb_microdia_control_read(dev, reg, buf, 1);
5009 if (ret < 0)
5010 goto err;
5012 reg = 0x10c0 ;
5013 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5014 ret = usb_microdia_control_write(dev, reg, buf, 8);
5015 if (ret < 0)
5016 goto err;
5018 reg = 0x10c0 ;
5019 ret = usb_microdia_control_read(dev, reg, buf, 1);
5020 if (ret < 0)
5021 goto err;
5023 reg = 0x10c0 ;
5024 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5025 ret = usb_microdia_control_write(dev, reg, buf, 8);
5026 if (ret < 0)
5027 goto err;
5029 reg = 0x10c0 ;
5030 ret = usb_microdia_control_read(dev, reg, buf, 1);
5031 if (ret < 0)
5032 goto err;
5034 reg = 0x10c0 ;
5035 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5036 ret = usb_microdia_control_write(dev, reg, buf, 8);
5037 if (ret < 0)
5038 goto err;
5040 reg = 0x10c0 ;
5041 ret = usb_microdia_control_read(dev, reg, buf, 1);
5042 if (ret < 0)
5043 goto err;
5045 reg = 0x10c0 ;
5046 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5047 ret = usb_microdia_control_write(dev, reg, buf, 8);
5048 if (ret < 0)
5049 goto err;
5051 reg = 0x10c0 ;
5052 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5053 ret = usb_microdia_control_write(dev, reg, buf, 8);
5054 if (ret < 0)
5055 goto err;
5057 reg = 0x10c0 ;
5058 ret = usb_microdia_control_read(dev, reg, buf, 1);
5059 if (ret < 0)
5060 goto err;
5062 reg = 0x10c0 ;
5063 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5064 ret = usb_microdia_control_write(dev, reg, buf, 8);
5065 if (ret < 0)
5066 goto err;
5068 reg = 0x10c0 ;
5069 ret = usb_microdia_control_read(dev, reg, buf, 1);
5070 if (ret < 0)
5071 goto err;
5073 reg = 0x10c0 ;
5074 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5075 ret = usb_microdia_control_write(dev, reg, buf, 8);
5076 if (ret < 0)
5077 goto err;
5079 reg = 0x10c0 ;
5080 ret = usb_microdia_control_read(dev, reg, buf, 1);
5081 if (ret < 0)
5082 goto err;
5084 reg = 0x10c0 ;
5085 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5086 ret = usb_microdia_control_write(dev, reg, buf, 8);
5087 if (ret < 0)
5088 goto err;
5090 reg = 0x10c0 ;
5091 ret = usb_microdia_control_read(dev, reg, buf, 1);
5092 if (ret < 0)
5093 goto err;
5095 reg = 0x10c0 ;
5096 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5097 ret = usb_microdia_control_write(dev, reg, buf, 8);
5098 if (ret < 0)
5099 goto err;
5101 reg = 0x10c0 ;
5102 ret = usb_microdia_control_read(dev, reg, buf, 1);
5103 if (ret < 0)
5104 goto err;
5106 reg = 0x10c0 ;
5107 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5108 ret = usb_microdia_control_write(dev, reg, buf, 8);
5109 if (ret < 0)
5110 goto err;
5112 reg = 0x10c0 ;
5113 ret = usb_microdia_control_read(dev, reg, buf, 1);
5114 if (ret < 0)
5115 goto err;
5117 reg = 0x10c0 ;
5118 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5119 ret = usb_microdia_control_write(dev, reg, buf, 8);
5120 if (ret < 0)
5121 goto err;
5123 reg = 0x10c0 ;
5124 ret = usb_microdia_control_read(dev, reg, buf, 1);
5125 if (ret < 0)
5126 goto err;
5128 reg = 0x10c0 ;
5129 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5130 ret = usb_microdia_control_write(dev, reg, buf, 8);
5131 if (ret < 0)
5132 goto err;
5134 reg = 0x10c0 ;
5135 ret = usb_microdia_control_read(dev, reg, buf, 1);
5136 if (ret < 0)
5137 goto err;
5139 reg = 0x10c0 ;
5140 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5141 ret = usb_microdia_control_write(dev, reg, buf, 8);
5142 if (ret < 0)
5143 goto err;
5145 reg = 0x10c2 ;
5146 ret = usb_microdia_control_read(dev, reg, buf, 5);
5147 if (ret < 0)
5148 goto err;
5150 reg = 0x10c1 ;
5151 buf[0] = 0x30;
5152 ret = usb_microdia_control_write(dev, reg, buf, 1);
5153 if (ret < 0)
5154 goto err;
5156 reg = 0x10e0 ;
5157 buf[0] = 0x47;
5158 ret = usb_microdia_control_write(dev, reg, buf, 1);
5159 if (ret < 0)
5160 goto err;
5162 reg = 0x10e0 ;
5163 buf[0] = 0x47;
5164 ret = usb_microdia_control_write(dev, reg, buf, 1);
5165 if (ret < 0)
5166 goto err;
5168 reg = 0x1001 ;
5169 buf[0] = 0xc6;
5170 ret = usb_microdia_control_write(dev, reg, buf, 1);
5171 if (ret < 0)
5172 goto err;
5174 reg = 0x1001 ;
5175 buf[0] = 0xc4;
5176 ret = usb_microdia_control_write(dev, reg, buf, 1);
5177 if (ret < 0)
5178 goto err;
5180 reg = 0x1001 ;
5181 buf[0] = 0x84;
5182 ret = usb_microdia_control_write(dev, reg, buf, 1);
5183 if (ret < 0)
5184 goto err;
5186 reg = 0x1189 ;
5187 buf[0] = 0xcc;
5188 ret = usb_microdia_control_write(dev, reg, buf, 1);
5189 if (ret < 0)
5190 goto err;
5192 reg = 0x11bc ;
5193 buf[0] = 0x00;
5194 ret = usb_microdia_control_write(dev, reg, buf, 1);
5195 if (ret < 0)
5196 goto err;
5198 reg = 0x11bd ;
5199 buf[0] = 0x00;
5200 ret = usb_microdia_control_write(dev, reg, buf, 1);
5201 if (ret < 0)
5202 goto err;
5204 reg = 0x11be ;
5205 buf[0] = 0x00;
5206 ret = usb_microdia_control_write(dev, reg, buf, 1);
5207 if (ret < 0)
5208 goto err;
5210 reg = 0x11bf ;
5211 buf[0] = 0x00;
5212 ret = usb_microdia_control_write(dev, reg, buf, 1);
5213 if (ret < 0)
5214 goto err;
5216 reg = 0x10c0 ;
5217 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5218 ret = usb_microdia_control_write(dev, reg, buf, 8);
5219 if (ret < 0)
5220 goto err;
5222 reg = 0x10c0 ;
5223 ret = usb_microdia_control_read(dev, reg, buf, 1);
5224 if (ret < 0)
5225 goto err;
5227 reg = 0x10c0 ;
5228 ret = usb_microdia_control_read(dev, reg, buf, 1);
5229 if (ret < 0)
5230 goto err;
5232 reg = 0x10c0 ;
5233 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
5234 ret = usb_microdia_control_write(dev, reg, buf, 8);
5235 if (ret < 0)
5236 goto err;
5238 reg = 0x10c0 ;
5239 ret = usb_microdia_control_read(dev, reg, buf, 1);
5240 if (ret < 0)
5241 goto err;
5243 reg = 0x10c0 ;
5244 ret = usb_microdia_control_read(dev, reg, buf, 1);
5245 if (ret < 0)
5246 goto err;
5248 reg = 0x10c0 ;
5249 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5250 ret = usb_microdia_control_write(dev, reg, buf, 8);
5251 if (ret < 0)
5252 goto err;
5254 reg = 0x10c0 ;
5255 ret = usb_microdia_control_read(dev, reg, buf, 1);
5256 if (ret < 0)
5257 goto err;
5259 reg = 0x10c0 ;
5260 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5261 ret = usb_microdia_control_write(dev, reg, buf, 8);
5262 if (ret < 0)
5263 goto err;
5265 reg = 0x10c0 ;
5266 ret = usb_microdia_control_read(dev, reg, buf, 1);
5267 if (ret < 0)
5268 goto err;
5270 reg = 0x10c0 ;
5271 ret = usb_microdia_control_read(dev, reg, buf, 1);
5272 if (ret < 0)
5273 goto err;
5275 reg = 0x1180 ;
5276 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
5277 ret = usb_microdia_control_write(dev, reg, buf, 6);
5278 if (ret < 0)
5279 goto err;
5281 reg = 0x10fb ;
5282 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
5283 ret = usb_microdia_control_write(dev, reg, buf, 5);
5284 if (ret < 0)
5285 goto err;
5287 reg = 0x1189 ;
5288 buf[0] = 0xdc;
5289 ret = usb_microdia_control_write(dev, reg, buf, 1);
5290 if (ret < 0)
5291 goto err;
5293 reg = 0x1189 ;
5294 buf[0] = 0xd0;
5295 ret = usb_microdia_control_write(dev, reg, buf, 1);
5296 if (ret < 0)
5297 goto err;
5299 reg = 0x11a1 ;
5300 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
5301 ret = usb_microdia_control_write(dev, reg, buf, 4);
5302 if (ret < 0)
5303 goto err;
5305 reg = 0x11ab ;
5306 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
5307 ret = usb_microdia_control_write(dev, reg, buf, 4);
5308 if (ret < 0)
5309 goto err;
5311 reg = 0x1000 ;
5312 buf[0] = 0x78;
5313 ret = usb_microdia_control_write(dev, reg, buf, 1);
5314 if (ret < 0)
5315 goto err;
5317 reg = 0x1002 ;
5318 buf[0] = 0x18;
5319 ret = usb_microdia_control_write(dev, reg, buf, 1);
5320 if (ret < 0)
5321 goto err;
5323 reg = 0x1002 ;
5324 buf[0] = 0x08;
5325 ret = usb_microdia_control_write(dev, reg, buf, 1);
5326 if (ret < 0)
5327 goto err;
5329 reg = 0x11b8 ;
5330 buf[0] = 0x38;
5331 ret = usb_microdia_control_write(dev, reg, buf, 1);
5332 if (ret < 0)
5333 goto err;
5335 reg = 0x118a ;
5336 buf[0] = 0x02;
5337 ret = usb_microdia_control_write(dev, reg, buf, 1);
5338 if (ret < 0)
5339 goto err;
5341 reg = 0x0395 ;
5342 buf[0] = 0x02;
5343 ret = usb_microdia_control_write(dev, reg, buf, 1);
5344 if (ret < 0)
5345 goto err;
5347 reg = 0x11b8 ;
5348 buf[0] = 0x78;
5349 ret = usb_microdia_control_write(dev, reg, buf, 1);
5350 if (ret < 0)
5351 goto err;
5353 reg = 0x11b8 ;
5354 ret = usb_microdia_control_read(dev, reg, buf, 1);
5355 if (ret < 0)
5356 goto err;
5358 reg = 0x11b8 ;
5359 buf[0] = 0xf9;
5360 ret = usb_microdia_control_write(dev, reg, buf, 1);
5361 if (ret < 0)
5362 goto err;
5364 reg = 0x11b8 ;
5365 ret = usb_microdia_control_read(dev, reg, buf, 1);
5366 if (ret < 0)
5367 goto err;
5369 reg = 0x11b8 ;
5370 buf[0] = 0x7a;
5371 ret = usb_microdia_control_write(dev, reg, buf, 1);
5372 if (ret < 0)
5373 goto err;
5375 reg = 0x11b8 ;
5376 ret = usb_microdia_control_read(dev, reg, buf, 1);
5377 if (ret < 0)
5378 goto err;
5380 reg = 0x11b8 ;
5381 buf[0] = 0x7b;
5382 ret = usb_microdia_control_write(dev, reg, buf, 1);
5383 if (ret < 0)
5384 goto err;
5386 reg = 0x11b8 ;
5387 ret = usb_microdia_control_read(dev, reg, buf, 1);
5388 if (ret < 0)
5389 goto err;
5391 reg = 0x11b8 ;
5392 buf[0] = 0x7c;
5393 ret = usb_microdia_control_write(dev, reg, buf, 1);
5394 if (ret < 0)
5395 goto err;
5397 reg = 0x11b8 ;
5398 ret = usb_microdia_control_read(dev, reg, buf, 1);
5399 if (ret < 0)
5400 goto err;
5402 reg = 0x11b8 ;
5403 buf[0] = 0xfd;
5404 ret = usb_microdia_control_write(dev, reg, buf, 1);
5405 if (ret < 0)
5406 goto err;
5408 reg = 0x11b8 ;
5409 ret = usb_microdia_control_read(dev, reg, buf, 1);
5410 if (ret < 0)
5411 goto err;
5413 reg = 0x11b8 ;
5414 buf[0] = 0xfa;
5415 ret = usb_microdia_control_write(dev, reg, buf, 1);
5416 if (ret < 0)
5417 goto err;
5419 reg = 0x10c0 ;
5420 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5421 ret = usb_microdia_control_write(dev, reg, buf, 8);
5422 if (ret < 0)
5423 goto err;
5425 reg = 0x10c0 ;
5426 ret = usb_microdia_control_read(dev, reg, buf, 1);
5427 if (ret < 0)
5428 goto err;
5430 reg = 0x10c0 ;
5431 ret = usb_microdia_control_read(dev, reg, buf, 1);
5432 if (ret < 0)
5433 goto err;
5435 reg = 0x10c0 ;
5436 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5437 ret = usb_microdia_control_write(dev, reg, buf, 8);
5438 if (ret < 0)
5439 goto err;
5441 reg = 0x10c0 ;
5442 ret = usb_microdia_control_read(dev, reg, buf, 1);
5443 if (ret < 0)
5444 goto err;
5446 reg = 0x10c0 ;
5447 ret = usb_microdia_control_read(dev, reg, buf, 1);
5448 if (ret < 0)
5449 goto err;
5451 reg = 0x10c0 ;
5452 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5453 ret = usb_microdia_control_write(dev, reg, buf, 8);
5454 if (ret < 0)
5455 goto err;
5457 reg = 0x10c0 ;
5458 ret = usb_microdia_control_read(dev, reg, buf, 1);
5459 if (ret < 0)
5460 goto err;
5462 reg = 0x10c0 ;
5463 ret = usb_microdia_control_read(dev, reg, buf, 1);
5464 if (ret < 0)
5465 goto err;
5467 reg = 0x10c0 ;
5468 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5469 ret = usb_microdia_control_write(dev, reg, buf, 8);
5470 if (ret < 0)
5471 goto err;
5473 reg = 0x10c0 ;
5474 ret = usb_microdia_control_read(dev, reg, buf, 1);
5475 if (ret < 0)
5476 goto err;
5478 reg = 0x10c0 ;
5479 ret = usb_microdia_control_read(dev, reg, buf, 1);
5480 if (ret < 0)
5481 goto err;
5483 reg = 0x10c0 ;
5484 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5485 ret = usb_microdia_control_write(dev, reg, buf, 8);
5486 if (ret < 0)
5487 goto err;
5489 reg = 0x10c0 ;
5490 ret = usb_microdia_control_read(dev, reg, buf, 1);
5491 if (ret < 0)
5492 goto err;
5494 reg = 0x10c0 ;
5495 ret = usb_microdia_control_read(dev, reg, buf, 1);
5496 if (ret < 0)
5497 goto err;
5499 reg = 0x10c0 ;
5500 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5501 ret = usb_microdia_control_write(dev, reg, buf, 8);
5502 if (ret < 0)
5503 goto err;
5505 reg = 0x10c0 ;
5506 ret = usb_microdia_control_read(dev, reg, buf, 1);
5507 if (ret < 0)
5508 goto err;
5510 reg = 0x10c0 ;
5511 ret = usb_microdia_control_read(dev, reg, buf, 1);
5512 if (ret < 0)
5513 goto err;
5515 reg = 0x10c0 ;
5516 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5517 ret = usb_microdia_control_write(dev, reg, buf, 8);
5518 if (ret < 0)
5519 goto err;
5521 reg = 0x10c0 ;
5522 ret = usb_microdia_control_read(dev, reg, buf, 1);
5523 if (ret < 0)
5524 goto err;
5526 reg = 0x10c0 ;
5527 ret = usb_microdia_control_read(dev, reg, buf, 1);
5528 if (ret < 0)
5529 goto err;
5531 reg = 0x1182 ;
5532 buf[0] = 0x01;
5533 ret = usb_microdia_control_write(dev, reg, buf, 1);
5534 if (ret < 0)
5535 goto err;
5537 reg = 0x10c0 ;
5538 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x7d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5539 ret = usb_microdia_control_write(dev, reg, buf, 8);
5540 if (ret < 0)
5541 goto err;
5543 reg = 0x10c0 ;
5544 ret = usb_microdia_control_read(dev, reg, buf, 1);
5545 if (ret < 0)
5546 goto err;
5548 reg = 0x10c0 ;
5549 ret = usb_microdia_control_read(dev, reg, buf, 1);
5550 if (ret < 0)
5551 goto err;
5553 reg = 0x10c0 ;
5554 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5555 ret = usb_microdia_control_write(dev, reg, buf, 8);
5556 if (ret < 0)
5557 goto err;
5559 reg = 0x10c0 ;
5560 ret = usb_microdia_control_read(dev, reg, buf, 1);
5561 if (ret < 0)
5562 goto err;
5564 reg = 0x10c0 ;
5565 ret = usb_microdia_control_read(dev, reg, buf, 1);
5566 if (ret < 0)
5567 goto err;
5569 reg = 0x10c0 ;
5570 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5571 ret = usb_microdia_control_write(dev, reg, buf, 8);
5572 if (ret < 0)
5573 goto err;
5575 reg = 0x10c0 ;
5576 ret = usb_microdia_control_read(dev, reg, buf, 1);
5577 if (ret < 0)
5578 goto err;
5580 reg = 0x10c0 ;
5581 ret = usb_microdia_control_read(dev, reg, buf, 1);
5582 if (ret < 0)
5583 goto err;
5585 reg = 0x10c0 ;
5586 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5587 ret = usb_microdia_control_write(dev, reg, buf, 8);
5588 if (ret < 0)
5589 goto err;
5591 reg = 0x10c0 ;
5592 ret = usb_microdia_control_read(dev, reg, buf, 1);
5593 if (ret < 0)
5594 goto err;
5596 reg = 0x10c0 ;
5597 ret = usb_microdia_control_read(dev, reg, buf, 1);
5598 if (ret < 0)
5599 goto err;
5601 reg = 0x10c0 ;
5602 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5603 ret = usb_microdia_control_write(dev, reg, buf, 8);
5604 if (ret < 0)
5605 goto err;
5607 reg = 0x10c0 ;
5608 ret = usb_microdia_control_read(dev, reg, buf, 1);
5609 if (ret < 0)
5610 goto err;
5612 reg = 0x10c0 ;
5613 ret = usb_microdia_control_read(dev, reg, buf, 1);
5614 if (ret < 0)
5615 goto err;
5617 reg = 0x10c0 ;
5618 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5619 ret = usb_microdia_control_write(dev, reg, buf, 8);
5620 if (ret < 0)
5621 goto err;
5623 reg = 0x10c0 ;
5624 ret = usb_microdia_control_read(dev, reg, buf, 1);
5625 if (ret < 0)
5626 goto err;
5628 reg = 0x10c0 ;
5629 ret = usb_microdia_control_read(dev, reg, buf, 1);
5630 if (ret < 0)
5631 goto err;
5633 reg = 0x10c0 ;
5634 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5635 ret = usb_microdia_control_write(dev, reg, buf, 8);
5636 if (ret < 0)
5637 goto err;
5639 reg = 0x10c0 ;
5640 ret = usb_microdia_control_read(dev, reg, buf, 1);
5641 if (ret < 0)
5642 goto err;
5644 reg = 0x10c0 ;
5645 ret = usb_microdia_control_read(dev, reg, buf, 1);
5646 if (ret < 0)
5647 goto err;
5649 reg = 0x10c0 ;
5650 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5651 ret = usb_microdia_control_write(dev, reg, buf, 8);
5652 if (ret < 0)
5653 goto err;
5655 reg = 0x10c0 ;
5656 ret = usb_microdia_control_read(dev, reg, buf, 1);
5657 if (ret < 0)
5658 goto err;
5660 reg = 0x10c0 ;
5661 ret = usb_microdia_control_read(dev, reg, buf, 1);
5662 if (ret < 0)
5663 goto err;
5665 reg = 0x11ba ;
5666 buf[0] = 0x0a;
5667 ret = usb_microdia_control_write(dev, reg, buf, 1);
5668 if (ret < 0)
5669 goto err;
5671 reg = 0x118b ;
5672 buf[0] = 0x10;
5673 ret = usb_microdia_control_write(dev, reg, buf, 1);
5674 if (ret < 0)
5675 goto err;
5677 reg = 0x10f7;
5678 buf[0] = 0x05;
5679 ret = usb_microdia_control_write(dev, reg, buf, 1);
5680 if (ret < 0)
5681 goto err;
5683 reg = 0x10f8 ;
5684 buf[0] = 0x14;
5685 ret = usb_microdia_control_write(dev, reg, buf, 1);
5686 if (ret < 0)
5687 goto err;
5689 reg = 0x10fa ;
5690 buf[0] = 0xff;
5691 ret = usb_microdia_control_write(dev, reg, buf, 1);
5692 if (ret < 0)
5693 goto err;
5695 reg = 0x10f9 ;
5696 buf[0] = 0x00;
5697 ret = usb_microdia_control_write(dev, reg, buf, 1);
5698 if (ret < 0)
5699 goto err;
5701 reg = 0x10f9 ;
5702 buf[0] = 0x00;
5703 ret = usb_microdia_control_write(dev, reg, buf, 1);
5704 if (ret < 0)
5705 goto err;
5707 reg = 0x11ba ;
5708 buf[0] = 0x0a;
5709 ret = usb_microdia_control_write(dev, reg, buf, 1);
5710 if (ret < 0)
5711 goto err;
5713 reg = 0x11bc ;
5714 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5715 ret = usb_microdia_control_write(dev, reg, buf, 4);
5716 if (ret < 0)
5717 goto err;
5719 reg = 0x11c0;
5720 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5721 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5722 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5723 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5724 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
5725 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00;
5726 buf[24] = 0x00; buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00;
5727 buf[28] = 0x00; buf[29] = 0x00; buf[30] = 0x00; buf[31] = 0x00;
5728 buf[32] = 0x00; buf[33] = 0x00; buf[34] = 0x00; buf[35] = 0x00;
5729 buf[36] = 0x00; buf[37] = 0x00; buf[38] = 0x00; buf[39] = 0x00;
5730 buf[40] = 0x00; buf[41] = 0x00; buf[42] = 0x00; buf[43] = 0x00;
5731 buf[44] = 0x00; buf[45] = 0x00; buf[46] = 0x00; buf[47] = 0x00;
5732 ret = usb_microdia_control_write(dev, reg, buf, 48);
5733 if (ret < 0)
5734 goto err;
5736 reg = 0x11a5 ;
5737 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
5738 buf[4] = 0x04; buf[5] = 0x3f;
5739 ret = usb_microdia_control_write(dev, reg, buf, 6);
5740 if (ret < 0)
5741 goto err;
5743 reg = 0x11af ;
5744 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
5745 ret = usb_microdia_control_write(dev, reg, buf, 4);
5746 if (ret < 0)
5747 goto err;
5749 reg = 0x11b3 ;
5750 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
5751 ret = usb_microdia_control_write(dev, reg, buf, 4);
5752 if (ret < 0)
5753 goto err;
5755 reg = 0x10e0 ;
5756 buf[0] = 0x47;
5757 ret = usb_microdia_control_write(dev, reg, buf, 1);
5758 if (ret < 0)
5759 goto err;
5761 reg = 0x1061 ;
5762 buf[0] = 0x01;
5763 ret = usb_microdia_control_write(dev, reg, buf, 1);
5764 if (ret < 0)
5765 goto err;
5767 reg = 0x10e0 ;
5768 buf[0] = 0x67;
5769 ret = usb_microdia_control_write(dev, reg, buf, 1);
5770 if (ret < 0)
5771 goto err;
5773 reg = 0x1100 ;
5774 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
5775 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
5776 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
5777 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
5778 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
5779 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
5780 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
5781 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
5782 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
5783 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
5784 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
5785 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
5786 buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
5787 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
5788 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
5789 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
5790 ret = usb_microdia_control_write(dev, reg, buf, 64);
5791 if (ret < 0)
5792 goto err;
5794 reg = 0x1140 ;
5795 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
5796 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
5797 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
5798 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
5799 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
5800 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
5801 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
5802 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
5803 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
5804 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
5805 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
5806 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
5807 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
5808 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
5809 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
5810 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
5811 ret = usb_microdia_control_write(dev, reg, buf, 64);
5812 if (ret < 0)
5813 goto err;
5815 reg = 0x10e0 ;
5816 buf[0] = 0x47;
5817 ret = usb_microdia_control_write(dev, reg, buf, 1);
5818 if (ret < 0)
5819 goto err;
5821 reg = 0x1061 ;
5822 buf[0] = 0x03;
5823 ret = usb_microdia_control_write(dev, reg, buf, 1);
5824 if (ret < 0)
5825 goto err;
5827 reg = 0x10e0 ;
5828 buf[0] = 0x4b;
5829 ret = usb_microdia_control_write(dev, reg, buf, 1);
5830 if (ret < 0)
5831 goto err;
5833 reg = 0x1189 ;
5834 buf[0] = 0xd0;
5835 ret = usb_microdia_control_write(dev, reg, buf, 1);
5836 if (ret < 0)
5837 goto err;
5839 reg = 0x11bc ;
5840 buf[0] = 0x00;
5841 ret = usb_microdia_control_write(dev, reg, buf, 1);
5842 if (ret < 0)
5843 goto err;
5845 reg = 0x11bd ;
5846 buf[0] = 0x00;
5847 ret = usb_microdia_control_write(dev, reg, buf, 1);
5848 if (ret < 0)
5849 goto err;
5851 reg = 0x11be ;
5852 buf[0] = 0x00;
5853 ret = usb_microdia_control_write(dev, reg, buf, 1);
5854 if (ret < 0)
5855 goto err;
5857 reg = 0x11bf ;
5858 buf[0] = 0x00;
5859 ret = usb_microdia_control_write(dev, reg, buf, 1);
5860 if (ret < 0)
5861 goto err;
5863 reg = 0x10c0 ;
5864 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5865 ret = usb_microdia_control_write(dev, reg, buf, 8);
5866 if (ret < 0)
5867 goto err;
5869 reg = 0x10c0 ;
5870 ret = usb_microdia_control_read(dev, reg, buf, 1);
5871 if (ret < 0)
5872 goto err;
5874 reg = 0x10c0 ;
5875 ret = usb_microdia_control_read(dev, reg, buf, 1);
5876 if (ret < 0)
5877 goto err;
5879 reg = 0x10c0 ;
5880 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
5881 ret = usb_microdia_control_write(dev, reg, buf, 8);
5882 if (ret < 0)
5883 goto err;
5885 reg = 0x10c0 ;
5886 ret = usb_microdia_control_read(dev, reg, buf, 1);
5887 if (ret < 0)
5888 goto err;
5890 reg = 0x10c0 ;
5891 ret = usb_microdia_control_read(dev, reg, buf, 1);
5892 if (ret < 0)
5893 goto err;
5895 reg = 0x10c0 ;
5896 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5897 ret = usb_microdia_control_write(dev, reg, buf, 8);
5898 if (ret < 0)
5899 goto err;
5901 reg = 0x10c0 ;
5902 ret = usb_microdia_control_read(dev, reg, buf, 1);
5903 if (ret < 0)
5904 goto err;
5906 reg = 0x10c0 ;
5907 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
5908 ret = usb_microdia_control_write(dev, reg, buf, 8);
5909 if (ret < 0)
5910 goto err;
5912 reg = 0x10c0 ;
5913 ret = usb_microdia_control_read(dev, reg, buf, 1);
5914 if (ret < 0)
5915 goto err;
5917 reg = 0x10c0 ;
5918 ret = usb_microdia_control_read(dev, reg, buf, 1);
5919 if (ret < 0)
5920 goto err;
5922 reg = 0x1180 ;
5923 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5924 buf[4] = 0x50; buf[5] = 0x78;
5925 ret = usb_microdia_control_write(dev, reg, buf, 6);
5926 if (ret < 0)
5927 goto err;
5929 reg = 0x10fb ;
5930 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5931 buf[4] = 0x00;
5932 ret = usb_microdia_control_write(dev, reg, buf, 5);
5933 if (ret < 0)
5934 goto err;
5936 reg = 0x1189 ;
5937 buf[0] = 0xd0;
5938 ret = usb_microdia_control_write(dev, reg, buf, 1);
5939 if (ret < 0)
5940 goto err;
5942 reg = 0x11a1 ;
5943 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
5944 ret = usb_microdia_control_write(dev, reg, buf, 4);
5945 if (ret < 0)
5946 goto err;
5948 reg = 0x11ab ;
5949 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
5950 ret = usb_microdia_control_write(dev, reg, buf, 4);
5951 if (ret < 0)
5952 goto err;
5954 reg = 0x1061 ;
5955 buf[0] = 0x03;
5956 ret = usb_microdia_control_write(dev, reg, buf, 1);
5957 if (ret < 0)
5958 goto err;
5960 reg = 0x11ba ;
5961 buf[0] = 0x0a;
5962 ret = usb_microdia_control_write(dev, reg, buf, 1);
5963 if (ret < 0)
5964 goto err;
5966 reg = 0x11b9 ;
5967 buf[0] = 0x00;
5968 ret = usb_microdia_control_write(dev, reg, buf, 1);
5969 if (ret < 0)
5970 goto err;
5972 reg = 0x11ba ;
5973 buf[0] = 0x0b;
5974 ret = usb_microdia_control_write(dev, reg, buf, 1);
5975 if (ret < 0)
5976 goto err;
5978 reg = 0x1061 ;
5979 buf[0] = 0x01;
5980 ret = usb_microdia_control_write(dev, reg, buf, 1);
5981 if (ret < 0)
5982 goto err;
5984 reg = 0x1000 ;
5985 buf[0] = 0x78;
5986 ret = usb_microdia_control_write(dev, reg, buf, 1);
5987 if (ret < 0)
5988 goto err;
5990 reg = 0x1002 ;
5991 buf[0] = 0x08;
5992 ret = usb_microdia_control_write(dev, reg, buf, 1);
5993 if (ret < 0)
5994 goto err;
5996 reg = 0x1002 ;
5997 buf[0] = 0x08;
5998 ret = usb_microdia_control_write(dev, reg, buf, 1);
5999 if (ret < 0)
6000 goto err;
6002 reg = 0x11b8 ;
6003 buf[0] = 0xfa;
6004 ret = usb_microdia_control_write(dev, reg, buf, 1);
6005 if (ret < 0)
6006 goto err;
6008 reg = 0x118a ;
6009 buf[0] = 0x02;
6010 ret = usb_microdia_control_write(dev, reg, buf, 1);
6011 if (ret < 0)
6012 goto err;
6014 reg = 0x0395 ;
6015 buf[0] = 0x02;
6016 ret = usb_microdia_control_write(dev, reg, buf, 1);
6017 if (ret < 0)
6018 goto err;
6020 reg = 0x11b8 ;
6021 buf[0] = 0xf8;
6022 ret = usb_microdia_control_write(dev, reg, buf, 1);
6023 if (ret < 0)
6024 goto err;
6026 reg = 0x11b8 ;
6027 ret = usb_microdia_control_read(dev, reg, buf, 1);
6028 if (ret < 0)
6029 goto err;
6031 reg = 0x11b8 ;
6032 buf[0] = 0xf9;
6033 ret = usb_microdia_control_write(dev, reg, buf, 1);
6034 if (ret < 0)
6035 goto err;
6037 reg = 0x11b8 ;
6038 ret = usb_microdia_control_read(dev, reg, buf, 1);
6039 if (ret < 0)
6040 goto err;
6042 reg = 0x11b8 ;
6043 buf[0] = 0x7a;
6044 ret = usb_microdia_control_write(dev, reg, buf, 1);
6045 if (ret < 0)
6046 goto err;
6048 reg = 0x11b8 ;
6049 ret = usb_microdia_control_read(dev, reg, buf, 1);
6050 if (ret < 0)
6051 goto err;
6053 reg = 0x11b8 ;
6054 buf[0] = 0x7b;
6055 ret = usb_microdia_control_write(dev, reg, buf, 1);
6056 if (ret < 0)
6057 goto err;
6059 reg = 0x11b8 ;
6060 ret = usb_microdia_control_read(dev, reg, buf, 1);
6061 if (ret < 0)
6062 goto err;
6064 reg = 0x11b8 ;
6065 buf[0] = 0x7c;
6066 ret = usb_microdia_control_write(dev, reg, buf, 1);
6067 if (ret < 0)
6068 goto err;
6070 reg = 0x11b8 ;
6071 ret = usb_microdia_control_read(dev, reg, buf, 1);
6072 if (ret < 0)
6073 goto err;
6075 reg = 0x11b8 ;
6076 buf[0] = 0xfd;
6077 ret = usb_microdia_control_write(dev, reg, buf, 1);
6078 if (ret < 0)
6079 goto err;
6081 reg = 0x11b8 ;
6082 ret = usb_microdia_control_read(dev, reg, buf, 1);
6083 if (ret < 0)
6084 goto err;
6086 reg = 0x11b8 ;
6087 buf[0] = 0xfa;
6088 ret = usb_microdia_control_write(dev, reg, buf, 1);
6089 if (ret < 0)
6090 goto err;
6092 reg = 0x10c0 ;
6093 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6094 ret = usb_microdia_control_write(dev, reg, buf, 8);
6095 if (ret < 0)
6096 goto err;
6098 reg = 0x10c0 ;
6099 ret = usb_microdia_control_read(dev, reg, buf, 1);
6100 if (ret < 0)
6101 goto err;
6103 reg = 0x10c0 ;
6104 ret = usb_microdia_control_read(dev, reg, buf, 1);
6105 if (ret < 0)
6106 goto err;
6108 reg = 0x10c0 ;
6109 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6110 ret = usb_microdia_control_write(dev, reg, buf, 8);
6111 if (ret < 0)
6112 goto err;
6114 reg = 0x10c0 ;
6115 ret = usb_microdia_control_read(dev, reg, buf, 1);
6116 if (ret < 0)
6117 goto err;
6119 reg = 0x10c0 ;
6120 ret = usb_microdia_control_read(dev, reg, buf, 1);
6121 if (ret < 0)
6122 goto err;
6124 reg = 0x10c0 ;
6125 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x70; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6126 ret = usb_microdia_control_write(dev, reg, buf, 8);
6127 if (ret < 0)
6128 goto err;
6130 reg = 0x10c0 ;
6131 ret = usb_microdia_control_read(dev, reg, buf, 1);
6132 if (ret < 0)
6133 goto err;
6135 reg = 0x10c0 ;
6136 ret = usb_microdia_control_read(dev, reg, buf, 1);
6137 if (ret < 0)
6138 goto err;
6140 reg = 0x10c0 ;
6141 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6142 ret = usb_microdia_control_write(dev, reg, buf, 8);
6143 if (ret < 0)
6144 goto err;
6146 reg = 0x10c0 ;
6147 ret = usb_microdia_control_read(dev, reg, buf, 1);
6148 if (ret < 0)
6149 goto err;
6151 reg = 0x10c0 ;
6152 ret = usb_microdia_control_read(dev, reg, buf, 1);
6153 if (ret < 0)
6154 goto err;
6156 reg = 0x10c0 ;
6157 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6158 ret = usb_microdia_control_write(dev, reg, buf, 8);
6159 if (ret < 0)
6160 goto err;
6162 reg = 0x10c0 ;
6163 ret = usb_microdia_control_read(dev, reg, buf, 1);
6164 if (ret < 0)
6165 goto err;
6167 reg = 0x10c0 ;
6168 ret = usb_microdia_control_read(dev, reg, buf, 1);
6169 if (ret < 0)
6170 goto err;
6172 reg = 0x10c0 ;
6173 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6174 ret = usb_microdia_control_write(dev, reg, buf, 8);
6175 if (ret < 0)
6176 goto err;
6178 reg = 0x10c0 ;
6179 ret = usb_microdia_control_read(dev, reg, buf, 1);
6180 if (ret < 0)
6181 goto err;
6183 reg = 0x10c0 ;
6184 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6185 ret = usb_microdia_control_write(dev, reg, buf, 8);
6186 if (ret < 0)
6187 goto err;
6189 reg = 0x10c0 ;
6190 ret = usb_microdia_control_read(dev, reg, buf, 1);
6191 if (ret < 0)
6192 goto err;
6194 reg = 0x10c2 ;
6195 ret = usb_microdia_control_read(dev, reg, buf, 5);
6196 if (ret < 0)
6197 goto err;
6199 reg = 0x10c0 ;
6200 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6201 ret = usb_microdia_control_write(dev, reg, buf, 8);
6202 if (ret < 0)
6203 goto err;
6205 reg = 0x10c0 ;
6206 ret = usb_microdia_control_read(dev, reg, buf, 1);
6207 if (ret < 0)
6208 goto err;
6210 reg = 0x10c0 ;
6211 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6212 ret = usb_microdia_control_write(dev, reg, buf, 8);
6213 if (ret < 0)
6214 goto err;
6216 reg = 0x10c0 ;
6217 ret = usb_microdia_control_read(dev, reg, buf, 1);
6218 if (ret < 0)
6219 goto err;
6221 reg = 0x10c2 ;
6222 ret = usb_microdia_control_read(dev, reg, buf, 5);
6223 if (ret < 0)
6224 goto err;
6226 reg = 0x10c0 ;
6227 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1c; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6228 ret = usb_microdia_control_write(dev, reg, buf, 8);
6229 if (ret < 0)
6230 goto err;
6232 reg = 0x10c0 ;
6233 ret = usb_microdia_control_read(dev, reg, buf, 1);
6234 if (ret < 0)
6235 goto err;
6237 reg = 0x10c0 ;
6238 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6239 ret = usb_microdia_control_write(dev, reg, buf, 8);
6240 if (ret < 0)
6241 goto err;
6243 reg = 0x10c0 ;
6244 ret = usb_microdia_control_read(dev, reg, buf, 1);
6245 if (ret < 0)
6246 goto err;
6248 reg = 0x10c2 ;
6249 ret = usb_microdia_control_read(dev, reg, buf, 5);
6250 if (ret < 0)
6251 goto err;
6253 reg = 0x10c0 ;
6254 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6255 ret = usb_microdia_control_write(dev, reg, buf, 8);
6256 if (ret < 0)
6257 goto err;
6259 reg = 0x10c0 ;
6260 ret = usb_microdia_control_read(dev, reg, buf, 1);
6261 if (ret < 0)
6262 goto err;
6264 reg = 0x10c0 ;
6265 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6266 ret = usb_microdia_control_write(dev, reg, buf, 8);
6267 if (ret < 0)
6268 goto err;
6270 reg = 0x10c0 ;
6271 ret = usb_microdia_control_read(dev, reg, buf, 1);
6272 if (ret < 0)
6273 goto err;
6275 reg = 0x10c2 ;
6276 ret = usb_microdia_control_read(dev, reg, buf, 5);
6277 if (ret < 0)
6278 goto err;
6280 reg = 0x1061 ;
6281 buf[0] = 0x03;
6282 ret = usb_microdia_control_write(dev, reg, buf, 1);
6283 if (ret < 0)
6284 goto err;
6286 reg = 0x1007 ;
6287 buf[0] = 0x20;
6288 ret = usb_microdia_control_write(dev, reg, buf, 1);
6289 if (ret < 0)
6290 goto err;
6292 reg = 0x1006 ;
6293 buf[0] = 0x00;
6294 ret = usb_microdia_control_write(dev, reg, buf, 1);
6295 if (ret < 0)
6296 goto err;
6298 reg = 0x10c0 ;
6299 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6300 ret = usb_microdia_control_write(dev, reg, buf, 8);
6301 if (ret < 0)
6302 goto err;
6304 reg = 0x10c0 ;
6305 ret = usb_microdia_control_read(dev, reg, buf, 1);
6306 if (ret < 0)
6307 goto err;
6309 reg = 0x10c0 ;
6310 ret = usb_microdia_control_read(dev, reg, buf, 1);
6311 if (ret < 0)
6312 goto err;
6314 reg = 0x10c0 ;
6315 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6316 ret = usb_microdia_control_write(dev, reg, buf, 8);
6317 if (ret < 0)
6318 goto err;
6320 reg = 0x10c0 ;
6321 ret = usb_microdia_control_read(dev, reg, buf, 1);
6322 if (ret < 0)
6323 goto err;
6325 reg = 0x10c0 ;
6326 ret = usb_microdia_control_read(dev, reg, buf, 1);
6327 if (ret < 0)
6328 goto err;
6330 reg = 0x10c0 ;
6331 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6332 ret = usb_microdia_control_write(dev, reg, buf, 8);
6333 if (ret < 0)
6334 goto err;
6336 reg = 0x10c0 ;
6337 ret = usb_microdia_control_read(dev, reg, buf, 1);
6338 if (ret < 0)
6339 goto err;
6341 reg = 0x10c0 ;
6342 ret = usb_microdia_control_read(dev, reg, buf, 1);
6343 if (ret < 0)
6344 goto err;
6346 reg = 0x10c0 ;
6347 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x36; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6348 ret = usb_microdia_control_write(dev, reg, buf, 8);
6349 if (ret < 0)
6350 goto err;
6352 reg = 0x10c0 ;
6353 ret = usb_microdia_control_read(dev, reg, buf, 1);
6354 if (ret < 0)
6355 goto err;
6357 reg = 0x10c0 ;
6358 ret = usb_microdia_control_read(dev, reg, buf, 1);
6359 if (ret < 0)
6360 goto err;
6362 reg = 0x10c0 ;
6363 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6364 ret = usb_microdia_control_write(dev, reg, buf, 8);
6365 if (ret < 0)
6366 goto err;
6368 reg = 0x10c0 ;
6369 ret = usb_microdia_control_read(dev, reg, buf, 1);
6370 if (ret < 0)
6371 goto err;
6373 reg = 0x10c0 ;
6374 ret = usb_microdia_control_read(dev, reg, buf, 1);
6375 if (ret < 0)
6376 goto err;
6378 reg = 0x10c0 ;
6379 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6380 ret = usb_microdia_control_write(dev, reg, buf, 8);
6381 if (ret < 0)
6382 goto err;
6384 reg = 0x10c0 ;
6385 ret = usb_microdia_control_read(dev, reg, buf, 1);
6386 if (ret < 0)
6387 goto err;
6389 reg = 0x10c0 ;
6390 ret = usb_microdia_control_read(dev, reg, buf, 1);
6391 if (ret < 0)
6392 goto err;
6394 reg = 0x10c0 ;
6395 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6396 ret = usb_microdia_control_write(dev, reg, buf, 8);
6397 if (ret < 0)
6398 goto err;
6400 reg = 0x10c0 ;
6401 ret = usb_microdia_control_read(dev, reg, buf, 1);
6402 if (ret < 0)
6403 goto err;
6405 reg = 0x10c0 ;
6406 ret = usb_microdia_control_read(dev, reg, buf, 1);
6407 if (ret < 0)
6408 goto err;
6410 reg = 0x10c0 ;
6411 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x94; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6412 ret = usb_microdia_control_write(dev, reg, buf, 8);
6413 if (ret < 0)
6414 goto err;
6416 reg = 0x10c0 ;
6417 ret = usb_microdia_control_read(dev, reg, buf, 1);
6418 if (ret < 0)
6419 goto err;
6421 reg = 0x10c0 ;
6422 ret = usb_microdia_control_read(dev, reg, buf, 1);
6423 if (ret < 0)
6424 goto err;
6426 reg = 0x10c0 ;
6427 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x8d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6428 ret = usb_microdia_control_write(dev, reg, buf, 8);
6429 if (ret < 0)
6430 goto err;
6432 reg = 0x10c0 ;
6433 ret = usb_microdia_control_read(dev, reg, buf, 1);
6434 if (ret < 0)
6435 goto err;
6437 reg = 0x10c0 ;
6438 ret = usb_microdia_control_read(dev, reg, buf, 1);
6439 if (ret < 0)
6440 goto err;
6442 reg = 0x10c0 ;
6443 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x09; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6444 ret = usb_microdia_control_write(dev, reg, buf, 8);
6445 if (ret < 0)
6446 goto err;
6448 reg = 0x10c0 ;
6449 ret = usb_microdia_control_read(dev, reg, buf, 1);
6450 if (ret < 0)
6451 goto err;
6453 reg = 0x10c0 ;
6454 ret = usb_microdia_control_read(dev, reg, buf, 1);
6455 if (ret < 0)
6456 goto err;
6458 reg = 0x10c0 ;
6459 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x95; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6460 ret = usb_microdia_control_write(dev, reg, buf, 8);
6461 if (ret < 0)
6462 goto err;
6464 reg = 0x10c0 ;
6465 ret = usb_microdia_control_read(dev, reg, buf, 1);
6466 if (ret < 0)
6467 goto err;
6469 reg = 0x10c0 ;
6470 ret = usb_microdia_control_read(dev, reg, buf, 1);
6471 if (ret < 0)
6472 goto err;
6474 reg = 0x10c0 ;
6475 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6476 ret = usb_microdia_control_write(dev, reg, buf, 8);
6477 if (ret < 0)
6478 goto err;
6480 reg = 0x10c0 ;
6481 ret = usb_microdia_control_read(dev, reg, buf, 1);
6482 if (ret < 0)
6483 goto err;
6485 reg = 0x10c0 ;
6486 ret = usb_microdia_control_read(dev, reg, buf, 1);
6487 if (ret < 0)
6488 goto err;
6490 reg = 0x10c0 ;
6491 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
6492 ret = usb_microdia_control_write(dev, reg, buf, 8);
6493 if (ret < 0)
6494 goto err;
6496 reg = 0x10c0 ;
6497 ret = usb_microdia_control_read(dev, reg, buf, 1);
6498 if (ret < 0)
6499 goto err;
6501 reg = 0x10c0 ;
6502 ret = usb_microdia_control_read(dev, reg, buf, 1);
6503 if (ret < 0)
6504 goto err;
6506 reg = 0x10c0 ;
6507 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x96; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6508 ret = usb_microdia_control_write(dev, reg, buf, 8);
6509 if (ret < 0)
6510 goto err;
6512 reg = 0x10c0 ;
6513 ret = usb_microdia_control_read(dev, reg, buf, 1);
6514 if (ret < 0)
6515 goto err;
6517 reg = 0x10c0 ;
6518 ret = usb_microdia_control_read(dev, reg, buf, 1);
6519 if (ret < 0)
6520 goto err;
6522 reg = 0x10c0 ;
6523 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6524 ret = usb_microdia_control_write(dev, reg, buf, 8);
6525 if (ret < 0)
6526 goto err;
6528 reg = 0x10c0 ;
6529 ret = usb_microdia_control_read(dev, reg, buf, 1);
6530 if (ret < 0)
6531 goto err;
6533 reg = 0x10c0 ;
6534 ret = usb_microdia_control_read(dev, reg, buf, 1);
6535 if (ret < 0)
6536 goto err;
6538 reg = 0x10c0 ;
6539 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
6540 ret = usb_microdia_control_write(dev, reg, buf, 8);
6541 if (ret < 0)
6542 goto err;
6544 reg = 0x10c0 ;
6545 ret = usb_microdia_control_read(dev, reg, buf, 1);
6546 if (ret < 0)
6547 goto err;
6549 reg = 0x10c0 ;
6550 ret = usb_microdia_control_read(dev, reg, buf, 1);
6551 if (ret < 0)
6552 goto err;
6554 reg = 0x1007 ;
6555 buf[0] = 0x20;
6556 ret = usb_microdia_control_write(dev, reg, buf, 1);
6557 if (ret < 0)
6558 goto err;
6560 reg = 0x1006 ;
6561 buf[0] = 0x20;
6562 ret = usb_microdia_control_write(dev, reg, buf, 1);
6563 if (ret < 0)
6564 goto err;
6569 /* END OF MICRODIA 6288 START STREAM */
6571 return 0;
6572 err:
6573 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
6574 return ret;
6577 int dev_microdia_stop_stream(struct usb_microdia *dev)
6579 int ret = -ENODEV;
6580 if (dev && dev->stop_stream)
6581 ret = dev->stop_stream(dev);
6583 return ret;
6587 * @brief From stop.htm
6589 * @param dev
6591 * @returns 0
6593 * @author GWater
6595 * For SN9C201 with MI1310.
6596 * This function has not been tested yet.
6598 int microdia_6242_stop_stream(struct usb_microdia *dev)
6600 __u8 buf[3];
6602 __u8 only10c0[3] = {0x0d, 0x00, 0x00};
6604 buf[0] = 0x01;
6605 usb_microdia_control_write(dev, 0x1061, buf, 1);
6607 buf[0] = 0x60;
6608 usb_microdia_control_write(dev, 0x1007, buf, 1);
6610 buf[0] = 0x00;
6611 usb_microdia_control_write(dev, 0x1006, buf, 1);
6613 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
6614 only10c0[0], dev->sensor_flags, &only10c0[1]);
6616 buf[0] = 0x38;
6617 usb_microdia_control_write(dev, 0x1000, buf, 1);
6619 buf[0] = 0x6b;
6620 usb_microdia_control_write(dev, 0x11b8, buf, 1);
6622 buf[0] = 0x60;
6623 usb_microdia_control_write(dev, 0x1007, buf, 1);
6625 buf[0] = 0x20;
6626 usb_microdia_control_write(dev, 0x1006, buf, 1);
6629 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
6630 usb_microdia_control_write(dev, 0x1000, buf, 3);
6633 * After the select alternate setting 0 is actually another transfer:
6634 * buf[0] = 0x00;
6635 * usb_microdia_control_write(dev, 0x1066, buf, 1);
6638 return 0;
6643 * @brief From stopstream.log
6645 * @param dev
6647 * @returns 0
6649 * @author GWater
6651 * For SN9C201 with SOI968.
6652 * I don't whether the function really stops the stream.
6653 * Nevertheless the LED on the webcam now stops glowing.
6654 * The function is very similar to "microdia_624f_stop_stream".
6656 int microdia_624e_stop_stream(struct usb_microdia *dev)
6658 __u8 buf[3];
6660 buf[0] = 0x01;
6661 usb_microdia_control_write(dev, 0x1061, buf, 1);
6663 /* Next two writes added because it works better.
6664 * The LED stops glowing and I think the stream does too.
6665 * 0x20 = 0b00100000 which is the minimal of what the
6666 * other stopstreams have in common.
6668 buf[0] = 0x20;
6669 usb_microdia_control_write(dev, 0x1007, buf, 1);
6671 buf[0] = 0x20;
6672 usb_microdia_control_write(dev, 0x1006, buf, 1);
6674 buf[0] = 0x3c;
6675 usb_microdia_control_write(dev, 0x1000, buf, 1);
6677 buf[0] = 0x6a;
6678 usb_microdia_control_write(dev, 0x11b8, buf, 1);
6680 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6681 usb_microdia_control_write(dev, 0x1000, buf, 3);
6683 usb_microdia_control_read(dev, 0x1066, buf, 1);
6685 return 0;
6689 int microdia_624f_stop_stream(struct usb_microdia *dev)
6691 int ret;
6692 __u16 command;
6693 __u8 buf[3];
6695 buf[0] = 0x02;
6696 command = 0x1066;
6697 ret = usb_microdia_control_write(dev, command, buf, 1);
6698 if (ret < 0)
6699 goto err;
6701 buf[0] = 0x01;
6702 command = 0x1061;
6703 ret = usb_microdia_control_write(dev, command, buf, 1);
6704 if (ret < 0)
6705 goto err;
6707 buf[0] = 0x38;
6708 command = 0x1000;
6709 ret = usb_microdia_control_write(dev, command, buf, 1);
6710 if (ret < 0)
6711 goto err;
6713 buf[0] = 0x6a;
6714 command = 0x11b8;
6715 ret = usb_microdia_control_write(dev, command, buf, 1);
6716 if (ret < 0)
6717 goto err;
6719 buf[0] = 0x20;
6720 command = 0x1007;
6721 ret = usb_microdia_control_write(dev, command, buf, 1);
6722 if (ret < 0)
6723 goto err;
6725 buf[0] = 0x20;
6726 command = 0x1006;
6727 ret = usb_microdia_control_write(dev, command, buf, 1);
6728 if (ret < 0)
6729 goto err;
6731 buf[0] = 0x98;
6732 buf[1] = 0xe7;
6733 buf[2] = 0x11;
6734 command = 0x1000;
6735 ret = usb_microdia_control_write(dev, command, buf, 3);
6736 if (ret < 0)
6737 goto err;
6739 command = 0x1045;
6740 ret = usb_microdia_control_read(dev, command, buf, 1);
6741 if (ret < 0)
6742 goto err;
6744 buf[0] = 0x0f;
6745 ret = usb_microdia_control_write(dev, command, buf, 1);
6746 if (ret < 0)
6747 goto err;
6749 return ret;
6751 err:
6752 UDIA_ERROR("command %x failed (%d)!\n", command, ret);
6753 return ret;
6756 int microdia_6260_stop_stream(struct usb_microdia *dev)
6758 int ret;
6759 __u8 buf[32];
6761 buf[0] = 0x01;
6762 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
6763 buf[0] = 0x38;
6764 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
6765 buf[0] = 0x6b;
6766 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
6767 buf[0] = 0x20;
6768 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
6769 buf[0] = 0x20;
6770 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
6772 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
6773 ret = usb_microdia_control_write(dev, 0x1000, buf, 3);
6775 buf[0] = 0x00;
6776 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
6777 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
6778 buf[0] = 0x0f;
6779 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
6780 buf[0] = 0x00;
6781 ret = usb_microdia_control_write(dev, 0x10c8, buf, 1);
6782 buf[0] = 0x80;
6783 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
6785 return ret;
6789 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
6791 * @param dev
6793 * @returns 0 (ok) or -1 (error)
6795 * @author Comer352l
6797 * Windows driver version: 5.7.23.000
6798 * Windows versions: 2000 and XP
6799 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
6800 * All logs were made using AMCAP with 640x480, RGB24
6802 int microdia_6270_stop_stream(struct usb_microdia *dev)
6804 int ret = 0;
6805 int retI2C = 0;
6806 __u8 buf[3];
6808 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS) {
6809 buf[0] = 0x20;
6810 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 3541 */
6811 buf[0] = 0x20;
6812 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 3542 */
6813 /* => These two writes seem to cause the cam to stop sending isochronus USB messages */
6815 buf[0] = 0x01;
6816 ret += usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 3544 */
6817 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
6818 buf[0] = 0x60;
6819 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 3541 */
6820 buf[0] = 0x60;
6821 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 3542 */
6823 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS) {
6824 /* Write to sensor register 0x07: Output Control */
6825 buf[0] = 0x00; buf[1] = 0x00; /* stop sensor readout, normal operation */
6826 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6828 buf[0] = 0x38; /* ALEX: 0x3c */
6829 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 3545 */
6830 buf[0] = 0x6d; /* ALEX: 0xec; FRANK: also 0x6c */
6831 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 3546 */
6832 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6833 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); /* URB 3547 */
6835 /* INTERRUPT COMMING BACK (URB 2227) */
6836 /* SELECT ALTERNATE SETTINGS (URB 3548) */
6837 /* INTERRUPT GOING DOWN (URB 3549) */
6839 buf[0] = 0x00;
6840 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 3550 */
6842 if (ret < 9) {
6843 UDIA_INFO("One ore more errors occured while stopping stream !\n");
6844 return -1;
6845 } else {
6846 return 0;
6850 int microdia_627b_stop_stream(struct usb_microdia *dev)
6852 int ret = 0;
6853 __u16 reg;
6854 __u8 buf[3];
6856 reg = 0x1007;
6857 buf[0] = 0x60;
6858 ret = usb_microdia_control_write(dev, reg, buf, 1);
6859 if (ret < 0)
6860 goto err;
6862 reg = 0x1006;
6863 buf[0] = 0x20;
6864 ret = usb_microdia_control_write(dev, reg, buf, 1);
6865 if (ret < 0)
6866 goto err;
6868 reg = 0x1061;
6869 buf[0] = 0x01;
6870 ret = usb_microdia_control_write(dev, reg, buf, 1);
6871 if (ret < 0)
6872 goto err;
6874 reg = 0x1000;
6875 buf[0] = 0x38;
6876 ret = usb_microdia_control_write(dev, reg, buf, 1);
6877 if (ret < 0)
6878 goto err;
6880 reg = 0x11b8;
6881 buf[0] = 0x6b;
6882 ret = usb_microdia_control_write(dev, reg, buf, 1);
6883 if (ret < 0)
6884 goto err;
6886 reg = 0x1000;
6887 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
6888 ret = usb_microdia_control_write(dev, reg, buf, 3);
6889 if (ret < 0)
6890 goto err;
6892 reg = 0x1066;
6893 buf[0] = 0x00;
6894 ret = usb_microdia_control_write(dev, reg, buf, 1);
6895 if (ret < 0)
6896 goto err;
6898 return ret;
6900 err:
6901 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
6902 return ret;
6906 * @brief From UsbSnoop-plugin-parsed.log
6908 * @param dev
6910 * @returns 0 (OK) or <0 (Error)
6912 * @author Vincent, Kuzja
6914 int microdia_6288_stop_stream(struct usb_microdia *dev)
6916 int ret = 0;
6917 __u16 reg;
6918 __u8 buf[8];
6920 reg = 0x1061 ;
6921 buf[0] = 0x01;
6922 ret = usb_microdia_control_write(dev, reg, buf, 1);
6923 if (ret < 0)
6924 goto err;
6926 reg = 0x1000 ;
6927 buf[0] = 0x38;
6928 ret = usb_microdia_control_write(dev, reg, buf, 1);
6929 if (ret < 0)
6930 goto err;
6932 reg = 0x11b8 ;
6933 buf[0] = 0xe9;
6934 ret = usb_microdia_control_write(dev, reg, buf, 1);
6935 if (ret < 0)
6936 goto err;
6938 reg = 0x1007 ;
6939 buf[0] = 0x20;
6940 ret = usb_microdia_control_write(dev, reg, buf, 1);
6941 if (ret < 0)
6942 goto err;
6944 reg = 0x1006 ;
6945 buf[0] = 0x20;
6946 ret = usb_microdia_control_write(dev, reg, buf, 1);
6947 if (ret < 0)
6948 goto err;
6950 reg = 0x1000 ;
6951 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
6952 ret = usb_microdia_control_write(dev, reg, buf, 3);
6953 if (ret < 0)
6954 goto err;
6956 reg = 0x1066 ;
6957 buf[0] = 0x00;
6958 ret = usb_microdia_control_write(dev, reg, buf, 1);
6959 if (ret < 0)
6960 goto err;
6962 return 0;
6963 err:
6964 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
6965 return ret;
6968 int microdia_624f_flip_detect(struct usb_microdia *dev)
6970 int ret = 0;
6971 __u8 val;
6973 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
6974 if (ret < 0)
6975 return -EAGAIN;
6976 if (val & 0x01)
6977 dev->vsettings.vflip = 1;
6978 else
6979 dev->vsettings.vflip = 0;
6980 return ret;
6983 int microdia_6260_flip_detect(struct usb_microdia *dev)
6985 const __u8 flip_bit = 0x01;
6986 int ret = 0;
6987 __u8 val;
6988 static __u8 flip_reg = flip_bit;
6989 __u8 vflip;
6991 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
6992 if (ret < 0)
6993 return -EAGAIN;
6994 if (flip_reg != (val & flip_bit)) {
6995 if (val & flip_bit)
6996 vflip = 0;
6997 else
6998 vflip = 1;
6999 ret = ov7670_auto_flip(dev, vflip);
7000 flip_reg = (val & flip_bit);
7003 return ret;