From c08a489e2732014cffebf06cd98166d429c29910 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Sun, 11 Dec 2016 00:02:02 -0800 Subject: [PATCH] Improve error message for VIDIOC_STREAMON "no space left on device". --- src/UsbCameraImpl.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/UsbCameraImpl.cpp b/src/UsbCameraImpl.cpp index 5679c69243..3a25f96d0d 100644 --- a/src/UsbCameraImpl.cpp +++ b/src/UsbCameraImpl.cpp @@ -713,7 +713,19 @@ bool UsbCameraImpl::DeviceStreamOn() { // Turn stream on int type = V4L2_BUF_TYPE_VIDEO_CAPTURE; - if (DoIoctl(fd, VIDIOC_STREAMON, &type) != 0) return false; + if (TryIoctl(fd, VIDIOC_STREAMON, &type) < 0) { + if (errno == ENOSPC) { + // indicates too much USB bandwidth requested + SERROR( + "could not start streaming due to USB bandwidth limitations; try a " + "lower resolution or a different pixel format (VIDIOC_STREAMON: " + "No space left on device)"); + } else { + // some other error + SERROR("ioctl VIDIOC_STREAMON failed: " << std::strerror(errno)); + } + return false; + } SDEBUG4("enabled streaming"); m_streaming = true; return true;