I am working on a library to make the Camera
API easier for developers to consume.
The Droid Incredible 2, in portrait mode, using the rear-facing camera, fails to take a picture. Specifically, I get this sequence in LogCat:
08-18 09:25:52.094: E/QualcommCameraHardware(1368): native_get_picture: MSM_CAM_IOCTL_GET_PICTURE fd 25 error Connection timed out
08-18 09:25:52.094: E/QualcommCameraHardware(1368): getPicture failed!
08-18 09:25:52.094: E/QualcommCameraHardware(1368): get picture failed, giving jpeg callback with NULL data
Those messages occur ~5 seconds after I call takePicture()
on the Camera
, which fits with some old source code I see for QualcommCameraHardware
that sets up a 5000ms timeout on the ioctl()
call to speak to the camera hardware.
The net result is that onPictureTaken()
is passed a null
byte[]
of JPEG data, meaning we have no photo.
The device works with my code in all other tested configurations, including working in portrait mode with the front-facing camera.
Does anyone know of something specific that might cause this particular failure?
UPDATE
I can no longer reproduce the error. I would delete the question, but that apparently is not possible once there are answers.
MSM_CAM_IOCTL_GET_PICTURE is a kernel call which runs the function
static int msm_get_pic(struct msm_sync *sync, void __user *arg)
I downloaded the kernel source for your device from the HTCdev and found the function defined in
drivers/media/video/msm/msm_camera-7x30.c
Could check what are the kernel messages when you take a picture?
adb shell su -c "dmesg"
Most probably the cameraService
which is part of the media process has crashed in the background. If you just try to run the default camera app in android and it does not show up then simply reboot the device to get this error off.
I think you are reusing picture callback for both raw and jpeg callbacks. So if it was called as raw callback, data could be null. Because the document says,
Triggers an asynchronous image capture. The camera service will initiate a series of callbacks to the application as the image capture progresses. The shutter callback occurs after the image is captured. This can be used to trigger a sound to let the user know that image has been captured. The raw callback occurs when the raw image data is available (NOTE: the data will be null if there is no raw image callback buffer available or the raw image callback buffer is not large enough to hold the raw image). The postview callback occurs when a scaled, fully processed postview image is available (NOTE: not all hardware supports this). The jpeg callback occurs when the compressed image is available. If the application does not need a particular callback, a null can be passed instead of a callback method.