aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-09-02 22:39:40 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2005-09-02 22:39:40 +0000
commit11b18fabe50ba2cea39503eccaf0c4fdbc741f4d (patch)
treea773078329bcf69c6e4c566ee3e81a01cd7b49a8 /lib/python/Components
parent8b0a581bf9ec96b6b698fa2d236d2aadc417f9da (diff)
downloadenigma2-11b18fabe50ba2cea39503eccaf0c4fdbc741f4d.tar.gz
enigma2-11b18fabe50ba2cea39503eccaf0c4fdbc741f4d.zip
add option for DHCP and possibility to disable configElements
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Network.py19
-rw-r--r--lib/python/Components/config.py1
2 files changed, 19 insertions, 1 deletions
diff --git a/lib/python/Components/Network.py b/lib/python/Components/Network.py
index 3740e51b..d53bf00e 100644
--- a/lib/python/Components/Network.py
+++ b/lib/python/Components/Network.py
@@ -6,6 +6,18 @@ class Network:
def __init__(self):
pass
+ def setDHCP(self, useDHCP):
+ if (useDHCP):
+ print "Using DHCP"
+ config.network.ip.enabled = False
+ config.network.gateway.enabled = False
+ config.network.dns.enabled = False
+ else:
+ print "NOT using DHCP"
+ config.network.ip.enabled = True
+ config.network.gateway.enabled = True
+ config.network.dns.enabled = True
+
def setIPAddress(self, ip):
print ip
os.system("echo ifconfig eth0 %d.%d.%d.%d" % (ip[0], ip[1], ip[2], ip[3]))
@@ -19,10 +31,11 @@ class Network:
resolvconf.close()
def setMACAddress(self, mac):
- os.system("echo ifconfig eth0 %02x:%02x:%02x:%02x:%02x:%02x" % (mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]))
+ os.system("echo ifconfig eth0 ether %02x:%02x:%02x:%02x:%02x:%02x" % (mac[0], mac[1], mac[2], mac[3], mac[4], mac[5]))
def InitNetwork():
config.network = ConfigSubsection()
+ config.network.dhcp = configElement("config.network.dhcp", configBoolean, 0, ("no", "yes"))
config.network.ip = configElement("config.network.ip", configSequence, [192,168,1,45], (("."), 3))
config.network.gateway = configElement("config.network.gateway", configSequence, [192,168,1,3], (("."), 3))
config.network.dns = configElement("config.network.dns", configSequence, [192,168,1,3], (("."), 3))
@@ -30,6 +43,9 @@ def InitNetwork():
iNetwork = Network()
+ def setDHCP(configElement):
+ iNetwork.setDHCP(configElement.value)
+
def setIPAddress(configElement):
iNetwork.setIPAddress(configElement.value)
@@ -43,6 +59,7 @@ def InitNetwork():
iNetwork.setMACAddress(configElement.value)
# this will call the "setup-val" initial
+ config.network.dhcp.addNotifier(setDHCP)
config.network.ip.addNotifier(setIPAddress)
config.network.gateway.addNotifier(setIPGateway)
config.network.dns.addNotifier(setIPNameserver)
diff --git a/lib/python/Components/config.py b/lib/python/Components/config.py
index e8376385..c7434e4d 100644
--- a/lib/python/Components/config.py
+++ b/lib/python/Components/config.py
@@ -233,6 +233,7 @@ class configElement:
self.controlType = control
self.vals = vals
self.notifierList = [ ]
+ self.enabled = True
self.loadData()
def addNotifier(self, notifier):
self.notifierList.append(notifier);