The transfer endpoint address is now automatically chosen.
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
 
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 1;
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAS106) {
                cam->cam_mode = sif_mode;
 
 
        cam->cam_mode = fpix_mode;
        cam->nmodes = 1;
-       cam->epaddr = 0x01;     /* todo: correct for all cams? */
        cam->bulk_size = FPIX_MAX_TRANSFER;
 
 /*     gspca_dev->nbalt = 1;    * use bulk transfer */
        /* Read the result of the command. Ignore the result, for it
         * varies with the device. */
        ret = usb_bulk_msg(gspca_dev->dev,
-                       usb_rcvbulkpipe(gspca_dev->dev,
-                                       gspca_dev->cam.epaddr),
+                       gspca_dev->urb[0]->pipe,
                        gspca_dev->usb_buf, FPIX_MAX_TRANSFER, &size_ret,
                        FPIX_TIMEOUT);
        if (ret != 0) {
        }
 
        /* Again, reset bulk in endpoint */
-       usb_clear_halt(gspca_dev->dev, gspca_dev->cam.epaddr);
+       usb_clear_halt(gspca_dev->dev, gspca_dev->urb[0]->pipe);
 
        /* Allocate a control URB */
        dev->control_urb = usb_alloc_urb(0, GFP_KERNEL);
 
  * look for an input transfer endpoint in an alternate setting
  */
 static struct usb_host_endpoint *alt_xfer(struct usb_host_interface *alt,
-                                         __u8 epaddr,
                                          __u8 xfer)
 {
        struct usb_host_endpoint *ep;
        int i, attr;
 
-       epaddr |= USB_DIR_IN;
        for (i = 0; i < alt->desc.bNumEndpoints; i++) {
                ep = &alt->endpoint[i];
-               if (ep->desc.bEndpointAddress == epaddr) {
-                       attr = ep->desc.bmAttributes
-                                               & USB_ENDPOINT_XFERTYPE_MASK;
-                       if (attr == xfer)
-                               return ep;
-                       break;
-               }
+               attr = ep->desc.bmAttributes & USB_ENDPOINT_XFERTYPE_MASK;
+               if (attr == xfer)
+                       return ep;
        }
        return NULL;
 }
        /* try isoc */
        while (--i > 0) {                       /* alt 0 is unusable */
                ep = alt_xfer(&intf->altsetting[i],
-                               gspca_dev->cam.epaddr,
                                USB_ENDPOINT_XFER_ISOC);
                if (ep)
                        break;
        /* if no isoc, try bulk */
        if (ep == NULL) {
                ep = alt_xfer(&intf->altsetting[0],
-                               gspca_dev->cam.epaddr,
                                USB_ENDPOINT_XFER_BULK);
                if (ep == NULL) {
                        err("no transfer endpoint found");
                /* clear the bulk endpoint */
                if (gspca_dev->alt == 0)        /* if bulk transfer */
                        usb_clear_halt(gspca_dev->dev,
-                                       usb_rcvintpipe(gspca_dev->dev,
-                                                gspca_dev->cam.epaddr));
+                                       gspca_dev->urb[0]->pipe);
 
                /* start the cam */
                ret = gspca_dev->sd_desc->start(gspca_dev);
 
                                 * - cannot be > MAX_NURBS
                                 * - when 0 and bulk_size != 0 means
                                 *   1 URB and submit done by subdriver */
-       __u8 epaddr;
 };
 
 struct gspca_dev;
 
        int err;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = M5602_ISOC_ENDPOINT_ADDR;
        sd->desc = &sd_desc;
 
        if (dump_bridge)
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
        sd->qindex = 1;                 /* set the quantization table */
 
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = OV511_ENDPOINT_ADDRESS;
        if (!sd->sif) {
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
 
 
        cam = &gspca_dev->cam;
 
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
 
 
                " (vid/pid 0x%04X:0x%04X)", id->idVendor, id->idProduct);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x05;
        cam->cam_mode = sif_mode;
        cam->nmodes = ARRAY_SIZE(sif_mode);
        sd->brightness = PAC207_BRIGHTNESS_DEFAULT;
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x05;
 
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAC7302) {
 
        gspca_dev->ctrl_dis = sensor_data[sd->sensor].ctrl_dis;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        if (!(sensor_data[sd->sensor].flags & F_SIF)) {
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = ARRAY_SIZE(vga_mode);
 
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        sd->subtype = id->driver_info;
        if (sd->subtype != LogitechClickSmart310) {
                cam->cam_mode = vga_mode;
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
        sd->subtype = id->driver_info;
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        sd->subtype = id->driver_info;
        if (sd->subtype != IntelPCCameraPro)
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = vga_mode;
        cam->nmodes = sizeof vga_mode / sizeof vga_mode[0];
        sd->brightness = sd_ctrls[SD_BRIGHTNESS].qctrl.default_value;
 
        PDEBUG(D_PROBE, "Window 1 average luminance: %d", data1);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        cam->cam_mode = sif_mode;
        cam->nmodes = ARRAY_SIZE(sif_mode);
 
 
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
        gspca_dev->nbalt = 7 + 1;       /* choose alternate 7 first */
 
        sd->chip_revision = id->driver_info;
 
        reg_w(gspca_dev, 0x63b, 0);
        reg_w(gspca_dev, 0x630, 5);
        ret = usb_bulk_msg(dev,
-                       usb_rcvbulkpipe(dev, 5),
+                       usb_rcvbulkpipe(dev, 0x05),
                        gspca_dev->usb_buf,
                        4,              /* length */
                        &alen,
                        const struct usb_device_id *id)
 {
        struct sd *sd = (struct sd *) gspca_dev;
-       struct cam *cam = &gspca_dev->cam;
 
-       cam->epaddr = 0x02;
        gspca_dev->cam.cam_mode = vga_mode;
        gspca_dev->cam.nmodes = ARRAY_SIZE(vga_mode);
        sd->brightness = BRIGHTNESS_DEF;
 
        PDEBUG(D_PROBE, "Configuring camera");
 
        cam = &gspca_dev->cam;
-       cam->epaddr = STV_ISOC_ENDPOINT_ADDR;
        sd->desc = sd_desc;
        gspca_dev->sd_desc = &sd->desc;
 
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 
        sd->bridge = id->driver_info >> 8;
        sd->subtype = id->driver_info;
 
        struct cam *cam;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 
        cam->cam_mode = vga_mode_t16;
        cam->nmodes = ARRAY_SIZE(vga_mode_t16);
 
        tv_8532WriteEEprom(gspca_dev);
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 1;
        cam->cam_mode = sif_mode;
        cam->nmodes = sizeof sif_mode / sizeof sif_mode[0];
 
 
        int sensor;
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x02;
        sd->bridge = id->driver_info;
 
        vc0321_reset(gspca_dev);
 
        }
 
        cam = &gspca_dev->cam;
-       cam->epaddr = 0x01;
 /*fixme:test*/
        gspca_dev->nbalt--;
        if (vga) {