You need to sign in or sign up before continuing.
提交 e4dac289 编写于 作者: J Jean-François Moine 提交者: Mauro Carvalho Chehab

V4L/DVB: gspca - main: Stop the webcam when bandwidth too small

Signed-off-by: NJean-François Moine <moinejf@free.fr>
Signed-off-by: NMauro Carvalho Chehab <mchehab@redhat.com>
上级 832d0a91
...@@ -613,6 +613,37 @@ static void destroy_urbs(struct gspca_dev *gspca_dev) ...@@ -613,6 +613,37 @@ static void destroy_urbs(struct gspca_dev *gspca_dev)
} }
} }
static int gspca_set_alt0(struct gspca_dev *gspca_dev)
{
int ret;
if (gspca_dev->alt == 0)
return 0;
ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0);
if (ret < 0)
PDEBUG(D_ERR|D_STREAM, "set alt 0 err %d", ret);
return ret;
}
/* Note: both the queue and the usb locks should be held when calling this */
static void gspca_stream_off(struct gspca_dev *gspca_dev)
{
gspca_dev->streaming = 0;
if (gspca_dev->present) {
if (gspca_dev->sd_desc->stopN)
gspca_dev->sd_desc->stopN(gspca_dev);
destroy_urbs(gspca_dev);
gspca_input_destroy_urb(gspca_dev);
gspca_set_alt0(gspca_dev);
gspca_input_create_urb(gspca_dev);
}
/* always call stop0 to free the subdriver's resources */
if (gspca_dev->sd_desc->stop0)
gspca_dev->sd_desc->stop0(gspca_dev);
PDEBUG(D_STREAM, "stream off OK");
}
/* /*
* look for an input transfer endpoint in an alternate setting * look for an input transfer endpoint in an alternate setting
*/ */
...@@ -838,8 +869,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) ...@@ -838,8 +869,7 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
} }
if (ret >= 0) if (ret >= 0)
break; break;
gspca_dev->streaming = 0; gspca_stream_off(gspca_dev);
destroy_urbs(gspca_dev);
if (ret != -ENOSPC) { if (ret != -ENOSPC) {
PDEBUG(D_ERR|D_STREAM, PDEBUG(D_ERR|D_STREAM,
"usb_submit_urb alt %d err %d", "usb_submit_urb alt %d err %d",
...@@ -869,37 +899,6 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev) ...@@ -869,37 +899,6 @@ static int gspca_init_transfer(struct gspca_dev *gspca_dev)
return ret; return ret;
} }
static int gspca_set_alt0(struct gspca_dev *gspca_dev)
{
int ret;
if (gspca_dev->alt == 0)
return 0;
ret = usb_set_interface(gspca_dev->dev, gspca_dev->iface, 0);
if (ret < 0)
PDEBUG(D_ERR|D_STREAM, "set alt 0 err %d", ret);
return ret;
}
/* Note: both the queue and the usb locks should be held when calling this */
static void gspca_stream_off(struct gspca_dev *gspca_dev)
{
gspca_dev->streaming = 0;
if (gspca_dev->present) {
if (gspca_dev->sd_desc->stopN)
gspca_dev->sd_desc->stopN(gspca_dev);
destroy_urbs(gspca_dev);
gspca_input_destroy_urb(gspca_dev);
gspca_set_alt0(gspca_dev);
gspca_input_create_urb(gspca_dev);
}
/* always call stop0 to free the subdriver's resources */
if (gspca_dev->sd_desc->stop0)
gspca_dev->sd_desc->stop0(gspca_dev);
PDEBUG(D_STREAM, "stream off OK");
}
static void gspca_set_default_mode(struct gspca_dev *gspca_dev) static void gspca_set_default_mode(struct gspca_dev *gspca_dev)
{ {
int i; int i;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册