def _set_autogain(self, state, camera=0): ''' 0 is off; 1 is on ''' if self._ag_control is not None and self._ag_control.value == state: return try: video_capture_device = open(self.devices[camera], 'rw') except BaseException: video_capture_device = None debug_output('video capture device not available', self._parent.running_sugar) return self._ag_control = v4l2_control(V4L2_CID_AUTOGAIN) try: ioctl(video_capture_device, VIDIOC_G_CTRL, self._ag_control) self._ag_control.value = state ioctl(video_capture_device, VIDIOC_S_CTRL, self._ag_control) except BaseException: pass video_capture_device.close()
def _set_autogain(self, state, camera=0): ''' 0 is off; 1 is on ''' if self._ag_control is not None and self._ag_control.value == state: return try: video_capture_device = open(self.devices[camera], 'rw') except: video_capture_device = None debug_output('video capture device not available', self._parent.running_sugar) return self._ag_control = v4l2_control(V4L2_CID_AUTOGAIN) try: ioctl(video_capture_device, VIDIOC_G_CTRL, self._ag_control) self._ag_control.value = state ioctl(video_capture_device, VIDIOC_S_CTRL, self._ag_control) except: pass video_capture_device.close()