0

I'm writing a highly specialized application for the Kyocera E6820 that requires the device's wide angle camera and the flashlight to be on simultaneously.

I'm using the Camera2 Android API. The problem is that by default the wide angle camera doesn't support flash, so if I try to turn on the flashlight and the wide angle camera at the same time by doing the following:

mPreviewRequestBuilder.set(CaptureRequest.FLASH_MODE, CaptureRequest.FLASH_MODE_TORCH);
mPreviewRequest = mPreviewRequestBuilder.build();
mCaptureSession.setRepeatingRequest(mPreviewRequest, mCaptureCallback, mBackgroundHandler);

I get an error that says:

W/LegacyRequestMapper: mapAeAndFlashMode - Ignore flash.mode == TORCH;camera does not support it

I tried to get around this by turning on the flash using the regular rear facing camera (which does support flash) without opening it by doing the following:

manager.openCamera(wideAngleCameraID, mStateCallback, mBackgroundHandler);
manager.setTorchMode(rearFacingCameraID, true);

However, it didn't work, and I got this message:

W/System.err: android.hardware.camera2.CameraAccessException: The system-wide limit for number of open cameras has been reached, and more camera devices cannot be opened until previous instances are closed.

I can get the normal rear facing camera and the flashlight to go on simultaneously, but no such luck with the wide angle.

Does anyone know a potential way around this problem? I've already looked through this post but didn't find anything useful. Since this is such a specialized application it is not out of the question to do something like rooting the phone or talking directly to the device's LED drivers, but I would need to know where to start. Any direction or help would be appreciated.

Matthias
  • 71
  • 1
  • 1
  • 7

1 Answers1

0

For anyone viewing, I found the answer after looking at this forum discussion. For me, the brightness value was located in the

/sys/class/leds/led:torch_0

directory. After rooting the phone, I was able to manipulate the value by invoking an adb command using the process given here.

Matthias
  • 71
  • 1
  • 1
  • 7