CyanogenDefy / android_device_motorola_jordan

Motorola Defy MB525 CM7 XDA (jordan)
http://forum.xda-developers.com/showthread.php?t=1065798
79 stars 60 forks source link

no video camera flash - red lens #24

Closed moshemft closed 13 years ago

moshemft commented 13 years ago

no flash for video camera, red lens.(177+rc1) can turn on turch,and take a video,but the flash option in the video camera is not working.

gzoul8 commented 13 years ago

Me too for yellow lens (nikon) 177+rc1 Same as miui

maurink6630 commented 13 years ago

Hello Green lense no flash on video widescreen recording (1657-NIGHTLY) Good luck

maniac103 commented 13 years ago

gzoul8, maurink6630,

can you please check what kind of camera device you have? Grab the app aLogCat from the market, start the camera, start alogcat and filter for 'CameraCommon' there. Please tell me whether it says 'Detected SOC camera' or 'Detected BAYER camera' (it should say the latter).

zxbodya commented 13 years ago

Also, no flash light for video camera. Using RC1, device with red camera(Detected BAYER camera - in log)

supersebius commented 13 years ago

i am on the #15 issue. for me: BAYER camera

antonyps commented 13 years ago

I have this issue too =( In leaked Froyo and Gingerbread flash works on camera mode.

maurink6630 commented 13 years ago

For me with green lense CameraCommon: Detected SOC device

maniac103 commented 13 years ago

If the flash light doesn't work with SOC camera, something is fishy on your device. What version are you on?

To all, does running 'echo 1 > /sys/class/leds/torch-flash/flash_light' in an adb shell turn on the flash light for you (substitute 1 by 0 to turn it off again)?

maniac103 commented 13 years ago

Actually, it would be interesting to also know the full kernel version string (under Settings -> About phone) of all of you. I wonder whether the problem is in the used kernel.

antonyps commented 13 years ago

Did the test, flashlight working, works on Torch app, works when taking photos (automatic and always on mode), just don't work when I try to activate while recording a video (or before recording).

Kernel Version: 2.6.32.9-ga28fcc4 fdc376@zch68lnxdroid12 #1

I have this problem since early beta's, I'm using Cyanogen since Beta2, and I think it never worked for me. Always use Nordic as a base. Actually using Jboogie3 LiquidArc based on RC1, but will update to RC1v2 this night.

maniac103 commented 13 years ago

The torch app uses a different path (/sys/class/leds/spotlight), which is why I asked for testing the flash_light file directly. Can you please also do the following:

Thanks.

antonyps commented 13 years ago

FLASH.TXT: http://www.mediafire.com/?3cajp946zchpi08

What i've done (never used logcat before) adb logcat > FLASH.TXT do the camera stuff ctrl^c

maniac103 commented 13 years ago

Thanks. The difference between camera 'always on' flash and video light seems to be that the mode passed to setFlashMode is 1 for camera and 3 for video. I need more information ;) Let's do the following:

That will capture all system calls the media server is doing. Enable the camera in video mode, press Enter in the adb window a few times (as start marker) and start toggling light on and off. strace should spew out a lot of lines. If it does not (sometimes happened to me as well), restart strace until it does. Then please provide the output.

Sample output for me (SOC camera):

write(13, "1933", 4) = 4 getpriority(PRIO_PROCESS, 1933) = 20 writev(4, [{"\3", 1}, {"LibSOCJordanCamera\0", 19}, {"+setParameters\n\0", 16}], 3) = 36 writev(4, [{"\4", 1}, {"LibSOCJordanCamera\0", 19}, {"Changed: flash-mode: off -> torc"..., 55}], 3) = 75 writev(4, [{"\4", 1}, {"LibSOCJordanCamera\0", 19}, {"Extract changes completed, 1 tot"..., 44}], 3) = 64 nanosleep({0, 1000000}, {0, 1000000}) = 0 writev(4, [{"\3", 1}, {"LibSOCJordanCamera\0", 19}, {"+handleFlashModeChange\n\0", 24}], 3) = 44 open("/sys/class/leds/torch-flash/flash_light", O_RDWR) = 39 writev(4, [{"\3", 1}, {"MOT_ISE\0", 8}, {"try to set torch of flash to: 1\n"..., 33}], 3) = 42 write(39, "64", 2) = 0 read(39, "64\n\0", 4) = 4 writev(4, [{"\6", 1}, {"MOT_ISE\0", 8}, {"torch intensity is not same as 0"..., 49}], 3) = 58 close(39) = 0 writev(4, [{"\3", 1}, {"LibSOCJordanCamera\0", 19}, {"-handleFlashModeChange\n\0", 24}], 3) = 44 writev(4, [{"\3", 1}, {"LibSOCJordanCamera\0", 19}, {"-setParameters\n\0", 16}], 3) = 36 ioctl(3, 0xc0186201, 0xbedddaa8) = 0 write(13, "1933", 4) = 4

You clearly can see the flashlight file being set to a value of 100 ;) Let's hope there's any conclusion from strace.

maniac103 commented 13 years ago

There's one possibility for the video flashlight: As the difference between camera and video is flash-mode being set to on for camera and torch for video, I can just convert torch to on for the bayer camera. That doesn't help for the focus light, though (handled in the camera binary), so I'd like to try to find the root cause prior to trying this hack.

antonyps commented 13 years ago

, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_CTRUNC|MSG_ERRQUEUE|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_CTRUNC|MSG_EOR|MSGWAITALL|MSG TRUNC|MSG_CONFIRM|MSG_SYN|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_CTRUNC|MSG_WAITALL|MSG_TRUNC|MS G_CONFIRM|MSG_PROBE|MSG_FIN|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_WAITALL|MSG_TRUNC|MSG_DONTWAIT| MSG_CONFIRM|MSG_PROBE|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\3", 1}, {"CameraHal\0", 10}, {"stopPreview\0", 12}], 3) = 23 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: S1Up\n\0", 14}], 3) = 28

recv(356872, 0x81, 1, MSG_EOR|MSG_TRUNC|MSG_NOSIGNAL|MSG_MORE|0xffff0000) = 1 recv(356876, 0x81, 1, MSG_OOB) = 1 writev(4, [{"\3", 1}, {"CameraHal\0", 10}, {"stop preview thread\0", 20}], 3) = 31 recv(1535832, "", 0, 0) = 0 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: Disable Preview\n\0", 25 }], 3) = 39 recv(351928, 0x81, 1, MSG_CTRUNC|MSG_EOR|MSG_WAITALL|MSG_TRUNC|MSGERRQUEUE|MSG DONTWAIT|MSG_CONFIRM|MSG_PROBE|MSG_FIN|MSG_SYN|MSG_RST|MSG_NOSIGNAL|MSG_MORE|0xf fff0000) = 1 recv(351932, 0x81, 1, MSG_OOB) = 1 recv(356872, 0x81, 1, MSG_DONTROUTE|MSG_EOR|MSG_PROBE|MSG_NOSIGNAL|MSG_MORE|0xff ff0000) = 1 recv(356876, 0x81, 1, MSG_OOB) = 1 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201

maniac103 commented 13 years ago

There's no open() line in there, even when restarting strace and/or after pressing Ctrl-C to end strace?

antonyps commented 13 years ago

Sorry, this time i tried to be more precise, i will only paste the output from turn flashlight on/off. Is there a way to send kill signal only to strace? CTRL^C closes adb and returns to prompt for me...

, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_CTRUNC|MSG_ERRQUEUE|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_CTRUNC|MSG_EOR|MSGWAITALL|MSG TRUNC|MSG_CONFIRM|MSG_SYN|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_CTRUNC|MSG_WAITALL|MSG_TRUNC|MS G_CONFIRM|MSG_PROBE|MSG_FIN|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\2", 1}, {"CameraSettings\0", 15}, {"Changed: flash-mode: off -> to rc"..., 55}], 3) = 71 writev(4, [{"\3", 1}, {"CameraSettings\0", 15}, {"Extract changes completed, 1 t ot"..., 44}], 3) = 60 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: SetFlashMode mode = 3\n\ 0", 31}], 3) = 45 recv(903148, 0x81, 1, MSG_DONTROUTE|MSG_PEEK|MSG_WAITALL|MSG_TRUNC|MSG_DONTWAIT| MSG_CONFIRM|MSG_PROBE|MSG_RST|MSG_MORE|0xffff0000) = 0 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201, 0xbea07c08) = 0 write(13, "2706", 4) = 4 getpriority(PRIO_PROCESS, 2706) = 20 writev(4, [{"\3", 1}, {"CameraHal\0", 10}, {"stopPreview\0", 12}], 3) = 23 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: S1Up\n\0", 14}], 3) = 28

recv(356872, 0x81, 1, MSG_EOR|MSG_TRUNC|MSG_NOSIGNAL|MSG_MORE|0xffff0000) = 1 recv(356876, 0x81, 1, MSG_OOB) = 1 writev(4, [{"\3", 1}, {"CameraHal\0", 10}, {"stop preview thread\0", 20}], 3) = 31 recv(1535832, "", 0, 0) = 0 writev(4, [{"\4", 1}, {"HPAndroidHAL\0", 13}, {"APILOG: Disable Preview\n\0", 25 }], 3) = 39 recv(351928, 0x81, 1, MSG_CTRUNC|MSG_EOR|MSG_WAITALL|MSG_TRUNC|MSGERRQUEUE|MSG DONTWAIT|MSG_CONFIRM|MSG_PROBE|MSG_FIN|MSG_SYN|MSG_RST|MSG_NOSIGNAL|MSG_MORE|0xf fff0000) = 1 recv(351932, 0x81, 1, MSG_OOB) = 1 recv(356872, 0x81, 1, MSG_DONTROUTE|MSG_EOR|MSG_PROBE|MSG_NOSIGNAL|MSG_MORE|0xff ff0000) = 1 recv(356876, 0x81, 1, MSG_OOB) = 1 ioctl(3, 0xc0186201, 0xbea07aa8) = 0 write(13, "2706", 4) = 4 ioctl(3, 0xc0186201

maniac103 commented 13 years ago

You didn't read my question :) Your previous strace was fine, just incomplete. This just happens sometimes, so my question was whether there are any open() lines appearing when stopping and restarting strace a few times (still toggling video flash after each start).

About stopping strace, I don't think there's any good way to stop it except Ctrl-C.

maniac103 commented 13 years ago

And I still would be interested in whether 'echo 1 > /sys/class/leds/torch-flash/flash_light' does anything.

matiasjrossi commented 13 years ago

'echo 1 > /sys/class/leds/torch-flash/flash_light' == Nothing. Also tried with different values between 1 and 255.

maniac103 commented 13 years ago

I think that's our problem, it's likely that the camera lib tries to write to exactly that file. I wonder whether it's devtree related...

maniac103 commented 13 years ago

Can anyone additionally post the output of 'dmesg' right after booting the phone? I'd like to understand the actual kernel init differences between the camera modules.

maniac103 commented 13 years ago

Also, if anyone of you feels like flashing a Moto ROM, where the LED is working: dmesg output of there would be interesting, as well as results of playing around with the various /sys/class/leds/*/brightness files. There must be some subtle difference, but it's very hard to find it out if one doesn't have the hardware. :-(

antonyps commented 13 years ago

My dmesg http://www.mediafire.com/?nzictq2441jsc9n

My strace -p http://hotfile.com/dl/122485595/22637bf/saida_strace_p.txt.html

For me adb shell "echo 1 > /sys/class/leds/torch-flash/flash_light" light my flashlight, echo 0 to disable it. I'm working right now, maybe at night I can flash froyo or gingerbread to post the results.

supersebius commented 13 years ago

for me (bayer camera) "echo 1 > /sys/class/leds/torch-flash/flash_light" light my flashlight too

kernel 2.6.32.9-ga28fcc4 jfqk83@zch68lnxdroid07 #1

matiasjrossi commented 13 years ago

Oops, I've tried with the wrong file: I can confirm "echo 1 > /sys/class/leds/torch-flash/flash_light" lights the flash. My previous test was using /sys/class/leds/torch-flash/brightness. Sorry for the confusion.

maniac103 commented 13 years ago

Ok, thanks. I've thought about this a bit more, and found I need to be more systematical ;-) I'll list what we have found out so far and which facts stand anyway:

So what does that leave us with? At the moment, I can only see

So what we could try is:

Those are the files referenced by the camera libraries.

matiasjrossi commented 13 years ago

I don't have the special file: /dev/bd7885. Tried changing permissions to 0666 in the rest of the files, but nothing happened.

This is what I have under /dev in my device: http://pastebin.com/m2JBUjeB

antonyps commented 13 years ago

I don't have /dev/bd7885 too.

supersebius commented 13 years ago

maniac. is there a way to capture the /sys tree istead of doing it manually? i am not linux/adb savy. i know how to go back and forth to stock/cyano roms and i can use the alogcat to catch differences. i would try to spot the /sys tree differences but help me here thx

maniac103 commented 13 years ago

Doing an 'ls -lR /sys' should be sufficient. If you are going to flash a stock ROM, please try the CM7 camera app on it (as mentioned above). Thanks.

supersebius commented 13 years ago

i´ve tryed nordic177 and the led worked while focusing

here you have the /sys tree comparison http://www.mediafire.com/?5byylt22jxxaq26

i would try to help more on this. i really want this problem to be solved

cm7 camera app didn´t work on nordic177 rom

thx

maniac103 commented 13 years ago

Didn't the CM7 app work in a sense of 'it crashed', or didn't it work in a sense of 'LED flash didn't work'?

maniac103 commented 13 years ago

In any case, I think we need to pursue the strace route. If any of you who is willing to test could join #cyanogenmod-dev on freenode and ping me there, that'd be good for reducing latency.

maniac103 commented 13 years ago

Well, I looked at the logcat output posted by antonyps again, and something is fishy there:

D/LibCommonCamera( 1929): CameraCommonHal: openCameraHardware() D/LibCommonCamera( 1929): CameraCommon: Detected BAYER device D/CameraSettings( 1929): CameraSettings constructor D/CameraHal( 1929): CameraHal constructor D/CameraHal( 1929): Model ID: MB525 2b4e0022ffd800000160a8f20f02200d D/CameraHal( 1929): Software ID 2.3.4 I/CameraCompFactory( 1929): assuming HP 5MP camera module implementation I/CameraCompFactory( 1929): no flash component implementation on this platform

It looks like the camera lib for whatever reason thinks there's no flash built into the device. This may very well be an explanation for the flash not working. Question now is why it thinks there's no flash... probably some missing file and/or system property.

maniac103 commented 13 years ago

Having the logcat output while starting the blur camera app on a stock ROM perhaps would be helpful.

maniac103 commented 13 years ago

Oooooh, I think I have found something. What happens if you add the following entries to /system/build.prop and reboot afterwards:

ro.media.capture.maxres=5m ro.media.capture.flash=led ro.media.capture.flashIntensity=41 ro.media.capture.torchIntensity=25

maniac103 commented 13 years ago

When trying, please also post the logcat output while starting the camera for confirmation.

supersebius commented 13 years ago

the build.prop thing. do you want me to try it on cm7 or stock rom ? regarding the camera app not working i couldn't get it to start. it gave me some kind of error and it doesn't start. in order to bring the camera to the stock rom i copied the camera.apk from /system/app or something. is that the correct procedure? i'll try those things and this time i'll grab a logcat.

maniac103 commented 13 years ago

Please try it on CM7, the stock ROM already has those properties. Actually I'm pretty sure that the lack of these properties is the actual problem, I just need confirmation ;-)

And yes, copying Camera.apk should have been enough. Anyway, most likely doesn't matter now :)

supersebius commented 13 years ago

it worked! i can´t do the logcat right now. if you really need it i´ll do it as soon as i can. thanks for your dedication man. i really appreciate this.

maniac103 commented 13 years ago

Great :) Logcat is not that important. I've pushed the change to the CyanogenDefy repo, thus this issue should be fixed now :)