![]() |
How to distinguish camera cover opening from closing via dbus?
I've been trying to figure this out for a while now.
Yes, I've searched... for a while now. Googling "+(maemo OR n900) +dbus open close +(camera OR lense) +(cover or shutter)" doesn't return anything useful. The problem is, according to "dbus-monitor --system", the same two signals are sent whether the camera cover is opening or closing. Shutter opening: Code:
signal sender=:1.13 -> dest=(null destination) serial=9631 path=/org/freedesktop/Hal/devices/platform_cam_shutter; interface=org.freedesktop.Hal.Device; member=PropertyModified Code:
signal sender=:1.13 -> dest=(null destination) serial=9636 path=/org/freedesktop/Hal/devices/platform_cam_shutter; interface=org.freedesktop.Hal.Device; member=PropertyModified One thing I noticed is dmesg does show the difference: Code:
Nokia-N900:~# dmesg| grep shutter| tail -2 Does anyone know what line I can use with dbus-scripts to distinguish camera cover opening from closing? |
Re: How to distinguish camera cover opening from closing via dbus?
Maybe HAL is being slow. When opening the shutter, maybe you could wait a little bit longer and see if you get a similar line saying true for "button.state.value"
Alternatively, you might be able to just add a blanket watch for the "shutter opened" condition but then run "lshal -s -u /org/freedesktop/Hal/devices/platform_cam_shutter | grep button.state.value | awk '{print $3}'" in the script you plan have DBus-Scripts execute - if that command correctly returns the state of the shutter, you can just have if conditions that do whatever depending on if it returns "false" or "true" |
Re: How to distinguish camera cover opening from closing via dbus?
I left dbus-monitor running well after the camera app fired up, and all I saw was phone-status changes (signal strength, etc.).
I like your suggestion... that's a lot cleaner than "dmesg | grep shutter | tail -1 | awk '{print $NF}'". :) Thanks! |
Re: How to distinguish camera cover opening from closing via dbus?
Actually, sorry, but after looking at the lshal man page again, I saw a command called hal-get-property.
hal-get-property --udi /org/freedesktop/Hal/devices/platform_cam_shutter --key button.state.value is cleaner than the lshal solution above |
Re: How to distinguish camera cover opening from closing via dbus?
Ugh! I thought we had a winner here, but unfortunately, simply unlocking or locking the screen fires off the same dbus events (twice!) as opening or closing the camera cover! :(
Code:
================================= I've set my N900 up to overclock (only 750) when I unlock the screen, then drop back to the default profile when I lock the screen (I plan to drop to a low voltage/slow profile after I get the rest finished). This part works wonderfully with the following triggers: Code:
/usr/local/bin/screenunlocked * * com.nokia.mce.signal tklock_mode_ind unlocked My current dbus-scripts setting for the camera trigger is: Code:
/usr/local/bin/camerashutter * * org.freedesktop.Hal.Device Condition ButtonPressed cover Code:
camerashutter called Code:
camerashutter called Code:
camerashutter Any ideas? |
All times are GMT. The time now is 11:17. |
vBulletin® Version 3.8.8