Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <quinticent@localhost.localdomain>2007-03-05 21:10:14 (GMT)
committer John (J5) Palmieri <quinticent@localhost.localdomain>2007-03-05 21:10:14 (GMT)
commit05081b3fa525cf0b090b0c1be520fd5e1309774e (patch)
treede6f019f077a81240b968c1552b7297b0868eb68
parente62fcbd29612fb3ca1b590970734d22421782fd8 (diff)
use hal to detect the presence of a v4l device
* right now we check for anything with the capability of 'video4linux' and for info.linux.driver = 'cafe1000-ccic' which is the olpc's webcam
-rw-r--r--shell/intro/intro.py26
1 files changed, 22 insertions, 4 deletions
diff --git a/shell/intro/intro.py b/shell/intro/intro.py
index 75e3791..83c88da 100644
--- a/shell/intro/intro.py
+++ b/shell/intro/intro.py
@@ -15,6 +15,7 @@
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
import gtk, gobject
+import dbus
import hippo
import logging
from gettext import gettext as _
@@ -100,11 +101,28 @@ class VideoBox(hippo.CanvasBox, hippo.CanvasItem):
self._label.props.font_desc = font.DEFAULT.get_pango_desc()
self.append(self._label)
+ # check for camera and if not generate a .jpg
+ has_webcam = False
try:
- import glive
- self._video = glive.LiveVideoSlot(_VIDEO_WIDTH, _VIDEO_HEIGHT)
- except ImportError:
- self._video = IntroFallbackVideo()
+ sys_bus = dbus.SystemBus()
+ hal_obj = sys_bus.get_object ('org.freedesktop.Hal', '/org/freedesktop/Hal/Manager')
+ hal = dbus.Interface (hal_obj, 'org.freedesktop.Hal.Manager')
+
+ udis = hal.FindDeviceByCapability ('video4linux')
+
+ # check for the olpc specific camera
+ if not udis:
+ udis = hal.FindDeviceStringMatch('info.linux.driver','cafe1000-ccic')
+
+ if udis:
+ has_webcam = True
+
+ finally:
+ if has_webcam:
+ import glive
+ self._video = glive.LiveVideoSlot(_VIDEO_WIDTH, _VIDEO_HEIGHT)
+ else:
+ self._video = IntroFallbackVideo()
self._video.set_size_request(_VIDEO_WIDTH, _VIDEO_HEIGHT)
self._video.connect('pixbuf', self._new_pixbuf_cb)