err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetCameraList( listRef ) );
if ( err != EdsError.EDS_ERR_OK ) {
throw new Exception("Camera failed to initialize");
}
final NativeLongByReference outRef = new NativeLongByReference();
err = CanonUtils.toEdsError( CanonCamera.EDSDK.EdsGetChildCount( listRef.getValue(), outRef ) );
if ( err != EdsError.EDS_ERR_OK ) {
throw new Exception( "Number of attached cameras couldn't be read" );
}
final long numCams = outRef.getValue().longValue();
if ( numCams <= 0 ) {
err = EdsError.EDS_ERR_DEVICE_NOT_FOUND;
throw new Exception( "No cameras found. Have you tried turning it off and on again?" );
}