Coding style changes for 6260 functions only
[microdia.git] / microdia-dev.c
blob555b81909b7b1187de9bfd2cdcf6fa3a257ec5ac
1 /**
2 * @file microdia-dev.c
3 * @author Nicolas VIVIEN
4 * @date 2008-02-01
5 * @version v0.0.0
7 * @brief Driver for Microdia USB video camera
9 * @note Copyright (C) Nicolas VIVIEN
11 * @par Licences
13 * This program is free software; you can redistribute it and/or modify
14 * it under the terms of the GNU General Public License as published by
15 * the Free Software Foundation; either version 2 of the License, or
16 * any later version.
18 * This program is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU General Public License for more details.
23 * You should have received a copy of the GNU General Public License
24 * along with this program; if not, write to the Free Software
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
28 #include <linux/errno.h>
29 #include <linux/string.h>
30 #include <stdarg.h>
32 #include "microdia.h"
33 #include "sn9c20x.h"
34 #include "ov7670.h"
35 #include "ov965x.h"
36 #include "mt9vx11.h"
37 #include "ov7660.h"
39 int dev_microdia_init_camera(struct usb_microdia *dev)
41 return 0;
44 int dev_microdia_camera_on(struct usb_microdia *dev)
46 int ret = -1;
47 struct usb_device *udev = dev->udev;
49 ret = usb_set_interface(udev, 0, 8);
51 if (ret < 0)
52 UDIA_ERROR("usb_set_interface failed !\n");
54 return ret;
57 int dev_microdia_camera_off(struct usb_microdia *dev)
59 int ret = -1;
60 struct usb_device *udev = dev->udev;
62 ret = usb_set_interface(udev, 0, 0);
64 if (ret < 0)
65 UDIA_ERROR("usb_set_interface failed !\n");
67 return 0;
70 int dev_microdia_camera_settings(struct usb_microdia *dev)
72 dev_microdia_camera_set_contrast(dev);
73 dev_microdia_camera_set_brightness(dev);
74 dev_microdia_camera_set_gamma(dev);
75 dev_microdia_camera_set_exposure(dev);
76 dev_microdia_camera_set_hvflip(dev);
77 dev_microdia_camera_set_sharpness(dev);
78 dev_microdia_camera_set_rgb_gain(dev);
79 dev_microdia_camera_set_auto_exposure(dev);
80 dev_microdia_camera_set_auto_whitebalance(dev);
81 return 0;
84 int dev_microdia_camera_set_contrast(struct usb_microdia *dev)
86 int ret = -ENODEV;
87 if(dev && dev->set_contrast)
88 ret = dev->set_contrast(dev);
89 return ret;
92 int dev_microdia_camera_set_brightness(struct usb_microdia *dev)
94 int ret = -ENODEV;
95 if(dev && dev->set_brightness)
96 ret = dev->set_brightness(dev);
97 return ret;
100 int dev_microdia_camera_set_gamma(struct usb_microdia *dev)
102 int ret = -ENODEV;
103 if(dev && dev->set_gamma)
104 ret = dev->set_gamma(dev);
105 return ret;
108 int dev_microdia_camera_set_exposure(struct usb_microdia *dev)
110 if (dev->set_exposure != NULL) {
111 return dev->set_exposure(dev);
113 return 0;
116 int dev_microdia_camera_set_hvflip(struct usb_microdia *dev)
118 int ret = -ENODEV;
119 if(dev && dev->set_hvflip)
120 ret = dev->set_hvflip(dev);
122 return ret;
125 int dev_microdia_camera_set_sharpness(struct usb_microdia *dev)
127 int ret = -ENODEV;
128 if(dev && dev->set_sharpness)
129 ret = dev->set_sharpness(dev);
131 return ret;
134 int dev_microdia_camera_set_rgb_gain(struct usb_microdia *dev)
136 int ret = -ENODEV;
137 if (dev && dev->set_rgb_gain)
138 ret = dev->set_rgb_gain(dev);
140 return ret;
143 int dev_microdia_camera_set_auto_exposure(struct usb_microdia *dev)
145 int ret = -ENODEV;
146 if(dev && dev->set_auto_exposure)
147 ret = dev->set_auto_exposure(dev);
149 return ret;
152 int dev_microdia_camera_set_auto_whitebalance(struct usb_microdia *dev)
154 int ret = -ENODEV;
155 if(dev && dev->set_auto_whitebalance)
156 ret = dev->set_auto_whitebalance(dev);
158 return ret;
162 /**
163 * @brief From UsbSnoop-plugin-parsed.log
165 * @param dev
167 * @returns
169 int dev_microdia_initialize_device(struct usb_microdia *dev)
171 int ret = -ENODEV;
173 if(dev && dev->initialize)
174 ret = dev->initialize(dev);
176 return ret;
180 * @brief From init-physical-replug.log
182 * @param dev
184 * @returns 0
186 * @author psnel
188 * For SN9C201 with MI1300.
191 int microdia_6240_initialize(struct usb_microdia *dev)
193 int ret = 0;
194 __u8 buf;
196 UDIA_INFO("Initializing camera...\n");
198 ret = usb_microdia_control_read(dev, 0x130d, &buf, 1); /* URB 5 0x81 */
199 UDIA_INFO("...init: read %x, ret = %d\n", buf, ret);
201 ret += usb_microdia_control_read(dev, 0x1040, &buf, 1); /* URB 6 0xe4 */
202 UDIA_INFO("...init: read %x, ret = %d\n", buf, ret);
204 buf = 0x00;
205 ret += usb_microdia_control_write(dev, 0x10c8, &buf, 1); /* URB 7 */
206 UDIA_INFO("...init: write %x, ret = %d\n", buf, ret);
208 /* Interrupt going down (URB 8) */
210 buf = 0x80;
211 ret += usb_microdia_control_write(dev, 0x1020, &buf, 1); /* URB 9 */
212 UDIA_INFO("...init: write %x, ret = %d\n", buf, ret);
214 if (ret < 4) {
215 UDIA_ERROR("One or more errors occured during initialization!\n");
216 return -1;
219 return 0;
223 * @brief From start.log (14 jun 2008)
225 * @param dev
227 * @returns 0
229 * @author psnel
231 * For SN9C201 with MI1300.
234 int microdia_6240_start_stream(struct usb_microdia *dev)
236 int ret = 0;
237 int i;
238 __u16 reg;
239 __u8 buf;
240 __u8 buf24[24];
241 __u8 buf64[64];
242 __u8 buf10e1[21] = { 0x16, 0x00, 0x2d, 0x00, 0x08, 0x00, 0xf1, 0x0f,
243 0xd3, 0x0f, 0x3c, 0x00, 0x36, 0x00, 0xce, 0x0f,
244 0xfc, 0x0f, 0x00, 0x00, 0x00
246 __u8 buf1100[64] = { 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
247 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
248 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
249 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
250 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
251 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
252 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
253 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54
255 UDIA_INFO("Starting camera data stream...\n");
257 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
258 // URB 10 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 8
259 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
260 reg = 0x1066;
261 buf = 0x00;
262 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 12 */
263 if (ret < 0)
264 goto err;
266 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
267 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: */
269 reg = 0x1007;
270 buf = 0x20;
271 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 14 */
272 if (ret < 0)
273 goto err;
274 reg = 0x1006;
275 buf = 0x00;
276 ret = usb_microdia_control_write(dev, reg, &buf, 1);
277 if (ret < 0)
278 goto err;
279 reg = 0x1000;
280 buf = 0x78;
281 ret = usb_microdia_control_write(dev, reg, &buf, 1);
282 if (ret < 0)
283 goto err;
285 reg = 0x1001;
286 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* cf */
287 if (ret < 0)
288 goto err;
290 reg = 0x1001;
291 buf = 0xc7;
292 ret = usb_microdia_control_write(dev, reg, &buf, 1);
293 if (ret < 0)
294 goto err;
295 reg = 0x1002;
296 buf = 0x18;
297 ret = usb_microdia_control_write(dev, reg, &buf, 1);
298 if (ret < 0)
299 goto err;
301 reg = 0x1007;
302 ret = usb_microdia_control_read(dev, reg, buf24, 7); /* URB 20 << 20 00 ff 81 00 00 00 */
303 if (ret < 0)
304 goto err;
306 reg = 0x1006;
307 buf24[0] = 0x80; buf24[1] = 0xa0;
308 ret = usb_microdia_control_write(dev, reg, buf24, 2);
309 if (ret < 0)
310 goto err;
311 reg = 0x1061;
312 buf = 0x01;
313 ret = usb_microdia_control_write(dev, reg, &buf, 1);
314 if (ret < 0)
315 goto err;
316 reg = 0x1020;
317 buf = 0x80;
318 ret = usb_microdia_control_write(dev, reg, &buf, 1);
319 if (ret < 0)
320 goto err;
321 reg = 0x1067;
322 buf24[0] = 0x40; buf24[1] = 0x30; buf24[2] = 0x20; buf24[3] = 0x10;
323 buf24[4] = 0x08;
324 ret = usb_microdia_control_write(dev, reg, buf24, 5);
325 if (ret < 0)
326 goto err;
327 reg = 0x10c0;
328 buf24[0] = 0x80; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
329 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
330 buf24[8] = 0x03;
331 ret = usb_microdia_control_write(dev, reg, buf24, 9);
332 if (ret < 0)
333 goto err;
334 reg = 0x10e0;
335 buf24[0] = 0x45; buf24[1] = 0x18; buf24[2] = 0x00; buf24[3] = 0x30;
336 buf24[4] = 0x00; buf24[5] = 0x09; buf24[6] = 0x00; buf24[7] = 0xed;
337 buf24[8] = 0x0f; buf24[9] = 0xda; buf24[10] = 0x0f; buf24[11] = 0x3a;
338 buf24[12] = 0x00; buf24[13] = 0x3a; buf24[14] = 0x00; buf24[15] = 0xd0;
339 buf24[16] = 0x0f; buf24[17] = 0xf7; buf24[18] = 0x0f; buf24[19] = 0x00;
340 buf24[20] = 0x00; buf24[21] = 0x00; buf24[22] = 0x60; buf24[23] = 0x0a;
341 ret = usb_microdia_control_write(dev, reg, buf24, 24);
342 if (ret < 0)
343 goto err;
344 reg = 0x10f8;
345 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00;
346 ret = usb_microdia_control_write(dev, reg, buf24, 3);
347 if (ret < 0)
348 goto err;
349 reg = 0x10fb;
350 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
351 buf24[4] = 0x00;
352 ret = usb_microdia_control_write(dev, reg, buf24, 5);
353 if (ret < 0)
354 goto err;
355 reg = 0x1188;
356 buf24[0] = 0x06; buf24[1] = 0x4c; buf24[2] = 0x08;
357 ret = usb_microdia_control_write(dev, reg, buf24, 3);
358 if (ret < 0)
359 goto err;
361 reg = 0x118b;
362 buf24[0] = 0x00; buf24[1] = 0x20; buf24[2] = 0x20; buf24[3] = 0x20;
363 buf24[4] = 0x20; buf24[5] = 0x00; buf24[6] = 0x24; buf24[7] = 0x3b;
364 buf24[8] = 0x4f; buf24[9] = 0x61; buf24[10] = 0x71; buf24[11] = 0x80;
365 buf24[12] = 0x8f; buf24[13] = 0x9d; buf24[14] = 0xab; buf24[15] = 0xb8;
367 buf24[16] = 0xc4; buf24[17] = 0xd1; buf24[18] = 0xdd; buf24[19] = 0xe9;
368 buf24[20] = 0xf4; buf24[21] = 0xff;
369 ret = usb_microdia_control_write(dev, reg, buf24, 22); /* URB 30 */
370 if (ret < 0)
371 goto err;
373 reg = 0x11a1;
374 buf24[0] = 0x00; buf24[1] = 0x00;
375 ret = usb_microdia_control_write(dev, reg, buf24, 2);
376 if (ret < 0)
377 goto err;
379 reg = 0x11b7;
380 buf24[0] = 0x60; buf24[1] = 0x28; buf24[2] = 0x00; buf24[3] = 0x08;
381 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
382 buf24[8] = 0x00;
383 ret = usb_microdia_control_write(dev, reg, buf24, 9);
384 if (ret < 0)
385 goto err;
387 reg = 0x11b8;
388 buf = 0x38;
389 ret = usb_microdia_control_write(dev, reg, &buf, 1);
390 if (ret < 0)
391 goto err;
393 reg = 0x1000;
394 buf = 0x78;
395 ret = usb_microdia_control_write(dev, reg, &buf, 1);
396 if (ret < 0)
397 goto err;
399 reg = 0x10c0;
400 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
401 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
402 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 35..90 --> */
403 if (ret < 0)
404 goto err;
406 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
407 if (ret < 0)
408 goto err;
409 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
410 if (ret < 0)
411 goto err;
413 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
414 buf24[4] = 0x01; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
415 ret = usb_microdia_control_write(dev, reg, buf24, 8);
416 if (ret < 0)
417 goto err;
419 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
420 if (ret < 0)
421 goto err;
422 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
423 if (ret < 0)
424 goto err;
426 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
427 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
428 ret = usb_microdia_control_write(dev, reg, buf24, 8);
429 if (ret < 0)
430 goto err;
432 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
433 if (ret < 0)
434 goto err;
435 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b4 */
436 if (ret < 0)
437 goto err;
439 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x01; buf24[3] = 0x00;
440 buf24[4] = 0x0e; buf24[5] = 0x00; buf24[6] = 0x14; buf24[7] = 0x10;
441 ret = usb_microdia_control_write(dev, reg, buf24, 8);
442 if (ret < 0)
443 goto err;
445 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // URB 45 << d0 */
446 if (ret < 0)
447 goto err;
448 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
449 if (ret < 0)
450 goto err;
452 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x03; buf24[3] = 0x03;
453 buf24[4] = 0xc1; buf24[5] = 0x05; buf24[6] = 0x01; buf24[7] = 0x10;
454 ret = usb_microdia_control_write(dev, reg, buf24, 8);
455 if (ret < 0)
456 goto err;
458 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
459 if (ret < 0)
460 goto err;
461 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
462 if (ret < 0)
463 goto err;
465 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
466 buf24[4] = 0x83; buf24[5] = 0x00; buf24[6] = 0x06; buf24[7] = 0x10;
467 ret = usb_microdia_control_write(dev, reg, buf24, 8);
468 if (ret < 0)
469 goto err;
471 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
472 if (ret < 0)
473 goto err;
474 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
475 if (ret < 0)
476 goto err;
478 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
479 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
480 ret = usb_microdia_control_write(dev, reg, buf24, 8);
481 if (ret < 0)
482 goto err;
484 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
485 if (ret < 0)
486 goto err;
487 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
488 if (ret < 0)
489 goto err;
491 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x00;
492 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
493 ret = usb_microdia_control_write(dev, reg, buf24, 8);
494 if (ret < 0)
495 goto err;
497 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
498 if (ret < 0)
499 goto err;
500 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
501 if (ret < 0)
502 goto err;
504 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x0b; buf24[3] = 0x00;
505 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
506 ret = usb_microdia_control_write(dev, reg, buf24, 8);
507 if (ret < 0)
508 goto err;
510 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
511 if (ret < 0)
512 goto err;
513 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
514 if (ret < 0)
515 goto err;
517 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x11; buf24[3] = 0x00;
518 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
519 ret = usb_microdia_control_write(dev, reg, buf24, 8);
520 if (ret < 0)
521 goto err;
523 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
524 if (ret < 0)
525 goto err;
526 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
527 if (ret < 0)
528 goto err;
530 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x1e; buf24[3] = 0x80;
531 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
532 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 65 */
533 if (ret < 0)
534 goto err;
536 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
537 if (ret < 0)
538 goto err;
539 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
540 if (ret < 0)
541 goto err;
543 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
544 buf24[4] = 0x05; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
545 ret = usb_microdia_control_write(dev, reg, buf24, 8);
546 if (ret < 0)
547 goto err;
549 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
550 if (ret < 0)
551 goto err;
552 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
553 if (ret < 0)
554 goto err;
556 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
557 buf24[4] = 0x08; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
558 ret = usb_microdia_control_write(dev, reg, buf24, 8);
559 if (ret < 0)
560 goto err;
562 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
563 if (ret < 0)
564 goto err;
565 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
566 if (ret < 0)
567 goto err;
569 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
570 buf24[4] = 0x14; buf24[5] = 0x00; buf24[6] = 0x08; buf24[7] = 0x10;
571 ret = usb_microdia_control_write(dev, reg, buf24, 8);
572 if (ret < 0)
573 goto err;
575 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
576 if (ret < 0)
577 goto err;
578 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
579 if (ret < 0)
580 goto err;
582 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
583 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
584 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 77 */
585 if (ret < 0)
586 goto err;
588 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
589 if (ret < 0)
590 goto err;
592 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x5f; buf24[3] = 0x89;
593 buf24[4] = 0x04; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
594 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 79 */
595 if (ret < 0)
596 goto err;
598 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
599 if(ret < 0) goto err;
600 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
601 if (ret < 0)
602 goto err;
604 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x60; buf24[3] = 0x00;
605 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
606 ret = usb_microdia_control_write(dev, reg, buf24, 8);
607 if (ret < 0)
608 goto err;
610 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
611 if (ret < 0)
612 goto err;
613 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
614 if (ret < 0)
615 goto err;
617 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x62; buf24[3] = 0x04;
618 buf24[4] = 0x98; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
619 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 85 */
620 if (ret < 0)
621 goto err;
623 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
624 if (ret < 0)
625 goto err;
626 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
627 if (ret < 0)
628 goto err;
630 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x68; buf24[3] = 0x00;
631 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
632 ret = usb_microdia_control_write(dev, reg, buf24, 8);
633 if (ret < 0)
634 goto err;
636 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
637 if (ret < 0)
638 goto err;
639 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
640 if (ret < 0)
641 goto err;
642 /* // <-- 10c0 */
643 reg = 0x10c1;
644 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* URB 91 // << 5d*/
645 if (ret < 0)
646 goto err;
647 buf = 0x50;
648 ret = usb_microdia_control_write(dev, reg, &buf, 1);
649 if (ret < 0)
650 goto err;
652 reg = 0x10c0;
653 buf24[0] = 0x90; buf24[1] = 0x50; buf24[2] = 0x00; buf24[3] = 0x00;
654 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
655 for(i=93; i<=108; i++){
656 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 93..108 */
657 if (ret < 0)
658 goto err;
659 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 9c */
660 if (ret < 0)
661 goto err;
663 ret = usb_microdia_control_write(dev, reg, buf24, 8);
664 if (ret < 0)
665 goto err;
667 buf24[0] = 0x92; /* // change only 1st value */
668 for(i=110; i<=126; i++){
669 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 110..126 */
670 if (ret < 0)
671 goto err;
672 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 9e */
673 if (ret < 0)
674 goto err;
677 reg = 0x10c2;
678 ret = usb_microdia_control_read(dev, reg, buf24, 5); /* // << ff ff ff ff ff */
679 if (ret < 0)
680 goto err;
682 reg = 0x10c1;
683 buf = 0x5d;
684 ret = usb_microdia_control_write(dev, reg, &buf, 1);
685 if (ret < 0)
686 goto err;
688 reg = 0x10e0;
689 buf = 0x47;
690 ret = usb_microdia_control_write(dev, reg, &buf, 1);
691 if (ret < 0)
692 goto err;
693 buf = 0x07;
694 ret = usb_microdia_control_write(dev, reg, &buf, 1);
695 if (ret < 0)
696 goto err;
698 reg = 0x1001;
699 buf = 0xc6;
700 ret = usb_microdia_control_write(dev, reg, &buf, 1);
701 if (ret < 0)
702 goto err;
703 buf = 0xc4;
704 ret = usb_microdia_control_write(dev, reg, &buf, 1);
705 if (ret < 0)
706 goto err;
707 buf = 0x44;
708 ret = usb_microdia_control_write(dev, reg, &buf, 1);
709 if (ret < 0)
710 goto err;
712 reg = 0x1189;
713 buf = 0x0c;
714 ret = usb_microdia_control_write(dev, reg, &buf, 1);
715 if (ret < 0)
716 goto err;
718 buf = 0x00;
719 reg = 0x11bc;
720 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 135..138 */
721 if (ret < 0)
722 goto err;
723 reg = 0x11bd;
724 ret = usb_microdia_control_write(dev, reg, &buf, 1);
725 if (ret < 0)
726 goto err;
727 reg = 0x11be;
728 ret = usb_microdia_control_write(dev, reg, &buf, 1);
729 if (ret < 0)
730 goto err;
731 reg = 0x11bf;
732 ret = usb_microdia_control_write(dev, reg, &buf, 1);
733 if (ret < 0)
734 goto err;
736 reg = 0x10c0;
737 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
738 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
739 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 139 */
740 if (ret < 0)
741 goto err;
743 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
744 if (ret < 0)
745 goto err;
746 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
747 if (ret < 0)
748 goto err;
750 reg = 0x1180;
751 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
752 buf24[4] = 0x28; buf24[5] = 0x3c;
753 ret = usb_microdia_control_write(dev, reg, buf24, 6); /* URB 142 */
754 if (ret < 0)
755 goto err;
757 reg = 0x10fb;
758 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
759 buf24[4] = 0x00;
760 ret = usb_microdia_control_write(dev, reg, buf24, 5);
761 if (ret < 0)
762 goto err;
764 reg = 0x1189;
765 buf = 0x0c;
766 ret = usb_microdia_control_write(dev, reg, &buf, 1);
767 if (ret < 0)
768 goto err;
770 reg = 0x11a1;
771 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
772 ret = usb_microdia_control_write(dev, reg, buf24, 4);
773 if (ret < 0)
774 goto err;
776 reg = 0x11ab;
777 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
778 ret = usb_microdia_control_write(dev, reg, buf24, 4);
779 if (ret < 0)
780 goto err;
782 reg = 0x1000;
783 buf = 0x7c;
784 ret = usb_microdia_control_write(dev, reg, &buf, 1);
785 if (ret < 0)
786 goto err;
788 reg = 0x1002;
789 buf = 0x1c;
790 for(i=148; i<=149; i++){
791 ret = usb_microdia_control_write(dev, reg, &buf, 1);
792 if (ret < 0)
793 goto err;
796 reg = 0x11b8;
797 buf = 0x38;
798 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 150 */
799 if (ret < 0)
800 goto err;
802 reg = 0x118a;
803 buf = 0x05;
804 ret = usb_microdia_control_write(dev, reg, &buf, 1);
805 if (ret < 0)
806 goto err;
808 reg = 0x0395;
809 buf = 0x05;
810 ret = usb_microdia_control_write(dev, reg, &buf, 1);
811 if (ret < 0)
812 goto err;
814 reg = 0x11b8;
815 buf = 0x78;
816 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 153..163 */
817 if (ret < 0)
818 goto err;
819 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
820 if (ret < 0)
821 goto err;
822 buf = 0x79;
823 ret = usb_microdia_control_write(dev, reg, &buf, 1);
824 if (ret < 0)
825 goto err;
826 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
827 if (ret < 0)
828 goto err;
829 buf = 0x7a;
830 ret = usb_microdia_control_write(dev, reg, &buf, 1);
831 if (ret < 0)
832 goto err;
833 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
834 if (ret < 0)
835 goto err;
836 buf = 0x7b;
837 ret = usb_microdia_control_write(dev, reg, &buf, 1);
838 if (ret < 0)
839 goto err;
840 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
841 if (ret < 0)
842 goto err;
843 buf = 0xfc;
844 ret = usb_microdia_control_write(dev, reg, &buf, 1);
845 if (ret < 0)
846 goto err;
847 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
848 if (ret < 0)
849 goto err;
850 buf = 0x78;
851 ret = usb_microdia_control_write(dev, reg, &buf, 1);
852 if (ret < 0)
853 goto err;
854 /* <-- 0x11b8 */
855 reg = 0x10c0;
856 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
857 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
858 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 164..169 */
859 if (ret < 0)
860 goto err;
862 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
863 if (ret < 0)
864 goto err;
865 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
866 if (ret < 0)
867 goto err;
869 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
870 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
871 ret = usb_microdia_control_write(dev, reg, buf24, 8);
872 if (ret < 0)
873 goto err;
875 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
876 if (ret < 0)
877 goto err;
878 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
879 if (ret < 0)
880 goto err;
881 /* <-- 0x10c0 */
882 reg = 0x11ba;
883 buf = 0x0a;
884 ret = usb_microdia_control_write(dev, reg, &buf, 1);
885 if (ret < 0)
886 goto err;
888 buf = 0x00;
889 reg = 0x118c;
890 ret = usb_microdia_control_write(dev, reg, &buf, 1);
891 if (ret < 0)
892 goto err;
893 reg = 0x118d;
894 ret = usb_microdia_control_write(dev, reg, &buf, 1);
895 if (ret < 0)
896 goto err;
897 reg = 0x118e;
898 ret = usb_microdia_control_write(dev, reg, &buf, 1);
899 if (ret < 0)
900 goto err;
901 reg = 0x118f;
902 ret = usb_microdia_control_write(dev, reg, &buf, 1);
903 if (ret < 0)
904 goto err;
906 reg = 0x118b;
907 buf = 0x0a;
908 ret = usb_microdia_control_write(dev, reg, &buf, 1);
909 if (ret < 0)
910 goto err;
912 reg = 0x1190;
913 buf24[0] = 0x08; buf24[1] = 0x2e; buf24[2] = 0x55; buf24[3] = 0x6f;
914 buf24[4] = 0x7f; buf24[5] = 0x8d; buf24[6] = 0x9a; buf24[7] = 0xa6;
915 buf24[8] = 0xb1; buf24[9] = 0xbb; buf24[10] = 0xc5; buf24[11] = 0xce;
916 buf24[12] = 0xd7; buf24[13] = 0xdf; buf24[14] = 0xe8; buf24[15] = 0xef;
917 buf24[16] = 0xf7;
918 ret = usb_microdia_control_write(dev, reg, buf24, 17); /* URB 176 */
919 if (ret < 0)
920 goto err;
922 reg = 0x10e1;
923 for (i = 0; i < 21; i++) /* // zeroes */
924 buf24[i] = 0x00;
925 for (i = 177; i <= 184; i++) {
926 ret = usb_microdia_control_write(dev, reg, buf24, 21); /* URB 177..185 */
927 if (ret < 0)
928 goto err;
930 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* ..URB 185 */
931 if (ret < 0)
932 goto err;
934 reg = 0x10f7;
935 buf = 0x07;
936 ret = usb_microdia_control_write(dev, reg, &buf, 1);
937 if (ret < 0)
938 goto err;
939 reg = 0x10f6;
940 buf = 0x60;
941 ret = usb_microdia_control_write(dev, reg, &buf, 1);
942 if (ret < 0)
943 goto err;
945 reg = 0x10e1;
946 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 188 */
947 if (ret < 0)
948 goto err;
950 reg = 0x10f8;
951 buf = 0x14;
952 ret = usb_microdia_control_write(dev, reg, &buf, 1);
953 if (ret < 0)
954 goto err;
955 reg = 0x10fa;
956 buf = 0xff;
957 ret = usb_microdia_control_write(dev, reg, &buf, 1);
958 if (ret < 0)
959 goto err;
960 reg = 0x10f9;
961 buf = 0x00;
962 ret = usb_microdia_control_write(dev, reg, &buf, 1);
963 if (ret < 0)
964 goto err;
965 reg = 0x10f9;
966 ret = usb_microdia_control_write(dev, reg, &buf, 1);
967 if (ret < 0)
968 goto err;
970 reg = 0x11ba;
971 buf = 0x0a;
972 ret = usb_microdia_control_write(dev, reg, &buf, 1);
973 if (ret < 0)
974 goto err;
976 reg = 0x11bc;
977 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x00;
978 ret = usb_microdia_control_write(dev, reg, buf24, 4);
979 if (ret < 0)
980 goto err;
982 reg = 0x11c0;
983 for (i = 0; i < 48; i++)
984 buf64[i] = 0; /* // zeroes */
985 ret = usb_microdia_control_write(dev, reg, buf64, 48); /* URB 195 */
986 if (ret < 0)
987 goto err;
989 buf = 0x20;
990 reg = 0x118c;
991 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 196..199 */
992 if (ret < 0)
993 goto err;
994 reg = 0x118d;
995 ret = usb_microdia_control_write(dev, reg, &buf, 1);
996 if (ret < 0)
997 goto err;
998 reg = 0x118e;
999 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1000 if(ret < 0) goto err;
1001 reg = 0x118f;
1002 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1003 if (ret < 0)
1004 goto err;
1006 reg = 0x10c0;
1007 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1008 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1009 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 200 */
1010 if (ret < 0)
1011 goto err;
1013 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1014 if (ret < 0)
1015 goto err;
1016 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1017 if (ret < 0)
1018 goto err;
1020 reg = 0x1180;
1021 buf = 0x02;
1022 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1023 if (ret < 0)
1024 goto err;
1026 reg = 0x10c0;
1028 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1029 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1031 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 204..206 */
1032 if (ret < 0)
1033 goto err;
1035 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* << b0 */
1036 if (ret < 0)
1037 goto err;
1038 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1039 if (ret < 0)
1040 goto err;
1042 reg = 0x1182;
1043 buf = 0x02;
1044 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1045 if (ret < 0)
1046 goto err;
1048 reg = 0x10c0;
1049 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x03;
1050 buf24[4] = 0xe8; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1051 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 208..224 */
1052 if (ret < 0)
1053 goto err;
1055 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1056 if (ret < 0)
1057 goto err;
1058 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1059 if (ret < 0)
1060 goto err;
1062 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1063 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1064 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1065 if (ret < 0)
1066 goto err;
1068 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1069 if (ret < 0)
1070 goto err;
1071 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1072 if (ret < 0)
1073 goto err;
1075 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
1076 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1077 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 214 */
1078 if (ret < 0)
1079 goto err;
1081 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1082 if (ret < 0)
1083 goto err;
1084 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1085 if (ret < 0)
1086 goto err;
1088 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
1089 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1090 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1091 if (ret < 0)
1092 goto err;
1094 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1095 if (ret < 0)
1096 goto err;
1097 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1098 if (ret < 0)
1099 goto err;
1101 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
1102 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1103 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1104 if(ret < 0) goto err;
1106 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1107 if (ret < 0)
1108 goto err;
1110 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1111 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1112 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1113 if (ret < 0)
1114 goto err;
1116 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1117 if (ret < 0)
1118 goto err;
1119 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1120 if (ret < 0)
1121 goto err;
1123 buf = 0x20;
1124 reg = 0x118c;
1125 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 225..228 */
1126 if (ret < 0)
1127 goto err;
1128 reg = 0x118d;
1129 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1130 if (ret < 0)
1131 goto err;
1132 reg = 0x118e;
1133 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1134 if (ret < 0)
1135 goto err;
1136 reg = 0x118f;
1137 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1138 if (ret < 0)
1139 goto err;
1141 reg = 0x11a5;
1142 buf24[0] = 0x2d; buf24[1] = 0x2d; buf24[2] = 0x3a; buf24[3] = 0x05;
1143 buf24[4] = 0x04; buf24[5] = 0x3f;
1144 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1145 if (ret < 0)
1146 goto err;
1147 reg = 0x11af;
1148 buf24[0] = 0x28; buf24[1] = 0xd8; buf24[2] = 0x14; buf24[3] = 0xec;
1149 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1150 if (ret < 0)
1151 goto err;
1152 reg = 0x11b3;
1153 buf24[0] = 0x32; buf24[1] = 0xdd; buf24[2] = 0x2d; buf24[3] = 0xdd;
1154 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1155 if (ret < 0)
1156 goto err;
1158 reg = 0x10c0;
1159 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1160 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1161 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 232..242 */
1162 if (ret < 0)
1163 goto err;
1165 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1166 if (ret < 0)
1167 goto err;
1168 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1169 if (ret < 0)
1170 goto err;
1172 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2c; buf24[3] = 0x00;
1173 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x1d; buf24[7] = 0x10;
1174 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1175 if (ret < 0)
1176 goto err;
1178 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1179 if (ret < 0)
1180 goto err;
1181 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1182 if (ret < 0)
1183 goto err;
1185 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x30; buf24[3] = 0x00;
1186 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1187 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1188 if (ret < 0)
1189 goto err;
1191 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1192 if (ret < 0)
1193 goto err;
1195 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1196 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1197 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1198 if (ret < 0)
1199 goto err;
1201 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1202 if (ret < 0)
1203 goto err;
1204 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1205 if (ret < 0)
1206 goto err;
1208 reg = 0x118c;
1209 buf = 0x1f;
1210 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1211 if (ret < 0)
1212 goto err;
1213 reg = 0x118d;
1214 buf = 0x20;
1215 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1216 if (ret < 0)
1217 goto err;
1218 reg = 0x118e;
1219 buf = 0x20;
1220 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1221 if (ret < 0)
1222 goto err;
1223 reg = 0x118f;
1224 buf = 0x1f;
1225 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1226 if (ret < 0)
1227 goto err;
1229 reg = 0x10e0;
1230 buf = 0x07;
1231 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1232 if (ret < 0)
1233 goto err;
1234 buf = 0x27;
1235 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1236 if (ret < 0)
1237 goto err;
1239 reg = 0x1100;
1240 ret = usb_microdia_control_write(dev, reg, buf1100, 64); /* URB 249 (see also 509/510) */
1241 if (ret < 0)
1242 goto err;
1244 reg = 0x1140; /* 00000000: */
1245 buf64[0] = 0x0d; buf64[1] = 0x11; buf64[2] = 0x11; buf64[3] = 0x15;
1246 buf64[4] = 0x11; buf64[5] = 0x15; buf64[6] = 0x26; buf64[7] = 0x15;
1247 buf64[8] = 0x15; buf64[9] = 0x26; buf64[10] = 0x54; buf64[11] = 0x36;
1248 buf64[12] = 0x2e; buf64[13] = 0x36; buf64[14] = 0x54; buf64[15] = 0x54; /* 00000010: .. 00000030: 0x54 */
1249 for(i=16; i<=63; i++) buf64[i] = 0x54;
1250 ret = usb_microdia_control_write(dev, reg, buf64, 64); /* URB 250 */
1251 if (ret < 0)
1252 goto err;
1254 reg = 0x10e0;
1255 buf = 0x07;
1256 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1257 if (ret < 0)
1258 goto err;
1259 buf = 0x0b;
1260 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1261 if (ret < 0)
1262 goto err;
1264 reg = 0x1189;
1265 buf = 0x0c;
1266 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1267 if (ret < 0)
1268 goto err;
1270 buf = 0x00;
1271 reg = 0x11bc;
1272 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 254..257 */
1273 if (ret < 0)
1274 goto err;
1275 reg = 0x11bd;
1276 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1277 if (ret < 0)
1278 goto err;
1279 reg = 0x11be;
1280 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1281 if (ret < 0)
1282 goto err;
1283 reg = 0x11bf;
1284 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1285 if (ret < 0)
1286 goto err;
1288 reg = 0x1180;
1289 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
1290 buf24[4] = 0x28; buf24[5] = 0x3c;
1291 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1292 if (ret < 0)
1293 goto err;
1295 reg = 0x10fb;
1296 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1297 buf24[4] = 0x00;
1298 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1299 if (ret < 0)
1300 goto err;
1302 reg = 0x1189;
1303 buf = 0x0c;
1304 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1305 if (ret < 0)
1306 goto err;
1308 reg = 0x11a1;
1309 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
1310 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1311 if (ret < 0)
1312 goto err;
1313 reg = 0x11ab;
1314 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
1315 ret = usb_microdia_control_write(dev, reg, buf24, 4);
1316 if (ret < 0)
1317 goto err;
1319 reg = 0x1061;
1320 buf = 0x03;
1321 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1322 if (ret < 0)
1323 goto err;
1324 reg = 0x11ba;
1325 buf = 0x0a;
1326 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1327 if (ret < 0)
1328 goto err;
1329 reg = 0x11b9;
1330 buf = 0x00;
1331 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1332 if (ret < 0)
1333 goto err;
1334 reg = 0x11ba;
1335 buf = 0x0b;
1336 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1337 if (ret < 0)
1338 goto err;
1339 reg = 0x1061;
1340 buf = 0x01;
1341 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1342 if (ret < 0)
1343 goto err;
1344 reg = 0x1000;
1345 buf = 0x7c;
1346 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1347 if (ret < 0)
1348 goto err;
1349 reg = 0x1002;
1350 buf = 0x1c;
1351 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1352 if (ret < 0)
1353 goto err;
1354 buf = 0x1c;
1355 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1356 if (ret < 0)
1357 goto err;
1358 reg = 0x11b8;
1359 buf = 0x78;
1360 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1361 if (ret < 0)
1362 goto err;
1363 reg = 0x118a;
1364 buf = 0x05;
1365 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1366 if (ret < 0)
1367 goto err;
1368 reg = 0x0395;
1369 buf = 0x05;
1370 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1371 if (ret < 0)
1372 goto err;
1375 reg = 0x11b8;
1376 buf = 0x78;
1377 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 274..284 */
1378 if (ret < 0)
1379 goto err;
1380 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
1381 if (ret < 0)
1382 goto err;
1383 buf = 0x79;
1384 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1385 if (ret < 0)
1386 goto err;
1387 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
1388 if (ret < 0)
1389 goto err;
1390 buf = 0x7a;
1391 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1392 if (ret < 0)
1393 goto err;
1394 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
1395 if (ret < 0)
1396 goto err;
1397 buf = 0x7b;
1398 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1399 if (ret < 0)
1400 goto err;
1401 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
1402 if (ret < 0)
1403 goto err;
1404 buf = 0xfc;
1405 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1406 if (ret < 0)
1407 goto err;
1408 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
1409 if (ret < 0)
1410 goto err;
1411 buf = 0x78;
1412 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1413 if (ret < 0)
1414 goto err;
1415 /* // <-- 0x11b8 */
1416 reg = 0x10c0;
1417 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
1418 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1419 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 285..295 */
1420 if (ret < 0)
1421 goto err;
1423 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1424 if (ret < 0)
1425 goto err;
1426 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1427 if (ret < 0)
1428 goto err;
1430 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
1431 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1432 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1433 if (ret < 0)
1434 goto err;
1436 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1437 if (ret < 0)
1438 goto err;
1439 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1440 if (ret < 0)
1441 goto err;
1443 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
1444 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1445 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1446 if (ret < 0)
1447 goto err;
1449 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1450 if (ret < 0)
1451 goto err;
1453 buf24[0] = 0xa2; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
1454 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1455 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1456 if (ret < 0)
1457 goto err;
1459 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a2 */
1460 if (ret < 0)
1461 goto err;
1462 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a6 */
1463 if (ret < 0)
1464 goto err;
1465 /* // <-- 0x10c0 */
1466 reg = 0x10c2;
1467 ret = usb_microdia_control_read(dev, reg, buf24, 5); /* URB 296 // << 00 00 00 84 31 */
1468 if (ret < 0)
1469 goto err;
1471 reg = 0x1061;
1472 buf = 0x03;
1473 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1474 if (ret < 0)
1475 goto err;
1476 buf = 0x01;
1477 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1478 if (ret < 0)
1479 goto err;
1481 reg = 0x10c0;
1482 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1483 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1484 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1485 if (ret < 0)
1486 goto err;
1488 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1489 if (ret < 0)
1490 goto err;
1491 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1492 if (ret < 0)
1493 goto err;
1495 reg = 0x1000;
1496 buf = 0x3c;
1497 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1498 if (ret < 0)
1499 goto err;
1500 reg = 0x11b8;
1501 buf = 0x68;
1502 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1503 if (ret < 0)
1504 goto err;
1505 reg = 0x1007;
1506 buf = 0xa0;
1507 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1508 if (ret < 0)
1509 goto err;
1510 reg = 0x1006;
1511 buf = 0xa0;
1512 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1513 if (ret < 0)
1514 goto err;
1516 reg = 0x1000;
1517 buf24[0] = 0x98; buf24[1] = 0xef; buf24[2] = 0x11;
1518 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1519 if (ret < 0)
1520 goto err;
1522 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1523 // URB 307 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 0
1524 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1527 reg = 0x1066;
1528 buf = 0x00;
1529 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1530 if (ret < 0)
1531 goto err;
1533 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1534 // URB 310 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 8
1535 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1537 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 312 */
1538 if (ret < 0)
1539 goto err;
1541 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1542 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER:
1545 reg = 0x1007;
1546 buf = 0xa0;
1547 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 314 */
1548 if (ret < 0)
1549 goto err;
1550 reg = 0x1006;
1551 buf = 0x80;
1552 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1553 if (ret < 0)
1554 goto err;
1555 reg = 0x1000;
1556 buf = 0x78;
1557 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1558 if (ret < 0)
1559 goto err;
1560 reg = 0x1001;
1561 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << ef */
1562 if (ret < 0)
1563 goto err;
1564 buf = 0xc7;
1565 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1566 if (ret < 0)
1567 goto err;
1568 reg = 0x1002;
1569 buf = 0x18;
1570 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1571 if (ret < 0)
1572 goto err;
1574 reg = 0x1007;
1575 ret = usb_microdia_control_read(dev, reg, buf24, 7); /* URB 320 // << a0 00 ff 81 00 00 00 */
1576 if (ret < 0)
1577 goto err;
1578 reg = 0x1006;
1579 buf24[0] = 0x80; buf24[1] = 0xa0;
1580 ret = usb_microdia_control_write(dev, reg, buf24, 2);
1581 if (ret < 0)
1582 goto err;
1584 reg = 0x1061;
1585 buf = 0x01;
1586 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1587 if (ret < 0)
1588 goto err;
1589 reg = 0x1020;
1590 buf = 0x80;
1591 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1592 if (ret < 0)
1593 goto err;
1595 reg = 0x1067;
1596 buf24[0] = 0x40; buf24[1] = 0x30; buf24[2] = 0x20; buf24[3] = 0x10;
1597 buf24[4] = 0x08;
1598 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1599 if (ret < 0)
1600 goto err;
1602 reg = 0x10c0;
1603 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1604 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1605 buf24[8] = 0x03;
1606 ret = usb_microdia_control_write(dev, reg, buf24, 9);
1607 if (ret < 0)
1608 goto err;
1610 reg = 0x10e0;
1611 /* // 00000000: */
1612 buf24[0] = 0x45; buf24[1] = 0x18; buf24[2] = 0x00; buf24[3] = 0x30;
1613 buf24[4] = 0x00; buf24[5] = 0x09; buf24[6] = 0x00; buf24[7] = 0xed;
1614 buf24[8] = 0x0f; buf24[9] = 0xda; buf24[10] = 0x0f; buf24[11] = 0x3a;
1615 buf24[12] = 0x00; buf24[13] = 0x3a; buf24[14] = 0x00; buf24[15] = 0xd0;
1616 /* // 00000010: */
1617 buf24[16] = 0x0f; buf24[17] = 0xf7; buf24[18] = 0x0f; buf24[19] = 0x10;
1618 buf24[20] = 0x00; buf24[21] = 0x00; buf24[22] = 0x60; buf24[23] = 0x0a;
1619 ret = usb_microdia_control_write(dev, reg, buf24, 24); /* URB 326 */
1620 if (ret < 0)
1621 goto err;
1623 reg = 0x10f8;
1624 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00;
1625 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1626 if (ret < 0)
1627 goto err;
1629 reg = 0x10fb;
1630 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1631 buf24[4] = 0x00;
1632 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1633 if (ret < 0)
1634 goto err;
1636 reg = 0x1188;
1637 buf24[0] = 0x06; buf24[1] = 0x4c; buf24[2] = 0x08;
1638 ret = usb_microdia_control_write(dev, reg, buf24, 3);
1639 if (ret < 0)
1640 goto err;
1642 reg = 0x118b;
1643 /* // 00000000: */
1644 buf24[0] = 0x00; buf24[1] = 0x20; buf24[2] = 0x20; buf24[3] = 0x20;
1645 buf24[4] = 0x20; buf24[5] = 0x00; buf24[6] = 0x24; buf24[7] = 0x3b;
1646 buf24[8] = 0x4f; buf24[9] = 0x61; buf24[10] = 0x71; buf24[11] = 0x80;
1647 buf24[12] = 0x8f; buf24[13] = 0x9d; buf24[14] = 0xab; buf24[15] = 0xb8;
1648 /* // 00000010: */
1649 buf24[16] = 0xc4; buf24[17] = 0xd1; buf24[18] = 0xdd; buf24[19] = 0xe9;
1650 buf24[20] = 0xf4; buf24[21] = 0xff;
1651 ret = usb_microdia_control_write(dev, reg, buf24, 22); /* URB 330 */
1652 if (ret < 0)
1653 goto err;
1655 reg = 0x11a1;
1656 buf24[0] = 0x00; buf24[1] = 0x00;
1657 ret = usb_microdia_control_write(dev, reg, buf24, 2);
1658 if (ret < 0)
1659 goto err;
1661 reg = 0x11b7;
1662 buf24[0] = 0x60; buf24[1] = 0x28; buf24[2] = 0x00; buf24[3] = 0x08;
1663 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x00;
1664 buf24[8] = 0x00;
1665 ret = usb_microdia_control_write(dev, reg, buf24, 9);
1666 if (ret < 0)
1667 goto err;
1669 reg = 0x11b8;
1670 buf = 0x38;
1671 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1672 if (ret < 0)
1673 goto err;
1674 reg = 0x1000;
1675 buf = 0x78;
1676 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1677 if (ret < 0)
1678 goto err;
1680 reg = 0x10c0;
1681 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
1682 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1683 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 335..390 */
1684 if (ret < 0)
1685 goto err;
1687 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1688 if (ret < 0)
1689 goto err;
1690 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1691 if (ret < 0)
1692 goto err;
1694 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1695 buf24[4] = 0x01; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1696 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1697 if (ret < 0)
1698 goto err;
1700 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1701 if (ret < 0)
1702 goto err;
1703 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1704 if (ret < 0)
1705 goto err;
1707 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1708 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1709 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1710 if (ret < 0)
1711 goto err;
1713 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1714 if (ret < 0)
1715 goto err;
1716 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1717 if (ret < 0)
1718 goto err;
1720 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x01; buf24[3] = 0x00;
1721 buf24[4] = 0x0e; buf24[5] = 0x00; buf24[6] = 0x14; buf24[7] = 0x10;
1722 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 344 */
1723 if (ret < 0)
1724 goto err;
1726 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1727 if (ret < 0)
1728 goto err;
1729 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1730 if (ret < 0)
1731 goto err;
1733 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x03; buf24[3] = 0x03;
1734 buf24[4] = 0xc1; buf24[5] = 0x05; buf24[6] = 0x01; buf24[7] = 0x10;
1735 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1736 if (ret < 0)
1737 goto err;
1739 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1740 if (ret < 0)
1741 goto err;
1742 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1743 if (ret < 0)
1744 goto err;
1746 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
1747 buf24[4] = 0x83; buf24[5] = 0x00; buf24[6] = 0x06; buf24[7] = 0x10;
1748 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1749 if (ret < 0)
1750 goto err;
1752 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1753 if (ret < 0)
1754 goto err;
1755 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1756 if (ret < 0)
1757 goto err;
1759 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x0d; buf24[3] = 0x00;
1760 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1761 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1762 if (ret < 0)
1763 goto err;
1765 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1766 if (ret < 0)
1767 goto err;
1768 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1769 if (ret < 0)
1770 goto err;
1772 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x09; buf24[3] = 0x00;
1773 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1774 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 356 */
1775 if (ret < 0)
1776 goto err;
1778 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1779 if(ret < 0) goto err;
1780 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1781 if (ret < 0)
1782 goto err;
1784 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x0b; buf24[3] = 0x00;
1785 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1786 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1787 if (ret < 0)
1788 goto err;
1790 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1791 if (ret < 0)
1792 goto err;
1793 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1794 if (ret < 0)
1795 goto err;
1797 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x11; buf24[3] = 0x00;
1798 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1799 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1800 if (ret < 0)
1801 goto err;
1803 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1804 if (ret < 0)
1805 goto err;
1806 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1807 if (ret < 0)
1808 goto err;
1810 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x1e; buf24[3] = 0x80;
1811 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1812 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 365 */
1813 if (ret < 0)
1814 goto err;
1816 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1817 if (ret < 0)
1818 goto err;
1819 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1820 if (ret < 0)
1821 goto err;
1823 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1824 buf24[4] = 0x05; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1825 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1826 if (ret < 0)
1827 goto err;
1829 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1830 if (ret < 0)
1831 goto err;
1832 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1833 if (ret < 0)
1834 goto err;
1836 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
1837 buf24[4] = 0x08; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
1838 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1839 if (ret < 0)
1840 goto err;
1842 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1843 if (ret < 0)
1844 goto err;
1845 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1846 if (ret < 0)
1847 goto err;
1849 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
1850 buf24[4] = 0x14; buf24[5] = 0x00; buf24[6] = 0x08; buf24[7] = 0x10;
1851 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1852 if (ret < 0)
1853 goto err;
1855 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1856 if (ret < 0)
1857 goto err;
1858 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1859 if (ret < 0)
1860 goto err;
1862 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
1863 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1864 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 377 */
1865 if (ret < 0)
1866 goto err;
1868 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
1869 if (ret < 0)
1870 goto err;
1872 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x5f; buf24[3] = 0x89;
1873 buf24[4] = 0x04; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1874 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1875 if (ret < 0)
1876 goto err;
1878 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1879 if (ret < 0)
1880 goto err;
1881 ret = usb_microdia_control_read(dev, reg, &buf, 1); // << b4
1882 if (ret < 0)
1883 goto err;
1885 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x60; buf24[3] = 0x00;
1886 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1887 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1888 if (ret < 0)
1889 goto err;
1891 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1892 if (ret < 0)
1893 goto err;
1894 ret = usb_microdia_control_read(dev, reg, &buf, 1); // << d4
1895 if (ret < 0)
1896 goto err;
1898 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x62; buf24[3] = 0x04;
1899 buf24[4] = 0x98; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1900 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 385 */
1901 if (ret < 0)
1902 goto err;
1904 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
1905 if (ret < 0)
1906 goto err;
1907 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
1908 if (ret < 0)
1909 goto err;
1911 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x68; buf24[3] = 0x00;
1912 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1913 ret = usb_microdia_control_write(dev, reg, buf24, 8);
1914 if (ret < 0)
1915 goto err;
1917 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1918 if (ret < 0)
1919 goto err;
1920 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1921 if (ret < 0)
1922 goto err;
1923 /* // <-- 0x10c0 */
1924 reg = 0x10e0;
1925 buf = 0x47;
1926 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 391 */
1927 if (ret < 0)
1928 goto err;
1929 buf = 0x07;
1930 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1931 if (ret < 0)
1932 goto err;
1934 reg = 0x1001;
1935 buf = 0xc6;
1936 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1937 if (ret < 0)
1938 goto err;
1939 buf = 0xc4;
1940 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1941 if (ret < 0)
1942 goto err;
1943 buf = 0x44;
1944 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1945 if (ret < 0)
1946 goto err;
1948 reg = 0x1189;
1949 buf = 0x0c;
1950 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1951 if (ret < 0)
1952 goto err;
1954 buf = 0x00;
1955 reg = 0x11bc;
1956 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 397..400 */
1957 if (ret < 0)
1958 goto err;
1959 reg = 0x11bd;
1960 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1961 if (ret < 0)
1962 goto err;
1963 reg = 0x11be;
1964 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1965 if (ret < 0)
1966 goto err;
1967 reg = 0x11bf;
1968 ret = usb_microdia_control_write(dev, reg, &buf, 1);
1969 if (ret < 0)
1970 goto err;
1972 reg = 0x10c0;
1973 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
1974 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
1975 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 401 */
1976 if (ret < 0)
1977 goto err;
1979 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
1980 if (ret < 0)
1981 goto err;
1982 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
1983 if (ret < 0)
1984 goto err;
1986 reg = 0x1180;
1987 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
1988 buf24[4] = 0x28; buf24[5] = 0x3c;
1989 ret = usb_microdia_control_write(dev, reg, buf24, 6);
1990 if (ret < 0)
1991 goto err;
1992 reg = 0x10fb;
1993 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
1994 buf24[4] = 0x00;
1995 ret = usb_microdia_control_write(dev, reg, buf24, 5);
1996 if (ret < 0)
1997 goto err;
1999 reg = 0x1189;
2000 buf = 0x0c;
2001 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2002 if (ret < 0)
2003 goto err;
2005 reg = 0x11a1;
2006 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
2007 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2008 if (ret < 0)
2009 goto err;
2010 reg = 0x11ab;
2011 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
2012 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2013 if (ret < 0)
2014 goto err;
2016 reg = 0x1000;
2017 buf = 0x7c;
2018 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2019 if (ret < 0)
2020 goto err;
2022 reg = 0x1002;
2023 buf = 0x1c;
2024 for(i=410; i<=411; i++){
2025 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2026 if (ret < 0)
2027 goto err;
2030 reg = 0x11b8;
2031 buf = 0x38;
2032 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2033 if (ret < 0)
2034 goto err;
2035 reg = 0x118a;
2036 buf = 0x05;
2037 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2038 if (ret < 0)
2039 goto err;
2040 reg = 0x0395;
2041 buf = 0x05;
2042 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2043 if (ret < 0)
2044 goto err;
2046 reg = 0x11b8;
2047 buf = 0x78;
2048 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 415..425 */
2049 if (ret < 0)
2050 goto err;
2051 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
2052 if (ret < 0)
2053 goto err;
2054 buf = 0x79;
2055 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2056 if (ret < 0)
2057 goto err;
2058 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
2059 if (ret < 0)
2060 goto err;
2061 buf = 0x7a;
2062 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2063 if (ret < 0)
2064 goto err;
2065 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
2066 if (ret < 0)
2067 goto err;
2068 buf = 0x7b;
2069 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2070 if (ret < 0)
2071 goto err;
2072 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
2073 if (ret < 0)
2074 goto err;
2075 buf = 0xfc;
2076 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2077 if (ret < 0)
2078 goto err;
2079 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
2080 if (ret < 0)
2081 goto err;
2082 buf = 0x78;
2083 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2084 if (ret < 0)
2085 goto err;
2086 /* // <-- 0x11b8 */
2087 reg = 0x10c0;
2089 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
2090 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2091 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 426..431 */
2092 if (ret < 0)
2093 goto err;
2095 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2096 if (ret < 0)
2097 goto err;
2098 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2099 if (ret < 0)
2100 goto err;
2102 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
2103 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2104 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2105 if (ret < 0)
2106 goto err;
2108 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2109 if (ret < 0)
2110 goto err;
2111 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2112 if (ret < 0)
2113 goto err;
2114 /* // <-- 0x10c0 */
2115 reg = 0x11ba;
2116 buf = 0x0a;
2117 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2118 if (ret < 0)
2119 goto err;
2120 reg = 0x118c;
2121 buf = 0x1f;
2122 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2123 if (ret < 0)
2124 goto err;
2125 reg = 0x118d;
2126 buf = 0x20;
2127 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2128 if (ret < 0)
2129 goto err;
2130 reg = 0x118e;
2131 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2132 if (ret < 0)
2133 goto err;
2134 reg = 0x118f;
2135 buf = 0x1f;
2136 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2137 if (ret < 0)
2138 goto err;
2139 reg = 0x118b;
2140 buf = 0x0a;
2141 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2142 if (ret < 0)
2143 goto err;
2145 reg = 0x1190;
2146 buf24[0] = 0x08; buf24[1] = 0x2e; buf24[2] = 0x55; buf24[3] = 0x6f;
2147 buf24[4] = 0x7f; buf24[5] = 0x8d; buf24[6] = 0x9a; buf24[7] = 0xa6;
2148 buf24[8] = 0xb1; buf24[9] = 0xbb; buf24[10] = 0xc5; buf24[11] = 0xce;
2149 buf24[12] = 0xd7; buf24[13] = 0xdf; buf24[14] = 0xe8; buf24[15] = 0xef;
2150 buf24[16] = 0xf7;
2151 ret = usb_microdia_control_write(dev, reg, buf24, 17); /* URB 438 */
2152 if (ret < 0)
2153 goto err;
2155 reg = 0x10e1;
2156 for(i=439; i<=447; i++){
2157 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 439..447 */
2158 if (ret < 0)
2159 goto err;
2162 reg = 0x10f7;
2163 buf = 0x07;
2164 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2165 if (ret < 0)
2166 goto err;
2167 reg = 0x10f6;
2168 buf = 0x60;
2169 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2170 if (ret < 0)
2171 goto err;
2173 reg = 0x10e1;
2174 ret = usb_microdia_control_write(dev, reg, buf10e1, 21); /* URB 450 */
2175 if (ret < 0)
2176 goto err;
2178 reg = 0x10f8;
2179 buf = 0x14;
2180 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2181 if (ret < 0)
2182 goto err;
2183 reg = 0x10fa;
2184 buf = 0xff;
2185 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2186 if (ret < 0)
2187 goto err;
2189 reg = 0x10f9;
2190 buf = 0x00;
2191 for(i=453; i<454; i++){
2192 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2193 if (ret < 0)
2194 goto err;
2197 reg = 0x11ba;
2198 buf = 0x0a;
2199 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2200 if (ret < 0)
2201 goto err;
2203 reg = 0x11bc;
2204 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x00;
2205 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2206 if (ret < 0)
2207 goto err;
2209 reg = 0x11c0;
2210 for (i = 0; i < 48; i++)
2211 buf64[i] = 0; /* // zeroes */
2212 ret = usb_microdia_control_write(dev, reg, buf64, 48); /* URB 457 */
2213 if (ret < 0)
2214 goto err;
2216 buf = 0x20;
2217 reg = 0x118c;
2218 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 458..461 */
2219 if (ret < 0)
2220 goto err;
2221 reg = 0x118d;
2222 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2223 if (ret < 0)
2224 goto err;
2225 reg = 0x118e;
2226 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2227 if (ret < 0)
2228 goto err;
2229 reg = 0x118f;
2230 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2231 if (ret < 0)
2232 goto err;
2234 reg = 0x10c0;
2235 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
2236 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2237 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 462 */
2238 if (ret < 0)
2239 goto err;
2241 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2242 if (ret < 0)
2243 goto err;
2244 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2245 if (ret < 0)
2246 goto err;
2248 reg = 0x1180;
2249 buf = 0x02;
2250 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2251 if (ret < 0)
2252 goto err;
2254 reg = 0x10c0;
2255 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x20; buf24[3] = 0x11;
2256 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2257 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 466 */
2258 if (ret < 0)
2259 goto err;
2261 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2262 if (ret < 0)
2263 goto err;
2264 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2265 if (ret < 0)
2266 goto err;
2268 reg = 0x1182;
2269 buf = 0x02;
2270 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2271 if (ret < 0)
2272 goto err;
2274 reg = 0x10c0;
2275 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2276 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2277 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 470..483 */
2278 if (ret < 0)
2279 goto err;
2281 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2282 if (ret < 0)
2283 goto err;
2284 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2285 if (ret < 0)
2286 goto err;
2288 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2b; buf24[3] = 0x00;
2289 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
2290 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2291 if (ret < 0)
2292 goto err;
2294 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
2295 if (ret < 0)
2296 goto err;
2297 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2298 if (ret < 0)
2299 goto err;
2301 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2d; buf24[3] = 0x00;
2302 buf24[4] = 0x10; buf24[5] = 0x00; buf24[6] = 0x10; buf24[7] = 0x10;
2303 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2304 if (ret < 0)
2305 goto err;
2307 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d0 */
2308 if (ret < 0)
2309 goto err;
2310 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2311 if (ret < 0)
2312 goto err;
2314 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x33; buf24[3] = 0x00;
2315 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2316 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 479 */
2317 if (ret < 0)
2318 goto err;
2320 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2321 if (ret < 0)
2322 goto err;
2324 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2325 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2326 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2327 if (ret < 0)
2328 goto err;
2330 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2331 if (ret < 0)
2332 goto err;
2333 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2334 if (ret < 0)
2335 goto err;
2336 /* // <-- 0x10c0 */
2337 buf = 0x20;
2338 reg = 0x118c;
2339 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 484..487 */
2340 if (ret < 0)
2341 goto err;
2342 reg = 0x118d;
2343 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2344 if (ret < 0)
2345 goto err;
2346 reg = 0x118e;
2347 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2348 if (ret < 0)
2349 goto err;
2350 reg = 0x118f;
2351 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2352 if (ret < 0)
2353 goto err;
2355 reg = 0x11a5;
2356 buf24[0] = 0x2d; buf24[1] = 0x2d; buf24[2] = 0x3a; buf24[3] = 0x05;
2357 buf24[4] = 0x04; buf24[5] = 0x3f;
2358 ret = usb_microdia_control_write(dev, reg, buf24, 6);
2359 if (ret < 0)
2360 goto err;
2361 reg = 0x11af;
2362 buf24[0] = 0x28; buf24[1] = 0xd8; buf24[2] = 0x14; buf24[3] = 0xec;
2363 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2364 if (ret < 0)
2365 goto err;
2366 reg = 0x11b3;
2367 buf24[0] = 0x32; buf24[1] = 0xdd; buf24[2] = 0x2d; buf24[3] = 0xdd;
2368 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2369 if (ret < 0)
2370 goto err;
2372 reg = 0x10c0;
2373 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2374 buf24[4] = 0x03; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2375 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 491..502 */
2376 if (ret < 0)
2377 goto err;
2379 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2380 if (ret < 0)
2381 goto err;
2382 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2383 if (ret < 0)
2384 goto err;
2386 buf24[0] = 0xd0; buf24[1] = 0x5d; buf24[2] = 0x2c; buf24[3] = 0x00;
2387 buf24[4] = 0x1d; buf24[5] = 0x00; buf24[6] = 0x1d; buf24[7] = 0x10;
2388 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2389 if (ret < 0)
2390 goto err;
2392 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 495: d0 */
2393 if (ret < 0)
2394 goto err;
2395 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 496: d0 */
2396 if (ret < 0)
2397 goto err;
2398 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << d4 */
2399 if (ret < 0)
2400 goto err;
2402 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x30; buf24[3] = 0x00;
2403 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2404 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2405 if (ret < 0)
2406 goto err;
2408 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2409 if (ret < 0)
2410 goto err;
2412 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x07; buf24[3] = 0x00;
2413 buf24[4] = 0x02; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2414 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2415 if (ret < 0)
2416 goto err;
2418 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2419 if (ret < 0)
2420 goto err;
2421 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2422 if (ret < 0)
2423 goto err;
2424 /* // <-- 0x10c0 */
2425 reg = 0x118c;
2426 buf = 0x1f;
2427 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2428 if (ret < 0)
2429 goto err;
2430 reg = 0x118d;
2431 buf = 0x20;
2432 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2433 if (ret < 0)
2434 goto err;
2435 reg = 0x118e;
2436 buf = 0x20;
2437 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2438 if (ret < 0)
2439 goto err;
2440 reg = 0x118f;
2441 buf = 0x1f;
2442 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2443 if (ret < 0)
2444 goto err;
2446 reg = 0x10e0;
2447 buf = 0x07;
2448 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2449 if (ret < 0)
2450 goto err;
2451 buf = 0x27;
2452 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2453 if (ret < 0)
2454 goto err;
2456 reg = 0x1100;
2457 ret = usb_microdia_control_write(dev, reg, buf1100, 64); /* URB 509 (see also 249/250) */
2458 if (ret < 0)
2459 goto err;
2461 reg = 0x1140;
2462 /* // 00000000: */
2463 buf64[0] = 0x0d; buf64[1] = 0x11; buf64[2] = 0x11; buf64[3] = 0x15;
2464 buf64[4] = 0x11; buf64[5] = 0x15; buf64[6] = 0x26; buf64[7] = 0x15;
2465 buf64[8] = 0x15; buf64[9] = 0x26; buf64[10] = 0x54; buf64[11] = 0x36;
2466 buf64[12] = 0x2e; buf64[13] = 0x36; buf64[14] = 0x54; buf64[15] = 0x54;
2467 /* // 00000010: .. 00000030: 0x54 */
2468 for(i=16; i<=63; i++) buf64[i] = 0x54;
2469 ret = usb_microdia_control_write(dev, reg, buf64, 64); /* URB 510 */
2470 if (ret < 0)
2471 goto err;
2473 reg = 0x10e0;
2474 buf = 0x07;
2475 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2476 if (ret < 0)
2477 goto err;
2478 buf = 0x0b;
2479 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2480 if (ret < 0)
2481 goto err;
2483 reg = 0x1189;
2484 buf = 0x0c;
2485 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2486 if (ret < 0)
2487 goto err;
2489 buf = 0x00;
2490 reg = 0x11bc;
2491 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 514..517 */
2492 if (ret < 0)
2493 goto err;
2494 reg = 0x11bd;
2495 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2496 if (ret < 0)
2497 goto err;
2498 reg = 0x11be;
2499 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2500 if (ret < 0)
2501 goto err;
2502 reg = 0x11bf;
2503 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2504 if (ret < 0)
2505 goto err;
2507 reg = 0x1180;
2508 buf24[0] = 0x02; buf24[1] = 0x00; buf24[2] = 0x02; buf24[3] = 0x00;
2509 buf24[4] = 0x28; buf24[5] = 0x3c;
2510 ret = usb_microdia_control_write(dev, reg, buf24, 6);
2512 reg = 0x10fb;
2513 buf24[0] = 0x00; buf24[1] = 0xa0; buf24[2] = 0x00; buf24[3] = 0xf0;
2514 buf24[4] = 0x00;
2515 ret = usb_microdia_control_write(dev, reg, buf24, 5);
2517 reg = 0x1189;
2518 buf = 0x0c;
2519 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2520 if (ret < 0)
2521 goto err;
2523 reg = 0x11a1;
2524 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x6a; buf24[3] = 0x50;
2525 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2527 reg = 0x11ab;
2528 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x50; buf24[3] = 0x3c;
2529 ret = usb_microdia_control_write(dev, reg, buf24, 4);
2531 reg = 0x1061;
2532 buf = 0x03;
2533 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2534 if (ret < 0)
2535 goto err;
2536 reg = 0x11ba;
2537 buf = 0x0a;
2538 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2539 if (ret < 0)
2540 goto err;
2541 reg = 0x11b9;
2542 buf = 0x00;
2543 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2544 if (ret < 0)
2545 goto err;
2546 reg = 0x11ba;
2547 buf = 0x0b;
2548 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2549 if (ret < 0)
2550 goto err;
2551 reg = 0x1061;
2552 buf = 0x01;
2553 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2554 if (ret < 0)
2555 goto err;
2556 reg = 0x1000;
2557 buf = 0x7c;
2558 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2559 if (ret < 0)
2560 goto err;
2562 reg = 0x1002;
2563 buf = 0x1c;
2564 for(i=529; i<=530; i++){
2565 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2566 if (ret < 0)
2567 goto err;
2570 reg = 0x11b8;
2571 buf = 0x78;
2572 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2573 if (ret < 0)
2574 goto err;
2575 reg = 0x118a;
2576 buf = 0x05;
2577 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2578 if (ret < 0)
2579 goto err;
2580 reg = 0x0395;
2581 buf = 0x05;
2582 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2583 if (ret < 0)
2584 goto err;
2586 reg = 0x11b8;
2587 buf = 0x78;
2588 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 534..544 */
2589 if (ret < 0)
2590 goto err;
2591 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 38 */
2592 if (ret < 0)
2593 goto err;
2594 buf = 0x79;
2595 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2596 if (ret < 0)
2597 goto err;
2598 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 39 */
2599 if (ret < 0)
2600 goto err;
2601 buf = 0x7a;
2602 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2603 if (ret < 0)
2604 goto err;
2605 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3a */
2606 if (ret < 0)
2607 goto err;
2608 buf = 0x7b;
2609 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2610 if (ret < 0)
2611 goto err;
2612 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << bb */
2613 if (ret < 0)
2614 goto err;
2615 buf = 0xfc;
2616 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2617 if (ret < 0)
2618 goto err;
2619 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 3c */
2620 if (ret < 0)
2621 goto err;
2622 buf = 0x78;
2623 ret = usb_microdia_control_write(dev, reg, &buf, 1);
2624 if (ret < 0)
2625 goto err;
2626 /* // <-- 0x11b8 */
2627 reg = 0x10c0;
2628 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x06; buf24[3] = 0x00;
2629 buf24[4] = 0xf2; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2630 ret = usb_microdia_control_write(dev, reg, buf24, 8); /* URB 545..555 */
2631 if (ret < 0)
2632 goto err;
2634 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2635 if (ret < 0)
2636 goto err;
2637 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2638 if (ret < 0)
2639 goto err;
2641 buf24[0] = 0xb0; buf24[1] = 0x5d; buf24[2] = 0x05; buf24[3] = 0x00;
2642 buf24[4] = 0x13; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2643 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2644 if (ret < 0)
2645 goto err;
2647 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b0 */
2648 if (ret < 0)
2649 goto err;
2650 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << b4 */
2651 if (ret < 0)
2652 goto err;
2654 buf24[0] = 0x90; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
2655 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2656 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2657 if (ret < 0)
2658 goto err;
2660 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << 94 */
2661 if (ret < 0)
2662 goto err;
2664 buf24[0] = 0xa2; buf24[1] = 0x5d; buf24[2] = 0x00; buf24[3] = 0x00;
2665 buf24[4] = 0x00; buf24[5] = 0x00; buf24[6] = 0x00; buf24[7] = 0x10;
2666 ret = usb_microdia_control_write(dev, reg, buf24, 8);
2667 if (ret < 0)
2668 goto err;
2670 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a2 */
2671 if (ret < 0)
2672 goto err;
2673 ret = usb_microdia_control_read(dev, reg, &buf, 1); /* // << a6 */
2674 if (ret < 0)
2675 goto err;
2676 /* // <-- 0x10c0 */
2677 reg = 0x10c2;
2678 buf24[0] = 0x00; buf24[1] = 0x00; buf24[2] = 0x00; buf24[3] = 0x84;
2679 buf24[4] = 0x31;
2680 ret = usb_microdia_control_write(dev, reg, buf24, 5);
2681 if (ret < 0)
2682 goto err;
2684 reg = 0x1061;
2685 buf = 0x03;
2686 ret = usb_microdia_control_write(dev, reg, &buf, 1); /* URB 557 */
2687 if (ret < 0)
2688 goto err;
2690 /* UNKNOWN -- URB_FUNCTION_RESET_PIPE:
2691 // UNKNOWN -- URB_FUNCTION_RESET_PIPE:
2692 // UNKNOWN -- URB_FUNCTION_GET_CURRENT_FRAME_NUMBER:
2693 // UNKNOWN -- URB_FUNCTION_GET_CURRENT_FRAME_NUMBER:
2694 // URB 560 >>> SENDING ISO REQUEST
2696 UDIA_INFO("...start function completed without errors.\n");
2697 return ret;
2698 err:
2699 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
2700 return ret;
2704 * @brief From stop-close-amcap.log
2706 * @param dev
2708 * @returns 0
2710 * @author psnel
2712 * For SN9C201 with MI1300. Comments from parser-usbsnoop(updated_13Mar2008).pl output
2715 int microdia_6240_stop_stream(struct usb_microdia *dev)
2717 int ret=0;
2718 __u8 buf[8];
2720 UDIA_INFO("Stopping camera...\n");
2722 buf[0]=0x01;
2723 ret = usb_microdia_control_write(dev, 0x1061, buf, 1); /* URB 25319 */
2724 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2726 buf[0]=0xb0; buf[1]=0x5d; buf[2]=0x07; buf[3]=0x00;
2727 buf[4]=0x00; buf[5]=0x00; buf[6]=0x00; buf[7]=0x10;
2728 ret += usb_microdia_control_write(dev, 0x10c0, buf, 8); /* URB 25320 */
2729 UDIA_INFO("...stop: write buf[8], ret = %d\n",ret);
2731 ret += usb_microdia_control_read(dev, 0x10c0, buf, 1); /* URB 25321 << b0 */
2732 UDIA_INFO("...stop: read %x, ret = %d\n",buf[0],ret);
2734 ret += usb_microdia_control_read(dev, 0x10c0, buf, 1); /* URB 25322 << b4 */
2735 UDIA_INFO("...stop: read %x, ret = %d\n",buf[0],ret);
2737 buf[0]=0x3c;
2738 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); /* URB 25323 */
2739 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2741 buf[0]=0x68;
2742 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); /* URB 25324 */
2743 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2745 buf[0]=0xa0;
2746 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); /* URB 25325 */
2747 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2749 buf[0]=0xa0;
2750 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); /* URB 25326 */
2751 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2753 buf[0]=0x98; buf[1]=0xef; buf[2]=0x11;
2754 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); /* URB 25327 */
2755 UDIA_INFO("...stop: write buf[3], ret = %d\n",ret);
2757 /* UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: (URB 5009)
2758 // URB 25328 <<< GETTING SELECT_INTERFACE Interface: AlternateSetting = 0
2759 // UNKNOWN -- URB_FUNCTION_BULK_OR_INTERRUPT_TRANSFER: (URB 25329)
2762 buf[0]=0x00;
2763 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); /* URB 25330 */
2764 UDIA_INFO("...stop: write %x, ret = %d\n",buf[0],ret);
2766 if (ret < 19) {
2767 UDIA_ERROR("One ore more errors occured during stop sequence !\n");
2768 return -1;
2771 return 0;
2775 * @brief From init.sequence.log
2777 * @param dev
2779 * @returns 0
2781 * @author GWater
2783 * For SN9C201 with SOI968.
2784 * Tests showed this function is actually unnecessary.
2785 * Nevertheless the reads may give us valuable values we don't know about yet.
2787 int microdia_624e_initialize(struct usb_microdia *dev)
2789 __u8 buf;
2791 usb_microdia_control_read(dev, 0x130d, &buf, 1);
2792 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2794 return 0;
2797 /**
2798 * @brief From UsbSnoop-plugin-parsed.log
2800 * @param dev
2802 * @returns
2804 int microdia_624f_initialize(struct usb_microdia *dev)
2806 /* Do nothing here */
2807 return 0;
2811 * @brief From UsbSnoop-plugin-parsed.log
2813 * @param dev
2815 * @returns
2817 int microdia_6260_initialize(struct usb_microdia *dev)
2819 __u8 buf;
2821 usb_microdia_control_read(dev, 0x130d, &buf, 1);
2822 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2823 buf = 0x00;
2824 usb_microdia_control_write(dev, 0x10c8, &buf, 1);
2825 usb_microdia_control_read(dev, 0x100a, &buf, 1);
2826 buf = 0x04;
2827 usb_microdia_control_write(dev, 0x100a, &buf, 1);
2828 usb_microdia_control_read(dev, 0x100b, &buf, 1);
2829 buf = 0x04;
2830 usb_microdia_control_write(dev, 0x100b, &buf, 1);
2831 usb_microdia_control_read(dev, 0x1001, &buf, 1);
2832 buf = 0xc7;
2833 usb_microdia_control_write(dev, 0x1001, &buf, 1);
2834 usb_microdia_control_read(dev, 0x1040, &buf, 1);
2835 buf = 0x00;
2836 usb_microdia_control_write(dev, 0x1040, &buf, 1);
2837 usb_microdia_control_read(dev, 0x1045, &buf, 1);
2838 buf = 0x04;
2839 usb_microdia_control_write(dev, 0x1045, &buf, 1);
2840 usb_microdia_control_read(dev, 0x1046, &buf, 1);
2841 buf = 0x10;
2842 usb_microdia_control_write(dev, 0x1046, &buf, 1);
2843 buf = 0x14;
2844 usb_microdia_control_write(dev, 0x1045, &buf, 1);
2845 buf = 0x01;
2846 usb_microdia_control_write(dev, 0x1040, &buf, 1);
2847 buf = 0x80;
2848 usb_microdia_control_write(dev, 0x1020, &buf, 1);
2850 return 0;
2854 * @brief From 6 init-logs
2856 * @param dev
2858 * @returns 0 (ok) or -1 (error)
2860 * @author Comer352l
2862 * Windows driver versions: 5.5.8.12 and 5.7.23.000
2863 * Windows versions: 2000 and XP
2864 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
2866 * Comments behind read oprations contain HEX-values that appeared in the logs
2868 int microdia_6270_initialize(struct usb_microdia *dev)
2870 //int actual;
2871 int ret = 0;
2872 int retSP = 0;
2873 int retASS = 0;
2874 __u8 buf[8];
2875 __u8 buf_0395[1];
2876 __u8 buf_1000[5];
2877 __u8 buf_1060[2];
2878 __u8 buf_11b8[1];
2880 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); // URB 5 0x81,0x85,0x04,0x8b,0x02,...
2882 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); // URB 6 0xe4,0xc4,0xa4,0x44,...
2885 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
2886 * buf[0]=0x00;
2887 * usb_microdia_control_write(dev, 0x10c8, buf, 1);
2890 ret += usb_microdia_control_read(dev, 0x118a, buf, 1); // URB 7 0x05,0x7b,0x01,0x04,...
2892 ret += usb_microdia_control_read(dev, 0x0395, buf_0395, 1); // URB 8 0xc2,0x82,0x38,0x98,0x04,...
2893 // => this value will be rewritten to 0x118a and 0x0395 later (URBs 81+82)
2895 buf[0] = 0x05;
2896 ret += usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 9
2898 ret += usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 10
2900 ret += usb_microdia_control_read(dev, 0x11b8, buf_11b8, 1); // URB 11 0xa0,0x00,0x24,...
2901 // => this value will be rewritten to 0x11b8 later (URB 83)
2903 buf[0] = 0x10;
2904 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 12
2906 ret += usb_microdia_control_read(dev, 0x1000, buf_1000, 5); // URB 13 0x30 0xCF 0x00 0x03 (0x02 or 0x00)
2907 // => these values will be rewritten to 0x1000 later (URB 84)
2909 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
2910 ret += usb_microdia_control_write(dev, 0x1000, buf, 5); // URB 14
2912 ret += usb_microdia_control_read(dev, 0x1060, buf_1060, 2); // URB 15 0x08 0x00 (always ???)
2913 // => this value will be rewritten to 0x1060 later (URB 85)
2915 buf[0] = 0x00; buf[1] = 0x03;
2916 ret += usb_microdia_control_write(dev, 0x1060, buf, 2); // URB 16
2918 // initialize I2C registers to avoid getting no ACK at first I2C operation:
2919 ret += sn9c20x_initialize_i2c(dev, SN9C20X_I2C_2WIRE, MT9V011_I2C_SLAVE_ADDRESS);
2921 // enable I2C communication (bit 0)
2922 buf[0] = 0x21; // THE OLD DRIVER 5.5.8.12 WRITES 0x5d
2923 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); // URB 17
2925 // probe sensor model:
2926 retSP = mt9vx11_sensor_probe(dev); // substitutes URBs 18-48
2927 if ((retSP == 0) && (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS))
2928 // switch (back) to IFP address space:
2929 retASS = mt9v111_select_address_space(dev, MT9V111_ADDRESSSPACE_IFP);
2931 ret += usb_microdia_control_write(dev, 0x118a, buf_0395, 1); // URB 81 => write value read with URB 8
2933 ret += usb_microdia_control_write(dev, 0x0395, buf_0395, 1); // URB 82 => write value read with URB 8
2935 ret += usb_microdia_control_write(dev, 0x11b8, buf_11b8, 1); // URB 83 => write value read with URB 11
2937 ret += usb_microdia_control_write(dev, 0x1000, buf_1000, 5); // URB 84 => write value read with URB 13
2939 ret += usb_microdia_control_write(dev, 0x1060, buf_1060, 2); // URB 85 => write value read with URB 15; (always 08 00 ???)
2941 // USB-interrupt-message: doesn't work yet (returns error -110)
2942 //usb_interrupt_msg(dev->udev, usb_rcvintpipe(dev->udev, dev->int_in_endpointAddr), dev->int_in_buffer, dev->int_in_size, &actual, 1000); // URB 86
2945 * THE OLD DRIVER 5.5.8.12 DOES AN ADDITIONAL WRITE HERE:
2946 * wbuf[0]=0x80;
2947 * usb_microdia_control_write(dev, 0x1020, wbuf, 1);
2950 if ((retSP != 0) || (retASS != 0) || (ret < 33))
2952 if (ret < 33)
2953 UDIA_INFO("One ore more errors occured during initialization !\n");
2954 return -1;
2956 else
2957 return 0;
2960 /**
2961 * @brief From UsbSnoop-plugin-parsed.log
2963 * @param dev
2965 * @returns
2967 int microdia_627b_initialize(struct usb_microdia *dev)
2969 /*int actual;*/
2970 int ret;
2971 int retI2C;
2972 __u16 reg;
2973 __u8 buf[32];
2974 __u8 reg0395[1];
2975 __u8 reg11b8[1];
2976 __u8 reg1000[5];
2977 __u8 reg1060[2];
2979 reg = 0x130d;
2980 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 5 */
2981 if (ret < 0)
2982 goto err;
2983 reg = 0x1040;
2984 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 6 */
2985 if (ret < 0)
2986 goto err;
2988 reg = 0x118a;
2989 ret = usb_microdia_control_read(dev, reg, buf, 1); /* URB 7 */
2990 if (ret < 0)
2991 goto err;
2992 reg = 0x0395;
2993 ret = usb_microdia_control_read(dev, reg, reg0395, 1); /* URB 8 */
2994 if (ret < 0)
2995 goto err;
2997 reg = 0x118a;
2998 buf[0] = 0x05;
2999 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 9 */
3000 if (ret < 0)
3001 goto err;
3002 reg = 0x0395;
3003 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 10 */
3004 if (ret < 0)
3005 goto err;
3007 reg = 0x11b8;
3008 ret = usb_microdia_control_read(dev, reg, reg11b8, 1); /* URB 11 */
3009 if (ret < 0)
3010 goto err;
3012 reg = 0x11b8;
3013 buf[0] = 0x10;
3014 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 12 */
3015 if (ret < 0)
3016 goto err;
3017 reg = 0x1000;
3018 ret = usb_microdia_control_read(dev, reg, reg1000, 5); /* URB 13 */
3019 if (ret < 0)
3020 goto err;
3022 reg = 0x1000;
3023 buf[0] = 0x70; buf[1] = 0x00; buf[2] = 0x18; buf[3] = 0x00; buf[4] = 0x00;
3024 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 14 */
3025 if (ret < 0)
3026 goto err;
3028 reg = 0x1060;
3029 ret = usb_microdia_control_read(dev, reg, reg1060, 2); /* URB 15 */
3030 if (ret < 0)
3031 goto err;
3033 reg = 0x1060;
3034 buf[0] = 0x00; buf[1] = 0x03;
3035 ret = usb_microdia_control_write(dev, reg, buf, 2); /* URB 16 */
3036 if (ret < 0)
3037 goto err;
3039 reg = 0x10c8;
3040 buf[0] = 0x21;
3041 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 17 */
3042 if (ret < 0)
3043 goto err;
3045 retI2C = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
3046 OV7660_CTL_PID, dev->sensor_flags, buf); /* URBs 18-29 */
3047 if (retI2C < 0) {
3048 /* 2nd try... */
3049 reg = 0x10c8;
3050 buf[0] = 0x21;
3051 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 30 */
3052 if (ret < 0)
3053 goto err;
3055 retI2C = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
3056 OV7660_CTL_PID, dev->sensor_flags, buf); /* URBs 31-35 */
3058 if (retI2C < 0)
3059 UDIA_ERROR("Read of sensor register 0x0a failed.");
3061 reg = 0x118a;
3062 buf[0] = 0xa6;
3063 ret = usb_microdia_control_write(dev, reg, reg0395, 1); /* URB 36 */
3064 if (ret < 0)
3065 goto err;
3066 reg = 0x0395;
3067 ret = usb_microdia_control_write(dev, reg, reg0395, 1); /* URB 37 */
3068 if (ret < 0)
3069 goto err;
3071 reg = 0x11b8;
3072 buf[0] = 0x06;
3073 ret = usb_microdia_control_write(dev, reg, reg11b8, 1); /* URB 38 */
3074 if (ret < 0)
3075 goto err;
3077 reg = 0x1000;
3078 buf[0] = 0x30; buf[1] = 0xcf; buf[2] = 0x00; buf[3] = 0x03; buf[4] = 0x02;
3079 ret = usb_microdia_control_write(dev, reg, reg1000, 5); /* URB 39 */
3080 if (ret < 0)
3081 goto err;
3083 reg = 0x1060;
3084 buf[0] = 0x08; buf[1] = 0x00;
3085 ret = usb_microdia_control_write(dev, reg, reg1060, 2); /* URB 40 */
3086 if (ret < 0)
3087 goto err;
3090 //URB 41
3091 ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000);
3094 return ret;
3095 err:
3096 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
3097 return ret;
3101 * @brief From init-start-stop-log (made by Víctor M. Hernández Rocamora)
3103 * @param dev
3105 * @returns 0 (ok) or -1 (error)
3107 * @author Comer352l
3109 * USB-Logger: SniffUSB 2.0
3111 * Comments behind read oprations contain HEX-values that appeared in the log
3113 int microdia_627f_initialize(struct usb_microdia *dev)
3115 __u8 buf[1];
3116 int ret = 0;
3118 ret += usb_microdia_control_read(dev, 0x130d, buf, 1); // URB 5 0x81
3120 ret += usb_microdia_control_read(dev, 0x1040, buf, 1); // URB 6 0xe4
3122 buf[0] = 0x00;
3123 ret += usb_microdia_control_write(dev, 0x10c8, buf, 1); // URB 7
3125 buf[0] = 0x80;
3126 ret += usb_microdia_control_write(dev, 0x1020, buf, 1); // URB 8
3128 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 9 0x0f
3130 buf[0] = 0x1f;
3131 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 10
3133 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 11 0x1f
3135 buf[0] = 0x0f;
3136 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 12
3138 ret += usb_microdia_control_read(dev, 0x1045, buf, 1); // URB 13 0x0f
3140 buf[0] = 0x1f;
3141 ret += usb_microdia_control_write(dev, 0x1045, buf, 1); // URB 14
3143 if (ret < 10)
3145 UDIA_INFO("One ore more errors occured during initialization !\n");
3146 return -1;
3148 return 0;
3151 /**
3152 * @brief From UsbSnoop-plugin-parsed.log
3154 * @param dev
3156 * @returns 0 (OK) or <0 (Error)
3158 * @author Vincent, Kuzja
3160 int microdia_6288_initialize(struct usb_microdia *dev)
3163 int ret;
3164 __u16 reg;
3165 __u8 buf[2];
3167 reg = 0x130d ;
3168 ret = usb_microdia_control_read(dev, reg, buf, 1);
3169 if(ret < 0) goto err;
3171 reg = 0x1040 ;
3172 ret = usb_microdia_control_read(dev, reg, buf, 1);
3173 if(ret < 0) goto err;
3175 if (ret < 0)
3176 return ret;
3177 else
3178 return 0;
3179 err:
3180 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
3181 return ret;
3184 /**
3185 * @brief From UsbSnoop-plugin-parsed.log
3187 * @param dev
3189 * @returns 0 if all OK
3191 * Function to initialize Microdia 6128 webcam
3192 * Bridge SN9C325 + OM6802 CMOS sensor
3193 * note: comments are my observations so they could be wrong
3195 int microdia_6128_initialize(struct usb_microdia *dev)
3197 int ret = 0;
3198 __u8 buf[2];
3200 UDIA_INFO("Initializing camera...\n");
3202 buf[0] = 0x01;
3203 ret += usb_microdia_control_write(dev, 0xf1, buf, 1);
3204 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // read reg 0x00 must write 0x00 in buf[0]
3205 ret += usb_microdia_control_write(dev, 0xf1, buf, 1);
3206 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // get cam ID, must read 0x12
3208 if(buf[0] != 0x12){
3209 UDIA_ERROR("Microdia 6128 is not connected or working !!!\n");
3210 return -ENODEV;
3213 buf[0] = 0x29; buf[1] = 0x70; // Configure GPIO
3214 ret += usb_microdia_control_write(dev, 0x01, buf, 2);
3216 buf[0] = 0x01;
3217 ret += usb_microdia_control_write(dev, 0xf1, buf, 1); // Maybe wakeup
3219 buf[0] = 0x0e;
3220 ret += usb_microdia_control_write(dev, 0x01, buf, 1); // Command to initialize cam
3222 if(ret != 8)
3223 UDIA_DEBUG("Some read or writes were not successful in initialization !\n");
3225 /* Device is initialized and ready */
3226 UDIA_INFO("Microdia USB2.0 Camera is ready\n");
3228 return 0;
3232 int dev_microdia_start_stream(struct usb_microdia *dev)
3234 int ret = -ENODEV;
3235 if(dev && dev->start_stream)
3236 ret = dev->start_stream(dev);
3238 return ret;
3242 * @brief From start.htm
3244 * @param dev
3246 * @returns 0
3248 * @author GWater
3250 * For SN9C201 with MI1310.
3251 * This function has not been tested yet.
3253 int microdia_6242_start_stream(struct usb_microdia *dev)
3255 int i = -1;
3256 __u8 buf[48];
3258 __u8 urb10[24] = {
3259 0x01, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
3260 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
3261 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
3263 __u8 urb13[11] = {
3264 0x02, 0x00, 0x02, 0x00, 0x50, 0x78, 0x00, 0x00,
3265 0x07, 0xc0, 0x0a};
3267 __u8 urb14[22] = {
3268 0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
3269 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
3270 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
3272 __u8 urb119[17] = {
3273 0x08, 0x38, 0x58, 0x6f, 0x7f, 0x8d, 0x9a, 0xa6,
3274 0xb1, 0xbb, 0xc5, 0xce, 0xd7, 0xdf, 0xe8, 0xef,
3275 0xf7};
3277 __u8 urb120[21] = {
3278 0x16, 0x00, 0x2b, 0x00, 0x08, 0x00, 0x00, 0x00,
3279 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
3280 0x00, 0x00, 0x00, 0x00, 0x00};
3282 __u8 qtable1[64] = {
3283 0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
3284 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
3285 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
3286 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
3287 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
3288 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
3289 0x4f, 0x54, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
3290 0x64, 0x5c, 0x54, 0x64, 0x4b, 0x54, 0x58, 0x54};
3292 __u8 qtable2[64] = {
3293 0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
3294 0x15, 0x26, 0x54, 0x36, 0x2e, 0x36, 0x54, 0x54,
3295 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3296 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3297 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3298 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3299 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54,
3300 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54, 0x54};
3302 __u8 first10c0[7][3] = {
3303 {0x0d, 0x00, 0x08},
3304 {0x0d, 0x00, 0x09},
3305 {0x0d, 0x00, 0x08},
3306 {0xf0, 0x00, 0x01},
3307 {0x3a, 0x73, 0x00},
3308 {0x06, 0x30, 0x8c},
3309 {0xf0, 0x00, 0x00}};
3311 __u8 second10c0a[2][5] = {
3312 {0x01, 0x00, 0x0e, 0x00, 0x14},
3313 {0x03, 0x03, 0xc4, 0x05, 0x14}};
3314 __u8 second10c0b[3] =
3315 {0xc8, 0x00, 0x03};
3317 __u8 third10c0[4][3] = {
3318 {0x0a, 0x00, 0x01},
3319 {0x06, 0x00, 0x29},
3320 {0x05, 0x00, 0x72},
3321 {0x20, 0x00, 0x00}};
3323 __u8 fourth10c0a[3][3] = {
3324 {0x20, 0x00, 0x00},
3325 {0x09, 0x01, 0x90},
3326 {0x0d, 0x80, 0x08}};
3327 __u8 fourth10c0b[2][5] = {
3328 {0x2b, 0x01, 0x88, 0x01, 0x88},
3329 {0x2d, 0x01, 0x88, 0x01, 0x88}};
3331 __u8 fifth10c0[4][3] = {
3332 {0x0a, 0x00, 0x01},
3333 {0x06, 0x00, 0x29},
3334 {0x05, 0x00, 0x72}};
3336 // interrupt down
3338 buf[0] = 0x00;
3339 usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 1
3341 // interrupt up
3343 // interrupt down
3345 buf[0] = 0x60;
3346 usb_microdia_control_write(dev, 0x1007, buf, 1);
3348 buf[0] = 0x00;
3349 usb_microdia_control_write(dev, 0x1006, buf, 1);
3351 buf[0] = 0x78;
3352 usb_microdia_control_write(dev, 0x1000, buf, 1);
3354 buf[0] = 0xc7;
3355 usb_microdia_control_write(dev, 0x1001, buf, 1);
3357 buf[0] = 0x1c;
3358 usb_microdia_control_write(dev, 0x1002, buf, 1);
3360 buf[0] = 0x01;
3361 usb_microdia_control_write(dev, 0x1061, buf, 1);
3363 buf[0] = 0x80;
3364 usb_microdia_control_write(dev, 0x1020, buf, 1);
3366 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3367 buf[3] = 0x10; buf[4] = 0x08;
3368 usb_microdia_control_write(dev, 0x1067, buf, 5);
3370 buf[0] = 0xb0; buf[1] = dev->sensor_slave_address; buf[2] = 0x0d;
3371 buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00;
3372 buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
3373 usb_microdia_control_write(dev, 0x10c0, buf, 9);
3375 usb_microdia_control_write(dev, 0x10e0, urb10, 24); // URB 10
3377 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
3378 usb_microdia_control_write(dev, 0x10f8, buf, 3);
3380 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00;
3381 buf[3] = 0xe0; buf[4] = 0x03;
3382 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3384 usb_microdia_control_write(dev, 0x1180, urb13, 11);
3386 usb_microdia_control_write(dev, 0x118b, urb14, 22);
3388 buf[0] = 0x00; buf[1] = 0x00;
3389 usb_microdia_control_write(dev, 0x11a1, buf, 2);
3391 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
3392 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00;
3393 buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00;
3394 usb_microdia_control_write(dev, 0x11b7, buf, 9);
3396 buf[0] = 0x30;
3397 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3399 buf[0] = 0x78;
3400 usb_microdia_control_write(dev, 0x1000, buf, 1);
3402 for (i = 0; i < 7; i++) // URB 9-48
3403 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3404 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]);
3406 buf[0] = 0x60;
3407 usb_microdia_control_write(dev, 0x1007, buf, 1);
3409 buf[0] = 0x00;
3410 usb_microdia_control_write(dev, 0x1006, buf, 1);
3412 buf[0] = 0x03;
3413 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 50
3415 buf[0] = 0x03;
3416 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3418 buf[0] = 0xc6;
3419 usb_microdia_control_write(dev, 0x1001, buf, 1);
3421 buf[0] = 0xc4;
3422 usb_microdia_control_write(dev, 0x1001, buf, 1);
3424 buf[0] = 0x44;
3425 usb_microdia_control_write(dev, 0x1001, buf, 1);
3427 buf[0] = 0x80;
3428 usb_microdia_control_write(dev, 0x1189, buf, 1);
3430 buf[0] = 0x00;
3431 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3433 buf[0] = 0x00;
3434 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3436 buf[0] = 0x00;
3437 usb_microdia_control_write(dev, 0x11be, buf, 1);
3439 buf[0] = 0x00;
3440 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3442 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3443 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
3445 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3446 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
3448 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3449 0x09, dev->sensor_flags, NULL);
3451 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3452 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3454 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
3455 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3456 usb_microdia_control_write(dev, 0x1180, buf, 6);
3458 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3459 buf[3] = 0xf0; buf[4] = 0x00;
3460 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 70
3462 buf[0] = 0x8c;
3463 usb_microdia_control_write(dev, 0x1189, buf, 1);
3465 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3466 usb_microdia_control_write(dev, 0x11a1, buf, 4);
3468 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3469 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3471 buf[0] = 0x78;
3472 usb_microdia_control_write(dev, 0x1000, buf, 1);
3474 buf[0] = 0x18;
3475 usb_microdia_control_write(dev, 0x1002, buf, 1);
3477 buf[0] = 0x18;
3478 usb_microdia_control_write(dev, 0x1002, buf, 1);
3480 buf[0] = 0x38;
3481 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3483 buf[0] = 0x02;
3484 usb_microdia_control_write(dev, 0x118a, buf, 1);
3486 buf[0] = 0x02;
3487 usb_microdia_control_write(dev, 0x0395, buf, 1);
3489 buf[0] = 0x78;
3490 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 80
3491 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3493 buf[0] = 0xf9;
3494 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3495 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3497 buf[0] = 0xfa;
3498 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3499 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3501 buf[0] = 0x7b;
3502 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3503 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3505 buf[0] = 0x7c;
3506 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3507 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3509 buf[0] = 0x7b;
3510 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 90
3512 for (i = 0; i < 4; i++) // URB 97-106
3513 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3514 third10c0[i][0], dev->sensor_flags, &third10c0[i][1]);
3516 buf[0] = 0x06;
3517 usb_microdia_control_write(dev, 0x1180, buf, 1);
3519 for (i = 0; i < 3; i++)
3520 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3521 fourth10c0a[i][0], dev->sensor_flags, &fourth10c0a[i][1]);
3523 for (i = 0; i < 2; i++)
3524 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3525 fourth10c0b[i][0], dev->sensor_flags, &fourth10c0b[i][1]);
3527 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3528 0x33, dev->sensor_flags, NULL);
3530 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3531 first10c0[0][0], dev->sensor_flags, &first10c0[0][1]);
3533 buf[0] = 0x20;
3534 usb_microdia_control_write(dev, 0x118c, buf, 1);
3536 buf[0] = 0x20;
3537 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 110
3539 buf[0] = 0x20;
3540 usb_microdia_control_write(dev, 0x118e, buf, 1);
3542 buf[0] = 0x20;
3543 usb_microdia_control_write(dev, 0x118f, buf, 1);
3545 buf[0] = 0x0a;
3546 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3548 buf[0] = 0x20;
3549 usb_microdia_control_write(dev, 0x118c, buf, 1);
3551 buf[0] = 0x20;
3552 usb_microdia_control_write(dev, 0x118d, buf, 1);
3554 buf[0] = 0x20;
3555 usb_microdia_control_write(dev, 0x118e, buf, 1);
3557 buf[0] = 0x20;
3558 usb_microdia_control_write(dev, 0x118f, buf, 1);
3560 buf[0] = 0x10;
3561 usb_microdia_control_write(dev, 0x118b, buf, 1);
3563 usb_microdia_control_write(dev, 0x1190, urb119, 17);
3565 for (i = 0; i < 9; i++) // URB 120-128
3566 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
3568 buf[0] = 0x05;
3569 usb_microdia_control_write(dev, 0x10f7, buf, 1);
3571 buf[0] = 0x60;
3572 usb_microdia_control_write(dev, 0x10f6, buf, 1); // URB 130
3574 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
3576 buf[0] = 0x14;
3577 usb_microdia_control_write(dev, 0x10f8, buf, 1);
3579 buf[0] = 0xff;
3580 usb_microdia_control_write(dev, 0x10fa, buf, 1);
3582 buf[0] = 0x00;
3583 usb_microdia_control_write(dev, 0x10f9, buf, 1);
3585 buf[0] = 0x00;
3586 usb_microdia_control_write(dev, 0x10f9, buf, 1);
3588 buf[0] = 0x0a;
3589 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3591 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
3592 usb_microdia_control_write(dev, 0x11bc, buf, 4);
3594 /* Set whole array buf to 0x00 */
3595 memset(buf, 0x00, 48);
3596 usb_microdia_control_write(dev, 0x11c0, buf, 48);
3598 buf[0] = 0x20;
3599 usb_microdia_control_write(dev, 0x118c, buf, 1);
3601 buf[0] = 0x20;
3602 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 140
3604 buf[0] = 0x20;
3605 usb_microdia_control_write(dev, 0x118e, buf, 1);
3607 buf[0] = 0x20;
3608 usb_microdia_control_write(dev, 0x118f, buf, 1);
3610 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
3611 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
3612 usb_microdia_control_write(dev, 0x11a5, buf, 6);
3614 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
3615 usb_microdia_control_write(dev, 0x11af, buf, 4);
3617 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
3618 usb_microdia_control_write(dev, 0x11b3, buf, 4);
3620 buf[0] = 0x07;
3621 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3623 buf[0] = 0x01;
3624 usb_microdia_control_write(dev, 0x1061, buf, 1);
3626 buf[0] = 0x27;
3627 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3629 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
3631 usb_microdia_control_write(dev, 0x1140, qtable2, 64); // URB 150
3633 buf[0] = 0x07;
3634 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3636 buf[0] = 0x03;
3637 usb_microdia_control_write(dev, 0x1061, buf, 1);
3639 buf[0] = 0x0b;
3640 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3642 buf[0] = 0x8c;
3643 usb_microdia_control_write(dev, 0x1189, buf, 1);
3645 buf[0] = 0x00;
3646 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3648 buf[0] = 0x00;
3649 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3651 buf[0] = 0x00;
3652 usb_microdia_control_write(dev, 0x11be, buf, 1);
3654 buf[0] = 0x00;
3655 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3657 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3658 second10c0a[0][0], dev->sensor_flags, &second10c0a[0][1]);
3660 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3661 second10c0a[1][0], dev->sensor_flags, &second10c0a[1][1]);
3663 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3664 0x09, dev->sensor_flags, NULL);
3666 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3667 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3669 buf[0] = 0x06; buf[1] = 0x00; buf[2] = 0x02;
3670 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3671 usb_microdia_control_write(dev, 0x1180, buf, 6);
3673 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3674 buf[3] = 0xf0; buf[4] = 0x00;
3675 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3677 buf[0] = 0x8c;
3678 usb_microdia_control_write(dev, 0x1189, buf, 1);
3680 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3681 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 170
3683 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3684 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3686 buf[0] = 0x03;
3687 usb_microdia_control_write(dev, 0x1061, buf, 1);
3689 buf[0] = 0x0a;
3690 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3692 buf[0] = 0x00;
3693 usb_microdia_control_write(dev, 0x11b9, buf, 1);
3695 buf[0] = 0x0b;
3696 usb_microdia_control_write(dev, 0x11ba, buf, 1);
3698 buf[0] = 0x01;
3699 usb_microdia_control_write(dev, 0x1061, buf, 1);
3701 buf[0] = 0x78;
3702 usb_microdia_control_write(dev, 0x1000, buf, 1);
3704 buf[0] = 0x18;
3705 usb_microdia_control_write(dev, 0x1002, buf, 1);
3707 buf[0] = 0x18;
3708 usb_microdia_control_write(dev, 0x1002, buf, 1);
3710 buf[0] = 0x7b;
3711 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 180
3713 buf[0] = 0x02;
3714 usb_microdia_control_write(dev, 0x118a, buf, 1);
3716 buf[0] = 0x02;
3717 usb_microdia_control_write(dev, 0x0395, buf, 1);
3719 buf[0] = 0x78;
3720 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3721 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3723 buf[0] = 0xf9;
3724 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3725 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3727 buf[0] = 0xfa;
3728 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3729 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3731 buf[0] = 0x7b;
3732 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3733 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 190
3735 buf[0] = 0x7c;
3736 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3737 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3739 buf[0] = 0x7b;
3740 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3742 for (i = 0; i < 3; i++) // URB 200-205
3743 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
3744 fifth10c0[i][0], dev->sensor_flags, &fifth10c0[i][1]);
3746 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2,
3747 0x00, dev->sensor_flags, buf);
3748 /* __u8 result[2] = {buf[3], buf[4]}; */
3750 buf[0] = 0x03;
3751 usb_microdia_control_write(dev, 0x1061, buf, 1);
3753 return 0;
3757 * @brief From startstream.log
3759 * @param dev
3761 * @returns 0
3763 * @author GWater
3765 * For SN9C201 with SOI968.
3766 * This is function triggers a working stream of image data and a glowing LED.
3768 int microdia_624e_start_stream(struct usb_microdia *dev)
3770 int i = -1;
3771 __u8 buf[48];
3773 __u8 urb10[24] =
3774 {0x47, 0x18, 0x00, 0x30, 0x00, 0x09, 0x00, 0xed,
3775 0x0f, 0xda, 0x0f, 0x3a, 0x00, 0x3a, 0x00, 0xd0,
3776 0x0f, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x60, 0x0a};
3778 __u8 urb14[22] =
3779 {0x00, 0x20, 0x20, 0x20, 0x20, 0x00, 0x24, 0x3b,
3780 0x4f, 0x61, 0x71, 0x80, 0x8f, 0x9d, 0xab, 0xb8,
3781 0xc4, 0xd1, 0xdd, 0xe9, 0xf4, 0xff};
3783 __u8 urb119[17] =
3784 {0x08, 0x2b, 0x59, 0x79, 0x91, 0x9e, 0xa9, 0xb3,
3785 0xbd, 0xc6, 0xce, 0xd6, 0xdd, 0xe4, 0xea, 0xf1,
3786 0xf7};
3788 __u8 urb120[21] =
3789 {0x16, 0x00, 0x2d, 0x00, 0x08, 0x00, 0xdd, 0x0f,
3790 0xbc, 0x0f, 0x68, 0x00, 0x68, 0x00, 0xa9, 0x0f,
3791 0xf0, 0x0f, 0x00, 0x00, 0x00};
3793 __u8 qtable1[64] =
3794 {0x0d, 0x08, 0x08, 0x0d, 0x08, 0x08, 0x0d, 0x0d,
3795 0x0d, 0x0d, 0x11, 0x0d, 0x0d, 0x11, 0x15, 0x21,
3796 0x15, 0x15, 0x11, 0x11, 0x15, 0x2a, 0x1d, 0x1d,
3797 0x19, 0x21, 0x32, 0x2a, 0x32, 0x32, 0x2e, 0x2a,
3798 0x2e, 0x2e, 0x36, 0x3a, 0x4b, 0x43, 0x36, 0x3a,
3799 0x47, 0x3a, 0x2e, 0x2e, 0x43, 0x5c, 0x43, 0x47,
3800 0x4f, 0x53, 0x58, 0x58, 0x58, 0x32, 0x3f, 0x60,
3801 0x64, 0x5c, 0x53, 0x64, 0x4b, 0x53, 0x58, 0x53};
3803 __u8 qtable2[64] =
3804 {0x0d, 0x11, 0x11, 0x15, 0x11, 0x15, 0x26, 0x15,
3805 0x15, 0x26, 0x53, 0x36, 0x2e, 0x36, 0x53, 0x53,
3806 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3807 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3808 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3809 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3810 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53,
3811 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53, 0x53};
3813 __u8 first10c0[20][2] = {
3814 {0x12, 0x80}, {0x12, 0x00}, {0x0c, 0x00}, {0x0f, 0x1f},
3815 {0x11, 0x80}, {0x38, 0x52}, {0x1e, 0x00}, {0x33, 0x08},
3816 {0x35, 0x8c}, {0x36, 0x0c}, {0x37, 0x04}, {0x45, 0x04},
3817 {0x47, 0xff}, {0x3e, 0x00}, {0x3f, 0x00}, {0x3b, 0x20},
3818 {0x3a, 0x96}, {0x3d, 0x0a}, {0x14, 0x4e}, {0x13, 0x88}};
3820 __u8 second10c0a[2] =
3821 {0x12, 0x40};
3822 __u8 second10c0b[5] =
3823 {0x17, 0x13, 0x63, 0x01, 0x79}; // length 4
3824 __u8 second10c0c[2] =
3825 {0x1b, 0x00}; // length 0
3826 __u8 second10c0d[2][2] = {
3827 {0x32, 0x24},
3828 {0x03, 0x00}};
3830 __u8 third10c0a[5][2] = {
3831 {0x11, 0x40},
3832 {0x2a, 0x10},
3833 {0x2b, 0xe0},
3834 {0x10, 0x32},
3835 {0x00, 0x00}};
3836 __u8 third10c0b[3] =
3837 {0x01, 0x80, 0x80}; // length 2
3839 __u8 read10c0[4] =
3840 {0x0a, 0x0b, 0x1c, 0x1d}; // these are four addresses
3842 // interrupt down
3844 buf[0] = 0x00;
3845 usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 1
3847 // interrupt up
3849 // interrupt down
3851 buf[0] = 0x78;
3852 usb_microdia_control_write(dev, 0x1000, buf, 1);
3854 buf[0] = 0xc7;
3855 usb_microdia_control_write(dev, 0x1001, buf, 1);
3857 buf[0] = 0x1c;
3858 usb_microdia_control_write(dev, 0x1002, buf, 1);
3860 buf[0] = 0xa0; buf[1] = 0xa0;
3861 usb_microdia_control_write(dev, 0x1006, buf, 2);
3863 buf[0] = 0x01;
3864 usb_microdia_control_write(dev, 0x1061, buf, 1);
3866 buf[0] = 0x80;
3867 usb_microdia_control_write(dev, 0x1020, buf, 1);
3869 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
3870 buf[3] = 0x10; buf[4] = 0x08;
3871 usb_microdia_control_write(dev, 0x1067, buf, 5);
3873 buf[0] = 0x92; buf[1] = dev->sensor_slave_address; buf[2] = 0x00;
3874 buf[3] = 0x00; buf[4] = 0x1d; buf[5] = 0x00;
3875 buf[6] = 0xa2; buf[7] = 0x10; buf[8] = 0x03;
3876 usb_microdia_control_write(dev, 0x10c0, buf, 9);
3878 usb_microdia_control_write(dev, 0x10e0, urb10, 24); // URB 10
3880 buf[0] = 0x00; buf[1] = 0x00; buf[3] = 0x00;
3881 usb_microdia_control_write(dev, 0x10f8, buf, 3);
3883 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3884 buf[3] = 0xf0; buf[4] = 0x00;
3885 usb_microdia_control_write(dev, 0x10fb, buf, 5);
3887 buf[0] = 0x8a; buf[1] = 0xcc; buf[2] = 0x08;
3888 usb_microdia_control_write(dev, 0x1188, buf, 3);
3890 usb_microdia_control_write(dev, 0x118b, urb14, 22);
3892 buf[0] = 0x00; buf[1] = 0x00;
3893 usb_microdia_control_write(dev, 0x11a1, buf, 2);
3895 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00;
3896 buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x40;
3897 buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
3898 usb_microdia_control_write(dev, 0x11b7, buf, 9);
3900 buf[0] = 0x30;
3901 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3903 buf[0] = 0x78;
3904 usb_microdia_control_write(dev, 0x1000, buf, 1);
3906 for (i = 0; i < 20; i++) // URB 9-48
3907 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3908 first10c0[i][0], dev->sensor_flags, &first10c0[i][1]);
3910 buf[0] = 0x47;
3911 usb_microdia_control_write(dev, 0x10e0, buf, 1);
3913 buf[0] = 0x07;
3914 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 50
3916 buf[0] = 0xc6;
3917 usb_microdia_control_write(dev, 0x1001, buf, 1);
3919 buf[0] = 0xc4;
3920 usb_microdia_control_write(dev, 0x1001, buf, 1);
3922 buf[0] = 0x44;
3923 usb_microdia_control_write(dev, 0x1001, buf, 1);
3925 buf[0] = 0x8c;
3926 usb_microdia_control_write(dev, 0x1189, buf, 1);
3928 buf[0] = 0x00;
3929 usb_microdia_control_write(dev, 0x11bc, buf, 1);
3931 buf[0] = 0x00;
3932 usb_microdia_control_write(dev, 0x11bd, buf, 1);
3934 buf[0] = 0x00;
3935 usb_microdia_control_write(dev, 0x11be, buf, 1);
3937 buf[0] = 0x00;
3938 usb_microdia_control_write(dev, 0x11bf, buf, 1);
3941 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, // URB 59-60
3942 second10c0a[0], dev->sensor_flags, &second10c0a[1]);
3944 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
3945 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
3947 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
3948 second10c0c[0], dev->sensor_flags, &second10c0c[1]);
3950 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3951 second10c0d[0][0], dev->sensor_flags, &second10c0d[0][1]);
3953 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
3954 second10c0d[1][0], dev->sensor_flags, &second10c0d[1][1]);
3956 buf[0] = 0x3c; buf[1] = 0x00; buf[2] = 0x0b;
3957 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
3958 usb_microdia_control_write(dev, 0x1180, buf, 6);
3960 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
3961 buf[3] = 0xf0; buf[4] = 0x00;
3962 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 70
3964 buf[0] = 0x8c;
3965 usb_microdia_control_write(dev, 0x1189, buf, 1);
3967 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
3968 usb_microdia_control_write(dev, 0x11a1, buf, 4);
3970 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
3971 usb_microdia_control_write(dev, 0x11ab, buf, 4);
3973 buf[0] = 0x7c;
3974 usb_microdia_control_write(dev, 0x1000, buf, 1);
3976 buf[0] = 0x1c;
3977 usb_microdia_control_write(dev, 0x1002, buf, 1);
3979 buf[0] = 0x1c;
3980 usb_microdia_control_write(dev, 0x1002, buf, 1);
3982 buf[0] = 0x38;
3983 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3985 buf[0] = 0x05;
3986 usb_microdia_control_write(dev, 0x118a, buf, 1);
3988 buf[0] = 0x05;
3989 usb_microdia_control_write(dev, 0x0395, buf, 1);
3991 buf[0] = 0x78;
3992 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 80
3993 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3995 buf[0] = 0xf9;
3996 usb_microdia_control_write(dev, 0x11b8, buf, 1);
3997 usb_microdia_control_read(dev, 0x11b8, buf, 1);
3999 buf[0] = 0x7a;
4000 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4001 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4003 buf[0] = 0x7b;
4004 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4005 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4007 buf[0] = 0x7c;
4008 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4009 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4011 buf[0] = 0xfd;
4012 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 90
4013 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4015 buf[0] = 0xfe;
4016 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4017 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4019 buf[0] = 0x7f;
4020 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4021 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4023 buf[0] = 0x7a;
4024 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4026 for (i = 0; i < 5; i++) // URB 97-106
4027 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4028 third10c0a[i][0], dev->sensor_flags, &third10c0a[i][1]);
4030 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
4031 third10c0b[0], dev->sensor_flags, &third10c0b[1]);
4033 buf[0] = 0x20;
4034 usb_microdia_control_write(dev, 0x118c, buf, 1);
4036 buf[0] = 0x20;
4037 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 110
4039 buf[0] = 0x20;
4040 usb_microdia_control_write(dev, 0x118e, buf, 1);
4042 buf[0] = 0x20;
4043 usb_microdia_control_write(dev, 0x118f, buf, 1);
4045 buf[0] = 0x0a;
4046 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4048 buf[0] = 0x20;
4049 usb_microdia_control_write(dev, 0x118c, buf, 1);
4051 buf[0] = 0x20;
4052 usb_microdia_control_write(dev, 0x118d, buf, 1);
4054 buf[0] = 0x20;
4055 usb_microdia_control_write(dev, 0x118e, buf, 1);
4057 buf[0] = 0x20;
4058 usb_microdia_control_write(dev, 0x118f, buf, 1);
4060 buf[0] = 0x0a;
4061 usb_microdia_control_write(dev, 0x118b, buf, 1);
4063 usb_microdia_control_write(dev, 0x1190, urb119, 17);
4065 for (i = 0; i < 9; i++) // URB 120-128
4066 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
4069 buf[0] = 0x07;
4070 usb_microdia_control_write(dev, 0x10f7, buf, 1);
4072 buf[0] = 0x60;
4073 usb_microdia_control_write(dev, 0x10f6, buf, 1); // URB 130
4075 usb_microdia_control_write(dev, 0x10e1, urb120, 21);
4077 buf[0] = 0x14;
4078 usb_microdia_control_write(dev, 0x10f8, buf, 1);
4080 buf[0] = 0xff;
4081 usb_microdia_control_write(dev, 0x10fa, buf, 1);
4083 buf[0] = 0x00;
4084 usb_microdia_control_write(dev, 0x10f9, buf, 1);
4086 buf[0] = 0x00;
4087 usb_microdia_control_write(dev, 0x10f9, buf, 1);
4089 buf[0] = 0x0e;
4090 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4092 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
4093 usb_microdia_control_write(dev, 0x11bc, buf, 4);
4095 /* Set whole buf to 0x00 */
4096 memset(buf, 0, 48);
4097 usb_microdia_control_write(dev, 0x11c0, buf, 48);
4099 buf[0] = 0x20;
4100 usb_microdia_control_write(dev, 0x118c, buf, 1);
4102 buf[0] = 0x20;
4103 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 140
4105 buf[0] = 0x20;
4106 usb_microdia_control_write(dev, 0x118e, buf, 1);
4108 buf[0] = 0x20;
4109 usb_microdia_control_write(dev, 0x118f, buf, 1);
4111 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a;
4112 buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
4113 usb_microdia_control_write(dev, 0x11a5, buf, 6);
4115 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
4116 usb_microdia_control_write(dev, 0x11af, buf, 4);
4118 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
4119 usb_microdia_control_write(dev, 0x11b3, buf, 4);
4121 buf[0] = 0x07;
4122 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4124 buf[0] = 0x01;
4125 usb_microdia_control_write(dev, 0x1061, buf, 1);
4127 buf[0] = 0x27;
4128 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4130 usb_microdia_control_write(dev, 0x1100, qtable1, 64);
4132 usb_microdia_control_write(dev, 0x1140, qtable2, 64); // URB 150
4134 buf[0] = 0x07;
4135 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4137 buf[0] = 0x03;
4138 usb_microdia_control_write(dev, 0x1061, buf, 1);
4140 buf[0] = 0x0b;
4141 usb_microdia_control_write(dev, 0x10e0, buf, 1);
4143 buf[0] = 0x8c;
4144 usb_microdia_control_write(dev, 0x1189, buf, 1);
4146 buf[0] = 0x00;
4147 usb_microdia_control_write(dev, 0x11bc, buf, 1);
4149 buf[0] = 0x00;
4150 usb_microdia_control_write(dev, 0x11bd, buf, 1);
4152 buf[0] = 0x00;
4153 usb_microdia_control_write(dev, 0x11be, buf, 1);
4155 buf[0] = 0x00;
4156 usb_microdia_control_write(dev, 0x11bf, buf, 1);
4158 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, // URB 159-160
4159 second10c0b[0], dev->sensor_flags, &second10c0b[1]);
4161 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
4162 second10c0c[0], dev->sensor_flags, &second10c0c[1]);
4164 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4165 second10c0d[0][0], dev->sensor_flags, &second10c0d[0][1]);
4167 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4168 second10c0d[1][0], dev->sensor_flags, &second10c0d[1][1]);
4170 buf[0] = 0x3c; buf[1] = 0x00; buf[2] = 0x0b;
4171 buf[3] = 0x00; buf[4] = 0x28; buf[5] = 0x3c;
4172 usb_microdia_control_write(dev, 0x1180, buf, 6);
4174 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
4175 buf[3] = 0xf0; buf[4] = 0x00;
4176 usb_microdia_control_write(dev, 0x10fb, buf, 5);
4178 buf[0] = 0x8c;
4179 usb_microdia_control_write(dev, 0x1189, buf, 1);
4181 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
4182 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 170
4184 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
4185 usb_microdia_control_write(dev, 0x11ab, buf, 4);
4187 buf[0] = 0x03;
4188 usb_microdia_control_write(dev, 0x1061, buf, 1);
4190 buf[0] = 0x0e;
4191 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4193 buf[0] = 0x00;
4194 usb_microdia_control_write(dev, 0x11b9, buf, 1);
4196 buf[0] = 0x0f;
4197 usb_microdia_control_write(dev, 0x11ba, buf, 1);
4199 buf[0] = 0x01;
4200 usb_microdia_control_write(dev, 0x1061, buf, 1);
4202 buf[0] = 0x7c;
4203 usb_microdia_control_write(dev, 0x1000, buf, 1);
4205 buf[0] = 0x1c;
4206 usb_microdia_control_write(dev, 0x1002, buf, 1);
4208 buf[0] = 0x1c;
4209 usb_microdia_control_write(dev, 0x1002, buf, 1);
4211 buf[0] = 0x7a;
4212 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 180
4214 buf[0] = 0x05;
4215 usb_microdia_control_write(dev, 0x118a, buf, 1);
4217 buf[0] = 0x05;
4218 usb_microdia_control_write(dev, 0x0395, buf, 1);
4220 buf[0] = 0x78;
4221 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4222 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4224 buf[0] = 0xf9;
4225 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4226 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4228 buf[0] = 0x7a;
4229 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4230 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4232 buf[0] = 0x7b;
4233 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4234 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 190
4236 buf[0] = 0x7c;
4237 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4238 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4240 buf[0] = 0x7d;
4241 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4242 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4244 buf[0] = 0xfe;
4245 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4246 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4248 buf[0] = 0x7f;
4249 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4250 usb_microdia_control_read(dev, 0x11b8, buf, 1);
4252 buf[0] = 0x7a;
4253 usb_microdia_control_write(dev, 0x11b8, buf, 1);
4255 for (i = 0; i < 3; i++) // URB 200-205
4256 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
4257 third10c0a[i][0], dev->sensor_flags, &third10c0a[i][1]);
4259 for (i = 0; i < 4; i++) // URB 206-225
4260 sn9c20x_read_i2c_data(dev, dev->sensor_slave_address,
4261 1, read10c0[i], dev->sensor_flags, buf);
4263 buf[0] = 0x03;
4264 usb_microdia_control_write(dev, 0x1061, buf, 1);
4266 buf[0] = 0xa0;
4267 usb_microdia_control_write(dev, 0x1007, buf, 1);
4269 buf[0] = 0x80;
4270 usb_microdia_control_write(dev, 0x1006, buf, 1);
4272 return 0;
4275 int microdia_624f_start_stream(struct usb_microdia *dev)
4277 int ret, i;
4278 __u8 last_11b8[1];
4279 __u8 eeprom_slave_id = 0x50;
4280 __u8 eeprom_flags = SN9C20X_I2C_2WIRE;
4281 __u16 command;
4282 __u8 buf[64];
4283 __u8 unknown1[9] = { dev->sensor_flags, dev->sensor_slave_address,
4284 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03 };
4286 buf[0] = 0x20;
4287 command = 0x1007;
4288 ret = usb_microdia_control_write(dev, command, buf, 1);
4289 if(ret < 0) goto err;
4291 buf[0] = 0x00;
4292 command = 0x1006;
4293 ret = usb_microdia_control_write(dev, command, buf, 1);
4294 if(ret < 0) goto err;
4296 buf[0] = 0x78;
4297 command = 0x1000;
4298 ret = usb_microdia_control_write(dev, command, buf, 1);
4299 if(ret < 0) goto err;
4301 buf[0] = 0xc7;
4302 command = 0x1001;
4303 ret = usb_microdia_control_write(dev, command, buf, 1);
4304 if(ret < 0) goto err;
4306 buf[0] = 0x1c;
4307 command = 0x1002;
4308 ret = usb_microdia_control_write(dev, command, buf, 1);
4309 if(ret < 0) goto err;
4311 buf[0] = 0x01;
4312 command = 0x1061;
4313 ret = usb_microdia_control_write(dev, command, buf, 1);
4314 if(ret < 0) goto err;
4316 buf[0] = 0x80;
4317 command = 0x1020;
4318 ret = usb_microdia_control_write(dev, command, buf, 1);
4319 if(ret < 0) goto err;
4321 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20;
4322 buf[3] = 0x10; buf[4] = 0x08;
4323 command = 0x1067;
4324 ret = usb_microdia_control_write(dev, command, buf, 5);
4325 if(ret < 0) goto err;
4327 /* this is the same register as the I2C write, not sure why
4328 * we're writing 9 bytes -- the SN9C102 docs say all writes
4329 * must be 8 bytes, but we don't have docs for SN9C20x */
4330 command = 0x10c0;
4331 ret = usb_microdia_control_write(dev, command, unknown1, 9);
4332 if(ret < 0) goto err;
4334 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
4335 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
4336 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
4337 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
4338 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
4339 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
4340 command = 0x10e0;
4341 ret = usb_microdia_control_write(dev, command, buf, 24);
4342 if(ret < 0) goto err;
4344 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
4345 command = 0x10f8;
4346 ret = usb_microdia_control_write(dev, command, buf, 3);
4347 if(ret < 0) goto err;
4349 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00;
4350 buf[3] = 0xf0; buf[4] = 0x00;
4351 command = 0x10fb;
4352 ret = usb_microdia_control_write(dev, command, buf, 5);
4353 if(ret < 0) goto err;
4355 buf[0] = 0x87; buf[1] = 0xcc; buf[2] = 0x08;
4356 command = 0x1188;
4357 ret = usb_microdia_control_write(dev, command, buf, 3);
4358 if(ret < 0) goto err;
4360 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
4361 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
4362 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
4363 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
4364 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
4365 buf[20] = 0xf4; buf[21] = 0xff;
4366 command = 0x118b;
4367 ret = usb_microdia_control_write(dev, command, buf, 22);
4368 if(ret < 0) goto err;
4370 buf[0] = 0x00; buf[1] = 0x00;
4371 command = 0x11a1;
4372 ret = usb_microdia_control_write(dev, command, buf, 2);
4373 if(ret < 0) goto err;
4375 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08;
4376 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
4377 buf[8] = 0x00;
4378 command = 0x11b7;
4379 ret = usb_microdia_control_write(dev, command, buf, 9);
4380 if(ret < 0) goto err;
4382 buf[0] = 0x30;
4383 command = 0x11b8;
4384 ret = usb_microdia_control_write(dev, command, buf, 1);
4385 if(ret < 0) goto err;
4387 buf[0] = 0x78;
4388 command = 0x1000;
4389 ret = usb_microdia_control_write(dev, command, buf, 1);
4390 if(ret < 0) goto err;
4392 /* reset all SCCB registers to their default values */
4393 buf[0] = OV965X_COM7_SCCB_RESET;
4394 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM7,
4395 dev->sensor_flags, buf);
4396 if(ret < 0) goto err;
4398 buf[0] = 0x7f; //0x7f; /* AGC setting */
4399 buf[1] = 0xe0; /* blue gain setting */
4400 buf[2] = 0x90; /* red gain setting */
4401 buf[3] = OV965X_VREF_VSTOP_LOW3(0x04) | OV965X_VREF_VSTART_LOW3(0x02);
4402 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_GAIN,
4403 dev->sensor_flags, buf);
4404 if(ret < 0) goto err;
4407 this write appears to be unnecessary since we issued
4408 the reset above and the spec says that 0x00 is the default
4409 for all 4 of the registers we're writing to here
4411 memset(buf, 0, 4);
4412 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM1,
4413 dev->sensor_flags, buf);
4414 if(ret < 0) goto err;
4416 /* first byte still 0, not sure why, RAVE default is 0x00 too */
4417 buf[0] = 0;
4418 buf[1] = OV965X_COM2_OUTPUT_DRIVE_CAP_2X;
4419 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, OV965X_CTL_RAVE,
4420 dev->sensor_flags, buf);
4421 if(ret < 0) goto err;
4423 buf[0] = 0x00; buf[1] = 0x00;
4424 /* not sure why we're setting bit 5 below, spec says it's reserved */
4425 buf[2] = OV965X_COM5_15FPS_48MHZ_RGB | 0x20;
4426 /* likewise, spec says 4 & 6 are reserved */
4427 buf[3] = OV965X_COM6_TIMING_RESET_ON_FMT_CHANGE | 0x50;
4428 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM3,
4429 dev->sensor_flags, buf);
4430 if(ret < 0) goto err;
4432 buf[0] = 0xff; /* AEC bits 2-9 */
4433 buf[1] = OV965X_CLKRC_INPUT_CLK_NO_SCALE;
4434 buf[2] = OV965X_COM7_OUTPUT_RAW_RGB;
4435 buf[3] = OV965X_COM8_FAST_AGC_AEC | OV965X_COM8_AEC_STEP_SIZE_NOLIMIT |
4436 /*OV965X_COM8_AGC_ENABLE |*/ OV965X_COM8_AEC_ENABLE | OV965X_COM8_AWB_ENABLE;
4437 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_AECH,
4438 dev->sensor_flags, buf);
4439 if(ret < 0) goto err;
4441 buf[0] = OV965X_COM9_MAX_AGC_8X | OV965X_COM9_RELAX_EXPOSURE_TIMING |
4442 OV965X_COM9_DROP_VSYNC_ON_FRAME_DROP |
4443 OV965X_COM9_DROP_FRAME_ON_BIG_AEC;
4444 buf[1] = 0x00;
4445 buf[2] = 0x07; /* hmm, spec says this is reserved */
4446 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, OV965X_CTL_COM9,
4447 dev->sensor_flags, buf);
4448 if(ret < 0) goto err;
4450 /* this is supposed to be reserved too */
4451 buf[0] = 0x04; buf[1] = 0x00;
4452 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, OV965X_CTL_MVFP,
4453 dev->sensor_flags, buf);
4454 if(ret < 0) goto err;
4456 buf[0] = 0x78; /* this is the default! */
4457 buf[1] = 0x68; /* this is the default! */
4458 buf[2] = 0xd4; /* this is the default! */
4459 buf[3] = 0x80; /* this is the default! */
4460 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_AEW,
4461 dev->sensor_flags, buf);
4462 if(ret < 0) goto err;
4464 buf[0] = OV965X_BIAS_SUBTRACT;
4465 buf[1] = OV965X_Gr_COM_BYPASS_ANALOG_BLC | OV965X_Gr_COM_BYPASS_REGULATOR;
4466 buf[2] = 0x00; buf[3] = 0x00;
4467 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_GbBIAS,
4468 dev->sensor_flags, buf);
4469 if(ret < 0) goto err;
4471 buf[0] = OV965X_BIAS_SUBTRACT;
4472 buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
4473 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_RBIAS,
4474 dev->sensor_flags, buf);
4475 if(ret < 0) goto err;
4477 buf[0] = 0x08; /* HSYNC rising edge start */
4478 buf[1] = 0x30; /* HSYNC rising edge end */
4479 buf[2] = OV965X_HREF_EDGE_OFT_TO_DATA_OUT(2) | OV965X_HREF_HSTART_LOW3(6)
4480 | OV965X_HREF_HSTOP_LOW3(4);
4481 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, OV965X_CTL_HSYST,
4482 dev->sensor_flags, buf);
4483 if(ret < 0) goto err;
4485 /* the docs say all 4 of these bytes are reserved */
4486 buf[0] = 0xe2; buf[1] = 0xbf; buf[2] = 0x81; buf[3] = 0xf9;
4487 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_CHLF,
4488 dev->sensor_flags, buf);
4489 if(ret < 0) goto err;
4491 /* the docs say these 2 bytes are reserved */
4492 buf[0] = 0x00; buf[1] = 0x93;
4493 buf[2] = 0x50; /* bits 4 and 6 are supposedly reserved */
4494 buf[3] = OV965X_TSLB_OUTPUT_SEQ_UYVY | OV965X_TSLB_DIGITAL_BLC_ENABLE;
4495 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_ADC,
4496 dev->sensor_flags, buf);
4497 if(ret < 0) goto err;
4499 buf[0] = OV965X_COM11_MANUAL_BANDING_FILTER;
4500 buf[1] = 0x73; /* these bits all reserved */
4501 buf[2] = OV965X_COM13_ENABLE_COLOR_MATRIX | OV965X_COM13_DELAY_Y_CHANNEL
4502 | OV965X_COM13_OUTPUT_DELAY(1);
4503 buf[3] = OV965X_COM14_YUV_EDGE_ENHANCE
4504 | OV965X_COM14_EDGE_ENHANCE_FACTOR_DBL
4505 | 0x0b; /* these last bits supposedly reserved */
4506 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_COM11,
4507 dev->sensor_flags, buf);
4508 if(ret < 0) goto err;
4510 buf[0] = OV965X_EDGE_EDGE_ENHANCE_LOW4(8)
4511 | OV965X_EDGE_EDGE_ENHANCE_FACTOR(8);
4512 buf[1] = OV965X_COM15_OUTPUT_RANGE_O0_TO_FF | 0x01; /* bit reserved */
4513 buf[2] = 0x00; buf[3] = 0x08; /* this bit supposedly reserved */
4514 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_EDGE,
4515 dev->sensor_flags, buf);
4516 if(ret < 0) goto err;
4518 buf[0] = 0x00;
4519 /* OV9653 control register 0x43 is reserved, according to the docs */
4520 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x43,
4521 dev->sensor_flags, buf); // 'Dummy'-write
4522 if(ret < 0) goto err;
4524 buf[0] = 0x80; buf[1] = 0x80; buf[2] = 0x40; buf[3] = 0x00;
4525 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_MANU,
4526 dev->sensor_flags, buf);
4527 if(ret < 0) goto err;
4529 buf[0] = 0x0a;
4530 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DBLV,
4531 dev->sensor_flags, buf);
4532 if(ret < 0) goto err;
4534 buf[0] = 0x06; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x00;
4535 /* OV9653 control register 0x8b is reserved, according to the docs */
4536 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x8b,
4537 dev->sensor_flags, buf);
4538 if(ret < 0) goto err;
4540 buf[0] = 0xdf;
4541 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DBLC1,
4542 dev->sensor_flags, buf);
4543 if(ret < 0) goto err;
4545 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x88; buf[3] = 0x88;
4546 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_DM_LNL,
4547 dev->sensor_flags, buf);
4548 if(ret < 0) goto err;
4550 buf[0] = 0x04;
4551 /* control reg 0x96 reserved, according to docs */
4552 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x96,
4553 dev->sensor_flags, buf);
4554 if(ret < 0) goto err;
4556 buf[0] = 0x80;
4557 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM26,
4558 dev->sensor_flags, buf);
4559 if(ret < 0) goto err;
4561 buf[0] = 0x80; buf[1] = 0xb8; buf[2] = 0x92; buf[3] = 0x0a;
4562 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_ACOM2,
4563 dev->sensor_flags, buf);
4564 if(ret < 0) goto err;
4566 /* reserved, according to docs */
4567 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0xac,
4568 dev->sensor_flags, NULL);
4569 if(ret < 0) goto err;
4571 buf[0] = 0x1b; buf[1] = 0xbb; buf[2] = 0x05; buf[3] = 0x7d;
4572 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_HSTART,
4573 dev->sensor_flags, buf);
4574 if(ret < 0) goto err;
4576 buf[0] = 0x00;
4577 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_PSHIFT,
4578 dev->sensor_flags, buf);
4579 if(ret < 0) goto err;
4581 /* now for some reason it switches to these two reads and
4582 * then back to the long init sequence */
4583 command = 0x10c1;
4584 ret = usb_microdia_control_read(dev, command, buf, 1); /* reads 30 */
4585 if(ret < 0) goto err;
4586 //msg("Should read 0x30, read: %x", buf[0]);
4588 command = 0x10c1;
4589 buf[0] = eeprom_slave_id;
4590 ret = usb_microdia_control_write(dev, command, buf, 1);
4591 if(ret < 0) goto err;
4593 // TRY TO READ FROM EEPROM:
4594 ret = sn9c20x_read_i2c_data(dev, eeprom_slave_id, 1, 0x00, eeprom_flags, buf);
4595 if (ret < 0)
4597 UDIA_INFO("No EEPROM found\n");
4599 else
4601 UDIA_INFO("Read from EEPROM successful\n");
4602 /* returns 0xff -- don't know what we're supposed to do w/ that info */
4603 //msg("Read from eeprom, should read 0xff, read: %x", buf[0]);
4606 command = 0x10c1;
4607 buf[0] = dev->sensor_slave_address;
4608 ret = usb_microdia_control_write(dev, command, buf, 1);
4609 if(ret < 0) goto err;
4611 command = 0x10e0;
4612 buf[0] = 0x47;
4613 ret = usb_microdia_control_write(dev, command, buf, 1);
4614 if(ret < 0) goto err;
4616 command = 0x10e0;
4617 buf[0] = 0x07;
4618 ret = usb_microdia_control_write(dev, command, buf, 1);
4619 if(ret < 0) goto err;
4621 command = 0x1001;
4622 buf[0] = 0xc6;
4623 ret = usb_microdia_control_write(dev, command, buf, 1);
4624 if(ret < 0) goto err;
4626 command = 0x1001;
4627 buf[0] = 0xc4;
4628 ret = usb_microdia_control_write(dev, command, buf, 1);
4629 if(ret < 0) goto err;
4631 command = 0x1001;
4632 buf[0] = 0x44;
4633 ret = usb_microdia_control_write(dev, command, buf, 1);
4634 if(ret < 0) goto err;
4636 command = 0x1189;
4637 buf[0] = 0x8c;
4638 ret = usb_microdia_control_write(dev, command, buf, 1);
4639 if(ret < 0) goto err;
4641 command = 0x11bc;
4642 buf[0] = 0x40;
4643 ret = usb_microdia_control_write(dev, command, buf, 1);
4644 if (ret < 0) goto err;
4646 command = 0x11bd;
4647 buf[0] = 0x01;
4648 ret = usb_microdia_control_write(dev, command, buf, 1);
4649 if (ret < 0) goto err;
4651 command = 0x11be;
4652 buf[0] = 0xf0;
4653 ret = usb_microdia_control_write(dev, command, buf, 1);
4654 if (ret < 0) goto err;
4656 command = 0x11bf;
4657 buf[0] = 0x00;
4658 ret = usb_microdia_control_write(dev, command, buf, 1);
4659 if (ret < 0) goto err;
4661 buf[0] = 0x45;
4662 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM7,
4663 dev->sensor_flags, buf);
4664 if(ret < 0) goto err;
4666 buf[0] = 0x36;
4667 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_VREF,
4668 dev->sensor_flags, buf);
4669 if(ret < 0) goto err;
4671 buf[0] = 0x24; buf[1] = 0xc5; buf[2] = 0x00; buf[3] = 0x3c;
4672 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, OV965X_CTL_HSTART,
4673 dev->sensor_flags, buf);
4674 if(ret < 0) goto err;
4676 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, OV965X_CTL_PSHIFT,
4677 dev->sensor_flags, NULL);
4678 if(ret < 0) goto err;
4680 buf[0] = 0x84;
4681 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_HREF,
4682 dev->sensor_flags, buf);
4683 if(ret < 0) goto err;
4685 command = 0x1180;
4686 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x07; buf[3] = 0x00;
4687 buf[4] = 0x28; buf[5] = 0x3c;
4688 ret = usb_microdia_control_write(dev, command, buf, 6);
4689 if(ret < 0) goto err;
4691 command = 0x10fb;
4692 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
4693 buf[4] = 0x00;
4694 ret = usb_microdia_control_write(dev, command, buf, 5);
4695 if(ret < 0) goto err;
4697 command = 0x1189;
4698 buf[0] = 0x8c;
4699 ret = usb_microdia_control_write(dev, command, buf, 1);
4700 if(ret < 0) goto err;
4702 command = 0x11a1;
4703 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
4704 ret = usb_microdia_control_write(dev, command, buf, 4);
4705 if(ret < 0) goto err;
4707 command = 0x11ab;
4708 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
4709 ret = usb_microdia_control_write(dev, command, buf, 4);
4710 if(ret < 0) goto err;
4712 command = 0x1000;
4713 buf[0] = 0x78;
4714 ret = usb_microdia_control_write(dev, command, buf, 1);
4715 if(ret < 0) goto err;
4717 command = 0x1002;
4718 buf[0] = 0x18;
4719 ret = usb_microdia_control_write(dev, command, buf, 1);
4720 if(ret < 0) goto err;
4722 command = 0x1002;
4723 buf[0] = 0x18;
4724 ret = usb_microdia_control_write(dev, command, buf, 1);
4725 if(ret < 0) goto err;
4727 /* urb 297 */
4728 command = 0x11b8;
4729 buf[0] = 0x38;
4730 ret = usb_microdia_control_write(dev, command, buf, 1);
4731 if(ret < 0) goto err;
4733 command = 0x118a;
4734 buf[0] = 0x04;
4735 ret = usb_microdia_control_write(dev, command, buf, 1);
4736 if(ret < 0) goto err;
4738 command = 0x0395;
4739 buf[0] = 0x04;
4740 ret = usb_microdia_control_write(dev, command, buf, 1);
4741 if(ret < 0) goto err;
4743 command = 0x11b8;
4744 buf[0] = 0x78;
4745 ret = usb_microdia_control_write(dev, command, buf, 1);
4746 if(ret < 0) goto err;
4747 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x38
4748 if(ret < 0) goto err;
4749 if (buf[0] == 0x38)
4750 buf[0] = 0x79;
4751 else if (buf[0] == 0xb8)
4752 buf[0] = 0xf9;
4753 ret = usb_microdia_control_write(dev, command, buf, 1);
4754 if(ret < 0) goto err;
4755 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x39
4756 if(ret < 0) goto err;
4757 if (buf[0] == 0x39)
4758 buf[0] = 0x7a;
4759 else if (buf[0] == 0xb9)
4760 buf[0] = 0xfa;
4761 ret = usb_microdia_control_write(dev, command, buf, 1);
4762 if(ret < 0) goto err;
4763 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3a
4764 if(ret < 0) goto err;
4765 if (buf[0] == 0x3a)
4766 buf[0] = 0x7b;
4767 else if (buf[0] == 0xba)
4768 buf[0] = 0xfb;
4769 ret = usb_microdia_control_write(dev, command, buf, 1);
4770 if(ret < 0) goto err;
4771 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3b
4772 if(ret < 0) goto err;
4773 if (buf[0] == 0x3b)
4774 buf[0] = 0x7c;
4775 else if (buf[0] == 0xbb)
4776 buf[0] = 0xfc;
4777 ret = usb_microdia_control_write(dev, command, buf, 1);
4778 if(ret < 0) goto err;
4779 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3c
4780 if(ret < 0) goto err;
4781 last_11b8[0] = buf[0];
4782 buf[0] = last_11b8[0] & 0xf0; // 0xf0 or 0x70
4783 buf[0] = buf[0] | 0x0a; // => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
4784 ret = usb_microdia_control_write(dev, command, buf, 1);
4785 if(ret < 0) goto err;
4787 buf[0] = 0x80;
4788 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_CLKRC,
4789 dev->sensor_flags, buf);
4790 if(ret < 0) goto err;
4792 /* urb 331 */
4793 buf[0] = 0x00;
4794 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCH,
4795 dev->sensor_flags, buf);
4796 if(ret < 0) goto err;
4798 buf[0] = 0x00;
4799 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCL,
4800 dev->sensor_flags, buf);
4801 if(ret < 0) goto err;
4803 buf[0] = 0x00;
4804 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNL,
4805 dev->sensor_flags, buf);
4806 if(ret < 0) goto err;
4808 /* urb 347 */
4809 buf[0] = 0x00;
4810 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNH,
4811 dev->sensor_flags, buf);
4812 if(ret < 0) goto err;
4814 buf[0] = 0x04;
4815 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MVFP,
4816 dev->sensor_flags, buf);
4817 if(ret < 0) goto err;
4819 /* is it really necessary to do this same write again?; 627f does this, too */
4820 buf[0] = 0x04;
4821 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MVFP,
4822 dev->sensor_flags, buf);
4823 if(ret < 0) goto err;
4825 /* urb 365 */
4826 command = 0x1182;
4827 buf[0] = 0x07;
4828 ret = usb_microdia_control_write(dev, command, buf, 1);
4829 if(ret < 0) goto err;
4831 buf[0] = 0x7c;
4832 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_AECH,
4833 dev->sensor_flags, buf);
4834 if(ret < 0) goto err;
4836 buf[0] = 0x03;
4837 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_COM1,
4838 dev->sensor_flags, buf);
4839 if(ret < 0) goto err;
4841 /* urb 379 */
4842 buf[0] = 0x00;
4843 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_AECHM,
4844 dev->sensor_flags, buf);
4845 if(ret < 0) goto err;
4847 buf[0] = 0x00;
4848 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_ADVFL,
4849 dev->sensor_flags, buf);
4850 if(ret < 0) goto err;
4852 /* urb 391 */
4853 buf[0] = 0x00;
4854 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_ADVFH,
4855 dev->sensor_flags, buf);
4856 if(ret < 0) goto err;
4858 /* urb 397 */
4859 buf[0] = 0x00;
4860 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_GAIN,
4861 dev->sensor_flags, buf);
4862 if(ret < 0) goto err;
4864 /* urb 403 */
4865 buf[0] = 0x78; /*buf[1] = 0x78;*/
4866 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_BLUE,
4867 dev->sensor_flags, buf);
4868 if(ret < 0) goto err;
4869 /* urb 409 */
4870 buf[0] = 0x78;
4871 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_RED,
4872 dev->sensor_flags, buf);
4873 if(ret < 0) goto err;
4874 // 627f does the last two writes at once (2 byte write to OV965X_CTL_BLUE)
4876 command = 0x118c;
4877 buf[0] = 0x20;
4878 ret = usb_microdia_control_write(dev, command, buf, 1);
4879 if(ret < 0) goto err;
4881 command = 0x118d;
4882 buf[0] = 0x20;
4883 ret = usb_microdia_control_write(dev, command, buf, 1);
4884 if(ret < 0) goto err;
4886 command = 0x118e;
4887 buf[0] = 0x20;
4888 ret = usb_microdia_control_write(dev, command, buf, 1);
4889 if(ret < 0) goto err;
4891 command = 0x118f;
4892 buf[0] = 0x20;
4893 ret = usb_microdia_control_write(dev, command, buf, 1);
4894 if(ret < 0) goto err;
4896 /* urb 423 */
4897 command = 0x11ba;
4898 buf[0] = 0x0a;
4899 ret = usb_microdia_control_write(dev, command, buf, 1);
4900 if(ret < 0) goto err;
4902 command = 0x118c;
4903 buf[0] = 0x20;
4904 ret = usb_microdia_control_write(dev, command, buf, 1);
4905 if(ret < 0) goto err;
4907 /* urb 427 */
4908 buf[0] = 0x20;
4909 command = 0x118d;
4910 ret = usb_microdia_control_write(dev, command, buf, 1);
4911 if(ret < 0) goto err;
4913 buf[0] = 0x20;
4914 command = 0x118e;
4915 ret = usb_microdia_control_write(dev, command, buf, 1);
4916 if(ret < 0) goto err;
4918 buf[0] = 0x20;
4919 command = 0x118f;
4920 ret = usb_microdia_control_write(dev, command, buf, 1);
4921 if(ret < 0) goto err;
4923 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4924 buf[0] = 0x0e;
4925 else // 624f
4926 buf[0] = 0x00;
4927 command = 0x118b;
4928 ret = usb_microdia_control_write(dev, command, buf, 1);
4929 if(ret < 0) goto err;
4931 /* urb 435 */
4932 /* Gamma control? */
4933 command = 0x1190;
4934 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4936 buf[0] = 0x08; buf[1] = 0x23; buf[2] = 0x37; buf[3] = 0x48;
4937 buf[4] = 0x59; buf[5] = 0x68; buf[6] = 0x77; buf[7] = 0x85;
4938 buf[8] = 0x93; buf[9] = 0xa1; buf[10] = 0xae; buf[11] = 0xba;
4939 buf[12] = 0xc7; buf[13] = 0xd3; buf[14] = 0xe0; buf[15] = 0xeb;
4940 buf[16] = 0xf7;
4942 else // 624f
4944 /*buf[0] = 0x0a; buf[1] = 0x37; buf[2] = 0x58; buf[3] = 0x70;
4945 buf[4] = 0x81; buf[5] = 0x8f; buf[6] = 0x9c; buf[7] = 0xa9;
4946 buf[8] = 0xb5; buf[9] = 0xbe; buf[10] = 0xc8; buf[11] = 0xd1;
4947 buf[12] = 0xda; buf[13] = 0xe2; buf[14] = 0xec; buf[15] = 0xf0;
4948 buf[16] = 0xf5;*/
4950 /* Old one */
4951 buf[0] = 0x00; buf[1] = 0x2a; buf[2] = 0x42; buf[3] = 0x56;
4952 buf[4] = 0x67; buf[5] = 0x78; buf[6] = 0x87; buf[7] = 0x95;
4953 buf[8] = 0xa2; buf[9] = 0xaf; buf[10] = 0xbc; buf[11] = 0xc8;
4954 buf[12] = 0xd4; buf[13] = 0xdf; buf[14] = 0xea; buf[15] = 0xf5;
4955 buf[16] = 0xff;
4957 ret = usb_microdia_control_write(dev, command, buf, 17);
4958 if(ret < 0) goto err;
4960 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4962 buf[0] = 0xf3; buf[1] = 0x0f; buf[2] = 0xf3; buf[3] = 0x0f;
4963 buf[4] = 0x0f; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
4964 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
4965 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
4966 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
4967 buf[20] = 0x00;
4969 else // 624f
4970 memset(buf, 0, 21);
4971 command = 0x10e1;
4972 for(i = 0; i < 8; i++)
4973 ret = usb_microdia_control_write(dev, command, buf, 21);
4975 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4977 buf[0] = 0x0f; buf[1] = 0x00; buf[2] = 0x15; buf[3] = 0x00;
4978 buf[4] = 0x1a; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
4979 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
4980 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
4981 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
4982 buf[20] = 0x00;
4984 else // 624f
4986 /* urb 453 */
4987 buf[0] = 0x15; buf[2] = 0x29;
4989 ret = usb_microdia_control_write(dev, command, buf, 21);
4990 if (ret < 0) goto err;
4992 command = 0x10f7;
4993 buf[0] = 0x05;
4994 ret = usb_microdia_control_write(dev, command, buf, 1);
4995 if(ret < 0) goto err;
4997 command = 0x10f6; // picture sharpness
4998 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
4999 buf[0] = 0x80;
5000 else // 624f
5001 buf[0] = 0x00; // 624f-log: 0xc0 !
5002 ret = usb_microdia_control_write(dev, command, buf, 1);
5003 if(ret < 0) goto err;
5005 /* urb 459 */
5006 command = 0x10e1;
5007 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5009 buf[0] = 0x0f; buf[1] = 0x00; buf[2] = 0x15; buf[3] = 0x00;
5010 buf[4] = 0x1a; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5011 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5012 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5013 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0c; buf[19] = 0x00;
5014 buf[20] = 0x00;
5016 else // 624f
5018 memset(buf, 0, 21);
5019 buf[0] = 0x15; buf[2] = 0x29; buf [4] = 0x08;
5021 ret = usb_microdia_control_write(dev, command, buf, 21);
5022 if(ret < 0) goto err;
5024 command = 0x10f8;
5025 buf[0] = 0x14;
5026 ret = usb_microdia_control_write(dev, command, buf, 1);
5027 if(ret < 0) goto err;
5029 /* urb 463 */
5030 command = 0x10fa;
5031 buf[0] = 0xff;
5032 ret = usb_microdia_control_write(dev, command, buf, 1);
5033 if(ret < 0) goto err;
5035 command = 0x10f9;
5036 buf[0] = 0x00;
5037 ret = usb_microdia_control_write(dev, command, buf, 1);
5038 if(ret < 0) goto err;
5040 /* urb 467 */
5041 command = 0x10f9;
5042 buf[0] = 0x00;
5043 ret = usb_microdia_control_write(dev, command, buf, 1);
5044 if(ret < 0) goto err;
5046 command = 0x11ba;
5047 buf[0] = 0x0e;
5048 ret = usb_microdia_control_write(dev, command, buf, 1);
5049 if(ret < 0) goto err;
5051 //memset(buf, 0, 4);
5052 command = 0x11bc;
5053 buf[0] = 0x80; buf[1] = 0x02; buf[2] = 0xe0; buf[3] = 0x01;
5054 ret = usb_microdia_control_write(dev, command, buf, 4);
5055 if(ret < 0) goto err;
5057 command = 0x11c0;
5058 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5060 buf[0] = 0x19; buf[1] = 0x31; buf[2] = 0x44; buf[3] = 0x50;
5061 buf[4] = 0x52; buf[5] = 0x56; buf[6] = 0x5b; buf[7] = 0x61;
5062 buf[8] = 0x65; buf[9] = 0x6a; buf[10] = 0x6c; buf[11] = 0x6e;
5063 buf[12] = 0x70; buf[13] = 0x72; buf[14] = 0x74; buf[15] = 0x76;
5064 buf[16] = 0x1a; buf[17] = 0x31; buf[18] = 0x44; buf[19] = 0x51;
5065 buf[20] = 0x54; buf[21] = 0x57; buf[22] = 0x5c; buf[23] = 0x61;
5066 buf[24] = 0x66; buf[25] = 0x6b; buf[26] = 0x6d; buf[27] = 0x6f;
5067 buf[28] = 0x71; buf[29] = 0x73; buf[30] = 0x75; buf[31] = 0x76;
5068 buf[32] = 0x1b; buf[33] = 0x32; buf[34] = 0x44; buf[35] = 0x50;
5069 buf[36] = 0x50; buf[37] = 0x54; buf[38] = 0x59; buf[39] = 0x5e;
5070 buf[40] = 0x63; buf[41] = 0x67; buf[42] = 0x6a; buf[43] = 0x6c;
5071 buf[44] = 0x6e; buf[45] = 0x70; buf[46] = 0x72; buf[47] = 0x73;
5073 else // 624f
5075 buf[0] = 0x10; buf[1] = 0x21; buf[2] = 0x34; buf[3] = 0x40;
5076 buf[4] =0x47; buf[5] = 0x4F; buf[6] = 0x57; buf[7] = 0x5F;
5077 buf[8] = 0x64; buf[9] = 0x68; buf[10] = 0x6D; buf[11] = 0x73;
5078 buf[12] = 0x79; buf[13] = 0x80; buf[14] = 0x89; buf[15] = 0x97;
5079 buf[16] = 0x0D; buf[17] = 0x1C; buf[18] = 0x2A; buf[19] = 0x33;
5080 buf[20] = 0x38; buf[21] = 0x3D; buf[22] = 0x44; buf[23] = 0x4A;
5081 buf[24] = 0x4E; buf[25] = 0x52; buf[26] = 0x56; buf[27] = 0x5B;
5082 buf[28] = 0x61; buf[29] = 0x68; buf[30] = 0x6F; buf[31] = 0x7A;
5083 buf[32] = 0x0D; buf[33] = 0x1A; buf[34] = 0x2A; buf[35] = 0x31;
5084 buf[36] = 0x36; buf[37] = 0x3B; buf[38] = 0x41; buf[39] = 0x47;
5085 buf[40] = 0x4A; buf[41] = 0x4E; buf[42] = 0x53; buf[43] = 0x58;
5086 buf[44] = 0x5D; buf[45] = 0x64; buf[46] = 0x6B; buf[47] = 0x76;
5088 ret = usb_microdia_control_write(dev, command, buf, 48);
5090 command = 0x118c;
5091 buf[0] = 0x20;
5092 ret = usb_microdia_control_write(dev, command, buf, 1);
5093 if(ret < 0) goto err;
5095 /* urb 477 */
5096 command = 0x118d;
5097 buf[0] = 0x20;
5098 ret = usb_microdia_control_write(dev, command, buf, 1);
5099 if(ret < 0) goto err;
5101 command = 0x118e;
5102 buf[0] = 0x20;
5103 ret = usb_microdia_control_write(dev, command, buf, 1);
5104 if(ret < 0) goto err;
5106 command = 0x118f;
5107 buf[0] = 0x20;
5108 ret = usb_microdia_control_write(dev, command, buf, 1);
5109 if(ret < 0) goto err;
5111 /* urb 483 */
5112 command = 0x11a5;
5113 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
5114 buf[4] = 0x04; buf[5] = 0x3f;
5115 ret = usb_microdia_control_write(dev, command, buf, 6);
5116 if(ret < 0) goto err;
5118 /* urb 485 */
5119 command = 0x11af;
5120 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
5121 ret = usb_microdia_control_write(dev, command, buf, 4);
5122 if(ret < 0) goto err;
5124 command = 0x11b3;
5125 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
5126 ret = usb_microdia_control_write(dev, command, buf, 4);
5127 if(ret < 0) goto err;
5129 /* urb 489 */
5130 command = 0x10e0;
5131 buf[0] = 0x07;
5132 ret = usb_microdia_control_write(dev, command, buf, 1);
5133 if(ret < 0) goto err;
5135 command = 0x1061;
5136 buf[0] = 0x01;
5137 ret = usb_microdia_control_write(dev, command, buf, 1);
5138 if(ret < 0) goto err;
5140 command = 0x10e0;
5141 buf[0] = 0x27;
5142 ret = usb_microdia_control_write(dev, command, buf, 1);
5143 if(ret < 0) goto err;
5146 //////////////////////////////////////////////////////////////////////
5147 /* urb 495 */
5148 command = 0x1100;
5149 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
5150 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
5151 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
5152 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
5153 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
5154 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
5155 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
5156 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
5157 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
5158 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
5159 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
5160 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
5161 buf[48] = 0x4f; buf[49] = 0x54; buf[50] = 0x58; buf[51] = 0x58;
5162 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
5163 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x54; buf[59] = 0x64;
5164 buf[60] = 0x4b; buf[61] = 0x54; buf[62] = 0x58; buf[63] = 0x54;
5165 ret = usb_microdia_control_write(dev, command, buf, 64);
5166 if(ret < 0) goto err;
5168 command = 0x1140;
5169 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
5170 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
5171 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x54; buf[11] = 0x36;
5172 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x54; buf[15] = 0x54;
5173 buf[16] = 0x54; buf[17] = 0x54; buf[18] = 0x54; buf[19] = 0x54;
5174 buf[20] = 0x54; buf[21] = 0x54; buf[22] = 0x54; buf[23] = 0x54;
5175 buf[24] = 0x54; buf[25] = 0x54; buf[26] = 0x54; buf[27] = 0x54;
5176 buf[28] = 0x54; buf[29] = 0x54; buf[30] = 0x54; buf[31] = 0x54;
5177 buf[32] = 0x54; buf[33] = 0x54; buf[34] = 0x54; buf[35] = 0x54;
5178 buf[36] = 0x54; buf[37] = 0x54; buf[38] = 0x54; buf[39] = 0x54;
5179 buf[40] = 0x54; buf[41] = 0x54; buf[42] = 0x54; buf[43] = 0x54;
5180 buf[44] = 0x54; buf[45] = 0x54; buf[46] = 0x54; buf[47] = 0x54;
5181 buf[48] = 0x54; buf[49] = 0x54; buf[50] = 0x54; buf[51] = 0x54;
5182 buf[52] = 0x54; buf[53] = 0x54; buf[54] = 0x54; buf[55] = 0x54;
5183 buf[56] = 0x54; buf[57] = 0x54; buf[58] = 0x54; buf[59] = 0x54;
5184 buf[60] = 0x54; buf[61] = 0x54; buf[62] = 0x54; buf[63] = 0x54;
5185 ret = usb_microdia_control_write(dev, command, buf, 64);
5186 if(ret < 0) goto err;
5188 /* urb 499 */
5189 command = 0x10e0;
5190 buf[0] = 0x07;
5191 ret = usb_microdia_control_write(dev, command, buf, 1);
5192 if(ret < 0) goto err;
5194 command = 0x1061;
5195 buf[0] = 0x03;
5196 ret = usb_microdia_control_write(dev, command, buf, 1);
5197 if(ret < 0) goto err;
5199 /* urb 503 */
5200 command = 0x10e0;
5201 buf[0] = 0x0b;
5202 ret = usb_microdia_control_write(dev, command, buf, 1);
5203 if(ret < 0) goto err;
5205 command = 0x1189;
5206 buf[0] = 0x8c;
5207 ret = usb_microdia_control_write(dev, command, buf, 1);
5208 if(ret < 0) goto err;
5210 buf[0] = 0x40;
5211 command = 0x11bc;
5212 ret = usb_microdia_control_write(dev, command, buf, 1);
5213 if(ret < 0) goto err;
5215 buf[0] = 0x01;
5216 command = 0x11bd;
5217 ret = usb_microdia_control_write(dev, command, buf, 1);
5218 if(ret < 0) goto err;
5220 buf[0] = 0xf0;
5221 command = 0x11be;
5222 ret = usb_microdia_control_write(dev, command, buf, 1);
5223 if(ret < 0) goto err;
5225 buf[0] = 0x00;
5226 command = 0x11bf;
5227 ret = usb_microdia_control_write(dev, command, buf, 1);
5228 if(ret < 0) goto err;
5230 /* urb 515 */
5231 command = 0x1180;
5232 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x07; buf[3] = 0x00;
5233 buf[4] = 0x28; buf[5] = 0x3c;
5234 ret = usb_microdia_control_write(dev, command, buf, 6);
5235 if(ret < 0) goto err;
5237 command = 0x10fb;
5238 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5239 buf[4] = 0x00;
5240 ret = usb_microdia_control_write(dev, command, buf, 5);
5241 if(ret < 0) goto err;
5243 command = 0x1189;
5244 buf[0] = 0x8c;
5245 ret = usb_microdia_control_write(dev, command, buf, 1);
5246 if(ret < 0) goto err;
5248 command = 0x11a1;
5249 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
5250 ret = usb_microdia_control_write(dev, command, buf, 4);
5251 if(ret < 0) goto err;
5253 /* 523 */
5254 command = 0x11ab;
5255 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
5256 ret = usb_microdia_control_write(dev, command, buf, 4);
5257 if(ret < 0) goto err;
5259 command = 0x1061;
5260 buf[0] = 0x03;
5261 ret = usb_microdia_control_write(dev, command, buf, 1);
5262 if(ret < 0) goto err;
5264 command = 0x11ba;
5265 buf[0] = 0x0e;
5266 ret = usb_microdia_control_write(dev, command, buf, 1);
5267 if(ret < 0) goto err;
5269 command = 0x11b9;
5270 buf[0] = 0x00;
5271 ret = usb_microdia_control_write(dev, command, buf, 1);
5272 if(ret < 0) goto err;
5274 command = 0x11ba;
5275 buf[0] = 0x0f;
5276 ret = usb_microdia_control_write(dev, command, buf, 1);
5277 if(ret < 0) goto err;
5279 command = 0x1061;
5280 buf[0] = 0x01;
5281 ret = usb_microdia_control_write(dev, command, buf, 1);
5282 if(ret < 0) goto err;
5284 command = 0x1000;
5285 buf[0] = 0x78;
5286 ret = usb_microdia_control_write(dev, command, buf, 1);
5287 if(ret < 0) goto err;
5289 command = 0x1002;
5290 buf[0] = 0x18;
5291 ret = usb_microdia_control_write(dev, command, buf, 1);
5292 if(ret < 0) goto err;
5294 /* urb 539 */
5295 command = 0x1002;
5296 buf[0] = 0x18;
5297 ret = usb_microdia_control_write(dev, command, buf, 1);
5298 if(ret < 0) goto err;
5300 command = 0x11b8;
5301 buf[0] = 0x7a;
5302 ret = usb_microdia_control_write(dev, command, buf, 1);
5303 if(ret < 0) goto err;
5305 command = 0x118a;
5306 buf[0] = 0x04;
5307 ret = usb_microdia_control_write(dev, command, buf, 1);
5308 if(ret < 0) goto err;
5310 /* urb 545 */
5311 command = 0x0395;
5312 buf[0] = 0x04;
5313 ret = usb_microdia_control_write(dev, command, buf, 1);
5314 if(ret < 0) goto err;
5316 command = 0x11b8;
5317 if (last_11b8[0] == 0x3c)
5318 buf[0] = 0x78;
5319 else if (last_11b8[0] == 0xbc)
5320 buf[0] = 0xf8;
5321 ret = usb_microdia_control_write(dev, command, buf, 1);
5322 if(ret < 0) goto err;
5323 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0xb8 627f: 0x38
5324 if(ret < 0) goto err;
5325 if (buf[0] == 0x38)
5326 buf[0] = 0x79;
5327 else if (buf[0] == 0xb8)
5328 buf[0] = 0xf9;
5329 ret = usb_microdia_control_write(dev, command, buf, 1);
5330 if(ret < 0) goto err;
5331 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0xb9 627f: 0x39
5332 if(ret < 0) goto err;
5333 if (buf[0] == 0x39)
5334 buf[0] = 0x7a;
5335 else if (buf[0] == 0xb9)
5336 buf[0] = 0xfa;
5337 ret = usb_microdia_control_write(dev, command, buf, 1);
5338 if(ret < 0) goto err;
5339 ret = usb_microdia_control_read(dev, command, buf, 1); // 0x3a
5340 if(ret < 0) goto err;
5341 if (buf[0] == 0x3a)
5342 buf[0] = 0x7b;
5343 else if (buf[0] == 0xba)
5344 buf[0] = 0xfb;
5345 ret = usb_microdia_control_write(dev, command, buf, 1);
5346 if(ret < 0) goto err;
5347 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0x3b 627f: 0xbb
5348 if(ret < 0) goto err;
5349 if (buf[0] == 0x3b)
5350 buf[0] = 0x7c;
5351 else if (buf[0] == 0xbb)
5352 buf[0] = 0xfc;
5353 ret = usb_microdia_control_write(dev, command, buf, 1);
5354 if(ret < 0) goto err;
5355 ret = usb_microdia_control_read(dev, command, buf, 1); // 624f: 0x3c 627f: 0xbc
5356 if(ret < 0) goto err;
5357 buf[0] = buf[0] & 0xf0; // 0xf0 or 0x70
5358 if (dev->webcam_model == CAMERA_MODEL(USB_0C45_VID, USB_627F_PID))
5359 buf[0] = buf[0] | 0x09; // THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
5360 else // 624f
5361 buf[0] = buf[0] | 0x08; // THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 5 READS/WRITES
5362 ret = usb_microdia_control_write(dev, command, buf, 1);
5363 if(ret < 0) goto err;
5365 buf[0] = 0x80;
5366 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_CLKRC,
5367 dev->sensor_flags, buf);
5368 if(ret < 0) goto err;
5370 buf[0] = 0x00;
5371 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCH,
5372 dev->sensor_flags, buf);
5373 if(ret < 0) goto err;
5375 /* urb 581 */
5376 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_EXHCL,
5377 dev->sensor_flags, buf);
5378 if(ret < 0) goto err;
5380 /* urb 587 */
5381 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNL,
5382 dev->sensor_flags, buf);
5383 if(ret < 0) goto err;
5385 /* urb 593 */
5386 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_DM_LNH,
5387 dev->sensor_flags, buf);
5388 if(ret < 0) goto err;
5390 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_PID,
5391 dev->sensor_flags, buf);
5392 /* returns 96, no idea what we're supposed to do with it */
5393 if(ret < 0) goto err;
5394 //msg("sensor pid, should be 0x96: %x", buf[0]);
5396 /* urb 609 */
5397 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_VER,
5398 dev->sensor_flags, buf);
5399 /* returns 52, no idea what we're supposed to do with it */
5400 if(ret < 0) goto err;
5401 //msg("sensor ver, should be 0x52: %x", buf[0]);
5403 /* urb 619 */
5404 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MIDH,
5405 dev->sensor_flags, buf);
5406 /* returns 7f, no idea what we're supposed to do with it */
5407 if(ret < 0) goto err;
5408 //msg("sensor midh, should be 0x7f: %x", buf[0]);
5410 /* urb 629 */
5411 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, OV965X_CTL_MIDL,
5412 dev->sensor_flags, buf);
5413 /* returns a2, no idea what we're supposed to do with it */
5414 if(ret < 0) goto err;
5415 //msg("sensor midl, should be 0xa2: %x", buf[0]);
5417 command = 0x1061;
5418 buf[0] = 0x03;
5419 ret = usb_microdia_control_write(dev, command, buf, 1);
5420 if(ret < 0) goto err;
5421 //////////////////////////////////////////////////////////////////////////////////
5422 //STREAM STARTED!
5423 //////////////////////////////////////////////////////////////////////////////////
5425 /* --- ADJUSTMENTS OF SHARPNESS, COLORS, CONTRAST, BRIGHTNESS ---
5426 * SHOULD BE REMOVED (writes to 0x10e1 and 0x10f6 are done again afterwards by dev_microdia_camera_settings() )
5427 * => NOT done by device 627f
5428 * => NOT in the 624f-log from 15-feb-08 at files.zenum.net
5431 command = 0x10f6;
5432 buf[0] = 0x80;
5433 ret = usb_microdia_control_write(dev, command, buf, 1);
5434 if(ret < 0) goto err;
5436 command = 0x10e1;
5437 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5438 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5439 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5440 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xDD ; buf[15] = 0x0F;
5441 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5442 buf[20] = 0x00;
5443 ret = usb_microdia_control_write(dev, command, buf, 21);
5444 if(ret < 0) goto err;
5446 buf[0] = 0x7d; buf[1] = 0x00;
5447 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x2d,
5448 dev->sensor_flags, buf);
5450 buf[0] = 0x0f;
5451 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x00,
5452 dev->sensor_flags, buf);
5454 // urb 679
5455 command = 0x10e1;
5456 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5457 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5458 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5459 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xDD ; buf[15] = 0x0F;
5460 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5461 buf[20] = 0x00;
5462 ret = usb_microdia_control_write(dev, command, buf, 21);
5463 if(ret < 0) goto err;
5465 // These 2 regs controls brightness of image
5466 // (night mode or something like that)
5468 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x2d,
5469 dev->sensor_flags, buf);
5470 //msg("Old brightness value: %x %x", buf[0], buf[1]);
5471 buf[0] = 0x00; buf[1] = 0x04;
5472 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x2d,
5473 dev->sensor_flags, buf);
5475 // urb 743
5476 command = 0x10f6;
5477 buf[0] = 0x74;
5478 ret = usb_microdia_control_write(dev, command, buf, 1);
5480 // urb 745
5481 command = 0x10e1;
5482 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00;
5483 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xF7; buf[7] = 0x0F;
5484 buf[8] = 0xC2; buf[9] = 0x0F; buf[10] = 0x47; buf[11] = 0x00;
5485 buf[12] = 0x36; buf[13] = 0x00; buf[14] = 0xdd ; buf[15] = 0x0F;
5486 buf[16] = 0xEE; buf[17] = 0x0F; buf[18] = 0x00; buf[19] = 0x00;
5487 buf[20] = 0x00;
5488 ret = usb_microdia_control_write(dev, command, buf, 21);
5489 if(ret < 0) goto err;
5490 return ret;
5492 buf[0] = 0xe8;
5493 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x01,
5494 dev->sensor_flags, buf);
5495 // THIS WRITE WILL NEVER BE DONE, because function returned before
5497 return 0;
5499 err:
5500 UDIA_ERROR("start stream: command %x failed (%d)!\n", command, ret);
5501 return ret;
5504 int microdia_6260_start_stream(struct usb_microdia *dev)
5506 int ret;
5507 __u8 buf[32];
5509 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
5510 buf[0] = 0x1f;
5511 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
5512 buf[0] = 0x00;
5513 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
5514 buf[0] = 0x20;
5515 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
5516 buf[0] = 0x00;
5517 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
5518 buf[0] = 0x78;
5519 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5520 buf[0] = 0xc7;
5521 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5522 buf[0] = 0x18;
5523 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5524 buf[0] = 0x01;
5525 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5526 buf[0] = 0x80;
5527 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
5529 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10;
5530 buf[4] = 0x08;
5531 ret = usb_microdia_control_write(dev, 0x1067, buf, 5);
5533 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
5534 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5535 buf[8] = 0x03;
5536 ret = usb_microdia_control_write(dev, 0x10c0, buf, 9);
5538 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
5539 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
5540 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
5541 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
5542 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
5543 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
5544 ret = usb_microdia_control_write(dev, 0x10e0, buf, 24);
5546 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
5547 ret = usb_microdia_control_write(dev, 0x10f8, buf, 3);
5549 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0;
5550 buf[4] = 0x00;
5551 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5553 buf[0] = 0x8a; buf[1] = 0x8c; buf[2] = 0x08;
5554 ret = usb_microdia_control_write(dev, 0x1188, buf, 3);
5556 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
5557 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
5558 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
5559 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
5560 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
5561 buf[20] = 0xf4; buf[21] = 0xff;
5562 ret = usb_microdia_control_write(dev, 0x118b, buf, 22);
5564 buf[0] = 0x00; buf[1] = 0x00;
5565 ret = usb_microdia_control_write(dev, 0x11a1, buf, 2);
5567 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x00;
5568 buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0;
5569 buf[8] = 0x00;
5570 ret = usb_microdia_control_write(dev, 0x11b7, buf, 9);
5572 buf[0] = 0x78;
5573 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5575 buf[0] = 0x38;
5576 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5578 ret = ov7670_initialise(dev);
5580 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1, 0x3b, dev->sensor_flags, buf);
5581 ret = usb_microdia_control_read(dev, 0x10c1, buf, 1);
5582 buf[0] = 0x50;
5583 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
5585 /* TRY TO READ FROM EEPROM: */
5586 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, dev->sensor_flags, buf);
5587 if (ret < 0)
5588 UDIA_INFO("No EEPROM found\n");
5589 else
5590 UDIA_INFO("Read from EEPROM successful\n");
5592 buf[0] = 0x21;
5593 ret = usb_microdia_control_write(dev, 0x10c1, buf, 1);
5594 buf[0] = 0x45;
5595 ret = usb_microdia_control_write(dev, 0x10e0, buf, 1);
5596 buf[0] = 0xc6;
5597 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5598 buf[0] = 0xc4;
5599 ret = usb_microdia_control_write(dev, 0x1001, buf, 1);
5601 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5602 buf[4] = 0x50; buf[5] = 0x3c;
5603 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
5605 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
5606 buf[4] = 0x01;
5607 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5609 buf[0] = 0x80;
5610 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
5612 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
5613 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
5615 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
5616 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
5617 buf[0] = 0x78;
5618 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5619 buf[0] = 0x10;
5620 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5621 buf[0] = 0x00;
5622 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5623 buf[0] = 0x38;
5624 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5625 buf[0] = 0x04;
5626 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
5627 buf[0] = 0x04;
5628 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
5629 buf[0] = 0x78;
5630 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5631 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5632 buf[0] = 0xf9;
5633 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5634 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5635 buf[0] = 0xfa;
5636 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5637 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5638 buf[0] = 0x7b;
5639 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5640 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5641 buf[0] = 0x7c;
5642 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5643 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5644 buf[0] = 0x7d;
5645 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5646 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5647 buf[0] = 0x7b;
5648 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5650 /* OV7670 Intialise Part 2 */
5651 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00;
5652 buf[4] = 0x50; buf[5] = 0x3c;
5653 ret = usb_microdia_control_write(dev, 0x1180, buf, 6);
5655 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x00; buf[3] = 0xf0;
5656 buf[4] = 0x01;
5657 ret = usb_microdia_control_write(dev, 0x10fb, buf, 5);
5659 buf[0] = 0x80;
5660 ret = usb_microdia_control_write(dev, 0x1189, buf, 1);
5662 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0x50;
5663 ret = usb_microdia_control_write(dev, 0x11a1, buf, 4);
5665 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x3c;
5666 ret = usb_microdia_control_write(dev, 0x11ab, buf, 4);
5668 buf[0] = 0x03;
5669 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5670 buf[0] = 0x01;
5671 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5672 buf[0] = 0x78;
5673 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
5674 buf[0] = 0x00;
5675 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5676 buf[0] = 0x00;
5677 ret = usb_microdia_control_write(dev, 0x1002, buf, 1);
5678 buf[0] = 0x7b;
5679 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5680 buf[0] = 0x04;
5681 ret = usb_microdia_control_write(dev, 0x118a, buf, 1);
5682 buf[0] = 0x04;
5683 ret = usb_microdia_control_write(dev, 0x0395, buf, 1);
5684 buf[0] = 0x78;
5685 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5686 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5687 buf[0] = 0x79;
5688 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5689 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5690 buf[0] = 0x7a;
5691 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5692 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5693 buf[0] = 0x7b;
5694 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5695 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5696 buf[0] = 0x7c;
5697 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5698 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5699 buf[0] = 0x7d;
5700 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5701 ret = usb_microdia_control_read(dev, 0x11b8, buf, 1);
5702 buf[0] = 0xfa;
5703 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
5705 /* OV7670 Initialisation Part 3 Goes Here */
5706 buf[0] = 0x03;
5707 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
5709 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5710 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5711 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5712 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5713 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5714 buf[20] = 0x00;
5715 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5717 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5718 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5719 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5720 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5721 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5722 buf[20] = 0x00;
5723 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5725 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5726 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5727 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5728 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5729 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5730 buf[20] = 0x00;
5731 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5733 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
5734 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5735 buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00;
5736 buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00;
5737 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x0a; buf[19] = 0x00;
5738 buf[20] = 0x00;
5739 ret = usb_microdia_control_write(dev, 0x10e1, buf, 21);
5741 return ret;
5745 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
5747 * @param dev
5749 * @returns 0 (ok) or -1 (error)
5751 * @author Comer352l
5753 * Windows driver versions: 5.7.23.000
5754 * Windows versions: 2000 and XP
5755 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
5756 * All logs were made using AMCAP with 640x480, RGB24
5758 int microdia_6270_start_stream(struct usb_microdia *dev)
5760 __u8 buf[64];
5761 __u8 last_11b8[1];
5762 int k;
5763 int retI2C;
5765 // Check if sensor slave address is valid:
5766 if ((dev->sensor_slave_address != MT9V111_I2C_SLAVE_ADDRESS) && (dev->sensor_slave_address != MT9V011_I2C_SLAVE_ADDRESS))
5768 UDIA_INFO("microdia_6270_start_stream(): Invalid sensor slave address !\n");
5769 return -1;
5772 // <= INTERRUPT COMING BACK (URB 1953)
5773 // SWITCH TO ALTERNATE SETTINGS 8 (URB 1954) // NOT IN ALEX'S LOG
5774 // => INTERRUPT GOING DOWN (URB 1955)
5776 buf[0] = 0x00;
5777 usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 1956
5779 // <= INTERRUPT COMING BACK (URB 1955)
5780 // => INTERRUPT GOING DOWN (URB 1957)
5782 buf[0] = 0x78;
5783 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 1958
5784 buf[0] = 0xc7;
5785 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 1959
5786 buf[0] = 0x18;
5787 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 1960
5788 buf[0] = 0x01;
5789 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 1961
5790 buf[0] = 0x80;
5791 usb_microdia_control_write(dev, 0x1020, buf, 1); // URB 1962
5792 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
5793 usb_microdia_control_write(dev, 0x1067, buf, 5); // URB 1963
5795 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5796 // STRANGE I2C MESSAGE:
5797 // - 9 bytes
5798 // - byte 8 = 0x00 at first start + first cycle
5799 // - procedure not complete: no wait/check for ack/error, no readout of 0x10c2
5800 // - dummy writes at first cycle and read at second cycle, but there are many I2C messages in the meantime, so this should not work
5802 // AT FIRST START + FIRST CYCLE:
5803 buf[0] = 0x80; buf[1] = dev->sensor_slave_address; buf[2] = 0x00; buf[3] = 0x00;
5804 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x03;
5805 // AT ALL FURTHER STARTS + FIRST CYCLE:
5806 //MT9V111: I2C MESSAGE => IFP Register 0x33: Auto exposure
5807 //buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x33; buf[3] = 0x00;
5808 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5809 //MT9V011: ?????????????????????????
5810 //buf[0] = 0x90; buf[1] = dev->sensor_slave_address; buf[2] = 0x07; buf[3] = 0x00;
5811 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5812 // ALWAYS AT 2nd AND FURTHER CYCLES:
5813 //MT9V111:
5814 //buf[0] = 0xa2; buf[1] = 0x5c; buf[2] = 0x00; buf[3] = 0x36;
5815 //buf[4] = 0x00; buf[5] = 0x82; buf[6] = 0x3a; buf[7] = 0x10; buf[8] = 0x03;
5816 // => buf[3] to buf[6] simply contain bytes read with URB 2215
5817 //MT9V011:
5818 //buf[0] = 0xb0; buf[1] = 0x5d; buf[2] = 0x07; buf[3] = 0x00;
5819 //buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10; buf[8] = 0x03;
5820 usb_microdia_control_write(dev, 0x10c0, buf, 9); // URB 1964
5821 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5823 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30;
5824 buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed;
5825 buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a;
5826 buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0;
5827 buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
5828 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
5829 usb_microdia_control_write(dev, 0x10e0, buf, 24); // URB 1965
5830 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
5831 usb_microdia_control_write(dev, 0x10f8, buf, 3); // URB 1966
5832 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
5833 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 1967
5834 buf[0] = 0x06; buf[1] = 0x0c; buf[2] = 0x08;
5835 usb_microdia_control_write(dev, 0x1188, buf, 3); // URB 1968
5836 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20;
5837 buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b;
5838 buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80;
5839 buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8;
5840 buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
5841 buf[20] = 0xf4; buf[21] = 0xff;
5842 usb_microdia_control_write(dev, 0x118b, buf, 22); // URB 1969
5843 buf[0] = 0x00; buf[1] = 0x00;
5844 usb_microdia_control_write(dev, 0x11a1, buf, 2); // URB 1970
5845 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08;
5846 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
5847 buf[8] = 0x00;
5848 usb_microdia_control_write(dev, 0x11b7, buf, 9); // URB 1971
5849 buf[0] = 0x38;
5850 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 1972
5851 buf[0] = 0x78;
5852 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 1973
5854 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
5855 // I2C MESSAGES
5856 retI2C = 0;
5857 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
5859 // Write to IFP register 0x0d: Color Correction Register 8
5860 buf[0] = 0x00; buf[1] = 0x01;
5861 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); // URBs 1974-1976
5862 // Write to IFP register 0x0d: Color Correction Register 8
5863 buf[0] = 0x00; buf[1] = 0x00; // ???
5864 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf); // URBs 1977-1979
5865 // Writes to IFP registers 0x01: Register Address Space Selection
5866 // 0x02: Color Correction Register 1
5867 buf[0] = 0x00; buf[1] = 0x01; // select IFP address space
5868 buf[2] = 0x00; buf[3] = 0x16; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5869 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); // URBs 1980-1982
5870 // Writes to IFP registers 0x03: Color Correction Register 3
5871 // 0x04: Color Correction Register 4
5872 buf[0] = 0x01; buf[1] = 0xe1; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5873 buf[2] = 0x02; buf[3] = 0x81; // ??? // AT FIRST START + FIRST CYCLE: 0x00 0x00
5874 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); // URBs 1983-1985
5875 // Writes to IFP registers 0x05: Aperture Correction (Sharpening)
5876 // 0x06: Operating Mode Control
5877 buf[0] = 0x00; buf[1] = 0x04; // 100% sharpening, no automatic sharpness reduction at low light // AT FIRST START + FIRST CYCLE: 0x00 0x00: no sharpening
5878 buf[2] = 0x00; buf[3] = 0x00; // stop AWB at the current values, no on-the-fly defect correction, no auto exposure, + RESREVED option
5879 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); // URBs 1986-1988
5880 // Writes to IFP registers 0x07: Image Flow Processor Soft Reset
5881 // 0x08: Output Format Control
5882 buf[0] = 0x30; buf[1] = 0x02; // reset // AT FIRST START + FIRST CYCLE: 0x00 0x00
5883 buf[2] = 0x04; buf[3] = 0x80; // bypass entire image processing, raw 8+2 Bayer data output directly
5884 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); // URBs 1989-1991
5885 // "Dummy" write to IFP Register 0x11: Color Correction Register 12
5886 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); // URBs 1992-1993
5887 // Write to register 0x01: Register address space selection
5888 // Write to sensor register 0x02: Column Start
5889 buf[0] = 0x00; buf[1] = 0x04; // select sensor address space
5890 buf[2] = 0x00; buf[3] = 0x16; // start with column 22
5891 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf); // URBs 1994-1996
5892 // Writes to sensor registers 0x03: Window Height
5893 // 0x04: Window Width
5894 buf[0] = 0x01; buf[1] = 0xe6; // 486
5895 buf[2] = 0x02; buf[3] = 0x86; // 646
5896 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf); // URBs 1997-1999
5897 // Writes to sensor registers 0x05: Horizontal Blanking
5898 // 0x06: Vertical Blanking
5899 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00
5900 buf[2] = 0x00; buf[3] = 0x00; // 0 rows
5901 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf); // URBs 2000-2002
5902 // Writes to sensor registers 0x07: Output Control
5903 // 0x08: Row Start
5904 buf[0] = 0x30; buf[1] = 0x02; // normal operation + chip enable + RESERVED options
5905 buf[2] = 0x00; buf[3] = 0x08; // row 8
5906 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x07, dev->sensor_flags, buf); // URBs 2003-2005
5907 // "Dummy" write to sensor Register 0x11: UNDOCUMENTED
5908 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x11, dev->sensor_flags, NULL); // URBs 2006-2007
5909 // Writes to sensor registers 0x0c: Shutter Delay
5910 // 0x0d: Reset (Soft) (from MT9V011 datasheet)
5911 buf[0] = 0x00; buf[1] = 0x00; // 0 master clocks
5912 buf[2] = 0x00; buf[3] = 0x00; // return to normal operation
5913 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf); // URBs 2008-2010
5914 // Writes to sensor registers 0x0e: UNDOCUMENTED
5915 // 0x0f: UNDOCUMENTED
5916 buf[0] = 0x00; buf[1] = 0x00;
5917 buf[2] = 0x00; buf[3] = 0x00;
5918 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf); // URBs 2011-2013
5919 // Writes to sensor registers 0x10: UNDOCUMENTED
5920 // 0x11: UNDOCUMENTED
5921 buf[0] = 0x00; buf[1] = 0x00;
5922 buf[2] = 0x00; buf[3] = 0x00;
5923 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf); // URBs 2014-2016
5924 // Writes to sensor registers 0x12: 2X Zoom Col Start => 0x1e bit 0 must be set to activate zoom
5925 // 0x13: 2X Zoom Row Start => 0x1e bit 0 must be set to activate zoom
5926 buf[0] = 0x00; buf[1] = 0xb0; // column 176
5927 buf[2] = 0x00; buf[3] = 0x7c; // row 124
5928 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf); // URBs 2017-2018
5929 // Writes to sensor registers 0x14: UNDOCUMENTED
5930 // 0x15: UNDOCUMENTED
5931 buf[0] = 0x00; buf[1] = 0x00;
5932 buf[2] = 0x00; buf[3] = 0x00;
5933 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf); // URBs 2019-2021
5934 // Writes to sensor registers 0x16: UNDOCUMENTED
5935 // 0x17: UNDOCUMENTED
5936 buf[0] = 0x00; buf[1] = 0x00;
5937 buf[2] = 0x00; buf[3] = 0x00;
5938 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf); // URBs 2022-2024
5939 // Writes to sensor registers 0x18: UNDOCUMENTED
5940 // 0x19: UNDOCUMENTED
5941 buf[0] = 0x00; buf[1] = 0x00;
5942 buf[2] = 0x00; buf[3] = 0x00;
5943 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf); // URBs 2025-2027
5944 // Writes to sensor registers 0x1a: UNDOCUMENTED
5945 // 0x1b: UNDOCUMENTED
5946 buf[0] = 0x00; buf[1] = 0x00;
5947 buf[2] = 0x00; buf[3] = 0x00;
5948 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf); // URBs 2028-2030
5949 // Writes to sensor registers 0x1c: UNDOCUMENTED
5950 // 0x1d: UNDOCUMENTED
5951 buf[0] = 0x00; buf[1] = 0x00;
5952 buf[2] = 0x00; buf[3] = 0x00;
5953 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf); // URBs 2031-2033
5954 // Write to sensor register 0x30: RESERVED
5955 buf[0] = 0x00; buf[1] = 0x00;
5956 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x30, dev->sensor_flags, buf); // URBs 2034-2036
5957 // Write to sensor register 0x20: Read Mode
5958 buf[0] = 0x00; buf[1] = 0x00; // normal readout
5959 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2037-2039
5960 // Writes to sensor registers 0x30: RESERVED
5961 // 0x31: RESERVED
5962 buf[0] = 0x00; buf[1] = 0x05;
5963 buf[2] = 0x00; buf[3] = 0x00;
5964 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x30, dev->sensor_flags, buf); // URBs 2040-2042
5965 // "Dummy" write to sensor Register 0x34: RESERVED
5966 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x34, dev->sensor_flags, NULL); // URBs 2043-2044
5968 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
5970 // Write to sensor register 0x07: Output Control
5971 buf[0] = 0x00; buf[1] = 0x02; // chip enable, normal operation
5972 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
5973 // Write to sensor register 0x0d: Soft Reset
5974 buf[0] = 0x00; buf[1] = 0x01; // reset
5975 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
5976 // Write to sensor register 0x0d: Soft Reset
5977 buf[0] = 0x00; buf[1] = 0x00; // resume operation
5978 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
5979 // Writes to sensor registers 0x01: Row start
5980 // 0x02: Column Start
5981 buf[0] = 0x00; buf[1] = 0x08; // start with row 8
5982 buf[2] = 0x00; buf[3] = 0x16; // start with column 22
5983 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x01, dev->sensor_flags, buf);
5984 // Writes to sensor registers 0x03: Window Height
5985 // 0x04: Window Width
5986 buf[0] = 0x01; buf[1] = 0xe1; // 481
5987 buf[2] = 0x02; buf[3] = 0x81; // 641
5988 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x03, dev->sensor_flags, buf);
5989 // Writes to sensor registers 0x05: Horizontal Blanking
5990 // 0x06: Vertical Blanking
5991 buf[0] = 0x00; buf[1] = 0x83; // 131 columns (pixel clocks)
5992 buf[2] = 0x00; buf[3] = 0x06; // 6 rows
5993 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x05, dev->sensor_flags, buf);
5994 // Write to sensor register 0x0d: Soft Reset
5995 buf[0] = 0x00; buf[1] = 0x02; // UNKNOWN
5996 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0d, dev->sensor_flags, buf);
5997 // Writes to sensor registers 0x0a: Pixel Clock Speed
5998 // 0x0b: Frame Restart
5999 buf[0] = 0x00; buf[1] = 0x00; // default
6000 buf[2] = 0x00; buf[3] = 0x00; // (has no effect/no restart)
6001 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0a, dev->sensor_flags, buf);
6002 // Writes to sensor registers 0x0c: Shutter Delay
6003 // 0x0d: Soft Reset
6004 buf[0] = 0x00; buf[1] = 0x00; // 0 master clocks
6005 buf[2] = 0x00; buf[3] = 0x00; // resume operation
6006 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0c, dev->sensor_flags, buf);
6007 // Writes to sensor registers 0x0e: UNDOCUMENTED
6008 // 0x0f: UNDOCUMENTED
6009 buf[0] = 0x00; buf[1] = 0x00;
6010 buf[2] = 0x00; buf[3] = 0x00;
6011 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x0e, dev->sensor_flags, buf);
6012 // Writes to sensor registers 0x10: UNDOCUMENTED
6013 // 0x11: UNDOCUMENTED
6014 buf[0] = 0x00; buf[1] = 0x00;
6015 buf[2] = 0x00; buf[3] = 0x00;
6016 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x10, dev->sensor_flags, buf);
6017 // Writes to sensor registers 0x12: 2X Zoom Column Start (from MT9V111 datasheet)
6018 // 0x13: 2X Zoom Row Start (from MT9V111 datasheet)
6019 buf[0] = 0x00; buf[1] = 0x00; // column 0 => bit0 of reg 0x1e must be set to activate zoom
6020 buf[2] = 0x00; buf[3] = 0x00; // row 0 => bit0 of reg 0x1e must be set to activate zoom
6021 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x12, dev->sensor_flags, buf);
6022 // Writes to sensor registers 0x14: UNDOCUMENTED
6023 // 0x15: UNDOCUMENTED
6024 buf[0] = 0x00; buf[1] = 0x00;
6025 buf[2] = 0x00; buf[3] = 0x00;
6026 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x14, dev->sensor_flags, buf);
6027 // Writes to sensor registers 0x16: UNDOCUMENTED
6028 // 0x17: UNDOCUMENTED
6029 buf[0] = 0x00; buf[1] = 0x00;
6030 buf[2] = 0x00; buf[3] = 0x00;
6031 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x16, dev->sensor_flags, buf);
6032 // Writes to sensor registers 0x18: UNDOCUMENTED
6033 // 0x19: UNDOCUMENTED
6034 buf[0] = 0x00; buf[1] = 0x00;
6035 buf[2] = 0x00; buf[3] = 0x00;
6036 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x18, dev->sensor_flags, buf);
6037 // Writes to sensor registers 0x1a: UNDOCUMENTED
6038 // 0x1b: UNDOCUMENTED
6039 buf[0] = 0x00; buf[1] = 0x00;
6040 buf[2] = 0x00; buf[3] = 0x00;
6041 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1a, dev->sensor_flags, buf);
6042 // Writes to sensor registers 0x1c: UNDOCUMENTED
6043 // 0x1d: UNDOCUMENTED
6044 buf[0] = 0x00; buf[1] = 0x00;
6045 buf[2] = 0x00; buf[3] = 0x00;
6046 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x1c, dev->sensor_flags, buf);
6047 // Write to sensor register 0x32: RESERVED
6048 buf[0] = 0x00; buf[1] = 0x00;
6049 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x32, dev->sensor_flags, buf);
6050 // Writes to sensor registers 0x20: Read Mode
6051 // 0x21: RESERVED
6052 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad frames) + UNDOCUMENTED
6053 buf[2] = 0x00; buf[3] = 0x00;
6054 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x20, dev->sensor_flags, buf);
6055 // Writes to sensor registers 0x22: RESERVED
6056 // 0x23: UNDOCUMENTED
6057 buf[0] = 0x00; buf[1] = 0x00;
6058 buf[2] = 0x00; buf[3] = 0x00;
6059 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x22, dev->sensor_flags, buf);
6060 // Writes to sensor registers 0x24: UNDOCUMENTED
6061 // 0x25: UNDOCUMENTED
6062 buf[0] = 0x00; buf[1] = 0x00;
6063 buf[2] = 0x00; buf[3] = 0x00;
6064 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x24, dev->sensor_flags, buf);
6065 // Writes to sensor registers 0x26: UNDOCUMENTED
6066 // 0x27: RESERVED
6067 buf[0] = 0x00; buf[1] = 0x00;
6068 buf[2] = 0x00; buf[3] = 0x24;
6069 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x26, dev->sensor_flags, buf);
6070 // "Dummy" write to sensor Register 0x30: RESERVED
6071 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x30, dev->sensor_flags, NULL);
6072 // Writes to sensor registers 0x2f: RESERVED
6073 // 0x30: RESERVED
6074 buf[0] = 0xf7; buf[1] = 0xb0;
6075 buf[2] = 0x00; buf[3] = 0x05;
6076 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2f, dev->sensor_flags, buf);
6077 // Writes to sensor registers 0x31: RESERVED
6078 // 0x32: RESERVED
6079 buf[0] = 0x00; buf[1] = 0x00;
6080 buf[2] = 0x00; buf[3] = 0x00;
6081 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x31, dev->sensor_flags, buf);
6082 // Writes to sensor registers 0x33: RESERVED
6083 // 0x34: RESERVED
6084 buf[0] = 0x00; buf[1] = 0x00;
6085 buf[2] = 0x01; buf[3] = 0x00;
6086 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x33, dev->sensor_flags, buf);
6087 // "Dummy" write to sensor Register 0x3b: RESERVED
6088 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x3b, dev->sensor_flags, NULL);
6089 // Write to sensor register 0x3d: RESERVED
6090 buf[0] = 0x06; buf[1] = 0x8f;
6091 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x3d, dev->sensor_flags, buf);
6092 // Writes to sensor registers 0x40: RESERVED
6093 // 0x41: RESERVED
6094 buf[0] = 0x01; buf[1] = 0xe0;
6095 buf[2] = 0x00; buf[3] = 0xd1;
6096 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x40, dev->sensor_flags, buf);
6097 // Write to sensor register 0x44: UNDOCUMENTED
6098 buf[0] = 0x00; buf[1] = 0x82;
6099 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x44, dev->sensor_flags, buf);
6100 // Writes to sensor registers 0x5a: RESERVED
6101 // 0x5b: RESERVED
6102 buf[0] = 0x00; buf[1] = 0x00;
6103 buf[2] = 0x00; buf[3] = 0x00;
6104 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5a, dev->sensor_flags, buf);
6105 // Writes to sensor registers 0x5c: RESERVED
6106 // 0x5d: RESERVED
6107 buf[0] = 0x00; buf[1] = 0x00;
6108 buf[2] = 0x00; buf[3] = 0x00;
6109 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5c, dev->sensor_flags, buf);
6110 // Writes to sensor registers 0x5e: RESERVED
6111 // 0x5f: RESERVED
6112 buf[0] = 0x00; buf[1] = 0x00;
6113 buf[2] = 0xa3; buf[3] = 0x1d;
6114 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x5e, dev->sensor_flags, buf);
6115 // "Dummy" write to sensor Register 0x68: UNDOCUMENTED
6116 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x68, dev->sensor_flags, NULL);
6117 // Write to sensor register 0x62: RESERVED
6118 buf[0] = 0x06; buf[1] = 0x11;
6119 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x62, dev->sensor_flags, buf);
6121 if (retI2C < 0)
6123 UDIA_INFO("1 or more errors occured in I2C-message-block 1 !\n");
6124 return -1;
6126 // END OF I2C MESSAGES
6127 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6129 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6131 buf[0] = 0x40;
6132 usb_microdia_control_write(dev, 0x1007, buf, 8);
6133 buf[0] = 0x40;
6134 usb_microdia_control_write(dev, 0x1006, buf, 8);
6138 // *** TEMPORARY SWITCH TO SLAVE ADDRESS 0x50, I2C READ ATTEMPT:
6139 // - WE CURRENTLY KNOW NO 6270 CAM THAT IS SUCCESSFULLY READ HERE
6140 // - IF READ FAILS, THIS IS NEVER DONE AGAIN (IN NEXT CYCLE OR FURTHER STARTS)
6141 usb_microdia_control_read(dev, 0x10c1, buf, 1); // returns 0x5c
6142 buf[0] = 0x50;
6143 usb_microdia_control_write(dev, 0x10c1, buf, 1);
6144 retI2C = sn9c20x_read_i2c_data(dev, 0x50, 1, 0x00, SN9C20X_I2C_2WIRE, buf);
6145 if (retI2C >= 0)
6146 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");
6147 buf[0] = 0x5c;
6148 usb_microdia_control_write(dev, 0x10c1, buf, 1);
6151 buf[0] = 0x47; // ALEX: 0x44
6152 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2045
6153 buf[0] = 0x47; // ALEX: 0x04
6154 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2046
6155 buf[0] = 0xc6;
6156 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2047
6157 buf[0] = 0xc4;
6158 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2048
6159 buf[0] = 0x84; // ALEX: 0xc0
6160 usb_microdia_control_write(dev, 0x1001, buf, 1); // URB 2049
6161 /* ALEX:
6162 buf[0] = 0x40;
6163 usb_microdia_control_write(dev, 0x1001, buf, 1);
6166 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6168 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6169 // I2C MESSAGES
6170 retI2C = 0;
6171 // Writes to sensor registers 0x02: Column Start
6172 // 0x03: Window Height
6173 buf[0] = 0x00; buf[1] = 0x16; // coulmn 22
6174 buf[2] = 0x01; buf[3] = 0xe1; // 481
6175 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); // URBs 2050-2052
6176 // Writes to sensor registers 0x04: Window Width
6177 // 0x05: Horizontal Blanking
6178 buf[0] = 0x02; buf[1] = 0x81; // 641
6179 buf[2] = 0x00; buf[3] = 0x04; // 4 columns (pixel clocks) // AT FIRST START + FIRST CYCLE: 0x00 0x00
6180 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); // URBs 2053-2055
6181 // Writes to sensor registers 0x06: Vertical Blanking
6182 // 0x07: Output Control
6183 buf[0] = 0x00; buf[1] = 0x00; // 0 rows
6184 buf[2] = 0x30; buf[3] = 0x02; // normal operation + chip enable + RESERVED options
6185 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); // URBs 2056-2058
6186 // Write to sensor register 0x0e: UNDOCUMENTED
6187 buf[0] = 0x00; buf[1] = 0x08;
6188 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); // URBs 2059-2061
6189 if (retI2C < 0)
6191 UDIA_INFO("1 or more errors occured in I2C-message-block 2 !\n");
6192 return -1;
6194 // END OF I2C MESSAGES
6195 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6198 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
6199 buf[4] = 0x28; buf[5] = 0x3c;
6200 usb_microdia_control_write(dev, 0x1180, buf, 6); // URB 2062
6201 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6202 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 2063
6203 buf[0] = 0x0c;
6204 usb_microdia_control_write(dev, 0x1189, buf, 1); // URB 2064
6205 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
6206 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 2065
6207 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
6208 usb_microdia_control_write(dev, 0x11ab, buf, 4); // URB 2066
6209 buf[0] = 0x78; // ALEX: 0x7c
6210 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 2067
6211 buf[0] = 0x18; // ALEX: 0x1c
6212 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2068
6213 buf[0] = 0x18; // ALEX: 0x1c
6214 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2069
6215 buf[0] = 0x38;
6216 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2070
6217 buf[0] = 0x04;
6218 usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 2071
6219 buf[0] = 0x04;
6220 usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 2072
6222 buf[0] = 0x78;
6223 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2073
6224 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2074 // 0x38
6225 if (buf[0] == 0x38)
6226 buf[0] = 0x79;
6227 else if (buf[0] == 0xb8)
6228 buf[0] = 0xf9;
6229 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2075
6230 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2076 // 0xb9
6231 if (buf[0] == 0x39)
6232 buf[0] = 0x7a;
6233 else if (buf[0] == 0xb9)
6234 buf[0] = 0xfa;
6235 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2077
6236 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2078
6237 if (buf[0] == 0x3a)
6238 buf[0] = 0x7b;
6239 else if (buf[0] == 0xba)
6240 buf[0] = 0xfb;
6241 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2079
6242 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2080 // 0x3b
6243 if (buf[0] == 0x3b)
6244 buf[0] = 0x7c;
6245 else if (buf[0] == 0xbb)
6246 buf[0] = 0xfc;
6247 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2081
6248 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2082 // 0x3c
6249 if (buf[0] == 0x3c)
6250 buf[0] = 0x7d;
6251 else if (buf[0] == 0xbc)
6252 buf[0] = 0xfd;
6253 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2083
6254 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2084 // 0x3d
6255 last_11b8[0] = buf[0];
6256 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6258 if (buf[0] == 0x3d)
6259 buf[0] = 0x7e;
6260 else if (buf[0] == 0xbd)
6261 buf[0] = 0xfe;
6262 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2085
6263 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2086
6264 if (buf[0] == 0x3e)
6265 buf[0] = 0x7f;
6266 else if (buf[0] == 0xbe)
6267 buf[0] = 0xff;
6268 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2087
6269 usb_microdia_control_read(dev, 0x11b8, last_11b8, 1); // URB 2088
6271 buf[0] = last_11b8[0] & 0xf0; // 0xf0 or 0x70
6272 buf[0] = buf[0] | 0x0d; // 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES
6273 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2089
6276 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6277 // I2C MESSAGES
6278 retI2C = 0;
6279 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6281 // Write to sensor register 0x06: Vertical Blanking
6282 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6283 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); // URBs 2090-2092
6284 // Write to sensor register 0x05: Horizontal Blanking
6285 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks)
6286 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); // URBs 2093-2095
6287 // Write to sensor register 0x20: Read Mode
6288 buf[0] = 0x00; buf[1] = 0x00; // normal readout
6289 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2096-2098
6291 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6293 // Write to sensor register 0x0a: Pixel Clock Speed
6294 buf[0] = 0x00; buf[1] = 0x00; // default
6295 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0a, dev->sensor_flags, buf);
6296 // Write to sensor register 0x06: Vertical Blanking
6297 buf[0] = 0x00; buf[1] = 0x29; // 41 rows
6298 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6299 // Write to sensor register 0x05: Horizontal Blanking
6300 buf[0] = 0x00; buf[1] = 0x09; // 9 columns (pixel clocks)
6301 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
6302 // Write to sensor register 0x20: Read Mode
6303 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad ones) + UNKNOWN
6304 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
6306 if (retI2C < 0)
6308 UDIA_INFO("1 or more errors occured in I2C-message-block 3 !\n");
6309 return -1;
6311 // END OF I2C MESSAGES
6312 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6315 buf[0] = 0x02;
6316 usb_microdia_control_write(dev, 0x1180, buf, 1); // URB 2099
6318 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6319 // I2C MESSAGE
6320 retI2C = 0;
6321 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6323 // Write to sensor register 0x20: Read Mode
6324 buf[0] = 0x00; buf[1] = 0x00; // normal readout
6325 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf); // URBs 2100-2102
6327 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6329 // Write to sensor register 0x20: Read Mode
6330 buf[0] = 0x11; buf[1] = 0x01; // output all frames (including bad ones) + UNKNOWN
6331 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x20, dev->sensor_flags, buf);
6333 if (retI2C < 0)
6335 UDIA_INFO("1 or more errors occured in I2C-message-block 4 !\n");
6336 return -1;
6338 // END OF I2C MESSAGES
6339 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6342 buf[0] = 0x02;
6343 usb_microdia_control_write(dev, 0x1182, buf, 1); // URB 2103
6346 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6347 // I2C MESSAGES
6348 retI2C = 0;
6349 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6351 // Write to sensor register 0x09: Shutter Width
6352 buf[0] = 0x00; buf[1] = 0x64; // integration of 100 rows
6353 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf); // URBs 2104-2106
6354 // Write to sensor register 0x2b: Green 1 Gain
6355 // 0x2c: Blue Gain
6356 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6357 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6358 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf); // URBs 2107-2109
6359 // Write to sensor register 0x2d: Red Gain
6360 // 0x2e: Green 2 Gain
6361 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6362 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6363 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf); // URBs 2110-2112
6364 // "Dummy" write to sensor Register 0x33: RESERVED
6365 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL); // URBs 2113-2114
6367 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6369 // Write to sensor register 0x09: Shutter Width
6370 buf[0] = 0x00; buf[1] = 0x64; // integration of 100 rows
6371 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x09, dev->sensor_flags, buf);
6372 // Write to sensor register 0x07: Output Control
6373 buf[0] = 0x00; buf[1] = 0x03; // dont update changes until bit0=0, chip enable, normal operation
6374 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6375 // Write to sensor register 0x2b: Green 1 Gain
6376 // 0x2c: Blue Gain
6377 buf[0] = 0x00; buf[1] = 0x33; // 51*0.03125*1 = 1.59375
6378 buf[2] = 0x00; buf[3] = 0xa0; // 32*0.03125*2 = 2
6379 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2b, dev->sensor_flags, buf);
6380 // Write to sensor register 0x2d: Red Gain
6381 // 0x2e: Green 2 Gain
6382 buf[0] = 0x00; buf[1] = 0xa0; // 32*0.03125*2 = 2
6383 buf[2] = 0x00; buf[3] = 0x33; // 51*0.03125*1 = 1.59375
6384 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x2d, dev->sensor_flags, buf);
6385 // "Dummy" write to sensor Register 0x33: RESERVED
6386 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0, 0x33, dev->sensor_flags, NULL);
6387 // Write to sensor register 0x07: Output Control
6388 buf[0] = 0x00; buf[1] = 0x02; // chip enable, normal operation
6389 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
6391 if (retI2C < 0)
6393 UDIA_INFO("1 or more errors occured in I2C-message-block 5 !\n");
6394 return -1;
6396 // END OF I2C MESSAGES
6397 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6400 buf[0] = 0x20;
6401 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2115
6402 buf[0] = 0x20;
6403 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2116
6404 buf[0] = 0x20;
6405 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2117
6406 buf[0] = 0x20;
6407 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2118
6408 buf[0] = 0x0a;
6409 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2119
6410 buf[0] = 0x20;
6411 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2120
6412 buf[0] = 0x20;
6413 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2121
6414 buf[0] = 0x20;
6415 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2122
6416 buf[0] = 0x20;
6417 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2123
6419 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6421 buf[0] = 0x14;
6423 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6425 buf[0] = 0x0a;
6427 usb_microdia_control_write(dev, 0x118b, buf, 1); // URB 2124
6430 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6432 buf[0] = 0x0a; buf[1] = 0x36; buf[2] = 0x56; buf[3] = 0x6e;
6433 buf[4] = 0x7f; buf[5] = 0x8d; buf[6] = 0x9b; buf[7] = 0xa8;
6434 buf[8] = 0xb4; buf[9] = 0xbd; buf[10] = 0xc7; buf[11] = 0xd0;
6435 buf[12] = 0xd9; buf[13] = 0xe2; buf[14] = 0xec; buf[15] = 0xf0;
6436 buf[16] = 0xf5;
6438 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6440 buf[0] = 0x08; buf[1] = 0x35; buf[2] = 0x5a; buf[3] = 0x6d;
6441 buf[4] = 0x7d; buf[5] = 0x8b; buf[6] = 0x97; buf[7] = 0xa3;
6442 buf[8] = 0xad; buf[9] = 0xb7; buf[10] = 0xc1; buf[11] = 0xca;
6443 buf[12] = 0xd3; buf[13] = 0xdb; buf[14] = 0xe3; buf[15] = 0xeb;
6444 buf[16] = 0xf2;
6446 usb_microdia_control_write(dev, 0x1190, buf, 17); // URB 2125
6448 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6450 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6451 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf6; buf[7] = 0x0f;
6452 buf[8] = 0xd2; buf[9] = 0x0f; buf[10] = 0x38; buf[11] = 0x00;
6453 buf[12] = 0x34; buf[13] = 0x00; buf[14] = 0xcf; buf[15] = 0x0f;
6454 buf[16] = 0xfd; buf[17] = 0x0f; buf[18] = 0x00; buf[19] = 0x00;
6455 buf[20] = 0x00;
6457 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6459 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6460 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf0; buf[7] = 0x0f;
6461 buf[8] = 0xd0; buf[9] = 0x0f; buf[10] = 0x41; buf[11] = 0x00;
6462 buf[12] = 0x38; buf[13] = 0x00; buf[14] = 0xc7; buf[15] = 0x0f;
6463 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
6464 buf[20] = 0x00;
6466 for (k=0; k<9; k++) // AT FIRST START + FIRST CYCLE: first 8 writes 21 bytes 0x00
6468 usb_microdia_control_write(dev, 0x10e1, buf, 21); // URB 2126 - 2134
6471 buf[0] = 0x07;
6472 usb_microdia_control_write(dev, 0x10f7, buf, 1); // URB 2135
6473 buf[0] = 0x18; // ALEX: 0x00
6474 usb_microdia_control_write(dev, 0x10f6, buf, 1); // URB 2136
6476 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6478 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6479 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf6; buf[7] = 0x0f;
6480 buf[8] = 0xd2; buf[9] = 0x0f; buf[10] = 0x38; buf[11] = 0x00;
6481 buf[12] = 0x34; buf[13] = 0x00; buf[14] = 0xcf; buf[15] = 0x0f;
6482 buf[16] = 0xfd; buf[17] = 0x0f; buf[18] = 0x00; buf[19] = 0x00;
6483 buf[20] = 0x00;
6485 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6487 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2b; buf[3] = 0x00;
6488 buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xf0; buf[7] = 0x0f;
6489 buf[8] = 0xd0; buf[9] = 0x0f; buf[10] = 0x41; buf[11] = 0x00;
6490 buf[12] = 0x38; buf[13] = 0x00; buf[14] = 0xc7; buf[15] = 0x0f;
6491 buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
6492 buf[20] = 0x00;
6494 usb_microdia_control_write(dev, 0x10e1, buf, 21); // URB 2137
6496 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6498 buf[0] = 0x01;
6500 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6502 buf[0] = 0x14;
6504 usb_microdia_control_write(dev, 0x10f8, buf, 1); // URB 2138
6506 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6508 buf[0] = 0x0a;
6510 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6512 buf[0] = 0xff;
6514 usb_microdia_control_write(dev, 0x10fa, buf, 1); // URB 2139
6516 buf[0] = 0x00;
6517 usb_microdia_control_write(dev, 0x10f9, buf, 1); // URB 2140
6518 buf[0] = 0x00;
6519 usb_microdia_control_write(dev, 0x10f9, buf, 1); // URB 2141
6520 buf[0] = 0x0a;
6521 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2142
6522 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
6523 usb_microdia_control_write(dev, 0x11bc, buf, 4); // URB 2143
6524 for (k=0; k<48; k++) buf[k] = 0x00;
6525 usb_microdia_control_write(dev, 0x11c0, buf, 48); // URB 2144
6526 buf[0] = 0x20;
6527 usb_microdia_control_write(dev, 0x118c, buf, 1); // URB 2145
6528 buf[0] = 0x20;
6529 usb_microdia_control_write(dev, 0x118d, buf, 1); // URB 2146
6530 buf[0] = 0x20;
6531 usb_microdia_control_write(dev, 0x118e, buf, 1); // URB 2147
6532 buf[0] = 0x20;
6533 usb_microdia_control_write(dev, 0x118f, buf, 1); // URB 2148
6534 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05;
6535 buf[4] = 0x04; buf[5] = 0x3f;
6536 usb_microdia_control_write(dev, 0x11a5, buf, 6); // URB 2149
6538 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6540 buf[0] = 0x14; buf[1] = 0xec; buf[2] = 0x0a; buf[3] = 0xf6;
6542 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6544 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
6546 usb_microdia_control_write(dev, 0x11af, buf, 4); // URB 2150
6548 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xdd;
6549 usb_microdia_control_write(dev, 0x11b3, buf, 4); // URB 2151
6550 buf[0] = 0x47; // ALEX: 0x04
6551 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2152
6552 buf[0] = 0x01;
6553 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2153
6554 buf[0] = 0x67; // ALEX: 0x24
6555 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2154
6556 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d;
6557 buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d;
6558 buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d;
6559 buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21;
6560 buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
6561 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d;
6562 buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a;
6563 buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a;
6564 buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a;
6565 buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
6566 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e;
6567 buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47;
6568 buf[48]= 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58;
6569 buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60;
6570 buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
6571 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
6572 usb_microdia_control_write(dev, 0x1100, buf, 64); // URB 2155
6573 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15;
6574 buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15;
6575 buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36;
6576 buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53;
6577 buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
6578 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53;
6579 buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53;
6580 buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53;
6581 buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53;
6582 buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
6583 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53;
6584 buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53;
6585 buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53;
6586 buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53;
6587 buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
6588 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
6589 usb_microdia_control_write(dev, 0x1140, buf, 64); // URB 2156
6590 buf[0] = 0x47; // ALEX: 0x04
6591 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2157
6592 buf[0] = 0x03;
6593 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2158
6594 buf[0] = 0x4b; // ALEX: 0x08
6595 usb_microdia_control_write(dev, 0x10e0, buf, 1); // URB 2159
6597 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6599 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6600 // I2C MESSAGES
6601 retI2C = 0;
6602 // Writes to sensor registers 0x02: Column Start
6603 // 0x03: Window Hight
6604 buf[0] = 0x00; buf[1] = 0x16; // coulmn 22
6605 buf[2] = 0x01; buf[3] = 0xe1; // 481
6606 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x02, dev->sensor_flags, buf); // URBs 2160-2162
6607 // Writes to sensor registers 0x04: Window Width
6608 // 0x05: Horizontal Blanking
6609 buf[0] = 0x02; buf[1] = 0x81; // 641
6610 buf[2] = 0x00; buf[3] = 0x04; // 4 columns (pixel clocks)
6611 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x04, dev->sensor_flags, buf); // URBs 2163-2165
6612 // Writes to sensor registers 0x06: Vertical Blanking
6613 // 0x07: Output Control
6614 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6615 buf[2] = 0x30; buf[3] = 0x02; // RESERVED options
6616 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, 0x06, dev->sensor_flags, buf); // URBs 2166-2167
6617 // Writes to sensor register 0x0e: UNDOCUMENTED
6618 buf[0] = 0x00; buf[1] = 0x08;
6619 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x0e, dev->sensor_flags, buf); // URBs 2168-2170
6620 if (retI2C < 0)
6622 UDIA_INFO("1 or more errors occured in I2C-message-block 6 !\n");
6623 return -1;
6625 // END OF I2C MESSAGES
6626 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6628 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6630 buf[0] = 0x40;
6631 usb_microdia_control_write(dev, 0x1007, buf, 1);
6632 buf[0] = 0x40;
6633 usb_microdia_control_write(dev, 0x1006, buf, 1);
6637 buf[0] = 0x02; buf[1] = 0x00; buf[2] = 0x02; buf[3] = 0x00;
6638 buf[4] = 0x28; buf[5] = 0x3c;
6639 usb_microdia_control_write(dev, 0x1180, buf, 6); // URB 2171
6640 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6641 usb_microdia_control_write(dev, 0x10fb, buf, 5); // URB 2172
6642 buf[0] = 0x0c;
6643 usb_microdia_control_write(dev, 0x1189, buf, 1); // URB 2173
6644 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
6645 usb_microdia_control_write(dev, 0x11a1, buf, 4); // URB 2174
6646 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
6647 usb_microdia_control_write(dev, 0x11ab, buf, 4); // URB 2175
6648 buf[0] = 0x03;
6649 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2176
6650 buf[0] = 0x0a;
6651 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2177
6652 buf[0] = 0x00;
6653 usb_microdia_control_write(dev, 0x11b9, buf, 1); // URB 2178
6654 buf[0] = 0x0b;
6655 usb_microdia_control_write(dev, 0x11ba, buf, 1); // URB 2179
6656 buf[0] = 0x01;
6657 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2180
6658 buf[0] = 0x78; // ALEX: 0x7c
6659 usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 2181
6660 buf[0] = 0x18; // ALEX: 0x1c
6661 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2182
6662 buf[0] = 0x18; // ALEX: 0x1c
6663 usb_microdia_control_write(dev, 0x1002, buf, 1); // URB 2183
6664 buf[0] = 0x7d; // ALEX: 0xfc
6665 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2184
6666 buf[0] = 0x04;
6667 usb_microdia_control_write(dev, 0x118a, buf, 1); // URB 2185
6668 buf[0] = 0x04;
6669 usb_microdia_control_write(dev, 0x0395, buf, 1); // URB 2186
6671 if ((last_11b8[0] == 0x3d) || (last_11b8[0] == 0x3f))
6672 buf[0] = 0x78;
6673 else if ((last_11b8[0] == 0xbd) || (last_11b8[0] == 0xbf))
6674 buf[0] = 0xf8;
6675 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2187
6676 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2188 // 0x38
6677 if (buf[0] == 0x38)
6678 buf[0] = 0x79;
6679 else if (buf[0] == 0xb8)
6680 buf[0] = 0xf9;
6681 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2189
6682 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2190 // 0xb9
6683 if (buf[0] == 0x39)
6684 buf[0] = 0x7a;
6685 else if (buf[0] == 0xb9)
6686 buf[0] = 0xfa;
6687 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2191
6688 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2192 // 0xba
6689 if (buf[0] == 0x3a)
6690 buf[0] = 0x7b;
6691 else if (buf[0] == 0xba)
6692 buf[0] = 0xfb;
6693 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2193
6694 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2194 // 0x3b
6695 if (buf[0] == 0x3b)
6696 buf[0] = 0x7c;
6697 else if (buf[0] == 0xbb)
6698 buf[0] = 0xfc;
6699 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2195
6700 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2196 // 0x3c
6701 if (buf[0] == 0x3c)
6702 buf[0] = 0x7d;
6703 else if (buf[0] == 0xbc)
6704 buf[0] = 0xfd;
6705 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2197
6706 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2198 // 0x3d
6707 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6709 if (buf[0] == 0x3d)
6710 buf[0] = 0x7e;
6711 else if (buf[0] == 0xbd)
6712 buf[0] = 0xfe;
6713 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2199
6714 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2200
6715 if (buf[0] == 0x3e)
6716 buf[0] = 0x7f;
6717 else if (buf[0] == 0xbe)
6718 buf[0] = 0xff;
6719 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2201
6720 usb_microdia_control_read(dev, 0x11b8, buf, 1); // URB 2202
6722 buf[0] = buf[0] & 0xf0; // 0xf0 or 0x70
6723 buf[0] = buf[0] | 0x0d; // 0x0c => THIS VALUE SEEMS TO DEPEND ON WHAT WAS READ/WRITTEN IN THE LAST 8 READS/WRITES
6724 usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 2089
6726 // ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6727 // I2C MESSAGES
6728 retI2C = 0;
6729 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6731 // Write to sensor register 0x06: Vertical Blanking
6732 buf[0] = 0x00; buf[1] = 0x2d; // 45 rows
6733 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf); // URBs 2204-2206
6734 // Write to sensor register 0x05: Horizontal Blanking
6735 buf[0] = 0x00; buf[1] = 0x04; // 4 columns (pixel clocks)
6736 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf); // URBs 2207-2209
6737 // Read of sensor register 0x36: Chip Version (mirror of reg0xff)
6738 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x36, dev->sensor_flags, buf); // URBs 2211-2215 // 0x82 0x3a
6740 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6742 // Write to sensor register 0x0a: Pixel Clock Speed
6743 buf[0] = 0x00; buf[1] = 0x00; // default
6744 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6745 // Write to sensor register 0x06: Vertical Blanking
6746 buf[0] = 0x00; buf[1] = 0x29; // 41 rows
6747 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x06, dev->sensor_flags, buf);
6748 // Write to sensor register 0x05: Horizontal Blanking
6749 buf[0] = 0x00; buf[1] = 0x09; // 9 columns (pixel clocks)
6750 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x05, dev->sensor_flags, buf);
6751 // Read of sensor register 0x00: Chip Version (=reg0xff)
6752 retI2C += sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 2, 0x00, dev->sensor_flags, buf); // 0x82 0x43
6754 if (retI2C < 0)
6756 UDIA_INFO("1 or more errors occured in I2C-message-block 7 !\n");
6757 return -1;
6759 // END OF I2C MESSAGES
6760 // +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
6763 buf[0] = 0x03;
6764 usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 2216
6767 /*** NOW DRIVER DOES STOP-SEQUENCE
6768 - WITHOUT WRITES TO 0x1007 AND 0x1006 (URBs 3544-3550) => MT9V111
6769 - WRITING 0x40 INSTEAD OF 0x60 TO 0x1007 AND 0x1006 => MT9V011
6770 ***/
6771 /*** 2nd, 3rd, ... CYCLE: ALL MESSAGES (URBs 1953 - URBs 2216) ARE REPEATED ***/
6772 /*** ----- WE DON'T DO THIS, IT SEEMS TO BE UNNECESSARY ----- ***/
6774 // Setup IFP registers for AE and AWB (new, not in the logs):
6775 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6777 mt9v111_setup_autoexposure(dev);
6778 mt9v111_setup_autowhitebalance(dev);
6779 mt9v111_set_autocorrections(dev, 1);
6782 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6784 buf[0] = 0x20;
6786 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6788 buf[0] = 0x60;
6790 usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 2489
6791 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
6793 buf[0] = 0x00;
6795 else if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
6797 buf[0] = 0x40;
6799 usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 2490
6800 // => These two writes seem to cause the cam to start sending isochronus USB messages
6802 return 0;
6805 int microdia_627b_start_stream(struct usb_microdia *dev)
6807 int ret;
6808 /* int actual; */
6809 __u16 reg;
6810 __u8 buf[64];
6812 buf[0] = 0x00; /** Will have to be set for every single interrupt. */
6814 ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000); // URB 43
6817 reg = 0x1066;
6818 buf[0] = 0x00;
6819 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 44 */
6820 if (ret < 0)
6821 goto err;
6824 //ret = usb_set_interface(dev->udev, 0, 8);
6825 //if(ret < 0) goto err;
6827 //buf[0] = 0x00; // Will have to be set for every single interrupt
6828 //ret = usb_interrupt_msg(dev->udev, 0x00000083, buf, 0x0000001, &actual, 1000); // URB 45
6831 reg = 0x1000;
6832 buf[0] = 0x78;
6833 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 46 */
6834 if (ret < 0)
6835 goto err;
6837 reg = 0x1001;
6838 buf[0] = 0xc7;
6839 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 47 */
6840 if (ret < 0)
6841 goto err;
6843 reg = 0x1002;
6844 buf[0] = 0x18;
6845 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 48 */
6846 if (ret < 0)
6847 goto err;
6849 reg = 0x1061;
6850 buf[0] = 0x01;
6851 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 49 */
6852 if (ret < 0)
6853 goto err;
6855 reg = 0x1020;
6856 buf[0] = 0x80;
6857 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 50 */
6858 if (ret < 0)
6859 goto err;
6861 reg = 0x1067;
6862 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
6863 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 51 */
6864 if (ret < 0)
6865 goto err;
6867 reg = 0x10c0;
6868 buf[0] = 0x80; buf[1] = 0x21; buf[2] = 0x00; buf[3] = 0x00;
6869 buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00;
6870 buf[8] = 0x03;
6871 ret = usb_microdia_control_write(dev, reg, buf, 9); /* URB 52 */
6872 if (ret < 0)
6873 goto err;
6875 /* transferbufferlength is 18, but data is 24 bytes long, what to do ? */
6876 reg = 0x10e0;
6877 buf[0] = 0x45; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30; buf[4] = 0x00;
6878 buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed; buf[8] = 0x0f; buf[9] = 0xda;
6879 buf[10] = 0x0f; buf[11] = 0x3a; buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00;
6880 buf[15] = 0xd0; buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00;
6881 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
6882 ret = usb_microdia_control_write(dev, reg, buf, 24); /* URB 53 */
6883 if (ret < 0)
6884 goto err;
6886 reg = 0x10f8;
6887 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
6888 ret = usb_microdia_control_write(dev, reg, buf, 3); /* URB 54 */
6889 if (ret < 0)
6890 goto err;
6892 reg = 0x10fb;
6893 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
6894 ret = usb_microdia_control_write(dev, reg, buf, 5); /* URB 55 */
6895 if (ret < 0)
6896 goto err;
6898 reg = 0x1188;
6899 buf[0] = 0x86; buf[1] = 0x8c; buf[2] = 0x08;
6900 ret = usb_microdia_control_write(dev, reg, buf, 3); /* URB 56 */
6901 if (ret < 0)
6902 goto err;
6904 reg = 0x118b;
6905 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20; buf[4] = 0x20;
6906 buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b; buf[8] = 0x4f; buf[9] = 0x61;
6907 buf[10] = 0x71; buf[11] = 0x80; buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab;
6908 buf[15] = 0xb8; buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9;
6909 buf[20] = 0xf4; buf[21] = 0xff;
6910 ret = usb_microdia_control_write(dev, reg, buf, 22); /* URB 57 */
6911 if (ret < 0)
6912 goto err;
6914 reg = 0x11a1;
6915 buf[0] = 0x00; buf[1] = 0x00;
6916 ret = usb_microdia_control_write(dev, reg, buf, 2); /* URB 58 */
6917 if (ret < 0)
6918 goto err;
6920 reg = 0x11b7;
6921 buf[0] = 0x60; buf[1] = 0x28; buf[2] = 0x00; buf[3] = 0x08; buf[4] = 0x00;
6922 buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
6923 ret = usb_microdia_control_write(dev, reg, buf, 9); /* URB 59 */
6924 if (ret < 0)
6925 goto err;
6927 reg = 0x11b8;
6928 buf[0] = 0x38;
6929 ret = usb_microdia_control_write(dev, reg, buf, 1); /* URB 60 */
6930 if (ret < 0)
6931 goto err;
6933 reg = 0x1000;
6934 buf[0] = 0x78;
6935 ret = usb_microdia_control_write(dev, reg, buf, 1);
6936 if (ret < 0)
6937 goto err;
6939 buf[0] = 0x80;
6940 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
6941 OV7660_CTL_COM7, dev->sensor_flags, buf);
6942 if (ret < 0)
6943 goto errI2C;
6945 buf[0] = 0x01; buf[1] = 0x74; buf[2] = 0x92; buf[3] = 0x00;
6946 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6947 OV7660_CTL_GAIN, dev->sensor_flags, buf);
6948 if (ret < 0)
6949 goto errI2C;
6951 buf[0] = 0x00; buf[1] = 0x7d; buf[2] = 0x62; buf[3] = 0x00;
6952 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6953 OV7660_CTL_COM1, dev->sensor_flags, buf);
6954 if (ret < 0)
6955 goto errI2C;
6957 buf[0] = 0x83; buf[1] = 0x01;
6958 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
6959 OV7660_CTL_RAVE, dev->sensor_flags, buf);
6960 if (ret < 0)
6961 goto errI2C;
6963 buf[0] = 0x00; buf[1] = 0x08; buf[2] = 0x04; buf[3] = 0x62;
6964 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6965 OV7660_CTL_COM3, dev->sensor_flags, buf);
6966 if (ret < 0)
6967 goto errI2C;
6969 buf[0] = 0x00; buf[1] = 0x40; buf[2] = 0x05; buf[3] = 0xf8;
6970 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6971 OV7660_CTL_AECH, dev->sensor_flags, buf);
6972 if (ret < 0)
6973 goto errI2C;
6975 buf[0] = 0x2e; buf[1] = 0x00; buf[2] = 0x02;
6976 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3,
6977 OV7660_CTL_COM9, dev->sensor_flags, buf);
6978 if (ret < 0)
6979 goto errI2C;
6981 buf[0] = 0x10; buf[1] = 0x60; buf[2] = 0x02; buf[3] = 0x7b;
6982 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
6983 OV7660_CTL_HSTART, dev->sensor_flags, buf);
6984 if (ret < 0)
6985 goto errI2C;
6987 buf[0] = 0x06;
6988 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
6989 OV7660_CTL_PSHFT, dev->sensor_flags, buf);
6990 if (ret < 0)
6991 goto errI2C;
6993 buf[0] = 0x01; buf[1] = 0x0e;
6994 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
6995 OV7660_CTL_MVFP, dev->sensor_flags, buf);
6996 if (ret < 0)
6997 goto errI2C;
6999 buf[0] = 0x07; buf[1] = 0x07; buf[2] = 0x07; buf[3] = 0x07;
7000 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7001 OV7660_CTL_BOS, dev->sensor_flags, buf);
7002 if (ret < 0)
7003 goto errI2C;
7005 buf[0] = 0x68; buf[1] = 0x58; buf[2] = 0xd4; buf[3] = 0x80;
7006 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7007 OV7660_CTL_AEW, dev->sensor_flags, buf);
7008 if (ret < 0)
7009 goto errI2C;
7011 buf[0] = 0x80; buf[1] = 0x3c; buf[2] = 0x00; buf[3] = 0x00;
7012 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7013 OV7660_CTL_GbBIAS, dev->sensor_flags, buf);
7014 if (ret < 0)
7015 goto errI2C;
7017 buf[0] = 0x80; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x62;
7018 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7019 OV7660_CTL_RBIAS, dev->sensor_flags, buf);
7020 if (ret < 0)
7021 goto errI2C;
7023 buf[0] = 0x08; buf[1] = 0x30; buf[2] = 0xb4;
7024 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3,
7025 OV7660_CTL_HSYST, dev->sensor_flags, buf);
7026 if (ret < 0)
7027 goto errI2C;
7029 buf[0] = 0x00; buf[1] = 0x07; buf[2] = 0x84; buf[3] = 0x00;
7030 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7031 OV7660_CTL_CHLF, dev->sensor_flags, buf);
7032 if (ret < 0)
7033 goto errI2C;
7035 buf[0] = 0x0c; buf[1] = 0x02; buf[2] = 0x43; buf[3] = 0x00;
7036 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7037 OV7660_CTL_ADC, dev->sensor_flags, buf);
7038 if (ret < 0)
7039 goto errI2C;
7041 buf[0] = 0x02; buf[1] = 0x6c; buf[2] = 0x19; buf[3] = 0x0e;
7042 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7043 OV7660_CTL_COM11, dev->sensor_flags, buf);
7044 if (ret < 0)
7045 goto errI2C;
7047 buf[0] = 0x41; buf[1] = 0xc1; buf[2] = 0x22; buf[3] = 0x08;
7048 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7049 OV7660_CTL_EDGE, dev->sensor_flags, buf);
7050 if (ret < 0)
7051 goto errI2C;
7053 /* "Dummy" write */
7054 reg = 0x43; /* RSVD 0x43 is Reserved */
7055 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7056 reg, dev->sensor_flags, NULL);
7057 if (ret < 0)
7058 goto errI2C;
7060 reg = 0x43; /* RSVD 0x43 is Reserved */
7061 buf[0] = 0xf0; buf[1] = 0x10; buf[2] = 0x78; buf[3] = 0xa8;
7062 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7063 dev->sensor_flags, buf);
7064 if (ret < 0)
7065 goto errI2C;
7067 reg = 0x47; /* RSVD 0x47 is Reserved */
7068 buf[0] = 0x60; buf[1] = 0x80; buf[2] = 0x00; buf[3] = 0x00;
7069 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7070 dev->sensor_flags, buf);
7071 if (ret < 0)
7072 goto errI2C;
7074 reg = 0x4b; /* RSVD 0x4b is Reserved */
7075 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
7076 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4, reg,
7077 dev->sensor_flags, buf);
7078 if (ret < 0)
7079 goto errI2C;
7081 /* "Dummy" write */
7082 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7083 OV7660_CTL_MTX1, dev->sensor_flags, NULL);
7084 if (ret < 0)
7085 goto errI2C;
7087 reg = 0x59; /* RSVD 0x59 is Reserved */
7088 buf[0] = 0xba; buf[1] = 0x9a; buf[2] = 0x22; buf[3] = 0xb9;
7089 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7090 reg, dev->sensor_flags, buf);
7091 if (ret < 0)
7092 goto errI2C;
7094 reg = 0x5d; /* RSVD 0x5d is Reserved */
7095 buf[0] = 0x9b; buf[1] = 0x10; buf[2] = 0xf0; buf[3] = 0x05;
7096 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7097 reg, dev->sensor_flags, buf);
7098 if (ret < 0)
7099 goto errI2C;
7101 reg = 0x61; /* RSVD 0x61 is Reserved */
7102 buf[0] = 0x60;
7103 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7104 reg, dev->sensor_flags, buf);
7105 if (ret < 0)
7106 goto errI2C;
7108 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x30;
7109 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7110 OV7660_CTL_LCC1, dev->sensor_flags, buf);
7111 if (ret < 0)
7112 goto errI2C;
7114 buf[0] = 0x00;
7115 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7116 OV7660_CTL_LCC5, dev->sensor_flags, buf);
7117 if (ret < 0)
7118 goto errI2C;
7120 buf[0] = 0x80; buf[1] = 0x7a; buf[2] = 0x90; buf[3] = 0x80;
7121 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7122 OV7660_CTL_MANU, dev->sensor_flags, buf);
7123 if (ret < 0)
7124 goto errI2C;
7126 buf[0] = 0x0a;
7127 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7128 OV7660_CTL_DBLV, dev->sensor_flags, buf);
7129 if (ret < 0)
7130 goto errI2C;
7132 reg = 0x8b; /* RSVD 0x8b is Reserved */
7133 buf[0] = 0x99; buf[1] = 0x99; buf[2] = 0xcf;
7134 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 3, reg,
7135 dev->sensor_flags, buf);
7136 if (ret < 0)
7137 goto errI2C;
7139 buf[0] = 0x00; buf[1] = 0x00;
7140 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
7141 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
7142 if (ret < 0)
7143 goto errI2C;
7145 reg = 0x1007;
7146 buf[0] = 0x40;
7147 ret = usb_microdia_control_write(dev, reg, buf, 1);
7148 if (ret < 0)
7149 goto err;
7151 reg = 0x1006;
7152 buf[0] = 0x00;
7153 ret = usb_microdia_control_write(dev, reg, buf, 1);
7154 if (ret < 0)
7155 goto err;
7157 reg = 0x10c1;
7158 ret = usb_microdia_control_read(dev, reg, buf, 1);
7159 if (ret < 0)
7160 goto err;
7162 reg = 0x10c1;
7163 buf[0] = 0x50;
7164 ret = usb_microdia_control_write(dev, reg, buf, 1);
7165 if (ret < 0)
7166 goto err;
7168 /* TRY TO READ FROM EEPROM: */
7169 reg = 0x00;
7170 ret = sn9c20x_read_i2c_data(dev, 0x50, 1, reg, SN9C20X_I2C_2WIRE, buf);
7171 if (ret < 0)
7172 UDIA_INFO("No EEPROM found\n");
7173 else
7174 UDIA_INFO("Read from EEPROM successful\n");
7176 reg = 0x10c1;
7177 buf[0] = 0x21;
7178 ret = usb_microdia_control_write(dev, reg, buf, 1);
7179 if (ret < 0)
7180 goto err;
7182 reg = 0x10e0;
7183 buf[0] = 0x47;
7184 ret = usb_microdia_control_write(dev, reg, buf, 1);
7185 if (ret < 0)
7186 goto err;
7188 reg = 0x10e0;
7189 buf[0] = 0x47;
7190 ret = usb_microdia_control_write(dev, reg, buf, 1);
7191 if (ret < 0)
7192 goto err;
7194 reg = 0x1001;
7195 buf[0] = 0xc6;
7196 ret = usb_microdia_control_write(dev, reg, buf, 1);
7197 if (ret < 0)
7198 goto err;
7200 reg = 0x1001;
7201 buf[0] = 0xc4;
7202 ret = usb_microdia_control_write(dev, reg, buf, 1);
7203 if (ret < 0)
7204 goto err;
7206 reg = 0x1001;
7207 buf[0] = 0x84;
7208 ret = usb_microdia_control_write(dev, reg, buf, 1);
7209 if (ret < 0)
7210 goto err;
7212 buf[0] = 0x08;
7213 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7214 OV7660_CTL_VREF, dev->sensor_flags, buf);
7215 if (ret < 0)
7216 goto errI2C;
7218 buf[0] = 0x10; buf[1] = 0x61; buf[2] = 0x02; buf[3] = 0x7a;
7219 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 4,
7220 OV7660_CTL_HSTART, dev->sensor_flags, buf);
7221 if (ret < 0)
7222 goto errI2C;
7224 /* "Dummy" write: */
7225 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 0,
7226 OV7660_CTL_PSHFT, dev->sensor_flags, NULL);
7227 if (ret < 0)
7228 goto errI2C;
7230 buf[0] = 0x84;
7231 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7232 OV7660_CTL_HREF, dev->sensor_flags, buf);
7233 if (ret < 0)
7234 goto errI2C;
7236 buf[0] = 0x84;
7237 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7238 OV7660_CTL_HREF, dev->sensor_flags, buf);
7239 if (ret < 0)
7240 goto errI2C;
7242 buf[0] = 0x84;
7243 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7244 OV7660_CTL_HREF, dev->sensor_flags, buf);
7245 if (ret < 0)
7246 goto errI2C;
7248 buf[0] = 0x84;
7249 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7250 OV7660_CTL_HREF, dev->sensor_flags, buf);
7251 if (ret < 0)
7252 goto errI2C;
7254 buf[0] = 0x84;
7255 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7256 OV7660_CTL_HREF, dev->sensor_flags, buf);
7257 if (ret < 0)
7258 goto errI2C;
7260 reg = 0x1180;
7261 buf[0] = 0x01; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x28;
7262 buf[5] = 0x3c;
7263 ret = usb_microdia_control_write(dev, reg, buf, 6);
7264 if (ret < 0)
7265 goto err;
7267 reg = 0x10fb;
7268 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
7269 ret = usb_microdia_control_write(dev, reg, buf, 5);
7270 if (ret < 0)
7271 goto err;
7273 reg = 0x1189;
7274 buf[0] = 0x8c;
7275 ret = usb_microdia_control_write(dev, reg, buf, 1);
7276 if (ret < 0)
7277 goto err;
7279 reg = 0x11a1;
7280 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
7281 ret = usb_microdia_control_write(dev, reg, buf, 4);
7282 if (ret < 0)
7283 goto err;
7285 reg = 0x11ab;
7286 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
7287 ret = usb_microdia_control_write(dev, reg, buf, 4);
7288 if (ret < 0)
7289 goto err;
7291 reg = 0x1000;
7292 buf[0] = 0x78;
7293 ret = usb_microdia_control_write(dev, reg, buf, 1);
7294 if (ret < 0)
7295 goto err;
7297 reg = 0x1002;
7298 buf[0] = 0x18;
7299 ret = usb_microdia_control_write(dev, reg, buf, 1);
7300 if (ret < 0)
7301 goto err;
7303 reg = 0x1002;
7304 buf[0] = 0x18;
7305 ret = usb_microdia_control_write(dev, reg, buf, 1);
7306 if (ret < 0)
7307 goto err;
7309 reg = 0x11b8;
7310 buf[0] = 0x38;
7311 ret = usb_microdia_control_write(dev, reg, buf, 1);
7312 if (ret < 0)
7313 goto err;
7315 reg = 0x118a;
7316 buf[0] = 0x04;
7317 ret = usb_microdia_control_write(dev, reg, buf, 1);
7318 if (ret < 0)
7319 goto err;
7321 reg = 0x0395;
7322 buf[0] = 0x04;
7323 ret = usb_microdia_control_write(dev, reg, buf, 1);
7324 if (ret < 0)
7325 goto err;
7327 reg = 0x11b8;
7328 buf[0] = 0x78;
7329 ret = usb_microdia_control_write(dev, reg, buf, 1);
7330 if (ret < 0)
7331 goto err;
7332 ret = usb_microdia_control_read(dev, reg, buf, 1);
7333 if (ret < 0)
7334 goto err;
7336 reg = 0x11b8;
7337 buf[0] = 0xf9;
7338 ret = usb_microdia_control_write(dev, reg, buf, 1);
7339 if (ret < 0)
7340 goto err;
7341 ret = usb_microdia_control_read(dev, reg, buf, 1);
7342 if (ret < 0)
7343 goto err;
7345 reg = 0x11b8;
7346 buf[0] = 0xfa;
7347 ret = usb_microdia_control_write(dev, reg, buf, 1);
7348 if (ret < 0)
7349 goto err;
7350 ret = usb_microdia_control_read(dev, reg, buf, 1);
7351 if (ret < 0)
7352 goto err;
7354 reg = 0x11b8;
7355 buf[0] = 0x7b;
7356 ret = usb_microdia_control_write(dev, reg, buf, 1);
7357 if (ret < 0)
7358 goto err;
7359 ret = usb_microdia_control_read(dev, reg, buf, 1);
7360 if (ret < 0)
7361 goto err;
7363 reg = 0x11b8;
7364 buf[0] = 0x7c;
7365 ret = usb_microdia_control_write(dev, reg, buf, 1);
7366 if (ret < 0)
7367 goto err;
7368 ret = usb_microdia_control_read(dev, reg, buf, 1);
7369 if (ret < 0)
7370 goto err;
7372 reg = 0x11b8;
7373 buf[0] = 0x7d;
7374 ret = usb_microdia_control_write(dev, reg, buf, 1);
7375 if (ret < 0)
7376 goto err;
7377 ret = usb_microdia_control_read(dev, reg, buf, 1);
7378 if (ret < 0)
7379 goto err;
7381 reg = 0x11b8;
7382 buf[0] = 0x7b;
7383 ret = usb_microdia_control_write(dev, reg, buf, 1);
7384 if (ret < 0)
7385 goto err;
7388 //ret = usb_microdia_control_read(dev, reg, buf, 1);
7389 //if(ret < 0) goto err;
7392 buf[0] = 0x40;
7393 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7394 OV7660_CTL_CLKRC, dev->sensor_flags, buf);
7395 if (ret < 0)
7396 goto errI2C;
7398 buf[0] = 0x00;
7399 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7400 OV7660_CTL_EXHCH, dev->sensor_flags, buf);
7401 if (ret < 0)
7402 goto errI2C;
7404 buf[0] = 0x00;
7405 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7406 OV7660_CTL_EXHCL, dev->sensor_flags, buf);
7407 if (ret < 0)
7408 goto errI2C;
7410 buf[0] = 0x00;
7411 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7412 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
7413 if (ret < 0)
7414 goto errI2C;
7416 buf[0] = 0x00;
7417 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7418 OV7660_CTL_DM_LNH, dev->sensor_flags, buf);
7419 if (ret < 0)
7420 goto errI2C;
7422 buf[0] = 0x01;
7423 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7424 OV7660_CTL_MVFP, dev->sensor_flags, buf);
7425 if (ret < 0)
7426 goto errI2C;
7428 buf[0] = 0x01;
7429 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7430 OV7660_CTL_MVFP, dev->sensor_flags, buf);
7431 if (ret < 0)
7432 goto errI2C;
7434 buf[0] = 0x08;
7435 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7436 OV7660_CTL_VREF, dev->sensor_flags, buf);
7437 if (ret < 0)
7438 goto errI2C;
7440 buf[0] = 0x00;
7441 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7442 OV7660_CTL_VREF, dev->sensor_flags, buf);
7443 if (ret < 0)
7444 goto errI2C;
7446 buf[0] = 0x7f;
7447 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7448 OV7660_CTL_AECH, dev->sensor_flags, buf);
7449 if (ret < 0)
7450 goto errI2C;
7452 buf[0] = 0x00;
7453 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7454 OV7660_CTL_COM1, dev->sensor_flags, buf);
7455 if (ret < 0)
7456 goto errI2C;
7458 buf[0] = 0x00;
7459 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7460 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
7461 if (ret < 0)
7462 goto errI2C;
7464 buf[0] = 0x00;
7465 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7466 OV7660_CTL_ADVFH, dev->sensor_flags, buf);
7467 if (ret < 0)
7468 goto errI2C;
7470 buf[0] = 0x00;
7471 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7472 OV7660_CTL_GAIN, dev->sensor_flags, buf);
7473 if (ret < 0)
7474 goto errI2C;
7476 buf[0] = 0x78; buf[1] = 0x78;
7477 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
7478 OV7660_CTL_BLUE, dev->sensor_flags, buf);
7479 if (ret < 0)
7480 goto errI2C;
7482 reg = 0x118c;
7483 buf[0] = 0x20;
7484 ret = usb_microdia_control_write(dev, reg, buf, 1);
7485 if (ret < 0)
7486 goto err;
7488 reg = 0x118d;
7489 buf[0] = 0x20;
7490 ret = usb_microdia_control_write(dev, reg, buf, 1);
7491 if (ret < 0)
7492 goto err;
7494 reg = 0x118e;
7495 buf[0] = 0x20;
7496 ret = usb_microdia_control_write(dev, reg, buf, 1);
7497 if (ret < 0)
7498 goto err;
7500 reg = 0x118f;
7501 buf[0] = 0x20;
7502 ret = usb_microdia_control_write(dev, reg, buf, 1);
7503 if (ret < 0)
7504 goto err;
7506 reg = 0x11ba;
7507 buf[0] = 0x0a;
7508 ret = usb_microdia_control_write(dev, reg, buf, 1);
7509 if (ret < 0)
7510 goto err;
7512 reg = 0x118c;
7513 buf[0] = 0x20;
7514 ret = usb_microdia_control_write(dev, reg, buf, 1);
7515 if (ret < 0)
7516 goto err;
7518 reg = 0x118d;
7519 buf[0] = 0x20;
7520 ret = usb_microdia_control_write(dev, reg, buf, 1);
7521 if (ret < 0)
7522 goto err;
7524 reg = 0x118e;
7525 buf[0] = 0x20;
7526 ret = usb_microdia_control_write(dev, reg, buf, 1);
7527 if (ret < 0)
7528 goto err;
7530 reg = 0x118f;
7531 buf[0] = 0x20;
7532 ret = usb_microdia_control_write(dev, reg, buf, 1);
7533 if (ret < 0)
7534 goto err;
7536 reg = 0x118b;
7537 buf[0] = 0x0c;
7538 ret = usb_microdia_control_write(dev, reg, buf, 1);
7539 if (ret < 0)
7540 goto err;
7542 reg = 0x1190;
7543 buf[0] = 0x00; buf[1] = 0x33; buf[2] = 0x53; buf[3] = 0x6b; buf[4] = 0x7c;
7544 buf[5] = 0x8b; buf[6] = 0x99; buf[7] = 0xa6; buf[8] = 0xb2; buf[9] = 0xbd;
7545 buf[10] = 0xc8; buf[11] = 0xd2; buf[12] = 0xdc; buf[13] = 0xe5; buf[14] = 0xee;
7546 buf[15] = 0xf7; buf[16] = 0xff;
7547 ret = usb_microdia_control_write(dev, reg, buf, 17);
7548 if (ret < 0)
7549 goto err;
7550 /* transferbufferlength was only 11 ? */
7552 reg = 0x10e1;
7553 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7554 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7555 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7556 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7557 buf[20] = 0x00;
7558 ret = usb_microdia_control_write(dev, reg, buf, 21);
7559 if (ret < 0)
7560 goto err;
7561 /* transferbufferlength was only 15 ? */
7563 reg = 0x10e1;
7564 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7565 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7566 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7567 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7568 buf[20] = 0x00;
7569 ret = usb_microdia_control_write(dev, reg, buf, 21);
7570 if (ret < 0)
7571 goto err;
7572 /* transferbufferlength was only 15 ? */
7574 reg = 0x10e1;
7575 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7576 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7577 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7578 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7579 buf[20] = 0x00;
7580 ret = usb_microdia_control_write(dev, reg, buf, 21);
7581 if (ret < 0)
7582 goto err;
7583 /* transferbufferlength was only 15 ? */
7585 reg = 0x10e1;
7586 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7587 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7588 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7589 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7590 buf[20] = 0x00;
7591 ret = usb_microdia_control_write(dev, reg, buf, 21);
7592 if (ret < 0)
7593 goto err;
7594 /* transferbufferlength was only 15 ? */
7596 reg = 0x10e1;
7597 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7598 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7599 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7600 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7601 buf[20] = 0x00;
7602 ret = usb_microdia_control_write(dev, reg, buf, 21);
7603 if (ret < 0)
7604 goto err;
7605 /* transferbufferlength was only 15 ? */
7607 reg = 0x10e1;
7608 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7609 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7610 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7611 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7612 buf[20] = 0x00;
7613 ret = usb_microdia_control_write(dev, reg, buf, 21);
7614 if (ret < 0)
7615 goto err;
7616 /* transferbufferlength was only 15 ? */
7618 reg = 0x10e1;
7619 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7620 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7621 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7622 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7623 buf[20] = 0x00;
7624 ret = usb_microdia_control_write(dev, reg, buf, 21);
7625 if (ret < 0)
7626 goto err;
7627 /* transferbufferlength was only 15 ? */
7629 reg = 0x10e1;
7630 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7631 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7632 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7633 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7634 buf[20] = 0x00;
7635 ret = usb_microdia_control_write(dev, reg, buf, 21);
7636 if (ret < 0)
7637 goto err;
7638 /* transferbufferlength was only 15 ? */
7640 reg = 0x10e1;
7641 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
7642 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7643 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7644 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7645 buf[20] = 0x00;
7646 ret = usb_microdia_control_write(dev, reg, buf, 21);
7647 if (ret < 0)
7648 goto err;
7649 /* transferbufferlength was only 15 ? */
7651 reg = 0x10f7;
7652 buf[0] = 0x05;
7653 ret = usb_microdia_control_write(dev, reg, buf, 1);
7654 if (ret < 0)
7655 goto err;
7657 reg = 0x10f6;
7658 buf[0] = 0x1b;
7659 ret = usb_microdia_control_write(dev, reg, buf, 1);
7660 if (ret < 0)
7661 goto err;
7663 reg = 0x10e1;
7664 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
7665 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7666 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7667 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0xee; buf[19] = 0x00;
7668 buf[20] = 0x00;
7669 ret = usb_microdia_control_write(dev, reg, buf, 21);
7670 if (ret < 0)
7671 goto err;
7672 /* transferbufferlength was only 15 ? */
7674 reg = 0x10f8;
7675 buf[0] = 0x14;
7676 ret = usb_microdia_control_write(dev, reg, buf, 1);
7677 if (ret < 0)
7678 goto err;
7680 reg = 0x10fa;
7681 buf[0] = 0xff;
7682 ret = usb_microdia_control_write(dev, reg, buf, 1);
7683 if (ret < 0)
7684 goto err;
7686 reg = 0x10f9;
7687 buf[0] = 0x00;
7688 ret = usb_microdia_control_write(dev, reg, buf, 1);
7689 if (ret < 0)
7690 goto err;
7692 reg = 0x10f9;
7693 buf[0] = 0x00;
7694 ret = usb_microdia_control_write(dev, reg, buf, 1);
7695 if (ret < 0)
7696 goto err;
7698 reg = 0x11ba;
7699 buf[0] = 0x0a;
7700 ret = usb_microdia_control_write(dev, reg, buf, 1);
7701 if (ret < 0)
7702 goto err;
7704 reg = 0x11bc;
7705 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
7706 ret = usb_microdia_control_write(dev, reg, buf, 4);
7707 if (ret < 0)
7708 goto err;
7710 reg = 0x11c0;
7711 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
7712 buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00;
7713 buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00;
7714 buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00;
7715 buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00; buf[24] = 0x00;
7716 buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00; buf[28] = 0x00; buf[29] = 0x00;
7717 buf[30] = 0x00; buf[31] = 0x00; buf[32] = 0x00;
7718 ret = usb_microdia_control_write(dev, reg, buf, 33);
7719 if (ret < 0)
7720 goto err;
7721 /* transferbufferlength was only 30 ? */
7723 reg = 0x118c;
7724 buf[0] = 0x20;
7725 ret = usb_microdia_control_write(dev, reg, buf, 1);
7726 if (ret < 0)
7727 goto err;
7729 reg = 0x118d;
7730 buf[0] = 0x20;
7731 ret = usb_microdia_control_write(dev, reg, buf, 1);
7732 if (ret < 0)
7733 goto err;
7735 reg = 0x118e;
7736 buf[0] = 0x20;
7737 ret = usb_microdia_control_write(dev, reg, buf, 1);
7738 if (ret < 0)
7739 goto err;
7741 reg = 0x118f;
7742 buf[0] = 0x20;
7743 ret = usb_microdia_control_write(dev, reg, buf, 1);
7744 if (ret < 0)
7745 goto err;
7747 reg = 0x11a5;
7748 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04;
7749 buf[5] = 0x3f;
7750 ret = usb_microdia_control_write(dev, reg, buf, 6);
7751 if (ret < 0)
7752 goto err;
7754 reg = 0x11af;
7755 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
7756 ret = usb_microdia_control_write(dev, reg, buf, 4);
7757 if (ret < 0)
7758 goto err;
7760 reg = 0x11b3;
7761 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
7762 ret = usb_microdia_control_write(dev, reg, buf, 4);
7763 if (ret < 0)
7764 goto err;
7766 reg = 0x10e0;
7767 buf[0] = 0x47;
7768 ret = usb_microdia_control_write(dev, reg, buf, 1);
7769 if (ret < 0)
7770 goto err;
7772 reg = 0x1061;
7773 buf[0] = 0x01;
7774 ret = usb_microdia_control_write(dev, reg, buf, 1);
7775 if (ret < 0)
7776 goto err;
7778 reg = 0x10e0;
7779 buf[0] = 0x67;
7780 ret = usb_microdia_control_write(dev, reg, buf, 1);
7781 if (ret < 0)
7782 goto err;
7784 reg = 0x1100;
7785 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d; buf[4] = 0x08;
7786 buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d; buf[8] = 0x0d; buf[9] = 0x0d;
7787 buf[10] = 0x11; buf[11] = 0x0d; buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15;
7788 buf[15] = 0x21; buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11;
7789 buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d; buf[24] = 0x19;
7790 buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a; buf[28] = 0x32; buf[29] = 0x32;
7791 buf[30] = 0x2e; buf[31] = 0x2a; buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36;
7792 buf[35] = 0x3a; buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a;
7793 buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e; buf[44] = 0x43;
7794 buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47; buf[48] = 0x4f; buf[49] = 0x53;
7795 buf[50] = 0x58; buf[51] = 0x58; buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f;
7796 buf[55] = 0x60; buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64;
7797 buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
7798 ret = usb_microdia_control_write(dev, reg, buf, 64);
7799 if (ret < 0)
7800 goto err;
7801 /* transferbufferlength is only 40 ? */
7803 reg = 0x1140;
7804 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15; buf[4] = 0x11;
7805 buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15; buf[8] = 0x15; buf[9] = 0x26;
7806 buf[10] = 0x53; buf[11] = 0x36; buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53;
7807 buf[15] = 0x53; buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53;
7808 buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53; buf[24] = 0x53;
7809 buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53; buf[28] = 0x53; buf[29] = 0x53;
7810 buf[30] = 0x53; buf[31] = 0x53; buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53;
7811 buf[35] = 0x53; buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53;
7812 buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53; buf[44] = 0x53;
7813 buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53; buf[48] = 0x53; buf[49] = 0x53;
7814 buf[50] = 0x53; buf[51] = 0x53; buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53;
7815 buf[55] = 0x53; buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53;
7816 buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
7817 ret = usb_microdia_control_write(dev, reg, buf, 64);
7818 if (ret < 0)
7819 goto err;
7820 /* transferbufferlength is only 40 ? */
7822 reg = 0x10e0;
7823 buf[0] = 0x47;
7824 ret = usb_microdia_control_write(dev, reg, buf, 1);
7825 if (ret < 0)
7826 goto err;
7828 reg = 0x1061;
7829 buf[0] = 0x03;
7830 ret = usb_microdia_control_write(dev, reg, buf, 1);
7831 if (ret < 0)
7832 goto err;
7834 reg = 0x10e0;
7835 buf[0] = 0x4b;
7836 ret = usb_microdia_control_write(dev, reg, buf, 1);
7837 if (ret < 0)
7838 goto err;
7840 buf[0] = 0x08;
7841 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
7842 OV7660_CTL_VREF, dev->sensor_flags, buf);
7843 if (ret < 0)
7844 goto errI2C;
7846 reg = 0x1180;
7847 buf[0] = 0x01; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x28;
7848 buf[5] = 0x3c;
7849 ret = usb_microdia_control_write(dev, reg, buf, 6);
7850 if (ret < 0)
7851 goto err;
7853 reg = 0x10fb;
7854 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
7855 ret = usb_microdia_control_write(dev, reg, buf, 5);
7856 if (ret < 0)
7857 goto err;
7859 reg = 0x1189;
7860 buf[0] = 0x8c;
7861 ret = usb_microdia_control_write(dev, reg, buf, 1);
7862 if (ret < 0)
7863 goto err;
7865 reg = 0x11a1;
7866 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x6a; buf[3] = 0x50;
7867 ret = usb_microdia_control_write(dev, reg, buf, 4);
7868 if (ret < 0)
7869 goto err;
7871 reg = 0x11ab;
7872 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x50; buf[3] = 0x3c;
7873 ret = usb_microdia_control_write(dev, reg, buf, 4);
7874 if (ret < 0)
7875 goto err;
7877 reg = 0x1061;
7878 buf[0] = 0x03;
7879 ret = usb_microdia_control_write(dev, reg, buf, 1);
7880 if (ret < 0)
7881 goto err;
7883 reg = 0x11ba;
7884 buf[0] = 0x0a;
7885 ret = usb_microdia_control_write(dev, reg, buf, 1);
7886 if (ret < 0)
7887 goto err;
7889 reg = 0x11b9;
7890 buf[0] = 0x00;
7891 ret = usb_microdia_control_write(dev, reg, buf, 1);
7892 if (ret < 0)
7893 goto err;
7895 reg = 0x11ba;
7896 buf[0] = 0x0b;
7897 ret = usb_microdia_control_write(dev, reg, buf, 1);
7898 if (ret < 0)
7899 goto err;
7901 reg = 0x1061;
7902 buf[0] = 0x01;
7903 ret = usb_microdia_control_write(dev, reg, buf, 1);
7904 if (ret < 0)
7905 goto err;
7907 reg = 0x1000;
7908 buf[0] = 0x78;
7909 ret = usb_microdia_control_write(dev, reg, buf, 1);
7910 if (ret < 0)
7911 goto err;
7913 reg = 0x1002;
7914 buf[0] = 0x18;
7915 ret = usb_microdia_control_write(dev, reg, buf, 1);
7916 if (ret < 0)
7917 goto err;
7919 reg = 0x1002;
7920 buf[0] = 0x18;
7921 ret = usb_microdia_control_write(dev, reg, buf, 1);
7922 if (ret < 0)
7923 goto err;
7925 reg = 0x11b8;
7926 buf[0] = 0x7b;
7927 ret = usb_microdia_control_write(dev, reg, buf, 1);
7928 if (ret < 0)
7929 goto err;
7931 reg = 0x118a;
7932 buf[0] = 0x04;
7933 ret = usb_microdia_control_write(dev, reg, buf, 1);
7934 if (ret < 0)
7935 goto err;
7937 reg = 0x0395;
7938 buf[0] = 0x04;
7939 ret = usb_microdia_control_write(dev, reg, buf, 1);
7940 if (ret < 0)
7941 goto err;
7943 reg = 0x11b8;
7944 buf[0] = 0x78;
7945 ret = usb_microdia_control_write(dev, reg, buf, 1);
7946 if (ret < 0)
7947 goto err;
7948 ret = usb_microdia_control_read(dev, reg, buf, 1);
7949 if (ret < 0)
7950 goto err;
7952 reg = 0x11b8;
7953 buf[0] = 0xf9;
7954 ret = usb_microdia_control_write(dev, reg, buf, 1);
7955 if (ret < 0)
7956 goto err;
7957 ret = usb_microdia_control_read(dev, reg, buf, 1);
7958 if (ret < 0)
7959 goto err;
7961 reg = 0x11b8;
7962 buf[0] = 0xfa;
7963 ret = usb_microdia_control_write(dev, reg, buf, 1);
7964 if (ret < 0)
7965 goto err;
7966 ret = usb_microdia_control_read(dev, reg, buf, 1);
7967 if (ret < 0)
7968 goto err;
7970 reg = 0x11b8;
7971 buf[0] = 0x7b;
7972 ret = usb_microdia_control_write(dev, reg, buf, 1);
7973 if (ret < 0)
7974 goto err;
7975 ret = usb_microdia_control_read(dev, reg, buf, 1);
7976 if (ret < 0)
7977 goto err;
7979 reg = 0x11b8;
7980 buf[0] = 0x7c;
7981 ret = usb_microdia_control_write(dev, reg, buf, 1);
7982 if (ret < 0)
7983 goto err;
7984 ret = usb_microdia_control_read(dev, reg, buf, 1);
7985 if (ret < 0)
7986 goto err;
7988 reg = 0x11b8;
7989 buf[0] = 0x7d;
7990 ret = usb_microdia_control_write(dev, reg, buf, 1);
7991 if (ret < 0)
7992 goto err;
7993 ret = usb_microdia_control_read(dev, reg, buf, 1);
7994 if (ret < 0)
7995 goto err;
7997 reg = 0x11b8;
7998 buf[0] = 0x7b;
7999 ret = usb_microdia_control_write(dev, reg, buf, 1);
8000 if (ret < 0)
8001 goto err;
8003 buf[0] = 0x40;
8004 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8005 OV7660_CTL_CLKRC, dev->sensor_flags, buf);
8006 if (ret < 0)
8007 goto errI2C;
8009 buf[0] = 0x00;
8010 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8011 OV7660_CTL_EXHCH, dev->sensor_flags, buf);
8012 if (ret < 0)
8013 goto errI2C;
8015 buf[0] = 0x00;
8016 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8017 OV7660_CTL_EXHCL, dev->sensor_flags, buf);
8018 if (ret < 0)
8019 goto errI2C;
8021 buf[0] = 0x00;
8022 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8023 OV7660_CTL_DM_LNL, dev->sensor_flags, buf);
8024 if (ret < 0)
8025 goto errI2C;
8027 buf[0] = 0x00;
8028 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8029 OV7660_CTL_DM_LNH, dev->sensor_flags, buf);
8030 if (ret < 0)
8031 goto errI2C;
8033 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8034 OV7660_CTL_PID, dev->sensor_flags, buf);
8035 if (ret < 0)
8036 goto errI2C;
8038 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8039 OV7660_CTL_VER, dev->sensor_flags, buf);
8040 if (ret < 0)
8041 goto errI2C;
8043 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8044 OV7660_CTL_MIDH, dev->sensor_flags, buf);
8045 if (ret < 0)
8046 goto errI2C;
8048 ret = sn9c20x_read_i2c_data(dev, dev->sensor_slave_address, 1,
8049 OV7660_CTL_MIDL, dev->sensor_flags, buf);
8050 if (ret < 0)
8051 goto errI2C;
8053 reg = 0x1061;
8054 buf[0] = 0x03;
8055 ret = usb_microdia_control_write(dev, reg, buf, 1);
8056 if (ret < 0)
8057 goto err;
8059 reg = 0x1007;
8060 buf[0] = 0x60;
8061 ret = usb_microdia_control_write(dev, reg, buf, 1);
8062 if (ret < 0)
8063 goto err;
8065 reg = 0x1006;
8066 buf[0] = 0x00;
8067 ret = usb_microdia_control_write(dev, reg, buf, 1);
8068 if (ret < 0)
8069 goto err;
8071 reg = 0x1007;
8072 buf[0] = 0x60;
8073 ret = usb_microdia_control_write(dev, reg, buf, 1);
8074 if (ret < 0)
8075 goto err;
8077 reg = 0x1006;
8078 buf[0] = 0x00;
8079 ret = usb_microdia_control_write(dev, reg, buf, 1);
8080 if (ret < 0)
8081 goto err;
8083 reg = 0x10e1;
8084 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8085 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8086 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8087 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8088 buf[20] = 0x00;
8089 ret = usb_microdia_control_write(dev, reg, buf, 21);
8090 if (ret < 0)
8091 goto err;
8092 /* transferbufferlength is only 15 ? */
8094 buf[0] = 0x7f;
8095 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8096 OV7660_CTL_AECH, dev->sensor_flags, buf);
8097 if (ret < 0)
8098 goto errI2C;
8100 buf[0] = 0x01;
8101 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8102 OV7660_CTL_COM1, dev->sensor_flags, buf);
8103 if (ret < 0)
8104 goto errI2C;
8106 reg = 0x10e1;
8107 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8108 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8109 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8110 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8111 buf[20] = 0x00;
8112 ret = usb_microdia_control_write(dev, reg, buf, 21);
8113 if (ret < 0)
8114 goto err;
8115 /* transferbufferlength is only 15 ? */
8117 buf[0] = 0x13;
8118 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8119 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8120 if (ret < 0)
8121 goto errI2C;
8123 reg = 0x10e1;
8124 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8125 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc4; buf[9] = 0x0f;
8126 buf[10] = 0x44; buf[11] = 0x00; buf[12] = 0x3f; buf[13] = 0x00; buf[14] = 0xd8;
8127 buf[15] = 0x0f; buf[16] = 0xe9; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8128 buf[20] = 0x00;
8129 ret = usb_microdia_control_write(dev, reg, buf, 21);
8130 if (ret < 0)
8131 goto err;
8132 /* transferbufferlength is only 15 ? */
8134 buf[0] = 0x00; buf[1] = 0x01;
8135 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8136 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8137 if (ret < 0)
8138 goto errI2C;
8140 buf[0] = 0x1e;
8141 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1,
8142 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8143 if (ret < 0)
8144 goto errI2C;
8146 buf[0] = 0x50; buf[1] = 0x60;
8147 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8148 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8149 if (ret < 0)
8150 goto errI2C;
8152 reg = 0x118c;
8153 buf[0] = 0x1e;
8154 ret = usb_microdia_control_write(dev, reg, buf, 1);
8155 if (ret < 0)
8156 goto err;
8158 reg = 0x118d;
8159 buf[0] = 0x20;
8160 ret = usb_microdia_control_write(dev, reg, buf, 1);
8161 if (ret < 0)
8162 goto err;
8164 reg = 0x118e;
8165 buf[0] = 0x20;
8166 ret = usb_microdia_control_write(dev, reg, buf, 1);
8167 if (ret < 0)
8168 goto err;
8170 reg = 0x118f;
8171 buf[0] = 0x21;
8172 ret = usb_microdia_control_write(dev, reg, buf, 1);
8173 if (ret < 0)
8174 goto err;
8176 buf[0] = 0xfc; buf[1] = 0x04;
8177 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8178 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8179 if (ret < 0)
8180 goto errI2C;
8182 reg = 0x10e1;
8183 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8184 buf[5] = 0x00; buf[6] = 0xf9; buf[7] = 0x0f; buf[8] = 0xc8; buf[9] = 0x0f;
8185 buf[10] = 0x3f; buf[11] = 0x00; buf[12] = 0x3b; buf[13] = 0x00; buf[14] = 0xdb;
8186 buf[15] = 0x0f; buf[16] = 0xeb; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8187 buf[20] = 0x00;
8188 ret = usb_microdia_control_write(dev, reg, buf, 21);
8189 if (ret < 0)
8190 goto err;
8191 /* transferbufferlength is only 15 ? */
8193 buf[0] = 0x1f; buf[1] = 0x00;
8194 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8195 OV7660_CTL_GAIN, dev->sensor_flags, buf);
8196 if (ret < 0)
8197 goto errI2C;
8199 buf[0] = 0x48; buf[1] = 0x58;
8200 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8201 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8202 if (ret < 0)
8203 goto errI2C;
8205 reg = 0x118c;
8206 buf[0] = 0x20;
8207 ret = usb_microdia_control_write(dev, reg, buf, 1);
8208 if (ret < 0)
8209 goto err;
8211 reg = 0x118d;
8212 buf[0] = 0x20;
8213 ret = usb_microdia_control_write(dev, reg, buf, 1);
8214 if (ret < 0)
8215 goto err;
8217 reg = 0x118e;
8218 buf[0] = 0x20;
8219 ret = usb_microdia_control_write(dev, reg, buf, 1);
8220 if (ret < 0)
8221 goto err;
8223 reg = 0x118f;
8224 buf[0] = 0x1f;
8225 ret = usb_microdia_control_write(dev, reg, buf, 1);
8226 if (ret < 0)
8227 goto err;
8229 buf[0] = 0xf6; buf[1] = 0x0b;
8230 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8231 OV7660_CTL_ADVFL, dev->sensor_flags, buf);
8232 if (ret < 0)
8233 goto errI2C;
8235 reg = 0x10e1;
8236 buf[0] = 0x15; buf[1] = 0x00; buf[2] = 0x29; buf[3] = 0x00; buf[4] = 0x08;
8237 buf[5] = 0x00; buf[6] = 0xfc; buf[7] = 0x0f; buf[8] = 0xdc; buf[9] = 0x0f;
8238 buf[10] = 0x29; buf[11] = 0x00; buf[12] = 0x26; buf[13] = 0x00; buf[14] = 0xe8;
8239 buf[15] = 0x0f; buf[16] = 0xf3; buf[17] = 0x0f; buf[18] = 0xeb; buf[19] = 0x00;
8240 buf[20] = 0x00;
8241 ret = usb_microdia_control_write(dev, reg, buf, 21);
8242 if (ret < 0)
8243 goto err;
8244 /* transferbufferlength is only 15 ? */
8246 reg = 0x118c;
8247 buf[0] = 0x21;
8248 ret = usb_microdia_control_write(dev, reg, buf, 1);
8249 if (ret < 0)
8250 goto err;
8252 reg = 0x118d;
8253 buf[0] = 0x20;
8254 ret = usb_microdia_control_write(dev, reg, buf, 1);
8255 if (ret < 0)
8256 goto err;
8258 reg = 0x118e;
8259 buf[0] = 0x20;
8260 ret = usb_microdia_control_write(dev, reg, buf, 1);
8261 if (ret < 0)
8262 goto err;
8264 reg = 0x118f;
8265 buf[0] = 0x21;
8266 ret = usb_microdia_control_write(dev, reg, buf, 1);
8267 if (ret < 0)
8268 goto err;
8270 reg = 0x1006;
8271 buf[0] = 0x40;
8272 ret = usb_microdia_control_write(dev, reg, buf, 1);
8273 if (ret < 0)
8274 goto err;
8276 buf[0] = 0x50; buf[1] = 0x60;
8277 ret = sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
8278 OV7660_CTL_BLUE, dev->sensor_flags, buf);
8279 if (ret < 0)
8280 goto errI2C;
8282 reg = 0x118c;
8283 buf[0] = 0x1f;
8284 ret = usb_microdia_control_write(dev, reg, buf, 1);
8285 if (ret < 0)
8286 goto err;
8288 reg = 0x118d;
8289 buf[0] = 0x20;
8290 ret = usb_microdia_control_write(dev, reg, buf, 1);
8291 if (ret < 0)
8292 goto err;
8294 reg = 0x118e;
8295 buf[0] = 0x20;
8296 ret = usb_microdia_control_write(dev, reg, buf, 1);
8297 if (ret < 0)
8298 goto err;
8300 reg = 0x118f;
8301 buf[0] = 0x20;
8302 ret = usb_microdia_control_write(dev, reg, buf, 1);
8303 if (ret < 0)
8304 goto err;
8306 return ret;
8307 err:
8308 UDIA_ERROR("r/w in bridge register %x failed (%d)!\n", reg, ret);
8309 return ret;
8311 errI2C:
8312 UDIA_ERROR("r/w in sensor register %x failed (%d)!\n", reg, ret);
8313 return ret;
8317 /**
8318 * @brief From UsbSnoop-plugin-parsed.log
8320 * @param dev
8322 * @returns 0 (OK) or <0 (Error)
8324 * @author Vincent, Kuzja
8326 int microdia_6288_start_stream(struct usb_microdia *dev)
8328 int ret;
8329 __u16 reg;
8330 __u8 buf[64];
8334 reg = 0x1066 ;
8335 buf[0] = 0x00;
8336 ret = usb_microdia_control_write(dev, reg, buf, 1);
8337 if(ret < 0) goto err;
8339 reg = 0x1000 ;
8340 buf[0] = 0x78;
8341 ret = usb_microdia_control_write(dev, reg, buf, 1);
8342 if(ret < 0) goto err;
8344 reg = 0x1001 ;
8345 buf[0] = 0xc7;
8346 ret = usb_microdia_control_write(dev, reg, buf, 1);
8347 if(ret < 0) goto err;
8349 reg = 0x1002 ;
8350 buf[0] = 0x1c;
8351 ret = usb_microdia_control_write(dev, reg, buf, 1);
8352 if(ret < 0) goto err;
8354 reg = 0x1061 ;
8355 buf[0] = 0x01;
8356 ret = usb_microdia_control_write(dev, reg, buf, 1);
8357 if(ret < 0) goto err;
8359 reg = 0x1020 ;
8360 buf[0] = 0x80;
8361 ret = usb_microdia_control_write(dev, reg, buf, 1);
8362 if(ret < 0) goto err;
8364 reg = 0x1067 ;
8365 buf[0] = 0x40; buf[1] = 0x30; buf[2] = 0x20; buf[3] = 0x10; buf[4] = 0x08;
8366 ret = usb_microdia_control_write(dev, reg, buf, 5);
8367 if(ret < 0) goto err;
8369 reg = 0x10c0 ;
8370 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;
8371 ret = usb_microdia_control_write(dev, reg, buf, 9);
8372 if(ret < 0) goto err;
8374 reg = 0x10e0 ;
8375 buf[0] = 0x44; buf[1] = 0x18; buf[2] = 0x00; buf[3] = 0x30; buf[4] = 0x00; buf[5] = 0x09; buf[6] = 0x00; buf[7] = 0xed; buf[8] = 0x0f; buf[9] = 0xda; buf[10] = 0x0f; buf[11] = 0x3a; buf[12] = 0x00; buf[13] = 0x3a; buf[14] = 0x00; buf[15] = 0xd0; buf[16] = 0x0f; buf[17] = 0xf7; buf[18] = 0x0f; buf[19] = 0x00; buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x60; buf[23] = 0x0a;
8376 ret = usb_microdia_control_write(dev, reg, buf, 24);
8377 if(ret < 0) goto err;
8379 reg = 0x10f8 ;
8380 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00;
8381 ret = usb_microdia_control_write(dev, reg, buf, 3);
8382 if(ret < 0) goto err;
8384 reg = 0x10fb ;
8385 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
8386 ret = usb_microdia_control_write(dev, reg, buf, 5);
8387 if(ret < 0) goto err;
8389 reg = 0x1188 ;
8390 buf[0] = 0x86; buf[1] = 0xcc; buf[2] = 0x08;
8391 ret = usb_microdia_control_write(dev, reg, buf, 3);
8392 if(ret < 0) goto err;
8394 reg = 0x118b ;
8395 buf[0] = 0x00; buf[1] = 0x20; buf[2] = 0x20; buf[3] = 0x20; buf[4] = 0x20; buf[5] = 0x00; buf[6] = 0x24; buf[7] = 0x3b; buf[8] = 0x4f; buf[9] = 0x61; buf[10] = 0x71; buf[11] = 0x80; buf[12] = 0x8f; buf[13] = 0x9d; buf[14] = 0xab; buf[15] = 0xb8; buf[16] = 0xc4; buf[17] = 0xd1; buf[18] = 0xdd; buf[19] = 0xe9; buf[20] = 0xf4; buf[21] = 0xff;
8396 ret = usb_microdia_control_write(dev, reg, buf, 22);
8397 if(ret < 0) goto err;
8399 reg = 0x11a1 ;
8400 buf[0] = 0x00; buf[1] = 0x00;
8401 ret = usb_microdia_control_write(dev, reg, buf, 2);
8402 if(ret < 0) goto err;
8404 reg = 0x11b7 ;
8405 buf[0] = 0x60; buf[1] = 0x20; buf[2] = 0x00; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x40; buf[6] = 0x01; buf[7] = 0xf0; buf[8] = 0x00;
8406 ret = usb_microdia_control_write(dev, reg, buf, 9);
8407 if(ret < 0) goto err;
8409 reg = 0x11b8 ;
8410 buf[0] = 0x30;
8411 ret = usb_microdia_control_write(dev, reg, buf, 1);
8412 if(ret < 0) goto err;
8414 reg = 0x1000 ;
8415 buf[0] = 0x78;
8416 ret = usb_microdia_control_write(dev, reg, buf, 1);
8417 if(ret < 0) goto err;
8419 reg = 0x10c0 ;
8420 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8421 ret = usb_microdia_control_write(dev, reg, buf, 8);
8422 if(ret < 0) goto err;
8424 reg = 0x10c0 ;
8425 ret = usb_microdia_control_read(dev, reg, buf, 1);
8426 if(ret < 0) goto err;
8428 reg = 0x10c0 ;
8429 ret = usb_microdia_control_read(dev, reg, buf, 1);
8430 if(ret < 0) goto err;
8432 reg = 0x10c0 ;
8433 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x12; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8434 ret = usb_microdia_control_write(dev, reg, buf, 8);
8435 if(ret < 0) goto err;
8437 reg = 0x10c0 ;
8438 ret = usb_microdia_control_read(dev, reg, buf, 1);
8439 if(ret < 0) goto err;
8441 reg = 0x10c0 ;
8442 ret = usb_microdia_control_read(dev, reg, buf, 1);
8443 if(ret < 0) goto err;
8445 reg = 0x10c0 ;
8446 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8447 ret = usb_microdia_control_write(dev, reg, buf, 8);
8448 if(ret < 0) goto err;
8450 reg = 0x10c0 ;
8451 ret = usb_microdia_control_read(dev, reg, buf, 1);
8452 if(ret < 0) goto err;
8454 reg = 0x10c0 ;
8455 ret = usb_microdia_control_read(dev, reg, buf, 1);
8456 if(ret < 0) goto err;
8458 reg = 0x10c0 ;
8459 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x0e; buf[3] = 0x61; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8460 ret = usb_microdia_control_write(dev, reg, buf, 8);
8461 if(ret < 0) goto err;
8463 reg = 0x10c0 ;
8464 ret = usb_microdia_control_read(dev, reg, buf, 1);
8465 if(ret < 0) goto err;
8467 reg = 0x10c0 ;
8468 ret = usb_microdia_control_read(dev, reg, buf, 1);
8469 if(ret < 0) goto err;
8471 reg = 0x10c0 ;
8472 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8473 ret = usb_microdia_control_write(dev, reg, buf, 8);
8474 if(ret < 0) goto err;
8476 reg = 0x10c0 ;
8477 ret = usb_microdia_control_read(dev, reg, buf, 1);
8478 if(ret < 0) goto err;
8480 reg = 0x10c0 ;
8481 ret = usb_microdia_control_read(dev, reg, buf, 1);
8482 if(ret < 0) goto err;
8484 reg = 0x10c0 ;
8485 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x13; buf[3] = 0xb8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8486 ret = usb_microdia_control_write(dev, reg, buf, 8);
8487 if(ret < 0) goto err;
8489 reg = 0x10c0 ;
8490 ret = usb_microdia_control_read(dev, reg, buf, 1);
8491 if(ret < 0) goto err;
8493 reg = 0x10c0 ;
8494 ret = usb_microdia_control_read(dev, reg, buf, 1);
8495 if(ret < 0) goto err;
8497 reg = 0x10c0 ;
8498 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x14; buf[3] = 0x3e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8499 ret = usb_microdia_control_write(dev, reg, buf, 8);
8500 if(ret < 0) goto err;
8502 reg = 0x10c0 ;
8503 ret = usb_microdia_control_read(dev, reg, buf, 1);
8504 if(ret < 0) goto err;
8506 reg = 0x10c0 ;
8507 ret = usb_microdia_control_read(dev, reg, buf, 1);
8508 if(ret < 0) goto err;
8510 reg = 0x10c0 ;
8511 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x16; buf[3] = 0x24; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8512 ret = usb_microdia_control_write(dev, reg, buf, 8);
8513 if(ret < 0) goto err;
8515 reg = 0x10c0 ;
8516 ret = usb_microdia_control_read(dev, reg, buf, 1);
8517 if(ret < 0) goto err;
8519 reg = 0x10c0 ;
8520 ret = usb_microdia_control_read(dev, reg, buf, 1);
8521 if(ret < 0) goto err;
8523 reg = 0x10c0 ;
8524 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8525 ret = usb_microdia_control_write(dev, reg, buf, 8);
8526 if(ret < 0) goto err;
8528 reg = 0x10c0 ;
8529 ret = usb_microdia_control_read(dev, reg, buf, 1);
8530 if(ret < 0) goto err;
8532 reg = 0x10c0 ;
8533 ret = usb_microdia_control_read(dev, reg, buf, 1);
8534 if(ret < 0) goto err;
8536 reg = 0x10c0 ;
8537 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8538 ret = usb_microdia_control_write(dev, reg, buf, 8);
8539 if(ret < 0) goto err;
8541 reg = 0x10c0 ;
8542 ret = usb_microdia_control_read(dev, reg, buf, 1);
8543 if(ret < 0) goto err;
8545 reg = 0x10c0 ;
8546 ret = usb_microdia_control_read(dev, reg, buf, 1);
8547 if(ret < 0) goto err;
8549 reg = 0x10c0 ;
8550 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8551 ret = usb_microdia_control_write(dev, reg, buf, 8);
8552 if(ret < 0) goto err;
8554 reg = 0x10c0 ;
8555 ret = usb_microdia_control_read(dev, reg, buf, 1);
8556 if(ret < 0) goto err;
8558 reg = 0x10c0 ;
8559 ret = usb_microdia_control_read(dev, reg, buf, 1);
8560 if(ret < 0) goto err;
8562 reg = 0x10c0 ;
8563 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x27; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8564 ret = usb_microdia_control_write(dev, reg, buf, 8);
8565 if(ret < 0) goto err;
8567 reg = 0x10c0 ;
8568 ret = usb_microdia_control_read(dev, reg, buf, 1);
8569 if(ret < 0) goto err;
8571 reg = 0x10c0 ;
8572 ret = usb_microdia_control_read(dev, reg, buf, 1);
8573 if(ret < 0) goto err;
8575 reg = 0x10c0 ;
8576 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x28; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8577 ret = usb_microdia_control_write(dev, reg, buf, 8);
8578 if(ret < 0) goto err;
8580 reg = 0x10c0 ;
8581 ret = usb_microdia_control_read(dev, reg, buf, 1);
8582 if(ret < 0) goto err;
8584 reg = 0x10c0 ;
8585 ret = usb_microdia_control_read(dev, reg, buf, 1);
8586 if(ret < 0) goto err;
8588 reg = 0x10c0 ;
8589 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x29; buf[3] = 0x15; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8590 ret = usb_microdia_control_write(dev, reg, buf, 8);
8591 if(ret < 0) goto err;
8593 reg = 0x10c0 ;
8594 ret = usb_microdia_control_read(dev, reg, buf, 1);
8595 if(ret < 0) goto err;
8597 reg = 0x10c0 ;
8598 ret = usb_microdia_control_read(dev, reg, buf, 1);
8599 if(ret < 0) goto err;
8601 reg = 0x10c0 ;
8602 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2c; buf[3] = 0x08; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8603 ret = usb_microdia_control_write(dev, reg, buf, 8);
8604 if(ret < 0) goto err;
8606 reg = 0x10c0 ;
8607 ret = usb_microdia_control_read(dev, reg, buf, 1);
8608 if(ret < 0) goto err;
8610 reg = 0x10c0 ;
8611 ret = usb_microdia_control_read(dev, reg, buf, 1);
8612 if(ret < 0) goto err;
8614 reg = 0x10c0 ;
8615 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8616 ret = usb_microdia_control_write(dev, reg, buf, 8);
8617 if(ret < 0) goto err;
8619 reg = 0x10c0 ;
8620 ret = usb_microdia_control_read(dev, reg, buf, 1);
8621 if(ret < 0) goto err;
8623 reg = 0x10c0 ;
8624 ret = usb_microdia_control_read(dev, reg, buf, 1);
8625 if(ret < 0) goto err;
8627 reg = 0x10c0 ;
8628 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x34; buf[3] = 0x3d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8629 ret = usb_microdia_control_write(dev, reg, buf, 8);
8630 if(ret < 0) goto err;
8632 reg = 0x10c0 ;
8633 ret = usb_microdia_control_read(dev, reg, buf, 1);
8634 if(ret < 0) goto err;
8636 reg = 0x10c0 ;
8637 ret = usb_microdia_control_read(dev, reg, buf, 1);
8638 if(ret < 0) goto err;
8640 reg = 0x10c0 ;
8641 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x35; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8642 ret = usb_microdia_control_write(dev, reg, buf, 8);
8643 if(ret < 0) goto err;
8645 reg = 0x10c0 ;
8646 ret = usb_microdia_control_read(dev, reg, buf, 1);
8647 if(ret < 0) goto err;
8649 reg = 0x10c0 ;
8650 ret = usb_microdia_control_read(dev, reg, buf, 1);
8651 if(ret < 0) goto err;
8653 reg = 0x10c0 ;
8654 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x36; buf[3] = 0xf8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8655 ret = usb_microdia_control_write(dev, reg, buf, 8);
8656 if(ret < 0) goto err;
8658 reg = 0x10c0 ;
8659 ret = usb_microdia_control_read(dev, reg, buf, 1);
8660 if(ret < 0) goto err;
8662 reg = 0x10c0 ;
8663 ret = usb_microdia_control_read(dev, reg, buf, 1);
8664 if(ret < 0) goto err;
8666 reg = 0x10c0 ;
8667 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x38; buf[3] = 0x12; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8668 ret = usb_microdia_control_write(dev, reg, buf, 8);
8669 if(ret < 0) goto err;
8671 reg = 0x10c0 ;
8672 ret = usb_microdia_control_read(dev, reg, buf, 1);
8673 if(ret < 0) goto err;
8675 reg = 0x10c0 ;
8676 ret = usb_microdia_control_read(dev, reg, buf, 1);
8677 if(ret < 0) goto err;
8679 reg = 0x10c0 ;
8680 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x39; buf[3] = 0x57; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8681 ret = usb_microdia_control_write(dev, reg, buf, 8);
8682 if(ret < 0) goto err;
8684 reg = 0x10c0 ;
8685 ret = usb_microdia_control_read(dev, reg, buf, 1);
8686 if(ret < 0) goto err;
8688 reg = 0x10c0 ;
8689 ret = usb_microdia_control_read(dev, reg, buf, 1);
8690 if(ret < 0) goto err;
8692 reg = 0x10c0 ;
8693 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8694 ret = usb_microdia_control_write(dev, reg, buf, 8);
8695 if(ret < 0) goto err;
8697 reg = 0x10c0 ;
8698 ret = usb_microdia_control_read(dev, reg, buf, 1);
8699 if(ret < 0) goto err;
8701 reg = 0x10c0 ;
8702 ret = usb_microdia_control_read(dev, reg, buf, 1);
8703 if(ret < 0) goto err;
8705 reg = 0x10c0 ;
8706 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3b; buf[3] = 0xcc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8707 ret = usb_microdia_control_write(dev, reg, buf, 8);
8708 if(ret < 0) goto err;
8710 reg = 0x10c0 ;
8711 ret = usb_microdia_control_read(dev, reg, buf, 1);
8712 if(ret < 0) goto err;
8714 reg = 0x10c0 ;
8715 ret = usb_microdia_control_read(dev, reg, buf, 1);
8716 if(ret < 0) goto err;
8718 reg = 0x10c0 ;
8719 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3c; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8720 ret = usb_microdia_control_write(dev, reg, buf, 8);
8721 if(ret < 0) goto err;
8723 reg = 0x10c0 ;
8724 ret = usb_microdia_control_read(dev, reg, buf, 1);
8725 if(ret < 0) goto err;
8727 reg = 0x10c0 ;
8728 ret = usb_microdia_control_read(dev, reg, buf, 1);
8729 if(ret < 0) goto err;
8731 reg = 0x10c0 ;
8732 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3d; buf[3] = 0x19; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8733 ret = usb_microdia_control_write(dev, reg, buf, 8);
8734 if(ret < 0) goto err;
8736 reg = 0x10c0 ;
8737 ret = usb_microdia_control_read(dev, reg, buf, 1);
8738 if(ret < 0) goto err;
8740 reg = 0x10c0 ;
8741 ret = usb_microdia_control_read(dev, reg, buf, 1);
8742 if(ret < 0) goto err;
8744 reg = 0x10c0 ;
8745 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3e; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8746 ret = usb_microdia_control_write(dev, reg, buf, 8);
8747 if(ret < 0) goto err;
8749 reg = 0x10c0 ;
8750 ret = usb_microdia_control_read(dev, reg, buf, 1);
8751 if(ret < 0) goto err;
8753 reg = 0x10c0 ;
8754 ret = usb_microdia_control_read(dev, reg, buf, 1);
8755 if(ret < 0) goto err;
8757 reg = 0x10c0 ;
8758 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x3f; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8759 ret = usb_microdia_control_write(dev, reg, buf, 8);
8760 if(ret < 0) goto err;
8762 reg = 0x10c0 ;
8763 ret = usb_microdia_control_read(dev, reg, buf, 1);
8764 if(ret < 0) goto err;
8766 reg = 0x10c0 ;
8767 ret = usb_microdia_control_read(dev, reg, buf, 1);
8768 if(ret < 0) goto err;
8770 reg = 0x10c0 ;
8771 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x41; buf[3] = 0x40; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8772 ret = usb_microdia_control_write(dev, reg, buf, 8);
8773 if(ret < 0) goto err;
8775 reg = 0x10c0 ;
8776 ret = usb_microdia_control_read(dev, reg, buf, 1);
8777 if(ret < 0) goto err;
8779 reg = 0x10c0 ;
8780 ret = usb_microdia_control_read(dev, reg, buf, 1);
8781 if(ret < 0) goto err;
8783 reg = 0x10c0 ;
8784 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x42; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8785 ret = usb_microdia_control_write(dev, reg, buf, 8);
8786 if(ret < 0) goto err;
8788 reg = 0x10c0 ;
8789 ret = usb_microdia_control_read(dev, reg, buf, 1);
8790 if(ret < 0) goto err;
8792 reg = 0x10c0 ;
8793 ret = usb_microdia_control_read(dev, reg, buf, 1);
8794 if(ret < 0) goto err;
8796 reg = 0x10c0 ;
8797 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x45; buf[3] = 0x46; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8798 ret = usb_microdia_control_write(dev, reg, buf, 8);
8799 if(ret < 0) goto err;
8801 reg = 0x10c0 ;
8802 ret = usb_microdia_control_read(dev, reg, buf, 1);
8803 if(ret < 0) goto err;
8805 reg = 0x10c0 ;
8806 ret = usb_microdia_control_read(dev, reg, buf, 1);
8807 if(ret < 0) goto err;
8809 reg = 0x10c0 ;
8810 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x46; buf[3] = 0x62; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8811 ret = usb_microdia_control_write(dev, reg, buf, 8);
8812 if(ret < 0) goto err;
8814 reg = 0x10c0 ;
8815 ret = usb_microdia_control_read(dev, reg, buf, 1);
8816 if(ret < 0) goto err;
8818 reg = 0x10c0 ;
8819 ret = usb_microdia_control_read(dev, reg, buf, 1);
8820 if(ret < 0) goto err;
8822 reg = 0x10c0 ;
8823 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x47; buf[3] = 0x2a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8824 ret = usb_microdia_control_write(dev, reg, buf, 8);
8825 if(ret < 0) goto err;
8827 reg = 0x10c0 ;
8828 ret = usb_microdia_control_read(dev, reg, buf, 1);
8829 if(ret < 0) goto err;
8831 reg = 0x10c0 ;
8832 ret = usb_microdia_control_read(dev, reg, buf, 1);
8833 if(ret < 0) goto err;
8835 reg = 0x10c0 ;
8836 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x48; buf[3] = 0x3c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8837 ret = usb_microdia_control_write(dev, reg, buf, 8);
8838 if(ret < 0) goto err;
8840 reg = 0x10c0 ;
8841 ret = usb_microdia_control_read(dev, reg, buf, 1);
8842 if(ret < 0) goto err;
8844 reg = 0x10c0 ;
8845 ret = usb_microdia_control_read(dev, reg, buf, 1);
8846 if(ret < 0) goto err;
8848 reg = 0x10c0 ;
8849 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4a; buf[3] = 0xf0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8850 ret = usb_microdia_control_write(dev, reg, buf, 8);
8851 if(ret < 0) goto err;
8853 reg = 0x10c0 ;
8854 ret = usb_microdia_control_read(dev, reg, buf, 1);
8855 if(ret < 0) goto err;
8857 reg = 0x10c0 ;
8858 ret = usb_microdia_control_read(dev, reg, buf, 1);
8859 if(ret < 0) goto err;
8861 reg = 0x10c0 ;
8862 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4b; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8863 ret = usb_microdia_control_write(dev, reg, buf, 8);
8864 if(ret < 0) goto err;
8866 reg = 0x10c0 ;
8867 ret = usb_microdia_control_read(dev, reg, buf, 1);
8868 if(ret < 0) goto err;
8870 reg = 0x10c0 ;
8871 ret = usb_microdia_control_read(dev, reg, buf, 1);
8872 if(ret < 0) goto err;
8874 reg = 0x10c0 ;
8875 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4c; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8876 ret = usb_microdia_control_write(dev, reg, buf, 8);
8877 if(ret < 0) goto err;
8879 reg = 0x10c0 ;
8880 ret = usb_microdia_control_read(dev, reg, buf, 1);
8881 if(ret < 0) goto err;
8883 reg = 0x10c0 ;
8884 ret = usb_microdia_control_read(dev, reg, buf, 1);
8885 if(ret < 0) goto err;
8887 reg = 0x10c0 ;
8888 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4d; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8889 ret = usb_microdia_control_write(dev, reg, buf, 8);
8890 if(ret < 0) goto err;
8892 reg = 0x10c0 ;
8893 ret = usb_microdia_control_read(dev, reg, buf, 1);
8894 if(ret < 0) goto err;
8896 reg = 0x10c0 ;
8897 ret = usb_microdia_control_read(dev, reg, buf, 1);
8898 if(ret < 0) goto err;
8900 reg = 0x10c0 ;
8901 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x4e; buf[3] = 0xdc; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8902 ret = usb_microdia_control_write(dev, reg, buf, 8);
8903 if(ret < 0) goto err;
8905 reg = 0x10c0 ;
8906 ret = usb_microdia_control_read(dev, reg, buf, 1);
8907 if(ret < 0) goto err;
8909 reg = 0x10c0 ;
8910 ret = usb_microdia_control_read(dev, reg, buf, 1);
8911 if(ret < 0) goto err;
8913 reg = 0x10c0 ;
8914 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x69; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8915 ret = usb_microdia_control_write(dev, reg, buf, 8);
8916 if(ret < 0) goto err;
8918 reg = 0x10c0 ;
8919 ret = usb_microdia_control_read(dev, reg, buf, 1);
8920 if(ret < 0) goto err;
8922 reg = 0x10c0 ;
8923 ret = usb_microdia_control_read(dev, reg, buf, 1);
8924 if(ret < 0) goto err;
8926 reg = 0x10c0 ;
8927 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6c; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8928 ret = usb_microdia_control_write(dev, reg, buf, 8);
8929 if(ret < 0) goto err;
8931 reg = 0x10c0 ;
8932 ret = usb_microdia_control_read(dev, reg, buf, 1);
8933 if(ret < 0) goto err;
8935 reg = 0x10c0 ;
8936 ret = usb_microdia_control_read(dev, reg, buf, 1);
8937 if(ret < 0) goto err;
8939 reg = 0x10c0 ;
8940 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x6f; buf[3] = 0x9e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8941 ret = usb_microdia_control_write(dev, reg, buf, 8);
8942 if(ret < 0) goto err;
8944 reg = 0x10c0 ;
8945 ret = usb_microdia_control_read(dev, reg, buf, 1);
8946 if(ret < 0) goto err;
8948 reg = 0x10c0 ;
8949 ret = usb_microdia_control_read(dev, reg, buf, 1);
8950 if(ret < 0) goto err;
8952 reg = 0x10c0 ;
8953 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x70; buf[3] = 0x05; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8954 ret = usb_microdia_control_write(dev, reg, buf, 8);
8955 if(ret < 0) goto err;
8957 reg = 0x10c0 ;
8958 ret = usb_microdia_control_read(dev, reg, buf, 1);
8959 if(ret < 0) goto err;
8961 reg = 0x10c0 ;
8962 ret = usb_microdia_control_read(dev, reg, buf, 1);
8963 if(ret < 0) goto err;
8965 reg = 0x10c0 ;
8966 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x71; buf[3] = 0x78; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8967 ret = usb_microdia_control_write(dev, reg, buf, 8);
8968 if(ret < 0) goto err;
8970 reg = 0x10c0 ;
8971 ret = usb_microdia_control_read(dev, reg, buf, 1);
8972 if(ret < 0) goto err;
8974 reg = 0x10c0 ;
8975 ret = usb_microdia_control_read(dev, reg, buf, 1);
8976 if(ret < 0) goto err;
8978 reg = 0x10c0 ;
8979 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x77; buf[3] = 0x02; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8980 ret = usb_microdia_control_write(dev, reg, buf, 8);
8981 if(ret < 0) goto err;
8983 reg = 0x10c0 ;
8984 ret = usb_microdia_control_read(dev, reg, buf, 1);
8985 if(ret < 0) goto err;
8987 reg = 0x10c0 ;
8988 ret = usb_microdia_control_read(dev, reg, buf, 1);
8989 if(ret < 0) goto err;
8991 reg = 0x10c0 ;
8992 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8a; buf[3] = 0x23; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
8993 ret = usb_microdia_control_write(dev, reg, buf, 8);
8994 if(ret < 0) goto err;
8996 reg = 0x10c0 ;
8997 ret = usb_microdia_control_read(dev, reg, buf, 1);
8998 if(ret < 0) goto err;
9000 reg = 0x10c0 ;
9001 ret = usb_microdia_control_read(dev, reg, buf, 1);
9002 if(ret < 0) goto err;
9004 reg = 0x10c0 ;
9005 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x8c; buf[3] = 0x0d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9006 ret = usb_microdia_control_write(dev, reg, buf, 8);
9007 if(ret < 0) goto err;
9009 reg = 0x10c0 ;
9010 ret = usb_microdia_control_read(dev, reg, buf, 1);
9011 if(ret < 0) goto err;
9013 reg = 0x10c0 ;
9014 ret = usb_microdia_control_read(dev, reg, buf, 1);
9015 if(ret < 0) goto err;
9017 reg = 0x10c0 ;
9018 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x90; buf[3] = 0x7e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9019 ret = usb_microdia_control_write(dev, reg, buf, 8);
9020 if(ret < 0) goto err;
9022 reg = 0x10c0 ;
9023 ret = usb_microdia_control_read(dev, reg, buf, 1);
9024 if(ret < 0) goto err;
9026 reg = 0x10c0 ;
9027 ret = usb_microdia_control_read(dev, reg, buf, 1);
9028 if(ret < 0) goto err;
9030 reg = 0x10c0 ;
9031 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x91; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9032 ret = usb_microdia_control_write(dev, reg, buf, 8);
9033 if(ret < 0) goto err;
9035 reg = 0x10c0 ;
9036 ret = usb_microdia_control_read(dev, reg, buf, 1);
9037 if(ret < 0) goto err;
9039 reg = 0x10c0 ;
9040 ret = usb_microdia_control_read(dev, reg, buf, 1);
9041 if(ret < 0) goto err;
9043 reg = 0x10c0 ;
9044 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x9f; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9045 ret = usb_microdia_control_write(dev, reg, buf, 8);
9046 if(ret < 0) goto err;
9048 reg = 0x10c0 ;
9049 ret = usb_microdia_control_read(dev, reg, buf, 1);
9050 if(ret < 0) goto err;
9052 reg = 0x10c0 ;
9053 ret = usb_microdia_control_read(dev, reg, buf, 1);
9054 if(ret < 0) goto err;
9056 reg = 0x10c0 ;
9057 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa0; buf[3] = 0x6e; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9058 ret = usb_microdia_control_write(dev, reg, buf, 8);
9059 if(ret < 0) goto err;
9061 reg = 0x10c0 ;
9062 ret = usb_microdia_control_read(dev, reg, buf, 1);
9063 if(ret < 0) goto err;
9065 reg = 0x10c0 ;
9066 ret = usb_microdia_control_read(dev, reg, buf, 1);
9067 if(ret < 0) goto err;
9069 reg = 0x10c0 ;
9070 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa4; buf[3] = 0x50; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9071 ret = usb_microdia_control_write(dev, reg, buf, 8);
9072 if(ret < 0) goto err;
9074 reg = 0x10c0 ;
9075 ret = usb_microdia_control_read(dev, reg, buf, 1);
9076 if(ret < 0) goto err;
9078 reg = 0x10c0 ;
9079 ret = usb_microdia_control_read(dev, reg, buf, 1);
9080 if(ret < 0) goto err;
9082 reg = 0x10c0 ;
9083 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa5; buf[3] = 0x68; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9084 ret = usb_microdia_control_write(dev, reg, buf, 8);
9085 if(ret < 0) goto err;
9087 reg = 0x10c0 ;
9088 ret = usb_microdia_control_read(dev, reg, buf, 1);
9089 if(ret < 0) goto err;
9091 reg = 0x10c0 ;
9092 ret = usb_microdia_control_read(dev, reg, buf, 1);
9093 if(ret < 0) goto err;
9095 reg = 0x10c0 ;
9096 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa6; buf[3] = 0x60; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9097 ret = usb_microdia_control_write(dev, reg, buf, 8);
9098 if(ret < 0) goto err;
9100 reg = 0x10c0 ;
9101 ret = usb_microdia_control_read(dev, reg, buf, 1);
9102 if(ret < 0) goto err;
9104 reg = 0x10c0 ;
9105 ret = usb_microdia_control_read(dev, reg, buf, 1);
9106 if(ret < 0) goto err;
9108 reg = 0x10c0 ;
9109 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa8; buf[3] = 0xc1; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9110 ret = usb_microdia_control_write(dev, reg, buf, 8);
9111 if(ret < 0) goto err;
9113 reg = 0x10c0 ;
9114 ret = usb_microdia_control_read(dev, reg, buf, 1);
9115 if(ret < 0) goto err;
9117 reg = 0x10c0 ;
9118 ret = usb_microdia_control_read(dev, reg, buf, 1);
9119 if(ret < 0) goto err;
9121 reg = 0x10c0 ;
9122 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa9; buf[3] = 0xfa; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9123 ret = usb_microdia_control_write(dev, reg, buf, 8);
9124 if(ret < 0) goto err;
9126 reg = 0x10c0 ;
9127 ret = usb_microdia_control_read(dev, reg, buf, 1);
9128 if(ret < 0) goto err;
9130 reg = 0x10c0 ;
9131 ret = usb_microdia_control_read(dev, reg, buf, 1);
9132 if(ret < 0) goto err;
9134 reg = 0x10c0 ;
9135 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaa; buf[3] = 0x92; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9136 ret = usb_microdia_control_write(dev, reg, buf, 8);
9137 if(ret < 0) goto err;
9139 reg = 0x10c0 ;
9140 ret = usb_microdia_control_read(dev, reg, buf, 1);
9141 if(ret < 0) goto err;
9143 reg = 0x10c0 ;
9144 ret = usb_microdia_control_read(dev, reg, buf, 1);
9145 if(ret < 0) goto err;
9147 reg = 0x10c0 ;
9148 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xab; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9149 ret = usb_microdia_control_write(dev, reg, buf, 8);
9150 if(ret < 0) goto err;
9152 reg = 0x10c0 ;
9153 ret = usb_microdia_control_read(dev, reg, buf, 1);
9154 if(ret < 0) goto err;
9156 reg = 0x10c0 ;
9157 ret = usb_microdia_control_read(dev, reg, buf, 1);
9158 if(ret < 0) goto err;
9160 reg = 0x10c0 ;
9161 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xac; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9162 ret = usb_microdia_control_write(dev, reg, buf, 8);
9163 if(ret < 0) goto err;
9165 reg = 0x10c0 ;
9166 ret = usb_microdia_control_read(dev, reg, buf, 1);
9167 if(ret < 0) goto err;
9169 reg = 0x10c0 ;
9170 ret = usb_microdia_control_read(dev, reg, buf, 1);
9171 if(ret < 0) goto err;
9173 reg = 0x10c0 ;
9174 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xad; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9175 ret = usb_microdia_control_write(dev, reg, buf, 8);
9176 if(ret < 0) goto err;
9178 reg = 0x10c0 ;
9179 ret = usb_microdia_control_read(dev, reg, buf, 1);
9180 if(ret < 0) goto err;
9182 reg = 0x10c0 ;
9183 ret = usb_microdia_control_read(dev, reg, buf, 1);
9184 if(ret < 0) goto err;
9186 reg = 0x10c0 ;
9187 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xae; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9188 ret = usb_microdia_control_write(dev, reg, buf, 8);
9189 if(ret < 0) goto err;
9191 reg = 0x10c0 ;
9192 ret = usb_microdia_control_read(dev, reg, buf, 1);
9193 if(ret < 0) goto err;
9195 reg = 0x10c0 ;
9196 ret = usb_microdia_control_read(dev, reg, buf, 1);
9197 if(ret < 0) goto err;
9199 reg = 0x10c0 ;
9200 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xaf; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9201 ret = usb_microdia_control_write(dev, reg, buf, 8);
9202 if(ret < 0) goto err;
9204 reg = 0x10c0 ;
9205 ret = usb_microdia_control_read(dev, reg, buf, 1);
9206 if(ret < 0) goto err;
9208 reg = 0x10c0 ;
9209 ret = usb_microdia_control_read(dev, reg, buf, 1);
9210 if(ret < 0) goto err;
9212 reg = 0x10c0 ;
9213 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb2; buf[3] = 0xf2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9214 ret = usb_microdia_control_write(dev, reg, buf, 8);
9215 if(ret < 0) goto err;
9217 reg = 0x10c0 ;
9218 ret = usb_microdia_control_read(dev, reg, buf, 1);
9219 if(ret < 0) goto err;
9221 reg = 0x10c0 ;
9222 ret = usb_microdia_control_read(dev, reg, buf, 1);
9223 if(ret < 0) goto err;
9225 reg = 0x10c0 ;
9226 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb3; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9227 ret = usb_microdia_control_write(dev, reg, buf, 8);
9228 if(ret < 0) goto err;
9230 reg = 0x10c0 ;
9231 ret = usb_microdia_control_read(dev, reg, buf, 1);
9232 if(ret < 0) goto err;
9234 reg = 0x10c0 ;
9235 ret = usb_microdia_control_read(dev, reg, buf, 1);
9236 if(ret < 0) goto err;
9238 reg = 0x10c0 ;
9239 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb4; buf[3] = 0x20; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9240 ret = usb_microdia_control_write(dev, reg, buf, 8);
9241 if(ret < 0) goto err;
9243 reg = 0x10c0 ;
9244 ret = usb_microdia_control_read(dev, reg, buf, 1);
9245 if(ret < 0) goto err;
9247 reg = 0x10c0 ;
9248 ret = usb_microdia_control_read(dev, reg, buf, 1);
9249 if(ret < 0) goto err;
9251 reg = 0x10c0 ;
9252 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb5; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9253 ret = usb_microdia_control_write(dev, reg, buf, 8);
9254 if(ret < 0) goto err;
9256 reg = 0x10c0 ;
9257 ret = usb_microdia_control_read(dev, reg, buf, 1);
9258 if(ret < 0) goto err;
9260 reg = 0x10c0 ;
9261 ret = usb_microdia_control_read(dev, reg, buf, 1);
9262 if(ret < 0) goto err;
9264 reg = 0x10c0 ;
9265 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xb6; buf[3] = 0xaf; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9266 ret = usb_microdia_control_write(dev, reg, buf, 8);
9267 if(ret < 0) goto err;
9269 reg = 0x10c0 ;
9270 ret = usb_microdia_control_read(dev, reg, buf, 1);
9271 if(ret < 0) goto err;
9273 reg = 0x10c0 ;
9274 ret = usb_microdia_control_read(dev, reg, buf, 1);
9275 if(ret < 0) goto err;
9277 reg = 0x10c0 ;
9278 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbb; buf[3] = 0xae; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9279 ret = usb_microdia_control_write(dev, reg, buf, 8);
9280 if(ret < 0) goto err;
9282 reg = 0x10c0 ;
9283 ret = usb_microdia_control_read(dev, reg, buf, 1);
9284 if(ret < 0) goto err;
9286 reg = 0x10c0 ;
9287 ret = usb_microdia_control_read(dev, reg, buf, 1);
9288 if(ret < 0) goto err;
9290 reg = 0x10c0 ;
9291 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbc; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9292 ret = usb_microdia_control_write(dev, reg, buf, 8);
9293 if(ret < 0) goto err;
9295 reg = 0x10c0 ;
9296 ret = usb_microdia_control_read(dev, reg, buf, 1);
9297 if(ret < 0) goto err;
9299 reg = 0x10c0 ;
9300 ret = usb_microdia_control_read(dev, reg, buf, 1);
9301 if(ret < 0) goto err;
9303 reg = 0x10c0 ;
9304 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbd; buf[3] = 0x44; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9305 ret = usb_microdia_control_write(dev, reg, buf, 8);
9306 if(ret < 0) goto err;
9308 reg = 0x10c0 ;
9309 ret = usb_microdia_control_read(dev, reg, buf, 1);
9310 if(ret < 0) goto err;
9312 reg = 0x10c0 ;
9313 ret = usb_microdia_control_read(dev, reg, buf, 1);
9314 if(ret < 0) goto err;
9316 reg = 0x10c0 ;
9317 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbe; buf[3] = 0x3b; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9318 ret = usb_microdia_control_write(dev, reg, buf, 8);
9319 if(ret < 0) goto err;
9321 reg = 0x10c0 ;
9322 ret = usb_microdia_control_read(dev, reg, buf, 1);
9323 if(ret < 0) goto err;
9325 reg = 0x10c0 ;
9326 ret = usb_microdia_control_read(dev, reg, buf, 1);
9327 if(ret < 0) goto err;
9329 reg = 0x10c0 ;
9330 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xbf; buf[3] = 0x3a; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9331 ret = usb_microdia_control_write(dev, reg, buf, 8);
9332 if(ret < 0) goto err;
9334 reg = 0x10c0 ;
9335 ret = usb_microdia_control_read(dev, reg, buf, 1);
9336 if(ret < 0) goto err;
9338 reg = 0x10c0 ;
9339 ret = usb_microdia_control_read(dev, reg, buf, 1);
9340 if(ret < 0) goto err;
9342 reg = 0x10c0 ;
9343 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc0; buf[3] = 0xe2; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9344 ret = usb_microdia_control_write(dev, reg, buf, 8);
9345 if(ret < 0) goto err;
9347 reg = 0x10c0 ;
9348 ret = usb_microdia_control_read(dev, reg, buf, 1);
9349 if(ret < 0) goto err;
9351 reg = 0x10c0 ;
9352 ret = usb_microdia_control_read(dev, reg, buf, 1);
9353 if(ret < 0) goto err;
9355 reg = 0x10c0 ;
9356 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc1; buf[3] = 0xc8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9357 ret = usb_microdia_control_write(dev, reg, buf, 8);
9358 if(ret < 0) goto err;
9360 reg = 0x10c0 ;
9361 ret = usb_microdia_control_read(dev, reg, buf, 1);
9362 if(ret < 0) goto err;
9364 reg = 0x10c0 ;
9365 ret = usb_microdia_control_read(dev, reg, buf, 1);
9366 if(ret < 0) goto err;
9368 reg = 0x10c0 ;
9369 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc2; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9370 ret = usb_microdia_control_write(dev, reg, buf, 8);
9371 if(ret < 0) goto err;
9373 reg = 0x10c0 ;
9374 ret = usb_microdia_control_read(dev, reg, buf, 1);
9375 if(ret < 0) goto err;
9377 reg = 0x10c0 ;
9378 ret = usb_microdia_control_read(dev, reg, buf, 1);
9379 if(ret < 0) goto err;
9381 reg = 0x10c0 ;
9382 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc4; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9383 ret = usb_microdia_control_write(dev, reg, buf, 8);
9384 if(ret < 0) goto err;
9386 reg = 0x10c0 ;
9387 ret = usb_microdia_control_read(dev, reg, buf, 1);
9388 if(ret < 0) goto err;
9390 reg = 0x10c0 ;
9391 ret = usb_microdia_control_read(dev, reg, buf, 1);
9392 if(ret < 0) goto err;
9394 reg = 0x10c0 ;
9395 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc6; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9396 ret = usb_microdia_control_write(dev, reg, buf, 8);
9397 if(ret < 0) goto err;
9399 reg = 0x10c0 ;
9400 ret = usb_microdia_control_read(dev, reg, buf, 1);
9401 if(ret < 0) goto err;
9403 reg = 0x10c0 ;
9404 ret = usb_microdia_control_read(dev, reg, buf, 1);
9405 if(ret < 0) goto err;
9407 reg = 0x10c0 ;
9408 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc7; buf[3] = 0x81; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9409 ret = usb_microdia_control_write(dev, reg, buf, 8);
9410 if(ret < 0) goto err;
9412 reg = 0x10c0 ;
9413 ret = usb_microdia_control_read(dev, reg, buf, 1);
9414 if(ret < 0) goto err;
9416 reg = 0x10c0 ;
9417 ret = usb_microdia_control_read(dev, reg, buf, 1);
9418 if(ret < 0) goto err;
9420 reg = 0x10c0 ;
9421 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xc9; buf[3] = 0xe0; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9422 ret = usb_microdia_control_write(dev, reg, buf, 8);
9423 if(ret < 0) goto err;
9425 reg = 0x10c0 ;
9426 ret = usb_microdia_control_read(dev, reg, buf, 1);
9427 if(ret < 0) goto err;
9429 reg = 0x10c0 ;
9430 ret = usb_microdia_control_read(dev, reg, buf, 1);
9431 if(ret < 0) goto err;
9433 reg = 0x10c0 ;
9434 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xca; buf[3] = 0xe8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9435 ret = usb_microdia_control_write(dev, reg, buf, 8);
9436 if(ret < 0) goto err;
9438 reg = 0x10c0 ;
9439 ret = usb_microdia_control_read(dev, reg, buf, 1);
9440 if(ret < 0) goto err;
9442 reg = 0x10c0 ;
9443 ret = usb_microdia_control_read(dev, reg, buf, 1);
9444 if(ret < 0) goto err;
9446 reg = 0x10c0 ;
9447 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcc; buf[3] = 0xd8; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9448 ret = usb_microdia_control_write(dev, reg, buf, 8);
9449 if(ret < 0) goto err;
9451 reg = 0x10c0 ;
9452 ret = usb_microdia_control_read(dev, reg, buf, 1);
9453 if(ret < 0) goto err;
9455 reg = 0x10c0 ;
9456 ret = usb_microdia_control_read(dev, reg, buf, 1);
9457 if(ret < 0) goto err;
9459 reg = 0x10c0 ;
9460 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xcd; buf[3] = 0x93; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9461 ret = usb_microdia_control_write(dev, reg, buf, 8);
9462 if(ret < 0) goto err;
9464 reg = 0x10c0 ;
9465 ret = usb_microdia_control_read(dev, reg, buf, 1);
9466 if(ret < 0) goto err;
9468 reg = 0x10c0 ;
9469 ret = usb_microdia_control_read(dev, reg, buf, 1);
9470 if(ret < 0) goto err;
9472 reg = 0x10c1 ;
9473 ret = usb_microdia_control_read(dev, reg, buf, 1);
9474 if(ret < 0) goto err;
9476 reg = 0x10c1 ;
9477 buf[0] = 0x50;
9478 ret = usb_microdia_control_write(dev, reg, buf, 1);
9479 if(ret < 0) goto err;
9481 reg = 0x10c0 ;
9482 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9483 ret = usb_microdia_control_write(dev, reg, buf, 8);
9484 if(ret < 0) goto err;
9486 reg = 0x10c0 ;
9487 ret = usb_microdia_control_read(dev, reg, buf, 1);
9488 if(ret < 0) goto err;
9490 reg = 0x10c0 ;
9491 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9492 ret = usb_microdia_control_write(dev, reg, buf, 8);
9493 if(ret < 0) goto err;
9495 reg = 0x10c0 ;
9496 ret = usb_microdia_control_read(dev, reg, buf, 1);
9497 if(ret < 0) goto err;
9499 reg = 0x10c0 ;
9500 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9501 ret = usb_microdia_control_write(dev, reg, buf, 8);
9502 if(ret < 0) goto err;
9504 reg = 0x10c0 ;
9505 ret = usb_microdia_control_read(dev, reg, buf, 1);
9506 if(ret < 0) goto err;
9508 reg = 0x10c0 ;
9509 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9510 ret = usb_microdia_control_write(dev, reg, buf, 8);
9511 if(ret < 0) goto err;
9513 reg = 0x10c0 ;
9514 ret = usb_microdia_control_read(dev, reg, buf, 1);
9515 if(ret < 0) goto err;
9517 reg = 0x10c0 ;
9518 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9519 ret = usb_microdia_control_write(dev, reg, buf, 8);
9520 if(ret < 0) goto err;
9522 reg = 0x10c0 ;
9523 ret = usb_microdia_control_read(dev, reg, buf, 1);
9524 if(ret < 0) goto err;
9526 reg = 0x10c0 ;
9527 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9528 ret = usb_microdia_control_write(dev, reg, buf, 8);
9529 if(ret < 0) goto err;
9531 reg = 0x10c0 ;
9532 ret = usb_microdia_control_read(dev, reg, buf, 1);
9533 if(ret < 0) goto err;
9535 reg = 0x10c0 ;
9536 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9537 ret = usb_microdia_control_write(dev, reg, buf, 8);
9538 if(ret < 0) goto err;
9540 reg = 0x10c0 ;
9541 ret = usb_microdia_control_read(dev, reg, buf, 1);
9542 if(ret < 0) goto err;
9544 reg = 0x10c0 ;
9545 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9546 ret = usb_microdia_control_write(dev, reg, buf, 8);
9547 if(ret < 0) goto err;
9549 reg = 0x10c0 ;
9550 ret = usb_microdia_control_read(dev, reg, buf, 1);
9551 if(ret < 0) goto err;
9553 reg = 0x10c0 ;
9554 buf[0] = 0x90; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9555 ret = usb_microdia_control_write(dev, reg, buf, 8);
9556 if(ret < 0) goto err;
9558 reg = 0x10c0 ;
9559 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9560 ret = usb_microdia_control_write(dev, reg, buf, 8);
9561 if(ret < 0) goto err;
9563 reg = 0x10c0 ;
9564 ret = usb_microdia_control_read(dev, reg, buf, 1);
9565 if(ret < 0) goto err;
9567 reg = 0x10c0 ;
9568 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9569 ret = usb_microdia_control_write(dev, reg, buf, 8);
9570 if(ret < 0) goto err;
9572 reg = 0x10c0 ;
9573 ret = usb_microdia_control_read(dev, reg, buf, 1);
9574 if(ret < 0) goto err;
9576 reg = 0x10c0 ;
9577 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9578 ret = usb_microdia_control_write(dev, reg, buf, 8);
9579 if(ret < 0) goto err;
9581 reg = 0x10c0 ;
9582 ret = usb_microdia_control_read(dev, reg, buf, 1);
9583 if(ret < 0) goto err;
9585 reg = 0x10c0 ;
9586 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9587 ret = usb_microdia_control_write(dev, reg, buf, 8);
9588 if(ret < 0) goto err;
9590 reg = 0x10c0 ;
9591 ret = usb_microdia_control_read(dev, reg, buf, 1);
9592 if(ret < 0) goto err;
9594 reg = 0x10c0 ;
9595 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9596 ret = usb_microdia_control_write(dev, reg, buf, 8);
9597 if(ret < 0) goto err;
9599 reg = 0x10c0 ;
9600 ret = usb_microdia_control_read(dev, reg, buf, 1);
9601 if(ret < 0) goto err;
9603 reg = 0x10c0 ;
9604 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9605 ret = usb_microdia_control_write(dev, reg, buf, 8);
9606 if(ret < 0) goto err;
9608 reg = 0x10c0 ;
9609 ret = usb_microdia_control_read(dev, reg, buf, 1);
9610 if(ret < 0) goto err;
9612 reg = 0x10c0 ;
9613 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9614 ret = usb_microdia_control_write(dev, reg, buf, 8);
9615 if(ret < 0) goto err;
9617 reg = 0x10c0 ;
9618 ret = usb_microdia_control_read(dev, reg, buf, 1);
9619 if(ret < 0) goto err;
9621 reg = 0x10c0 ;
9622 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9623 ret = usb_microdia_control_write(dev, reg, buf, 8);
9624 if(ret < 0) goto err;
9626 reg = 0x10c0 ;
9627 ret = usb_microdia_control_read(dev, reg, buf, 1);
9628 if(ret < 0) goto err;
9630 reg = 0x10c0 ;
9631 buf[0] = 0x92; buf[1] = 0x50; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9632 ret = usb_microdia_control_write(dev, reg, buf, 8);
9633 if(ret < 0) goto err;
9635 reg = 0x10c2 ;
9636 ret = usb_microdia_control_read(dev, reg, buf, 5);
9637 if(ret < 0) goto err;
9639 reg = 0x10c1 ;
9640 buf[0] = 0x30;
9641 ret = usb_microdia_control_write(dev, reg, buf, 1);
9642 if(ret < 0) goto err;
9644 reg = 0x10e0 ;
9645 buf[0] = 0x47;
9646 ret = usb_microdia_control_write(dev, reg, buf, 1);
9647 if(ret < 0) goto err;
9649 reg = 0x10e0 ;
9650 buf[0] = 0x47;
9651 ret = usb_microdia_control_write(dev, reg, buf, 1);
9652 if(ret < 0) goto err;
9654 reg = 0x1001 ;
9655 buf[0] = 0xc6;
9656 ret = usb_microdia_control_write(dev, reg, buf, 1);
9657 if(ret < 0) goto err;
9659 reg = 0x1001 ;
9660 buf[0] = 0xc4;
9661 ret = usb_microdia_control_write(dev, reg, buf, 1);
9662 if(ret < 0) goto err;
9664 reg = 0x1001 ;
9665 buf[0] = 0x84;
9666 ret = usb_microdia_control_write(dev, reg, buf, 1);
9667 if(ret < 0) goto err;
9669 reg = 0x1189 ;
9670 buf[0] = 0xcc;
9671 ret = usb_microdia_control_write(dev, reg, buf, 1);
9672 if(ret < 0) goto err;
9674 reg = 0x11bc ;
9675 buf[0] = 0x00;
9676 ret = usb_microdia_control_write(dev, reg, buf, 1);
9677 if(ret < 0) goto err;
9679 reg = 0x11bd ;
9680 buf[0] = 0x00;
9681 ret = usb_microdia_control_write(dev, reg, buf, 1);
9682 if(ret < 0) goto err;
9684 reg = 0x11be ;
9685 buf[0] = 0x00;
9686 ret = usb_microdia_control_write(dev, reg, buf, 1);
9687 if(ret < 0) goto err;
9689 reg = 0x11bf ;
9690 buf[0] = 0x00;
9691 ret = usb_microdia_control_write(dev, reg, buf, 1);
9692 if(ret < 0) goto err;
9694 reg = 0x10c0 ;
9695 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9696 ret = usb_microdia_control_write(dev, reg, buf, 8);
9697 if(ret < 0) goto err;
9699 reg = 0x10c0 ;
9700 ret = usb_microdia_control_read(dev, reg, buf, 1);
9701 if(ret < 0) goto err;
9703 reg = 0x10c0 ;
9704 ret = usb_microdia_control_read(dev, reg, buf, 1);
9705 if(ret < 0) goto err;
9707 reg = 0x10c0 ;
9708 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
9709 ret = usb_microdia_control_write(dev, reg, buf, 8);
9710 if(ret < 0) goto err;
9712 reg = 0x10c0 ;
9713 ret = usb_microdia_control_read(dev, reg, buf, 1);
9714 if(ret < 0) goto err;
9716 reg = 0x10c0 ;
9717 ret = usb_microdia_control_read(dev, reg, buf, 1);
9718 if(ret < 0) goto err;
9720 reg = 0x10c0 ;
9721 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9722 ret = usb_microdia_control_write(dev, reg, buf, 8);
9723 if(ret < 0) goto err;
9725 reg = 0x10c0 ;
9726 ret = usb_microdia_control_read(dev, reg, buf, 1);
9727 if(ret < 0) goto err;
9729 reg = 0x10c0 ;
9730 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9731 ret = usb_microdia_control_write(dev, reg, buf, 8);
9732 if(ret < 0) goto err;
9734 reg = 0x10c0 ;
9735 ret = usb_microdia_control_read(dev, reg, buf, 1);
9736 if(ret < 0) goto err;
9738 reg = 0x10c0 ;
9739 ret = usb_microdia_control_read(dev, reg, buf, 1);
9740 if(ret < 0) goto err;
9742 reg = 0x1180 ;
9743 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
9744 ret = usb_microdia_control_write(dev, reg, buf, 6);
9745 if(ret < 0) goto err;
9747 reg = 0x10fb ;
9748 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
9749 ret = usb_microdia_control_write(dev, reg, buf, 5);
9750 if(ret < 0) goto err;
9752 reg = 0x1189 ;
9753 buf[0] = 0xdc;
9754 ret = usb_microdia_control_write(dev, reg, buf, 1);
9755 if(ret < 0) goto err;
9757 reg = 0x1189 ;
9758 buf[0] = 0xd0;
9759 ret = usb_microdia_control_write(dev, reg, buf, 1);
9760 if(ret < 0) goto err;
9762 reg = 0x11a1 ;
9763 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
9764 ret = usb_microdia_control_write(dev, reg, buf, 4);
9765 if(ret < 0) goto err;
9767 reg = 0x11ab ;
9768 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
9769 ret = usb_microdia_control_write(dev, reg, buf, 4);
9770 if(ret < 0) goto err;
9772 reg = 0x1000 ;
9773 buf[0] = 0x78;
9774 ret = usb_microdia_control_write(dev, reg, buf, 1);
9775 if(ret < 0) goto err;
9777 reg = 0x1002 ;
9778 buf[0] = 0x18;
9779 ret = usb_microdia_control_write(dev, reg, buf, 1);
9780 if(ret < 0) goto err;
9782 reg = 0x1002 ;
9783 buf[0] = 0x08;
9784 ret = usb_microdia_control_write(dev, reg, buf, 1);
9785 if(ret < 0) goto err;
9787 reg = 0x11b8 ;
9788 buf[0] = 0x38;
9789 ret = usb_microdia_control_write(dev, reg, buf, 1);
9790 if(ret < 0) goto err;
9792 reg = 0x118a ;
9793 buf[0] = 0x02;
9794 ret = usb_microdia_control_write(dev, reg, buf, 1);
9795 if(ret < 0) goto err;
9797 reg = 0x0395 ;
9798 buf[0] = 0x02;
9799 ret = usb_microdia_control_write(dev, reg, buf, 1);
9800 if(ret < 0) goto err;
9802 reg = 0x11b8 ;
9803 buf[0] = 0x78;
9804 ret = usb_microdia_control_write(dev, reg, buf, 1);
9805 if(ret < 0) goto err;
9807 reg = 0x11b8 ;
9808 ret = usb_microdia_control_read(dev, reg, buf, 1);
9809 if(ret < 0) goto err;
9811 reg = 0x11b8 ;
9812 buf[0] = 0xf9;
9813 ret = usb_microdia_control_write(dev, reg, buf, 1);
9814 if(ret < 0) goto err;
9816 reg = 0x11b8 ;
9817 ret = usb_microdia_control_read(dev, reg, buf, 1);
9818 if(ret < 0) goto err;
9820 reg = 0x11b8 ;
9821 buf[0] = 0x7a;
9822 ret = usb_microdia_control_write(dev, reg, buf, 1);
9823 if(ret < 0) goto err;
9825 reg = 0x11b8 ;
9826 ret = usb_microdia_control_read(dev, reg, buf, 1);
9827 if(ret < 0) goto err;
9829 reg = 0x11b8 ;
9830 buf[0] = 0x7b;
9831 ret = usb_microdia_control_write(dev, reg, buf, 1);
9832 if(ret < 0) goto err;
9834 reg = 0x11b8 ;
9835 ret = usb_microdia_control_read(dev, reg, buf, 1);
9836 if(ret < 0) goto err;
9838 reg = 0x11b8 ;
9839 buf[0] = 0x7c;
9840 ret = usb_microdia_control_write(dev, reg, buf, 1);
9841 if(ret < 0) goto err;
9843 reg = 0x11b8 ;
9844 ret = usb_microdia_control_read(dev, reg, buf, 1);
9845 if(ret < 0) goto err;
9847 reg = 0x11b8 ;
9848 buf[0] = 0xfd;
9849 ret = usb_microdia_control_write(dev, reg, buf, 1);
9850 if(ret < 0) goto err;
9852 reg = 0x11b8 ;
9853 ret = usb_microdia_control_read(dev, reg, buf, 1);
9854 if(ret < 0) goto err;
9856 reg = 0x11b8 ;
9857 buf[0] = 0xfa;
9858 ret = usb_microdia_control_write(dev, reg, buf, 1);
9859 if(ret < 0) goto err;
9861 reg = 0x10c0 ;
9862 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9863 ret = usb_microdia_control_write(dev, reg, buf, 8);
9864 if(ret < 0) goto err;
9866 reg = 0x10c0 ;
9867 ret = usb_microdia_control_read(dev, reg, buf, 1);
9868 if(ret < 0) goto err;
9870 reg = 0x10c0 ;
9871 ret = usb_microdia_control_read(dev, reg, buf, 1);
9872 if(ret < 0) goto err;
9874 reg = 0x10c0 ;
9875 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9876 ret = usb_microdia_control_write(dev, reg, buf, 8);
9877 if(ret < 0) goto err;
9879 reg = 0x10c0 ;
9880 ret = usb_microdia_control_read(dev, reg, buf, 1);
9881 if(ret < 0) goto err;
9883 reg = 0x10c0 ;
9884 ret = usb_microdia_control_read(dev, reg, buf, 1);
9885 if(ret < 0) goto err;
9887 reg = 0x10c0 ;
9888 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9889 ret = usb_microdia_control_write(dev, reg, buf, 8);
9890 if(ret < 0) goto err;
9892 reg = 0x10c0 ;
9893 ret = usb_microdia_control_read(dev, reg, buf, 1);
9894 if(ret < 0) goto err;
9896 reg = 0x10c0 ;
9897 ret = usb_microdia_control_read(dev, reg, buf, 1);
9898 if(ret < 0) goto err;
9900 reg = 0x10c0 ;
9901 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9902 ret = usb_microdia_control_write(dev, reg, buf, 8);
9903 if(ret < 0) goto err;
9905 reg = 0x10c0 ;
9906 ret = usb_microdia_control_read(dev, reg, buf, 1);
9907 if(ret < 0) goto err;
9909 reg = 0x10c0 ;
9910 ret = usb_microdia_control_read(dev, reg, buf, 1);
9911 if(ret < 0) goto err;
9913 reg = 0x10c0 ;
9914 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9915 ret = usb_microdia_control_write(dev, reg, buf, 8);
9916 if(ret < 0) goto err;
9918 reg = 0x10c0 ;
9919 ret = usb_microdia_control_read(dev, reg, buf, 1);
9920 if(ret < 0) goto err;
9922 reg = 0x10c0 ;
9923 ret = usb_microdia_control_read(dev, reg, buf, 1);
9924 if(ret < 0) goto err;
9926 reg = 0x10c0 ;
9927 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9928 ret = usb_microdia_control_write(dev, reg, buf, 8);
9929 if(ret < 0) goto err;
9931 reg = 0x10c0 ;
9932 ret = usb_microdia_control_read(dev, reg, buf, 1);
9933 if(ret < 0) goto err;
9935 reg = 0x10c0 ;
9936 ret = usb_microdia_control_read(dev, reg, buf, 1);
9937 if(ret < 0) goto err;
9939 reg = 0x10c0 ;
9940 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x1e; buf[3] = 0x04; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9941 ret = usb_microdia_control_write(dev, reg, buf, 8);
9942 if(ret < 0) goto err;
9944 reg = 0x10c0 ;
9945 ret = usb_microdia_control_read(dev, reg, buf, 1);
9946 if(ret < 0) goto err;
9948 reg = 0x10c0 ;
9949 ret = usb_microdia_control_read(dev, reg, buf, 1);
9950 if(ret < 0) goto err;
9952 reg = 0x1182 ;
9953 buf[0] = 0x01;
9954 ret = usb_microdia_control_write(dev, reg, buf, 1);
9955 if(ret < 0) goto err;
9957 reg = 0x10c0 ;
9958 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x7d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9959 ret = usb_microdia_control_write(dev, reg, buf, 8);
9960 if(ret < 0) goto err;
9962 reg = 0x10c0 ;
9963 ret = usb_microdia_control_read(dev, reg, buf, 1);
9964 if(ret < 0) goto err;
9966 reg = 0x10c0 ;
9967 ret = usb_microdia_control_read(dev, reg, buf, 1);
9968 if(ret < 0) goto err;
9970 reg = 0x10c0 ;
9971 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9972 ret = usb_microdia_control_write(dev, reg, buf, 8);
9973 if(ret < 0) goto err;
9975 reg = 0x10c0 ;
9976 ret = usb_microdia_control_read(dev, reg, buf, 1);
9977 if(ret < 0) goto err;
9979 reg = 0x10c0 ;
9980 ret = usb_microdia_control_read(dev, reg, buf, 1);
9981 if(ret < 0) goto err;
9983 reg = 0x10c0 ;
9984 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9985 ret = usb_microdia_control_write(dev, reg, buf, 8);
9986 if(ret < 0) goto err;
9988 reg = 0x10c0 ;
9989 ret = usb_microdia_control_read(dev, reg, buf, 1);
9990 if(ret < 0) goto err;
9992 reg = 0x10c0 ;
9993 ret = usb_microdia_control_read(dev, reg, buf, 1);
9994 if(ret < 0) goto err;
9996 reg = 0x10c0 ;
9997 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
9998 ret = usb_microdia_control_write(dev, reg, buf, 8);
9999 if(ret < 0) goto err;
10001 reg = 0x10c0 ;
10002 ret = usb_microdia_control_read(dev, reg, buf, 1);
10003 if(ret < 0) goto err;
10005 reg = 0x10c0 ;
10006 ret = usb_microdia_control_read(dev, reg, buf, 1);
10007 if(ret < 0) goto err;
10009 reg = 0x10c0 ;
10010 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10011 ret = usb_microdia_control_write(dev, reg, buf, 8);
10012 if(ret < 0) goto err;
10014 reg = 0x10c0 ;
10015 ret = usb_microdia_control_read(dev, reg, buf, 1);
10016 if(ret < 0) goto err;
10018 reg = 0x10c0 ;
10019 ret = usb_microdia_control_read(dev, reg, buf, 1);
10020 if(ret < 0) goto err;
10022 reg = 0x10c0 ;
10023 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10024 ret = usb_microdia_control_write(dev, reg, buf, 8);
10025 if(ret < 0) goto err;
10027 reg = 0x10c0 ;
10028 ret = usb_microdia_control_read(dev, reg, buf, 1);
10029 if(ret < 0) goto err;
10031 reg = 0x10c0 ;
10032 ret = usb_microdia_control_read(dev, reg, buf, 1);
10033 if(ret < 0) goto err;
10035 reg = 0x10c0 ;
10036 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10037 ret = usb_microdia_control_write(dev, reg, buf, 8);
10038 if(ret < 0) goto err;
10040 reg = 0x10c0 ;
10041 ret = usb_microdia_control_read(dev, reg, buf, 1);
10042 if(ret < 0) goto err;
10044 reg = 0x10c0 ;
10045 ret = usb_microdia_control_read(dev, reg, buf, 1);
10046 if(ret < 0) goto err;
10048 reg = 0x10c0 ;
10049 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10050 ret = usb_microdia_control_write(dev, reg, buf, 8);
10051 if(ret < 0) goto err;
10053 reg = 0x10c0 ;
10054 ret = usb_microdia_control_read(dev, reg, buf, 1);
10055 if(ret < 0) goto err;
10057 reg = 0x10c0 ;
10058 ret = usb_microdia_control_read(dev, reg, buf, 1);
10059 if(ret < 0) goto err;
10061 reg = 0x118c ;
10062 buf[0] = 0x20;
10063 ret = usb_microdia_control_write(dev, reg, buf, 1);
10064 if(ret < 0) goto err;
10066 reg = 0x118d ;
10067 buf[0] = 0x20;
10068 ret = usb_microdia_control_write(dev, reg, buf, 1);
10069 if(ret < 0) goto err;
10071 reg = 0x118e ;
10072 buf[0] = 0x20;
10073 ret = usb_microdia_control_write(dev, reg, buf, 1);
10074 if(ret < 0) goto err;
10076 reg = 0x118f ;
10077 buf[0] = 0x20;
10078 ret = usb_microdia_control_write(dev, reg, buf, 1);
10079 if(ret < 0) goto err;
10081 reg = 0x11ba ;
10082 buf[0] = 0x0a;
10083 ret = usb_microdia_control_write(dev, reg, buf, 1);
10084 if(ret < 0) goto err;
10086 reg = 0x118c ;
10087 buf[0] = 0x20;
10088 ret = usb_microdia_control_write(dev, reg, buf, 1);
10089 if(ret < 0) goto err;
10091 reg = 0x118d ;
10092 buf[0] = 0x20;
10093 ret = usb_microdia_control_write(dev, reg, buf, 1);
10094 if(ret < 0) goto err;
10096 reg = 0x118e ;
10097 buf[0] = 0x20;
10098 ret = usb_microdia_control_write(dev, reg, buf, 1);
10099 if(ret < 0) goto err;
10101 reg = 0x118f ;
10102 buf[0] = 0x20;
10103 ret = usb_microdia_control_write(dev, reg, buf, 1);
10104 if(ret < 0) goto err;
10106 reg = 0x118b ;
10107 buf[0] = 0x10;
10108 ret = usb_microdia_control_write(dev, reg, buf, 1);
10109 if(ret < 0) goto err;
10111 reg = 0x1190 ;
10112 buf[0] = 0x08; buf[1] = 0x2f; buf[2] = 0x46; buf[3] = 0x58; buf[4] = 0x69; buf[5] = 0x78; buf[6] = 0x86; buf[7] = 0x94; buf[8] = 0xa0; buf[9] = 0xac; buf[10] = 0xb8; buf[11] = 0xc3; buf[12] = 0xce; buf[13] = 0xd9; buf[14] = 0xe3; buf[15] = 0xed; buf[16] = 0xf7;
10113 ret = usb_microdia_control_write(dev, reg, buf, 17);
10114 if(ret < 0) goto err;
10116 reg = 0x10e1 ;
10117 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10118 ret = usb_microdia_control_write(dev, reg, buf, 21);
10119 if(ret < 0) goto err;
10121 reg = 0x10e1 ;
10122 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10123 ret = usb_microdia_control_write(dev, reg, buf, 21);
10124 if(ret < 0) goto err;
10126 reg = 0x10e1 ;
10127 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10128 ret = usb_microdia_control_write(dev, reg, buf, 21);
10129 if(ret < 0) goto err;
10131 reg = 0x10e1 ;
10132 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10133 ret = usb_microdia_control_write(dev, reg, buf, 21);
10134 if(ret < 0) goto err;
10136 reg = 0x10e1 ;
10137 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10138 ret = usb_microdia_control_write(dev, reg, buf, 21);
10139 if(ret < 0) goto err;
10141 reg = 0x10e1 ;
10142 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10143 ret = usb_microdia_control_write(dev, reg, buf, 21);
10144 if(ret < 0) goto err;
10146 reg = 0x10e1 ;
10147 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10148 ret = usb_microdia_control_write(dev, reg, buf, 21);
10149 if(ret < 0) goto err;
10151 reg = 0x10e1 ;
10152 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10153 ret = usb_microdia_control_write(dev, reg, buf, 21);
10154 if(ret < 0) goto err;
10156 reg = 0x10e1 ;
10157 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10158 ret = usb_microdia_control_write(dev, reg, buf, 21);
10159 if(ret < 0) goto err;
10161 reg = 0x10f7 ;
10162 buf[0] = 0x05;
10163 ret = usb_microdia_control_write(dev, reg, buf, 1);
10164 if(ret < 0) goto err;
10166 reg = 0x10f6 ;
10167 buf[0] = 0x20;
10168 ret = usb_microdia_control_write(dev, reg, buf, 1);
10169 if(ret < 0) goto err;
10171 reg = 0x10e1 ;
10172 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10173 ret = usb_microdia_control_write(dev, reg, buf, 21);
10174 if(ret < 0) goto err;
10176 reg = 0x10f8 ;
10177 buf[0] = 0x14;
10178 ret = usb_microdia_control_write(dev, reg, buf, 1);
10179 if(ret < 0) goto err;
10181 reg = 0x10fa ;
10182 buf[0] = 0xff;
10183 ret = usb_microdia_control_write(dev, reg, buf, 1);
10184 if(ret < 0) goto err;
10186 reg = 0x10f9 ;
10187 buf[0] = 0x00;
10188 ret = usb_microdia_control_write(dev, reg, buf, 1);
10189 if(ret < 0) goto err;
10191 reg = 0x10f9 ;
10192 buf[0] = 0x00;
10193 ret = usb_microdia_control_write(dev, reg, buf, 1);
10194 if(ret < 0) goto err;
10196 reg = 0x11ba ;
10197 buf[0] = 0x0a;
10198 ret = usb_microdia_control_write(dev, reg, buf, 1);
10199 if(ret < 0) goto err;
10201 reg = 0x11bc ;
10202 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00;
10203 ret = usb_microdia_control_write(dev, reg, buf, 4);
10204 if(ret < 0) goto err;
10206 reg = 0x11c0 ;
10207 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x00; buf[8] = 0x00; buf[9] = 0x00; buf[10] = 0x00; buf[11] = 0x00; buf[12] = 0x00; buf[13] = 0x00; buf[14] = 0x00; buf[15] = 0x00; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00; buf[21] = 0x00; buf[22] = 0x00; buf[23] = 0x00; buf[24] = 0x00; buf[25] = 0x00; buf[26] = 0x00; buf[27] = 0x00; buf[28] = 0x00; buf[29] = 0x00; buf[30] = 0x00; buf[31] = 0x00; buf[32] = 0x00; buf[33] = 0x00; buf[34] = 0x00; buf[35] = 0x00; buf[36] = 0x00; buf[37] = 0x00; buf[38] = 0x00; buf[39] = 0x00; buf[40] = 0x00; buf[41] = 0x00; buf[42] = 0x00; buf[43] = 0x00; buf[44] = 0x00; buf[45] = 0x00; buf[46] = 0x00; buf[47] = 0x00;
10208 ret = usb_microdia_control_write(dev, reg, buf, 48);
10209 if(ret < 0) goto err;
10211 reg = 0x118c ;
10212 buf[0] = 0x20;
10213 ret = usb_microdia_control_write(dev, reg, buf, 1);
10214 if(ret < 0) goto err;
10216 reg = 0x118d ;
10217 buf[0] = 0x20;
10218 ret = usb_microdia_control_write(dev, reg, buf, 1);
10219 if(ret < 0) goto err;
10221 reg = 0x118e ;
10222 buf[0] = 0x20;
10223 ret = usb_microdia_control_write(dev, reg, buf, 1);
10224 if(ret < 0) goto err;
10226 reg = 0x118f ;
10227 buf[0] = 0x20;
10228 ret = usb_microdia_control_write(dev, reg, buf, 1);
10229 if(ret < 0) goto err;
10231 reg = 0x11a5 ;
10232 buf[0] = 0x2d; buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
10233 ret = usb_microdia_control_write(dev, reg, buf, 6);
10234 if(ret < 0) goto err;
10236 reg = 0x11af ;
10237 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
10238 ret = usb_microdia_control_write(dev, reg, buf, 4);
10239 if(ret < 0) goto err;
10241 reg = 0x11b3 ;
10242 buf[0] = 0x32; buf[1] = 0xdd; buf[2] = 0x32; buf[3] = 0xdd;
10243 ret = usb_microdia_control_write(dev, reg, buf, 4);
10244 if(ret < 0) goto err;
10246 reg = 0x10e0 ;
10247 buf[0] = 0x47;
10248 ret = usb_microdia_control_write(dev, reg, buf, 1);
10249 if(ret < 0) goto err;
10251 reg = 0x1061 ;
10252 buf[0] = 0x01;
10253 ret = usb_microdia_control_write(dev, reg, buf, 1);
10254 if(ret < 0) goto err;
10256 reg = 0x10e0 ;
10257 buf[0] = 0x67;
10258 ret = usb_microdia_control_write(dev, reg, buf, 1);
10259 if(ret < 0) goto err;
10261 reg = 0x1100 ;
10262 buf[0] = 0x0d; buf[1] = 0x08; buf[2] = 0x08; buf[3] = 0x0d; buf[4] = 0x08; buf[5] = 0x08; buf[6] = 0x0d; buf[7] = 0x0d; buf[8] = 0x0d; buf[9] = 0x0d; buf[10] = 0x11; buf[11] = 0x0d; buf[12] = 0x0d; buf[13] = 0x11; buf[14] = 0x15; buf[15] = 0x21; buf[16] = 0x15; buf[17] = 0x15; buf[18] = 0x11; buf[19] = 0x11; buf[20] = 0x15; buf[21] = 0x2a; buf[22] = 0x1d; buf[23] = 0x1d; buf[24] = 0x19; buf[25] = 0x21; buf[26] = 0x32; buf[27] = 0x2a; buf[28] = 0x32; buf[29] = 0x32; buf[30] = 0x2e; buf[31] = 0x2a; buf[32] = 0x2e; buf[33] = 0x2e; buf[34] = 0x36; buf[35] = 0x3a; buf[36] = 0x4b; buf[37] = 0x43; buf[38] = 0x36; buf[39] = 0x3a; buf[40] = 0x47; buf[41] = 0x3a; buf[42] = 0x2e; buf[43] = 0x2e; buf[44] = 0x43; buf[45] = 0x5c; buf[46] = 0x43; buf[47] = 0x47; buf[48] = 0x4f; buf[49] = 0x53; buf[50] = 0x58; buf[51] = 0x58; buf[52] = 0x58; buf[53] = 0x32; buf[54] = 0x3f; buf[55] = 0x60; buf[56] = 0x64; buf[57] = 0x5c; buf[58] = 0x53; buf[59] = 0x64; buf[60] = 0x4b; buf[61] = 0x53; buf[62] = 0x58; buf[63] = 0x53;
10263 ret = usb_microdia_control_write(dev, reg, buf, 64);
10264 if(ret < 0) goto err;
10266 reg = 0x1140 ;
10267 buf[0] = 0x0d; buf[1] = 0x11; buf[2] = 0x11; buf[3] = 0x15; buf[4] = 0x11; buf[5] = 0x15; buf[6] = 0x26; buf[7] = 0x15; buf[8] = 0x15; buf[9] = 0x26; buf[10] = 0x53; buf[11] = 0x36; buf[12] = 0x2e; buf[13] = 0x36; buf[14] = 0x53; buf[15] = 0x53; buf[16] = 0x53; buf[17] = 0x53; buf[18] = 0x53; buf[19] = 0x53; buf[20] = 0x53; buf[21] = 0x53; buf[22] = 0x53; buf[23] = 0x53; buf[24] = 0x53; buf[25] = 0x53; buf[26] = 0x53; buf[27] = 0x53; buf[28] = 0x53; buf[29] = 0x53; buf[30] = 0x53; buf[31] = 0x53; buf[32] = 0x53; buf[33] = 0x53; buf[34] = 0x53; buf[35] = 0x53; buf[36] = 0x53; buf[37] = 0x53; buf[38] = 0x53; buf[39] = 0x53; buf[40] = 0x53; buf[41] = 0x53; buf[42] = 0x53; buf[43] = 0x53; buf[44] = 0x53; buf[45] = 0x53; buf[46] = 0x53; buf[47] = 0x53; buf[48] = 0x53; buf[49] = 0x53; buf[50] = 0x53; buf[51] = 0x53; buf[52] = 0x53; buf[53] = 0x53; buf[54] = 0x53; buf[55] = 0x53; buf[56] = 0x53; buf[57] = 0x53; buf[58] = 0x53; buf[59] = 0x53; buf[60] = 0x53; buf[61] = 0x53; buf[62] = 0x53; buf[63] = 0x53;
10268 ret = usb_microdia_control_write(dev, reg, buf, 64);
10269 if(ret < 0) goto err;
10271 reg = 0x10e0 ;
10272 buf[0] = 0x47;
10273 ret = usb_microdia_control_write(dev, reg, buf, 1);
10274 if(ret < 0) goto err;
10276 reg = 0x1061 ;
10277 buf[0] = 0x03;
10278 ret = usb_microdia_control_write(dev, reg, buf, 1);
10279 if(ret < 0) goto err;
10281 reg = 0x10e0 ;
10282 buf[0] = 0x4b;
10283 ret = usb_microdia_control_write(dev, reg, buf, 1);
10284 if(ret < 0) goto err;
10286 reg = 0x1189 ;
10287 buf[0] = 0xd0;
10288 ret = usb_microdia_control_write(dev, reg, buf, 1);
10289 if(ret < 0) goto err;
10291 reg = 0x11bc ;
10292 buf[0] = 0x00;
10293 ret = usb_microdia_control_write(dev, reg, buf, 1);
10294 if(ret < 0) goto err;
10296 reg = 0x11bd ;
10297 buf[0] = 0x00;
10298 ret = usb_microdia_control_write(dev, reg, buf, 1);
10299 if(ret < 0) goto err;
10301 reg = 0x11be ;
10302 buf[0] = 0x00;
10303 ret = usb_microdia_control_write(dev, reg, buf, 1);
10304 if(ret < 0) goto err;
10306 reg = 0x11bf ;
10307 buf[0] = 0x00;
10308 ret = usb_microdia_control_write(dev, reg, buf, 1);
10309 if(ret < 0) goto err;
10311 reg = 0x10c0 ;
10312 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x03; buf[3] = 0x14; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10313 ret = usb_microdia_control_write(dev, reg, buf, 8);
10314 if(ret < 0) goto err;
10316 reg = 0x10c0 ;
10317 ret = usb_microdia_control_read(dev, reg, buf, 1);
10318 if(ret < 0) goto err;
10320 reg = 0x10c0 ;
10321 ret = usb_microdia_control_read(dev, reg, buf, 1);
10322 if(ret < 0) goto err;
10324 reg = 0x10c0 ;
10325 buf[0] = 0xd0; buf[1] = 0x30; buf[2] = 0x17; buf[3] = 0x1b; buf[4] = 0xbc; buf[5] = 0x01; buf[6] = 0x7a; buf[7] = 0x10;
10326 ret = usb_microdia_control_write(dev, reg, buf, 8);
10327 if(ret < 0) goto err;
10329 reg = 0x10c0 ;
10330 ret = usb_microdia_control_read(dev, reg, buf, 1);
10331 if(ret < 0) goto err;
10333 reg = 0x10c0 ;
10334 ret = usb_microdia_control_read(dev, reg, buf, 1);
10335 if(ret < 0) goto err;
10337 reg = 0x10c0 ;
10338 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10339 ret = usb_microdia_control_write(dev, reg, buf, 8);
10340 if(ret < 0) goto err;
10342 reg = 0x10c0 ;
10343 ret = usb_microdia_control_read(dev, reg, buf, 1);
10344 if(ret < 0) goto err;
10346 reg = 0x10c0 ;
10347 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x32; buf[3] = 0x82; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10348 ret = usb_microdia_control_write(dev, reg, buf, 8);
10349 if(ret < 0) goto err;
10351 reg = 0x10c0 ;
10352 ret = usb_microdia_control_read(dev, reg, buf, 1);
10353 if(ret < 0) goto err;
10355 reg = 0x10c0 ;
10356 ret = usb_microdia_control_read(dev, reg, buf, 1);
10357 if(ret < 0) goto err;
10359 reg = 0x1180 ;
10360 buf[0] = 0x05; buf[1] = 0x00; buf[2] = 0x01; buf[3] = 0x00; buf[4] = 0x50; buf[5] = 0x78;
10361 ret = usb_microdia_control_write(dev, reg, buf, 6);
10362 if(ret < 0) goto err;
10364 reg = 0x10fb ;
10365 buf[0] = 0x00; buf[1] = 0xa0; buf[2] = 0x00; buf[3] = 0xf0; buf[4] = 0x00;
10366 ret = usb_microdia_control_write(dev, reg, buf, 5);
10367 if(ret < 0) goto err;
10369 reg = 0x1189 ;
10370 buf[0] = 0xd0;
10371 ret = usb_microdia_control_write(dev, reg, buf, 1);
10372 if(ret < 0) goto err;
10374 reg = 0x11a1 ;
10375 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xd5; buf[3] = 0xa0;
10376 ret = usb_microdia_control_write(dev, reg, buf, 4);
10377 if(ret < 0) goto err;
10379 reg = 0x11ab ;
10380 buf[0] = 0x00; buf[1] = 0x00; buf[2] = 0xa0; buf[3] = 0x78;
10381 ret = usb_microdia_control_write(dev, reg, buf, 4);
10382 if(ret < 0) goto err;
10384 reg = 0x1061 ;
10385 buf[0] = 0x03;
10386 ret = usb_microdia_control_write(dev, reg, buf, 1);
10387 if(ret < 0) goto err;
10389 reg = 0x11ba ;
10390 buf[0] = 0x0a;
10391 ret = usb_microdia_control_write(dev, reg, buf, 1);
10392 if(ret < 0) goto err;
10394 reg = 0x11b9 ;
10395 buf[0] = 0x00;
10396 ret = usb_microdia_control_write(dev, reg, buf, 1);
10397 if(ret < 0) goto err;
10399 reg = 0x11ba ;
10400 buf[0] = 0x0b;
10401 ret = usb_microdia_control_write(dev, reg, buf, 1);
10402 if(ret < 0) goto err;
10404 reg = 0x1061 ;
10405 buf[0] = 0x01;
10406 ret = usb_microdia_control_write(dev, reg, buf, 1);
10407 if(ret < 0) goto err;
10409 reg = 0x1000 ;
10410 buf[0] = 0x78;
10411 ret = usb_microdia_control_write(dev, reg, buf, 1);
10412 if(ret < 0) goto err;
10414 reg = 0x1002 ;
10415 buf[0] = 0x08;
10416 ret = usb_microdia_control_write(dev, reg, buf, 1);
10417 if(ret < 0) goto err;
10419 reg = 0x1002 ;
10420 buf[0] = 0x08;
10421 ret = usb_microdia_control_write(dev, reg, buf, 1);
10422 if(ret < 0) goto err;
10424 reg = 0x11b8 ;
10425 buf[0] = 0xfa;
10426 ret = usb_microdia_control_write(dev, reg, buf, 1);
10427 if(ret < 0) goto err;
10429 reg = 0x118a ;
10430 buf[0] = 0x02;
10431 ret = usb_microdia_control_write(dev, reg, buf, 1);
10432 if(ret < 0) goto err;
10434 reg = 0x0395 ;
10435 buf[0] = 0x02;
10436 ret = usb_microdia_control_write(dev, reg, buf, 1);
10437 if(ret < 0) goto err;
10439 reg = 0x11b8 ;
10440 buf[0] = 0xf8;
10441 ret = usb_microdia_control_write(dev, reg, buf, 1);
10442 if(ret < 0) goto err;
10444 reg = 0x11b8 ;
10445 ret = usb_microdia_control_read(dev, reg, buf, 1);
10446 if(ret < 0) goto err;
10448 reg = 0x11b8 ;
10449 buf[0] = 0xf9;
10450 ret = usb_microdia_control_write(dev, reg, buf, 1);
10451 if(ret < 0) goto err;
10453 reg = 0x11b8 ;
10454 ret = usb_microdia_control_read(dev, reg, buf, 1);
10455 if(ret < 0) goto err;
10457 reg = 0x11b8 ;
10458 buf[0] = 0x7a;
10459 ret = usb_microdia_control_write(dev, reg, buf, 1);
10460 if(ret < 0) goto err;
10462 reg = 0x11b8 ;
10463 ret = usb_microdia_control_read(dev, reg, buf, 1);
10464 if(ret < 0) goto err;
10466 reg = 0x11b8 ;
10467 buf[0] = 0x7b;
10468 ret = usb_microdia_control_write(dev, reg, buf, 1);
10469 if(ret < 0) goto err;
10471 reg = 0x11b8 ;
10472 ret = usb_microdia_control_read(dev, reg, buf, 1);
10473 if(ret < 0) goto err;
10475 reg = 0x11b8 ;
10476 buf[0] = 0x7c;
10477 ret = usb_microdia_control_write(dev, reg, buf, 1);
10478 if(ret < 0) goto err;
10480 reg = 0x11b8 ;
10481 ret = usb_microdia_control_read(dev, reg, buf, 1);
10482 if(ret < 0) goto err;
10484 reg = 0x11b8 ;
10485 buf[0] = 0xfd;
10486 ret = usb_microdia_control_write(dev, reg, buf, 1);
10487 if(ret < 0) goto err;
10489 reg = 0x11b8 ;
10490 ret = usb_microdia_control_read(dev, reg, buf, 1);
10491 if(ret < 0) goto err;
10493 reg = 0x11b8 ;
10494 buf[0] = 0xfa;
10495 ret = usb_microdia_control_write(dev, reg, buf, 1);
10496 if(ret < 0) goto err;
10498 reg = 0x10c0 ;
10499 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x11; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10500 ret = usb_microdia_control_write(dev, reg, buf, 8);
10501 if(ret < 0) goto err;
10503 reg = 0x10c0 ;
10504 ret = usb_microdia_control_read(dev, reg, buf, 1);
10505 if(ret < 0) goto err;
10507 reg = 0x10c0 ;
10508 ret = usb_microdia_control_read(dev, reg, buf, 1);
10509 if(ret < 0) goto err;
10511 reg = 0x10c0 ;
10512 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10513 ret = usb_microdia_control_write(dev, reg, buf, 8);
10514 if(ret < 0) goto err;
10516 reg = 0x10c0 ;
10517 ret = usb_microdia_control_read(dev, reg, buf, 1);
10518 if(ret < 0) goto err;
10520 reg = 0x10c0 ;
10521 ret = usb_microdia_control_read(dev, reg, buf, 1);
10522 if(ret < 0) goto err;
10524 reg = 0x10c0 ;
10525 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2b; buf[3] = 0x70; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10526 ret = usb_microdia_control_write(dev, reg, buf, 8);
10527 if(ret < 0) goto err;
10529 reg = 0x10c0 ;
10530 ret = usb_microdia_control_read(dev, reg, buf, 1);
10531 if(ret < 0) goto err;
10533 reg = 0x10c0 ;
10534 ret = usb_microdia_control_read(dev, reg, buf, 1);
10535 if(ret < 0) goto err;
10537 reg = 0x10c0 ;
10538 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x92; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10539 ret = usb_microdia_control_write(dev, reg, buf, 8);
10540 if(ret < 0) goto err;
10542 reg = 0x10c0 ;
10543 ret = usb_microdia_control_read(dev, reg, buf, 1);
10544 if(ret < 0) goto err;
10546 reg = 0x10c0 ;
10547 ret = usb_microdia_control_read(dev, reg, buf, 1);
10548 if(ret < 0) goto err;
10550 reg = 0x10c0 ;
10551 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x93; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10552 ret = usb_microdia_control_write(dev, reg, buf, 8);
10553 if(ret < 0) goto err;
10555 reg = 0x10c0 ;
10556 ret = usb_microdia_control_read(dev, reg, buf, 1);
10557 if(ret < 0) goto err;
10559 reg = 0x10c0 ;
10560 ret = usb_microdia_control_read(dev, reg, buf, 1);
10561 if(ret < 0) goto err;
10563 reg = 0x10c0 ;
10564 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0a; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10565 ret = usb_microdia_control_write(dev, reg, buf, 8);
10566 if(ret < 0) goto err;
10568 reg = 0x10c0 ;
10569 ret = usb_microdia_control_read(dev, reg, buf, 1);
10570 if(ret < 0) goto err;
10572 reg = 0x10c0 ;
10573 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10574 ret = usb_microdia_control_write(dev, reg, buf, 8);
10575 if(ret < 0) goto err;
10577 reg = 0x10c0 ;
10578 ret = usb_microdia_control_read(dev, reg, buf, 1);
10579 if(ret < 0) goto err;
10581 reg = 0x10c2 ;
10582 ret = usb_microdia_control_read(dev, reg, buf, 5);
10583 if(ret < 0) goto err;
10585 reg = 0x10c0 ;
10586 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x0b; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10587 ret = usb_microdia_control_write(dev, reg, buf, 8);
10588 if(ret < 0) goto err;
10590 reg = 0x10c0 ;
10591 ret = usb_microdia_control_read(dev, reg, buf, 1);
10592 if(ret < 0) goto err;
10594 reg = 0x10c0 ;
10595 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10596 ret = usb_microdia_control_write(dev, reg, buf, 8);
10597 if(ret < 0) goto err;
10599 reg = 0x10c0 ;
10600 ret = usb_microdia_control_read(dev, reg, buf, 1);
10601 if(ret < 0) goto err;
10603 reg = 0x10c2 ;
10604 ret = usb_microdia_control_read(dev, reg, buf, 5);
10605 if(ret < 0) goto err;
10607 reg = 0x10c0 ;
10608 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1c; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10609 ret = usb_microdia_control_write(dev, reg, buf, 8);
10610 if(ret < 0) goto err;
10612 reg = 0x10c0 ;
10613 ret = usb_microdia_control_read(dev, reg, buf, 1);
10614 if(ret < 0) goto err;
10616 reg = 0x10c0 ;
10617 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10618 ret = usb_microdia_control_write(dev, reg, buf, 8);
10619 if(ret < 0) goto err;
10621 reg = 0x10c0 ;
10622 ret = usb_microdia_control_read(dev, reg, buf, 1);
10623 if(ret < 0) goto err;
10625 reg = 0x10c2 ;
10626 ret = usb_microdia_control_read(dev, reg, buf, 5);
10627 if(ret < 0) goto err;
10629 reg = 0x10c0 ;
10630 buf[0] = 0x90; buf[1] = 0x30; buf[2] = 0x1d; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10631 ret = usb_microdia_control_write(dev, reg, buf, 8);
10632 if(ret < 0) goto err;
10634 reg = 0x10c0 ;
10635 ret = usb_microdia_control_read(dev, reg, buf, 1);
10636 if(ret < 0) goto err;
10638 reg = 0x10c0 ;
10639 buf[0] = 0x92; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10640 ret = usb_microdia_control_write(dev, reg, buf, 8);
10641 if(ret < 0) goto err;
10643 reg = 0x10c0 ;
10644 ret = usb_microdia_control_read(dev, reg, buf, 1);
10645 if(ret < 0) goto err;
10647 reg = 0x10c2 ;
10648 ret = usb_microdia_control_read(dev, reg, buf, 5);
10649 if(ret < 0) goto err;
10651 reg = 0x1061 ;
10652 buf[0] = 0x03;
10653 ret = usb_microdia_control_write(dev, reg, buf, 1);
10654 if(ret < 0) goto err;
10656 reg = 0x1007 ;
10657 buf[0] = 0x20;
10658 ret = usb_microdia_control_write(dev, reg, buf, 1);
10659 if(ret < 0) goto err;
10661 reg = 0x1006 ;
10662 buf[0] = 0x00;
10663 ret = usb_microdia_control_write(dev, reg, buf, 1);
10664 if(ret < 0) goto err;
10666 reg = 0x10e1 ;
10667 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10668 ret = usb_microdia_control_write(dev, reg, buf, 21);
10669 if(ret < 0) goto err;
10671 reg = 0x10c0 ;
10672 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0xa1; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10673 ret = usb_microdia_control_write(dev, reg, buf, 8);
10674 if(ret < 0) goto err;
10676 reg = 0x10c0 ;
10677 ret = usb_microdia_control_read(dev, reg, buf, 1);
10678 if(ret < 0) goto err;
10680 reg = 0x10c0 ;
10681 ret = usb_microdia_control_read(dev, reg, buf, 1);
10682 if(ret < 0) goto err;
10684 reg = 0x10c0 ;
10685 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x10; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10686 ret = usb_microdia_control_write(dev, reg, buf, 8);
10687 if(ret < 0) goto err;
10689 reg = 0x10c0 ;
10690 ret = usb_microdia_control_read(dev, reg, buf, 1);
10691 if(ret < 0) goto err;
10693 reg = 0x10c0 ;
10694 ret = usb_microdia_control_read(dev, reg, buf, 1);
10695 if(ret < 0) goto err;
10697 reg = 0x10c0 ;
10698 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x04; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10699 ret = usb_microdia_control_write(dev, reg, buf, 8);
10700 if(ret < 0) goto err;
10702 reg = 0x10c0 ;
10703 ret = usb_microdia_control_read(dev, reg, buf, 1);
10704 if(ret < 0) goto err;
10706 reg = 0x10c0 ;
10707 ret = usb_microdia_control_read(dev, reg, buf, 1);
10708 if(ret < 0) goto err;
10710 reg = 0x10c0 ;
10711 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2d; buf[3] = 0x36; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10712 ret = usb_microdia_control_write(dev, reg, buf, 8);
10713 if(ret < 0) goto err;
10715 reg = 0x10c0 ;
10716 ret = usb_microdia_control_read(dev, reg, buf, 1);
10717 if(ret < 0) goto err;
10719 reg = 0x10c0 ;
10720 ret = usb_microdia_control_read(dev, reg, buf, 1);
10721 if(ret < 0) goto err;
10723 reg = 0x10c0 ;
10724 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x2e; buf[3] = 0x00; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10725 ret = usb_microdia_control_write(dev, reg, buf, 8);
10726 if(ret < 0) goto err;
10728 reg = 0x10c0 ;
10729 ret = usb_microdia_control_read(dev, reg, buf, 1);
10730 if(ret < 0) goto err;
10732 reg = 0x10c0 ;
10733 ret = usb_microdia_control_read(dev, reg, buf, 1);
10734 if(ret < 0) goto err;
10736 reg = 0x10e1 ;
10737 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10738 ret = usb_microdia_control_write(dev, reg, buf, 21);
10739 if(ret < 0) goto err;
10741 reg = 0x10c0 ;
10742 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x01; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10743 ret = usb_microdia_control_write(dev, reg, buf, 8);
10744 if(ret < 0) goto err;
10746 reg = 0x10c0 ;
10747 ret = usb_microdia_control_read(dev, reg, buf, 1);
10748 if(ret < 0) goto err;
10750 reg = 0x10c0 ;
10751 ret = usb_microdia_control_read(dev, reg, buf, 1);
10752 if(ret < 0) goto err;
10754 reg = 0x10e1 ;
10755 buf[0] = 0x16; buf[1] = 0x00; buf[2] = 0x2d; buf[3] = 0x00; buf[4] = 0x08; buf[5] = 0x00; buf[6] = 0xdd; buf[7] = 0x0f; buf[8] = 0xcc; buf[9] = 0x0f; buf[10] = 0x58; buf[11] = 0x00; buf[12] = 0x4b; buf[13] = 0x00; buf[14] = 0xb5; buf[15] = 0x0f; buf[16] = 0x00; buf[17] = 0x00; buf[18] = 0x00; buf[19] = 0x00; buf[20] = 0x00;
10756 ret = usb_microdia_control_write(dev, reg, buf, 21);
10757 if(ret < 0) goto err;
10759 reg = 0x10c0 ;
10760 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x06; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10761 ret = usb_microdia_control_write(dev, reg, buf, 8);
10762 if(ret < 0) goto err;
10764 reg = 0x10c0 ;
10765 ret = usb_microdia_control_read(dev, reg, buf, 1);
10766 if(ret < 0) goto err;
10768 reg = 0x10c0 ;
10769 ret = usb_microdia_control_read(dev, reg, buf, 1);
10770 if(ret < 0) goto err;
10772 reg = 0x10c0 ;
10773 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x94; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10774 ret = usb_microdia_control_write(dev, reg, buf, 8);
10775 if(ret < 0) goto err;
10777 reg = 0x10c0 ;
10778 ret = usb_microdia_control_read(dev, reg, buf, 1);
10779 if(ret < 0) goto err;
10781 reg = 0x10c0 ;
10782 ret = usb_microdia_control_read(dev, reg, buf, 1);
10783 if(ret < 0) goto err;
10785 reg = 0x10c0 ;
10786 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x8d; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10787 ret = usb_microdia_control_write(dev, reg, buf, 8);
10788 if(ret < 0) goto err;
10790 reg = 0x10c0 ;
10791 ret = usb_microdia_control_read(dev, reg, buf, 1);
10792 if(ret < 0) goto err;
10794 reg = 0x10c0 ;
10795 ret = usb_microdia_control_read(dev, reg, buf, 1);
10796 if(ret < 0) goto err;
10798 reg = 0x118c ;
10799 buf[0] = 0x20;
10800 ret = usb_microdia_control_write(dev, reg, buf, 1);
10801 if(ret < 0) goto err;
10803 reg = 0x118d ;
10804 buf[0] = 0x20;
10805 ret = usb_microdia_control_write(dev, reg, buf, 1);
10806 if(ret < 0) goto err;
10808 reg = 0x118e ;
10809 buf[0] = 0x20;
10810 ret = usb_microdia_control_write(dev, reg, buf, 1);
10811 if(ret < 0) goto err;
10813 reg = 0x118f ;
10814 buf[0] = 0x20;
10815 ret = usb_microdia_control_write(dev, reg, buf, 1);
10816 if(ret < 0) goto err;
10818 reg = 0x10c0 ;
10819 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x09; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10820 ret = usb_microdia_control_write(dev, reg, buf, 8);
10821 if(ret < 0) goto err;
10823 reg = 0x10c0 ;
10824 ret = usb_microdia_control_read(dev, reg, buf, 1);
10825 if(ret < 0) goto err;
10827 reg = 0x10c0 ;
10828 ret = usb_microdia_control_read(dev, reg, buf, 1);
10829 if(ret < 0) goto err;
10831 reg = 0x10c0 ;
10832 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x95; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10833 ret = usb_microdia_control_write(dev, reg, buf, 8);
10834 if(ret < 0) goto err;
10836 reg = 0x10c0 ;
10837 ret = usb_microdia_control_read(dev, reg, buf, 1);
10838 if(ret < 0) goto err;
10840 reg = 0x10c0 ;
10841 ret = usb_microdia_control_read(dev, reg, buf, 1);
10842 if(ret < 0) goto err;
10844 reg = 0x10c0 ;
10845 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x85; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10846 ret = usb_microdia_control_write(dev, reg, buf, 8);
10847 if(ret < 0) goto err;
10849 reg = 0x10c0 ;
10850 ret = usb_microdia_control_read(dev, reg, buf, 1);
10851 if(ret < 0) goto err;
10853 reg = 0x10c0 ;
10854 ret = usb_microdia_control_read(dev, reg, buf, 1);
10855 if(ret < 0) goto err;
10857 reg = 0x118c ;
10858 buf[0] = 0x20;
10859 ret = usb_microdia_control_write(dev, reg, buf, 1);
10860 if(ret < 0) goto err;
10862 reg = 0x118d ;
10863 buf[0] = 0x20;
10864 ret = usb_microdia_control_write(dev, reg, buf, 1);
10865 if(ret < 0) goto err;
10867 reg = 0x118e ;
10868 buf[0] = 0x20;
10869 ret = usb_microdia_control_write(dev, reg, buf, 1);
10870 if(ret < 0) goto err;
10872 reg = 0x118f ;
10873 buf[0] = 0x20;
10874 ret = usb_microdia_control_write(dev, reg, buf, 1);
10875 if(ret < 0) goto err;
10877 reg = 0x10c0 ;
10878 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x00; buf[3] = 0x0c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x15;
10879 ret = usb_microdia_control_write(dev, reg, buf, 8);
10880 if(ret < 0) goto err;
10882 reg = 0x10c0 ;
10883 ret = usb_microdia_control_read(dev, reg, buf, 1);
10884 if(ret < 0) goto err;
10886 reg = 0x10c0 ;
10887 ret = usb_microdia_control_read(dev, reg, buf, 1);
10888 if(ret < 0) goto err;
10890 reg = 0x10c0 ;
10891 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x01; buf[3] = 0x96; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10892 ret = usb_microdia_control_write(dev, reg, buf, 8);
10893 if(ret < 0) goto err;
10895 reg = 0x10c0 ;
10896 ret = usb_microdia_control_read(dev, reg, buf, 1);
10897 if(ret < 0) goto err;
10899 reg = 0x10c0 ;
10900 ret = usb_microdia_control_read(dev, reg, buf, 1);
10901 if(ret < 0) goto err;
10903 reg = 0x10c0 ;
10904 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x80; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10905 ret = usb_microdia_control_write(dev, reg, buf, 8);
10906 if(ret < 0) goto err;
10908 reg = 0x10c0 ;
10909 ret = usb_microdia_control_read(dev, reg, buf, 1);
10910 if(ret < 0) goto err;
10912 reg = 0x10c0 ;
10913 ret = usb_microdia_control_read(dev, reg, buf, 1);
10914 if(ret < 0) goto err;
10916 reg = 0x118c ;
10917 buf[0] = 0x20;
10918 ret = usb_microdia_control_write(dev, reg, buf, 1);
10919 if(ret < 0) goto err;
10921 reg = 0x118d ;
10922 buf[0] = 0x20;
10923 ret = usb_microdia_control_write(dev, reg, buf, 1);
10924 if(ret < 0) goto err;
10926 reg = 0x118e ;
10927 buf[0] = 0x20;
10928 ret = usb_microdia_control_write(dev, reg, buf, 1);
10929 if(ret < 0) goto err;
10931 reg = 0x118f ;
10932 buf[0] = 0x20;
10933 ret = usb_microdia_control_write(dev, reg, buf, 1);
10934 if(ret < 0) goto err;
10936 reg = 0x10c0 ;
10937 buf[0] = 0xa0; buf[1] = 0x30; buf[2] = 0x02; buf[3] = 0x7c; buf[4] = 0x00; buf[5] = 0x00; buf[6] = 0x00; buf[7] = 0x10;
10938 ret = usb_microdia_control_write(dev, reg, buf, 8);
10939 if(ret < 0) goto err;
10941 reg = 0x10c0 ;
10942 ret = usb_microdia_control_read(dev, reg, buf, 1);
10943 if(ret < 0) goto err;
10945 reg = 0x10c0 ;
10946 ret = usb_microdia_control_read(dev, reg, buf, 1);
10947 if(ret < 0) goto err;
10949 reg = 0x118c ;
10950 buf[0] = 0x20;
10951 ret = usb_microdia_control_write(dev, reg, buf, 1);
10952 if(ret < 0) goto err;
10954 reg = 0x118d ;
10955 buf[0] = 0x20;
10956 ret = usb_microdia_control_write(dev, reg, buf, 1);
10957 if(ret < 0) goto err;
10959 reg = 0x118e ;
10960 buf[0] = 0x20;
10961 ret = usb_microdia_control_write(dev, reg, buf, 1);
10962 if(ret < 0) goto err;
10964 reg = 0x118f ;
10965 buf[0] = 0x20;
10966 ret = usb_microdia_control_write(dev, reg, buf, 1);
10967 if(ret < 0) goto err;
10969 reg = 0x1007 ;
10970 buf[0] = 0x20;
10971 ret = usb_microdia_control_write(dev, reg, buf, 1);
10972 if(ret < 0) goto err;
10974 reg = 0x1006 ;
10975 buf[0] = 0x20;
10976 ret = usb_microdia_control_write(dev, reg, buf, 1);
10977 if(ret < 0) goto err;
10982 /* END OF MICRODIA 6288 START STREAM */
10984 return 0;
10985 err:
10986 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
10987 return ret;
10990 /**
10991 * @brief From UsbSnoop-plugin-parsed.log
10993 * @param dev
10995 * @returns 0 if all OK
10997 * this function starts video stream Microdia 6128 webcam
10998 * Bridge SN9C325 + OM6802 CMOS sensor
10999 * note: comments are my observations so they could be wrong
11001 int microdia_6128_start_stream(struct usb_microdia *dev)
11003 int i;
11004 int ret = 0;
11005 __u8 buf[8];
11007 __u8 data_15[] = {
11008 0x00, 0x1a, 0x34, 0x27, 0x20, 0xa0, 0x34, 0x69, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00
11011 __u8 data_17[] = {
11012 0x08, 0x22, 0x44, 0x63, 0x7d, 0x92, 0xa3, 0xaf, 0xbc, 0xc4, 0xcd, 0xd5, 0xdc, 0xe1, 0xe8, 0xef,
11013 0xf7
11016 __u8 data_21[] = {
11017 0x15, 0x00, 0x2b, 0x00, 0x08, 0x00, 0xeb, 0x0f, 0xd7, 0x0f, 0x43, 0x00, 0x3d, 0x00, 0xca, 0x0f,
11018 0xf7, 0x0f, 0x0c, 0x00, 0x00
11021 __u8 qtable_1[] = {
11022 0x06, 0x04, 0x04, 0x06, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x08, 0x06, 0x06, 0x08, 0x0a, 0x10,
11023 0x0a, 0x0a, 0x08, 0x08, 0x0a, 0x13, 0x0e, 0x0e, 0x0c, 0x10, 0x17, 0x13, 0x17, 0x17, 0x15, 0x13,
11024 0x15, 0x15, 0x19, 0x1b, 0x23, 0x1f, 0x19, 0x1b, 0x21, 0x1b, 0x15, 0x15, 0x1f, 0x2b, 0x1f, 0x21,
11025 0x25, 0x27, 0x29, 0x29, 0x29, 0x17, 0x1d, 0x2d, 0x2f, 0x2b, 0x27, 0x2f, 0x23, 0x27, 0x29, 0x27
11029 __u8 qtable_2[] = {
11030 0x06, 0x08, 0x08, 0x0a, 0x08, 0x0a, 0x12, 0x0a, 0x0a, 0x12, 0x27, 0x19, 0x15, 0x19, 0x27, 0x27,
11031 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11032 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11033 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27, 0x27,
11036 __u8 om6802_sensor[][8] = {
11037 {0xa0, dev->sensor_slave_address, 0xd6, 0x02, 0x00, 0x00, 0x00, 0x10},
11038 {0xa0, dev->sensor_slave_address, 0xae, 0xe2, 0x00, 0x00, 0x00, 0x10},
11039 {0xa0, dev->sensor_slave_address, 0xdf, 0x6d, 0x00, 0x00, 0x00, 0x10}, // Enter factory mode
11040 {0xa0, dev->sensor_slave_address, 0xdd, 0x18, 0x00, 0x00, 0x00, 0x10}, // RGB, uyvy1,Raw RGB, n/1/2, n/clp
11041 {0xa0, dev->sensor_slave_address, 0x5a, 0xc0, 0x00, 0x00, 0x00, 0x10},
11042 {0xa0, dev->sensor_slave_address, 0xfb, 0x11, 0x00, 0x00, 0x00, 0x10},
11043 {0xa0, dev->sensor_slave_address, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x10},
11044 {0xa0, dev->sensor_slave_address, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x10},
11045 {0xa0, dev->sensor_slave_address, 0xe4, 0xff, 0x00, 0x00, 0x00, 0x10},
11046 {0xa0, dev->sensor_slave_address, 0xfb, 0xee, 0x00, 0x00, 0x00, 0x10},
11047 {0xa0, dev->sensor_slave_address, 0x5d, 0x80, 0x00, 0x00, 0x00, 0x10},
11048 {0xa0, dev->sensor_slave_address, 0x71, 0x84, 0x00, 0x00, 0x00, 0x10},
11049 {0xa0, dev->sensor_slave_address, 0x72, 0x00, 0x00, 0x00, 0x00, 0x10},
11050 {0xa0, dev->sensor_slave_address, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10},
11051 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
11052 {0xa0, dev->sensor_slave_address, 0x71, 0x18, 0x00, 0x00, 0x00, 0x10},
11053 {0xa0, dev->sensor_slave_address, 0x72, 0x04, 0x00, 0x00, 0x00, 0x10},
11054 {0xa0, dev->sensor_slave_address, 0x68, 0xde, 0x00, 0x00, 0x00, 0x10},
11055 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10}, // 18
11056 {0xa0, dev->sensor_slave_address, 0x68, 0x80, 0x00, 0x00, 0x00, 0x10},
11057 {0xa0, dev->sensor_slave_address, 0x69, 0x00, 0x00, 0x00, 0x00, 0x10},
11058 {0, 0, 0, 0, 0, 0, 0, 0} // Terminating string
11061 buf[0] = 0x00;
11062 ret += usb_microdia_control_write(dev, 0xf1, buf, 1); // Reset cam
11064 buf[0] = 0x23;
11065 ret += usb_microdia_control_write(dev, 0x01, buf, 1); // Sensor off, video off, clk 12MHz
11067 ret += usb_microdia_control_read(dev, 0x00, buf, 1); // Check if cam is working, must write 0x12 in buf[0]
11069 if(buf[0] != 0x12){
11070 UDIA_ERROR("Microdia 6128 webcam not connected or working !!!\n");
11071 return -ENODEV;
11074 ret += usb_microdia_control_read(dev, 0x01, buf, 1); // Must read 23
11076 if(buf[0] != 0x23){
11077 UDIA_ERROR("Microdia 6128 webcam is not initialized !!!\n");
11078 return -ENODEV;
11081 buf[0] = 0x23; buf[1] = 0x72;
11082 ret += usb_microdia_control_write(dev, 0x01, buf, 2); // Configure GPIO
11084 buf[0] = 0x34; buf[1] = 0x27; buf[2] = 0x20; buf[3] = 0xa0; buf[4] = 0x34;
11085 ret += usb_microdia_control_write(dev, 0x05, buf, 5);
11087 buf[0] = 0x44; buf[1] = 0x45; buf[2] = 0x00; buf[3] = 0x00; buf[4] = 0x00;
11088 ret += usb_microdia_control_write(dev, 0x17, buf, 5);
11090 buf[0] = 0x08; buf[1] = 0x40; buf[2] = 0x20; buf[3] = 0x00; buf[4] = 0x00;
11091 ret += usb_microdia_control_write(dev, 0x9a, buf, 5);
11093 buf[0] = 0x60; buf[1] = 0x00; buf[2] = 0x00;
11094 ret += usb_microdia_control_write(dev, 0xd4, buf, 3);
11095 ret += usb_microdia_control_write(dev, 0x03, data_15, 15);
11097 buf[0] = 0x73;
11098 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11100 buf[0] = 0x64;
11101 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11103 buf[0] = 0x22; buf[1] = 0x62;
11104 ret += usb_microdia_control_write(dev, 0x01, &buf[0], 1);
11105 ret += usb_microdia_control_write(dev, 0x01, &buf[1], 1);
11107 buf[0] = 0x64;
11108 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11109 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11111 buf[0] = 0x42; // Sensor on, clk 24MHz, video off
11112 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11113 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11115 // Sensor stuff
11116 for (i = 0; i < 2; i++){
11117 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11118 msleep(1);
11121 buf[0] = 0x71;
11122 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11124 // Sensor stuff
11125 for (i = 2; i < 11; i++){
11126 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11127 msleep(1);
11130 buf[0] = 0x71;
11131 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11132 ret += usb_microdia_control_write(dev, 0x02, buf, 1); // URB 1780
11134 buf[0] = 0x28;
11135 ret += usb_microdia_control_write(dev, 0x15, buf, 1);
11137 buf[0] = 0x1e;
11138 ret += usb_microdia_control_write(dev, 0x16, buf, 1);
11140 buf[0] = 0x51;
11141 ret += usb_microdia_control_write(dev, 0x12, buf, 1);
11143 buf[0] = 0x01;
11144 ret += usb_microdia_control_write(dev, 0x13, buf, 1);
11146 buf[0] = 0x45;
11147 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11149 buf[0] = 0x6a;
11150 ret += usb_microdia_control_write(dev, 0xd2, buf, 1);
11152 buf[0] = 0x50;
11153 ret += usb_microdia_control_write(dev, 0xd3, buf, 1);
11155 buf[0] = 0x00;
11156 ret += usb_microdia_control_write(dev, 0xc6, buf, 1);
11157 ret += usb_microdia_control_write(dev, 0xc7, buf, 1);
11159 buf[0] = 0x50;
11160 ret += usb_microdia_control_write(dev, 0xc8, buf, 1);
11162 buf[0] = 0x3c;
11163 ret += usb_microdia_control_write(dev, 0xc9, buf, 1);
11165 buf[0] = 0x45;
11166 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11168 buf[0] = 0x64;
11169 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11171 buf[0] = 0x20;
11172 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11173 ret += usb_microdia_control_write(dev, 0x07, buf, 1);
11174 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11176 buf[0] = 0x00;
11177 ret += usb_microdia_control_write(dev, 0x14, buf, 1);
11179 ret += usb_microdia_control_write(dev, 0x20, data_17, 17);
11180 ret += usb_microdia_control_write(dev, 0x20, data_17, 17);
11182 for (i = 0; i < 8; ++i) // writing the same buffer 8 times, why ??
11183 ret += usb_microdia_control_write(dev, 0x84, data_21, 21);
11185 data_21[0] = 0x16; data_21[10] = 40; data_21[12] = 0x3f;
11186 ret += usb_microdia_control_write(dev, 0x84, data_21, 21);
11188 buf[0] = 0x08;
11189 ret += usb_microdia_control_write(dev, 0x9a, buf, 1);
11191 buf[0] = 0x10;
11192 ret += usb_microdia_control_write(dev, 0x99, buf, 1);
11194 ret += usb_microdia_control_write(dev, 0x84, data_21, 21); // URB 1811
11196 buf[0] = 0x20;
11197 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11198 ret += usb_microdia_control_write(dev, 0x07, buf, 1);
11199 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11201 // Sensor Stuff
11202 for (i = 11; i < 15; i++){
11203 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11204 msleep(1);
11207 buf[0] = 0x34;
11208 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11209 buf[0] = 0x27;
11210 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11212 buf[0] = buf[1] = 0x2d; buf[2] = 0x3a; buf[3] = 0x05; buf[4] = 0x04; buf[5] = 0x3f;
11213 ret += usb_microdia_control_write(dev, 0xc0, buf, 6);
11215 buf[0] = 0x28; buf[1] = 0xd8; buf[2] = 0x14; buf[3] = 0xec;
11216 ret += usb_microdia_control_write(dev, 0xca, buf, 4);
11218 buf[0] = 0x1e; buf[1] = 0xdd; buf[2] = 0x2d; buf[3] = 0xe7;
11219 ret += usb_microdia_control_write(dev, 0xce, buf, 4);
11221 buf[0] = 0x42;
11222 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11224 buf[0] = 0x64;
11225 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11227 // Sensor Stuff
11228 for (i = 15; i < 19; i++){
11229 ret += usb_microdia_control_write(dev, 0x08, om6802_sensor[i], 8);
11230 msleep(1);
11233 buf[0] = 0x28;
11234 ret += usb_microdia_control_write(dev, 0x05, buf, 1);
11236 buf[0] = 0x54;
11237 ret += usb_microdia_control_write(dev, 0x06, buf, 1);
11239 // This changes the mode (VGA = 0 , CIF = 1)
11240 // buf = 0x40 | 0x05 | (mode << 4) 45 or 55
11241 buf[0] = 0x45;
11242 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11244 // This is the Q table
11245 ret += usb_microdia_control_write(dev, 0x0100, qtable_1, 64); // first time
11246 ret += usb_microdia_control_write(dev, 0x0140, qtable_2, 64); // second time
11248 // mode: VGA = 0, CIF = 1
11249 // buf = 0x05 | (mode << 4) 05 or 15
11250 buf[0] = 0x05;
11251 ret += usb_microdia_control_write(dev, 0x18, buf, 1);
11253 buf[0] = 0x71;
11254 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11255 ret += usb_microdia_control_write(dev, 0x02, buf, 1);
11257 buf[0] = 0x42; // Sensor on, Video disabled, clk 24MHz
11258 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11260 buf[0] = 0x64;
11261 ret += usb_microdia_control_write(dev, 0x17, buf, 1);
11263 // Command to start streaming
11264 // Sensor on, clk 24MHz, video enabled
11265 buf[0] = 0x46;
11266 ret += usb_microdia_control_write(dev, 0x01, buf, 1);
11268 // When the device reads 46 from reg 0x01 it means that
11269 // camera is streaming
11270 ret += usb_microdia_control_read(dev, 0x01, buf, 1); // Must read 0x46
11272 if (ret != 624)
11273 UDIA_DEBUG("Some read or write were not successful in Start Stream\n");
11275 return 0;
11279 int dev_microdia_stop_stream(struct usb_microdia *dev)
11281 int ret = -ENODEV;
11282 if(dev && dev->stop_stream)
11283 ret = dev->stop_stream(dev);
11285 return ret;
11289 * @brief From stop.htm
11291 * @param dev
11293 * @returns 0
11295 * @author GWater
11297 * For SN9C201 with MI1310.
11298 * This function has not been tested yet.
11300 int microdia_6242_stop_stream(struct usb_microdia *dev)
11302 __u8 buf[3];
11304 __u8 only10c0[3] = {0x0d, 0x00, 0x00};
11306 buf[0] = 0x01;
11307 usb_microdia_control_write(dev, 0x1061, buf, 1);
11309 buf[0] = 0x60;
11310 usb_microdia_control_write(dev, 0x1007, buf, 1);
11312 buf[0] = 0x00;
11313 usb_microdia_control_write(dev, 0x1006, buf, 1);
11315 sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2,
11316 only10c0[0], dev->sensor_flags, &only10c0[1]);
11318 buf[0] = 0x38;
11319 usb_microdia_control_write(dev, 0x1000, buf, 1);
11321 buf[0] = 0x6b;
11322 usb_microdia_control_write(dev, 0x11b8, buf, 1);
11324 buf[0] = 0x60;
11325 usb_microdia_control_write(dev, 0x1007, buf, 1);
11327 buf[0] = 0x20;
11328 usb_microdia_control_write(dev, 0x1006, buf, 1);
11331 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11332 usb_microdia_control_write(dev, 0x1000, buf, 3);
11335 * After the select alternate setting 0 is actually another transfer:
11336 * buf[0] = 0x00;
11337 * usb_microdia_control_write(dev, 0x1066, buf, 1);
11340 return 0;
11343 /**
11344 * @brief From stopstream.log
11346 * @param dev
11348 * @returns 0
11350 * @author GWater
11352 * For SN9C201 with SOI968.
11353 * I don't whether the function really stops the stream.
11354 * Nevertheless the LED on the webcam now stops glowing.
11355 * The function is very similar to "microdia_624f_stop_stream".
11357 int microdia_624e_stop_stream(struct usb_microdia *dev)
11359 __u8 buf[3];
11361 buf[0] = 0x01;
11362 usb_microdia_control_write(dev, 0x1061, buf, 1);
11364 /* Next two writes added because it works better.
11365 * The LED stops glowing and I think the stream does too.
11366 * 0x20 = 0b00100000 which is the minimal of what the other stopstreams have in common.
11368 buf[0] = 0x20;
11369 usb_microdia_control_write(dev, 0x1007, buf, 1);
11371 buf[0] = 0x20;
11372 usb_microdia_control_write(dev, 0x1006, buf, 1);
11374 buf[0] = 0x3c;
11375 usb_microdia_control_write(dev, 0x1000, buf, 1);
11377 buf[0] = 0x6a;
11378 usb_microdia_control_write(dev, 0x11b8, buf, 1);
11380 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11381 usb_microdia_control_write(dev, 0x1000, buf, 3);
11383 usb_microdia_control_read(dev, 0x1066, buf, 1);
11385 return 0;
11388 int microdia_624f_stop_stream(struct usb_microdia *dev)
11390 int ret;
11391 __u16 command;
11392 __u8 buf[3];
11394 buf[0] = 0x02;
11395 command = 0x1066;
11396 ret = usb_microdia_control_write(dev, command, buf, 1);
11397 if(ret < 0) goto err;
11399 buf[0] = 0x01;
11400 command = 0x1061;
11401 ret = usb_microdia_control_write(dev, command, buf, 1);
11402 if(ret < 0) goto err;
11404 buf[0] = 0x38;
11405 command = 0x1000;
11406 ret = usb_microdia_control_write(dev, command, buf, 1);
11407 if(ret < 0) goto err;
11409 buf[0] = 0x6a;
11410 command = 0x11b8;
11411 ret = usb_microdia_control_write(dev, command, buf, 1);
11412 if(ret < 0) goto err;
11414 buf[0] = 0x20;
11415 command = 0x1007;
11416 ret = usb_microdia_control_write(dev, command, buf, 1);
11417 if(ret < 0) goto err;
11419 buf[0] = 0x20;
11420 command = 0x1006;
11421 ret = usb_microdia_control_write(dev, command, buf, 1);
11422 if(ret < 0) goto err;
11424 buf[0] = 0x98;
11425 buf[1] = 0xe7;
11426 buf[2] = 0x11;
11427 command = 0x1000;
11428 ret = usb_microdia_control_write(dev, command, buf, 3);
11429 if(ret < 0) goto err;
11431 command = 0x1045;
11432 ret = usb_microdia_control_read(dev, command, buf, 1);
11433 if(ret < 0) goto err;
11435 buf[0] = 0x0f;
11436 ret = usb_microdia_control_write(dev, command, buf, 1);
11437 if(ret < 0) goto err;
11439 return ret;
11441 err:
11442 UDIA_ERROR("command %x failed (%d)!\n", command, ret);
11443 return ret;
11446 int microdia_6260_stop_stream(struct usb_microdia *dev)
11448 int ret;
11449 __u8 buf[32];
11451 buf[0] = 0x01;
11452 ret = usb_microdia_control_write(dev, 0x1061, buf, 1);
11453 buf[0] = 0x38;
11454 ret = usb_microdia_control_write(dev, 0x1000, buf, 1);
11455 buf[0] = 0x6b;
11456 ret = usb_microdia_control_write(dev, 0x11b8, buf, 1);
11457 buf[0] = 0x20;
11458 ret = usb_microdia_control_write(dev, 0x1007, buf, 1);
11459 buf[0] = 0x20;
11460 ret = usb_microdia_control_write(dev, 0x1006, buf, 1);
11462 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11463 ret = usb_microdia_control_write(dev, 0x1000, buf, 3);
11465 buf[0] = 0x00;
11466 ret = usb_microdia_control_write(dev, 0x1066, buf, 1);
11467 ret = usb_microdia_control_read(dev, 0x1045, buf, 1);
11468 buf[0] = 0x0f;
11469 ret = usb_microdia_control_write(dev, 0x1045, buf, 1);
11470 buf[0] = 0x00;
11471 ret = usb_microdia_control_write(dev, 0x10c8, buf, 1);
11472 buf[0] = 0x80;
11473 ret = usb_microdia_control_write(dev, 0x1020, buf, 1);
11475 return ret;
11479 * @brief From 7 start-stop-logs (made by Alex Carlos, Boris Borisov, bohzan and Comer352l)
11481 * @param dev
11483 * @returns 0 (ok) or -1 (error)
11485 * @author Comer352l
11487 * Windows driver version: 5.7.23.000
11488 * Windows versions: 2000 and XP
11489 * USB-Logger: SniffUSB 1.8 and 2.0, USBTrace 2.0, SnoopyPro
11490 * All logs were made using AMCAP with 640x480, RGB24
11492 int microdia_6270_stop_stream(struct usb_microdia *dev)
11494 int ret = 0;
11495 int retI2C = 0;
11496 __u8 buf[3];
11498 if (dev->sensor_slave_address == MT9V111_I2C_SLAVE_ADDRESS)
11500 buf[0] = 0x20;
11501 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 3541
11502 buf[0] = 0x20;
11503 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 3542
11504 // => These two writes seem to cause the cam to stop sending isochronus USB messages
11506 buf[0] = 0x01;
11507 ret += usb_microdia_control_write(dev, 0x1061, buf, 1); // URB 3544
11508 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
11510 buf[0] = 0x60;
11511 ret += usb_microdia_control_write(dev, 0x1007, buf, 1); // URB 3541
11512 buf[0] = 0x60;
11513 ret += usb_microdia_control_write(dev, 0x1006, buf, 1); // URB 3542
11515 if (dev->sensor_slave_address == MT9V011_I2C_SLAVE_ADDRESS)
11517 // Write to sensor register 0x07: Output Control
11518 buf[0] = 0x00; buf[1] = 0x00; // stop sensor readout, normal operation
11519 retI2C += sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 2, 0x07, dev->sensor_flags, buf);
11521 buf[0] = 0x38; // ALEX: 0x3c
11522 ret += usb_microdia_control_write(dev, 0x1000, buf, 1); // URB 3545
11523 buf[0] = 0x6d; // ALEX: 0xec; FRANK: also 0x6c
11524 ret += usb_microdia_control_write(dev, 0x11b8, buf, 1); // URB 3546
11525 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11526 ret += usb_microdia_control_write(dev, 0x1000, buf, 3); // URB 3547
11528 // INTERRUPT COMMING BACK (URB 2227)
11529 // SELECT ALTERNATE SETTINGS (URB 3548)
11530 // INTERRUPT GOING DOWN (URB 3549)
11532 buf[0] = 0x00;
11533 ret += usb_microdia_control_write(dev, 0x1066, buf, 1); // URB 3550
11535 if (ret < 9)
11537 UDIA_INFO("One ore more errors occured while stopping stream !\n");
11538 return -1;
11540 else
11541 return 0;
11544 int microdia_627b_stop_stream(struct usb_microdia *dev)
11546 int ret = 0;
11547 __u16 reg;
11548 __u8 buf[3];
11550 reg = 0x1007;
11551 buf[0] = 0x60;
11552 ret = usb_microdia_control_write(dev, reg, buf, 1);
11553 if (ret < 0)
11554 goto err;
11556 reg = 0x1006;
11557 buf[0] = 0x20;
11558 ret = usb_microdia_control_write(dev, reg, buf, 1);
11559 if (ret < 0)
11560 goto err;
11563 //reg = 0x1007;
11564 //buf[0] = 0x60;
11565 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11566 //if(ret < 0) goto err;
11568 //reg = 0x1006;
11569 //buf[0] = 0x20;
11570 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11571 //if(ret < 0) goto err;
11574 reg = 0x1061;
11575 buf[0] = 0x01;
11576 ret = usb_microdia_control_write(dev, reg, buf, 1);
11577 if (ret < 0)
11578 goto err;
11581 //reg = 0x1007;
11582 //buf[0] = 0x60;
11583 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11584 //if(ret < 0) goto err;
11586 //reg = 0x1006;
11587 //buf[0] = 0x20;
11588 //ret = usb_microdia_control_write(dev, reg, buf, 1);
11589 //if(ret < 0) goto err;
11592 reg = 0x1000;
11593 buf[0] = 0x38;
11594 ret = usb_microdia_control_write(dev, reg, buf, 1);
11595 if (ret < 0)
11596 goto err;
11598 reg = 0x11b8;
11599 buf[0] = 0x6b;
11600 ret = usb_microdia_control_write(dev, reg, buf, 1);
11601 if (ret < 0)
11602 goto err;
11604 reg = 0x1000;
11605 buf[0] = 0x38; buf[1] = 0xe7; buf[2] = 0x11;
11606 ret = usb_microdia_control_write(dev, reg, buf, 3);
11607 if (ret < 0)
11608 goto err;
11610 reg = 0x1066;
11611 buf[0] = 0x00;
11612 ret = usb_microdia_control_write(dev, reg, buf, 1);
11613 if (ret < 0)
11614 goto err;
11616 return ret;
11617 err:
11618 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
11619 return ret;
11622 /**
11623 * @brief From UsbSnoop-plugin-parsed.log
11625 * @param dev
11627 * @returns 0 (OK) or <0 (Error)
11629 * @author Vincent, Kuzja
11631 int microdia_6288_stop_stream(struct usb_microdia *dev)
11633 int ret = 0;
11634 __u16 reg;
11635 __u8 buf[8];
11637 reg = 0x1061 ;
11638 buf[0] = 0x01;
11639 ret = usb_microdia_control_write(dev, reg, buf, 1);
11640 if(ret < 0) goto err;
11642 reg = 0x1000 ;
11643 buf[0] = 0x38;
11644 ret = usb_microdia_control_write(dev, reg, buf, 1);
11645 if(ret < 0) goto err;
11647 reg = 0x11b8 ;
11648 buf[0] = 0xe9;
11649 ret = usb_microdia_control_write(dev, reg, buf, 1);
11650 if(ret < 0) goto err;
11652 reg = 0x1007 ;
11653 buf[0] = 0x20;
11654 ret = usb_microdia_control_write(dev, reg, buf, 1);
11655 if(ret < 0) goto err;
11657 reg = 0x1006 ;
11658 buf[0] = 0x20;
11659 ret = usb_microdia_control_write(dev, reg, buf, 1);
11660 if(ret < 0) goto err;
11662 reg = 0x1000 ;
11663 buf[0] = 0x98; buf[1] = 0xe7; buf[2] = 0x11;
11664 ret = usb_microdia_control_write(dev, reg, buf, 3);
11665 if(ret < 0) goto err;
11667 reg = 0x1066 ;
11668 buf[0] = 0x00;
11669 ret = usb_microdia_control_write(dev, reg, buf, 1);
11670 if(ret < 0) goto err;
11672 return 0;
11673 err:
11674 UDIA_ERROR("r/w in Register %x failed (%d)!\n", reg, ret);
11675 return ret;
11678 /**
11679 * @brief From UsbSnoop-plugin-parsed.log
11681 * @param dev
11683 * @returns 0 if all OK
11685 * This function stops the video stream for microdia 6128
11686 * Bridge SN9C325 + OM6802 CMOS sensor
11687 * note: comments are my observations so they could be wrong
11689 int microdia_6128_stop_stream(struct usb_microdia *dev)
11691 int ret = 0;
11692 __u8 data;
11694 ret += usb_microdia_control_read(dev, 0x00, &data, 1);
11696 // Stop stream command
11697 data = 0x00;
11698 ret += usb_microdia_control_write(dev, 0x01, &data, 1);
11700 data = 0x00;
11701 ret += usb_microdia_control_write(dev, 0xf1, &data, 1);
11703 data = 0x01;
11704 ret += usb_microdia_control_write(dev, 0xf1, &data, 1);
11706 if(ret != 4)
11707 UDIA_DEBUG("Some read or write were not successful in Stop Stream\n");
11709 return 0;
11714 int microdia_624f_set_exposure(struct usb_microdia *dev)
11716 int ret = 0;
11717 __u8 v1 = (dev->vsettings.exposure >> 4) & 0xff;
11718 __u8 v2 = dev->vsettings.exposure >> 12;
11720 ret |= sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x2d,
11721 dev->sensor_flags, &v1);
11723 ret |= sn9c20x_write_i2c_data(dev, dev->sensor_slave_address, 1, 0x2e,
11724 dev->sensor_flags, &v2);
11726 return ret;
11729 int microdia_624f_flip_detect(struct usb_microdia *dev)
11731 int ret = 0;
11732 __u8 val;
11734 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
11735 if (ret < 0) return -EAGAIN;
11736 if (val & 0x01) {
11737 dev->vsettings.vflip = 1;
11739 else {
11740 dev->vsettings.vflip = 0;
11743 return ret;
11746 int microdia_6260_flip_detect(struct usb_microdia *dev)
11748 const __u8 flip_bit = 0x01;
11749 int ret = 0;
11750 __u8 val;
11751 static __u8 flip_reg = flip_bit;
11752 __u8 vflip;
11754 ret = usb_microdia_control_read(dev, 0x1009, &val, 1);
11755 if (ret < 0)
11756 return -EAGAIN;
11757 if (flip_reg != (val & flip_bit)) {
11758 if (val & flip_bit)
11759 vflip = 0;
11760 else
11761 vflip = 1;
11762 ret = ov7670_auto_flip(dev, vflip);
11763 flip_reg = (val & flip_bit);
11766 return ret;