m920x fix for TVWalker Twin USB

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The following modifications to the m920x_probe() function in m920x.c should fix the problem with the second tuner on the TVWalker Twin USB tuner. Please feel free to refactor and integrate these changes into the main source tree.

I have the TVWalker Twin USB working with both adapters on MythTV and mplayer. There are no spurious adapters in the /dev/dvb/, and /proc/bus/usb/devices shows all four interfaces as handled by dev_usb_m920x.

(BTW I'm using linux kernel 2.6.21 on Gentoo - test h/w is a laptop with an Intel 945GM chipset.)

Cheers,
Jeremy

----

static int m920x_probe(struct usb_interface *intf,
              const struct usb_device_id *id)
{
   struct dvb_usb_device *d;
   struct usb_host_interface *alt;
   int ret;

   struct m920x_inits *rc_init_seq = NULL;

   int bInterfaceNumber = intf->cur_altsetting->desc.bInterfaceNumber;
   struct usb_device *udev = interface_to_usbdev(intf);

   deb("Probing for m920x device at interface %d\n", bInterfaceNumber);

   if (bInterfaceNumber == 0) {
       /* Single-tuner device, or first interface on
        * multi-tuner device
        */

       if ((ret = dvb_usb_device_init(intf, &megasky_properties,
                          THIS_MODULE, &d)) == 0) {
           rc_init_seq = megasky_rc_init;
           goto found;
       }

       if ((ret = dvb_usb_device_init(intf,
                          &digivox_mini_ii_properties,
                          THIS_MODULE, &d)) == 0) {
           /* No remote control, so no rc_init_seq */
           goto found;
       }

       /* This configures both tuners on the TV Walker Twin */
       if ((ret = dvb_usb_device_init(intf, &tvwalkertwin_properties,
                          THIS_MODULE, &d)) == 0) {
           rc_init_seq = tvwalkertwin_rc_init;
           goto found;
       }

       if ((ret = dvb_usb_device_init(intf, &dposh_properties,
                          THIS_MODULE, &d)) == 0) {
           /* Remote controller not supported yet. */
           goto found;
       }

       return ret;
   } else {
       /* Another interface on a multi-tuner device */

       /* The LifeView TV Walker Twin gets here, but struct
        * tvwalkertwin_properties already configured both
        * tuners, so there is nothing for us to do here
        */
/* But, we still need to configure the alternate interface
        * for the second endpoint. So we will fall through to the
        * 'found' label and add the alternate interface.
        */
   }

found:
   alt = usb_altnum_to_altsetting(intf, 1);
   if (alt == NULL) {
       deb("No alt found!\n");
       return -ENODEV;
   }

ret = usb_set_interface(udev, alt->desc.bInterfaceNumber, alt->desc.bAlternateSetting);
   if (ret < 0)
       return ret;

   // Initialize the remote control, but only once per adapter
if ( (bInterfaceNumber == 0) && ((ret = m920x_init(d, rc_init_seq)) != 0) )
       return ret;

   return ret;
}

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux