/* * Manage sending of SET STREAMING command using the specified * read_speed and write_speed. * * This function allocates and initializes a Performance * Descriptor, which is sent as part of the SET STREAMING * command. The descriptor is deallocated before function * exit. */ static int do_set_streaming(cd_device *dev, uint_t read_speed, uint_t write_speed) { int ret; uchar_t *str; /* Allocate and initialize the Performance Descriptor */ str = (uchar_t *)my_zalloc(SET_STREAM_DATA_LEN); /* Read Time (in milliseconds) */ load_scsi32(&str[16], 1000); /* Write Time (in milliseconds) */ load_scsi32(&str[24], 1000); /* Read Speed */ load_scsi32(&str[12], (uint32_t)read_speed); /* Write Speed */ load_scsi32(&str[20], (uint32_t)write_speed); /* issue SET STREAMING command */ ret = set_streaming(dev->d_fd, str); free(str); return (ret); }
static int stk_start_stream(struct stk_camera *dev) { int value; int i, ret; int value_116, value_117; if (!is_present(dev)) return -ENODEV; if (!is_memallocd(dev) || !is_initialised(dev)) { STK_ERROR("FIXME: Buffers are not allocated\n"); return -EFAULT; } ret = usb_set_interface(dev->udev, 0, 5); if (ret < 0) STK_ERROR("usb_set_interface failed !\n"); if (stk_sensor_wakeup(dev)) STK_ERROR("error awaking the sensor\n"); stk_camera_read_reg(dev, 0x0116, &value_116); stk_camera_read_reg(dev, 0x0117, &value_117); stk_camera_write_reg(dev, 0x0116, 0x0000); stk_camera_write_reg(dev, 0x0117, 0x0000); stk_camera_read_reg(dev, 0x0100, &value); stk_camera_write_reg(dev, 0x0100, value | 0x80); stk_camera_write_reg(dev, 0x0116, value_116); stk_camera_write_reg(dev, 0x0117, value_117); for (i = 0; i < MAX_ISO_BUFS; i++) { if (dev->isobufs[i].urb) { ret = usb_submit_urb(dev->isobufs[i].urb, GFP_KERNEL); atomic_inc(&dev->urbs_used); if (ret) return ret; } } set_streaming(dev); return 0; }