small optimizations and cleanups by Moritz Venn
[enigma2.git] / lib / python / Components / Renderer / FrontpanelLed.py
1 from Components.Element import Element
2
3 # this is not a GUI renderer.
4 class FrontpanelLed(Element):
5         def changed(self, *args, **kwargs):
6                 if self.source.value:
7                         pattern = 0x55555555
8                         speed = 20
9                 else:
10                         pattern = 0
11                         speed = 1
12
13                 try:
14                         open("/proc/stb/fp/led0_pattern", "w").write("%08x" % pattern)
15                         open("/proc/stb/fp/led_pattern_speed", "w").write("%d" % speed)
16                 except IOError:
17                         pass