Commit 30b3cfd1 authored by Ken Tossell's avatar Ken Tossell
Browse files

Added more informative error messages in the case of uvc_open() failure

parent 24e3bdc3
...@@ -271,7 +271,29 @@ void CameraDriver::OpenCamera(UVCCameraConfig &new_config) { ...@@ -271,7 +271,29 @@ void CameraDriver::OpenCamera(UVCCameraConfig &new_config) {
uvc_error_t open_err = uvc_open(dev_, &devh_); uvc_error_t open_err = uvc_open(dev_, &devh_);
if (open_err != UVC_SUCCESS) { if (open_err != UVC_SUCCESS) {
uvc_perror(open_err, "uvc_open"); switch (open_err) {
case UVC_ERROR_ACCESS:
#ifdef __linux__
ROS_ERROR("Permission denied opening /dev/bus/usb/%03d/%03d",
uvc_get_bus_number(dev_), uvc_get_device_address(dev_));
#else
ROS_ERROR("Permission denied opening device %d on bus %d",
uvc_get_device_address(dev_), uvc_get_bus_number(dev_));
#endif
break;
default:
#ifdef __linux__
ROS_ERROR("Can't open /dev/bus/usb/%03d/%03d: %s (%d)",
uvc_get_bus_number(dev_), uvc_get_device_address(dev_),
uvc_strerror(open_err), open_err);
#else
ROS_ERROR("Can't open device %d on bus %d: %s (%d)",
uvc_get_device_address(dev_), uvc_get_bus_number(dev_),
uvc_strerror(open_err), open_err);
#endif
break;
}
uvc_unref_device(dev_); uvc_unref_device(dev_);
return; return;
} }
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment