Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[media] gspca: sn9c2028: Add support for Genius Videocam Live v2

This cam seems to return different values on long commands, so make status check
in sn9c2028_long_command() more tolerant. Anyway, read value isn't used anywhere
later.

Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>

authored by

Vasily Khoruzhick and committed by
Mauro Carvalho Chehab
48c291ed c579401a

+118 -1
+118 -1
drivers/media/usb/gspca/sn9c2028.c
··· 128 128 status = -1; 129 129 for (i = 0; i < 256 && status < 2; i++) 130 130 status = sn9c2028_read1(gspca_dev); 131 - if (status != 2) { 131 + if (status < 0) { 132 132 pr_err("long command status read error %d\n", status); 133 133 return (status < 0) ? status : -EIO; 134 134 } ··· 177 177 switch (sd->model) { 178 178 case 0x7005: 179 179 PDEBUG(D_PROBE, "Genius Smart 300 camera"); 180 + break; 181 + case 0x7003: 182 + PDEBUG(D_PROBE, "Genius Videocam Live v2"); 180 183 break; 181 184 case 0x8000: 182 185 PDEBUG(D_PROBE, "DC31VC"); ··· 533 530 ARRAY_SIZE(genius_start_commands)); 534 531 } 535 532 533 + static int start_genius_videocam_live(struct gspca_dev *gspca_dev) 534 + { 535 + int r; 536 + struct sd *sd = (struct sd *) gspca_dev; 537 + struct init_command genius_vcam_live_start_commands[] = { 538 + {{0x0c, 0x01, 0x00, 0x00, 0x00, 0x00}, 0}, 539 + {{0x16, 0x01, 0x00, 0x00, 0x00, 0x00}, 4}, 540 + {{0x10, 0x00, 0x00, 0x00, 0x00, 0x00}, 4}, 541 + {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4}, 542 + {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4}, 543 + 544 + {{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4}, 545 + {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4}, 546 + {{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4}, 547 + {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4}, 548 + {{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4}, 549 + {{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4}, 550 + {{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4}, 551 + {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4}, 552 + {{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4}, 553 + {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4}, 554 + {{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4}, 555 + {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4}, 556 + {{0x11, 0x11, 0x64, 0x00, 0x00, 0x00}, 4}, 557 + {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4}, 558 + {{0x11, 0x13, 0x91, 0x00, 0x00, 0x00}, 4}, 559 + {{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4}, 560 + {{0x11, 0x15, 0x20, 0x00, 0x00, 0x00}, 4}, 561 + {{0x11, 0x16, 0x01, 0x00, 0x00, 0x00}, 4}, 562 + {{0x11, 0x17, 0x60, 0x00, 0x00, 0x00}, 4}, 563 + {{0x1c, 0x20, 0x00, 0x2d, 0x00, 0x00}, 4}, 564 + {{0x13, 0x20, 0x01, 0x00, 0x00, 0x00}, 4}, 565 + {{0x13, 0x21, 0x01, 0x00, 0x00, 0x00}, 4}, 566 + {{0x13, 0x22, 0x01, 0x00, 0x00, 0x00}, 4}, 567 + {{0x13, 0x23, 0x01, 0x01, 0x00, 0x00}, 4}, 568 + {{0x13, 0x24, 0x01, 0x00, 0x00, 0x00}, 4}, 569 + {{0x13, 0x25, 0x01, 0x16, 0x00, 0x00}, 4}, 570 + {{0x13, 0x26, 0x01, 0x12, 0x00, 0x00}, 4}, 571 + {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4}, 572 + {{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4}, 573 + {{0x13, 0x29, 0x01, 0x22, 0x00, 0x00}, 4}, 574 + {{0x13, 0x2a, 0x01, 0x00, 0x00, 0x00}, 4}, 575 + {{0x13, 0x2b, 0x01, 0x00, 0x00, 0x00}, 4}, 576 + {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4}, 577 + {{0x13, 0x2d, 0x01, 0x02, 0x00, 0x00}, 4}, 578 + {{0x13, 0x2e, 0x01, 0x09, 0x00, 0x00}, 4}, 579 + {{0x13, 0x2f, 0x01, 0x07, 0x00, 0x00}, 4}, 580 + {{0x12, 0x34, 0x01, 0x00, 0x00, 0x00}, 4}, 581 + {{0x13, 0x34, 0x01, 0xa1, 0x00, 0x00}, 4}, 582 + {{0x13, 0x35, 0x01, 0x00, 0x00, 0x00}, 4}, 583 + {{0x11, 0x01, 0x04, 0x00, 0x00, 0x00}, 4}, 584 + {{0x11, 0x02, 0x92, 0x00, 0x00, 0x00}, 4}, 585 + {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4}, 586 + {{0x11, 0x11, 0x64, 0x00, 0x00, 0x00}, 4}, 587 + {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4}, 588 + {{0x11, 0x13, 0x91, 0x00, 0x00, 0x00}, 4}, 589 + {{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4}, 590 + {{0x11, 0x15, 0x20, 0x00, 0x00, 0x00}, 4}, 591 + {{0x11, 0x16, 0x01, 0x00, 0x00, 0x00}, 4}, 592 + {{0x11, 0x17, 0x60, 0x00, 0x00, 0x00}, 4}, 593 + {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4}, 594 + {{0x11, 0x21, 0x2d, 0x00, 0x00, 0x00}, 4}, 595 + {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4}, 596 + {{0x11, 0x23, 0x03, 0x00, 0x00, 0x00}, 4}, 597 + {{0x11, 0x25, 0x00, 0x00, 0x00, 0x00}, 4}, 598 + {{0x11, 0x26, 0x02, 0x00, 0x00, 0x00}, 4}, 599 + {{0x11, 0x27, 0x88, 0x00, 0x00, 0x00}, 4}, 600 + {{0x11, 0x30, 0x38, 0x00, 0x00, 0x00}, 4}, 601 + {{0x11, 0x31, 0x2a, 0x00, 0x00, 0x00}, 4}, 602 + {{0x11, 0x32, 0x2a, 0x00, 0x00, 0x00}, 4}, 603 + {{0x11, 0x33, 0x2a, 0x00, 0x00, 0x00}, 4}, 604 + {{0x11, 0x34, 0x02, 0x00, 0x00, 0x00}, 4}, 605 + {{0x11, 0x5b, 0x0a, 0x00, 0x00, 0x00}, 4}, 606 + {{0x13, 0x25, 0x01, 0x28, 0x00, 0x00}, 4}, 607 + {{0x13, 0x26, 0x01, 0x1e, 0x00, 0x00}, 4}, 608 + {{0x13, 0x28, 0x01, 0x0e, 0x00, 0x00}, 4}, 609 + {{0x13, 0x27, 0x01, 0x20, 0x00, 0x00}, 4}, 610 + {{0x13, 0x29, 0x01, 0x62, 0x00, 0x00}, 4}, 611 + {{0x13, 0x2c, 0x01, 0x02, 0x00, 0x00}, 4}, 612 + {{0x13, 0x2d, 0x01, 0x03, 0x00, 0x00}, 4}, 613 + {{0x13, 0x2e, 0x01, 0x0f, 0x00, 0x00}, 4}, 614 + {{0x13, 0x2f, 0x01, 0x0c, 0x00, 0x00}, 4}, 615 + {{0x11, 0x20, 0x00, 0x00, 0x00, 0x00}, 4}, 616 + {{0x11, 0x21, 0x2a, 0x00, 0x00, 0x00}, 4}, 617 + {{0x11, 0x22, 0x00, 0x00, 0x00, 0x00}, 4}, 618 + {{0x11, 0x23, 0x28, 0x00, 0x00, 0x00}, 4}, 619 + {{0x11, 0x10, 0x00, 0x00, 0x00, 0x00}, 4}, 620 + {{0x11, 0x11, 0x04, 0x00, 0x00, 0x00}, 4}, 621 + {{0x11, 0x12, 0x00, 0x00, 0x00, 0x00}, 4}, 622 + {{0x11, 0x13, 0x03, 0x00, 0x00, 0x00}, 4}, 623 + {{0x11, 0x14, 0x01, 0x00, 0x00, 0x00}, 4}, 624 + {{0x11, 0x15, 0xe0, 0x00, 0x00, 0x00}, 4}, 625 + {{0x11, 0x16, 0x02, 0x00, 0x00, 0x00}, 4}, 626 + {{0x11, 0x17, 0x80, 0x00, 0x00, 0x00}, 4}, 627 + {{0x1c, 0x20, 0x00, 0x2a, 0x00, 0x00}, 1}, 628 + {{0x20, 0x34, 0xa1, 0x00, 0x00, 0x00}, 0}, 629 + /* Camera should start to capture now. */ 630 + {{0x12, 0x27, 0x01, 0x00, 0x00, 0x00}, 0}, 631 + {{0x1b, 0x32, 0x26, 0x00, 0x00, 0x00}, 0}, 632 + {{0x1d, 0x25, 0x10, 0x20, 0xab, 0x00}, 0}, 633 + }; 634 + 635 + r = run_start_commands(gspca_dev, genius_vcam_live_start_commands, 636 + ARRAY_SIZE(genius_vcam_live_start_commands)); 637 + if (r < 0) 638 + return r; 639 + 640 + return r; 641 + } 642 + 536 643 static int start_vivitar_cam(struct gspca_dev *gspca_dev) 537 644 { 538 645 struct init_command vivitar_start_commands[] = { ··· 736 623 case 0x7005: 737 624 err_code = start_genius_cam(gspca_dev); 738 625 break; 626 + case 0x7003: 627 + err_code = start_genius_videocam_live(gspca_dev); 628 + break; 739 629 case 0x8001: 740 630 err_code = start_spy_cam(gspca_dev); 741 631 break; ··· 817 701 /* -- module initialisation -- */ 818 702 static const struct usb_device_id device_table[] = { 819 703 {USB_DEVICE(0x0458, 0x7005)}, /* Genius Smart 300, version 2 */ 704 + {USB_DEVICE(0x0458, 0x7003)}, /* Genius Videocam Live v2 */ 820 705 /* The Genius Smart is untested. I can't find an owner ! */ 821 706 /* {USB_DEVICE(0x0c45, 0x8000)}, DC31VC, Don't know this camera */ 822 707 {USB_DEVICE(0x0c45, 0x8001)}, /* Wild Planet digital spy cam */