camera/QCamera2/util/QCameraFlash.cpp
/*===========================================================================
 * FUNCTION   : deinitFlash
 *
 * DESCRIPTION: Release the flash unit associated with a given camera
 *              position. This function is blocking until the operation
 *              completes or fails.
 *
 * PARAMETERS :
 *   @camera_id : Camera id of the flash.
 *
 * RETURN     :
 *   0        : success
 *   -EINVAL  : No camera present at camera_id or not inited.
 *==========================================================================*/
FUNCTION   : deinitFlash
DESCRIPTION: Release the flash unit associated with a given camera
position. This function is blocking until the operation
completes or fails.

PARAMETERS :
@camera_id : Camera id of the flash.

RETURN     :
0        : success
-EINVAL  : No camera present at camera_id or not inited.
FUNCTION : deinitFlash DESCRIPTION : Release the flash unit associated with a given camera position . This function is blocking until the operation completes or fails . PARAMETERS : @camera_id : Camera id of the flash . RETURN : 0 : success - EINVAL : No camera present at camera_id or not inited .
int32_t QCameraFlash::deinitFlash(const int camera_id)
{
    int32_t retVal = 0;
    if (camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS) {
        LOGE("Invalid camera id: %d", camera_id);
        return -EINVAL;
    }
    if (m_flashFds[camera_id].first < 0) {
        LOGE("called deinitFlash for uninited first flash");
        retVal = -EINVAL;
    } else {
        setFlashMode(camera_id, false, LED_FIRST);
        close(m_flashFds[camera_id].first);
        m_flashFds[camera_id].first = -1;
    }
    if (m_flashFds[camera_id].second < 0) {
        LOGE("called deinitFlash for uninited second flash");
        retVal = -EINVAL;
    } else {
        setFlashMode(camera_id, false, LED_SECOND);
        close(m_flashFds[camera_id].second);
        m_flashFds[camera_id].second = -1;
    }
    return retVal;
}
int32_t QCameraFlash :: deinitFlash ( const int camera_id ) { int32_t retVal = 0 ; if ( camera_id < 0 || camera_id >= MM_CAMERA_MAX_NUM_SENSORS ) { LOGE ( " " , camera_id ) ; return - EINVAL ; } if ( m_flashFds [ camera_id ] . first < 0 ) { LOGE ( " " ) ; retVal = - EINVAL ; } else { setFlashMode ( camera_id , false , LED_FIRST ) ; close ( m_flashFds [ camera_id ] . first ) ; m_flashFds [ camera_id ] . first = -1 ; } if ( m_flashFds [ camera_id ] . second < 0 ) { LOGE ( " " ) ; retVal = - EINVAL ; } else { setFlashMode ( camera_id , false , LED_SECOND ) ; close ( m_flashFds [ camera_id ] . second ) ; m_flashFds [ camera_id ] . second = -1 ; } return retVal ; }
FUNCTION   : deinitFlash
 DESCRIPTION: Release the flash unit associated with a given camera
              position.
FUNCTION : deinitFlash DESCRIPTION : Release the flash unit associated with a given camera position .