Servo: Fix clobber_ok usage.

Clobber_ok allows us to overload signals from different overlays,
i.e. a board may have certain signals other boards will not.

Currently however if a board tries to clobber a signal that does not
exist for all boards then adding of the signal fails. This change
instead only replaces the signal if it already exists and if not
just treats it as a regular new signal.

BUG=chromium:248685
TEST=Ran locally and ensured that clobbering an unexistant signal
now works.

Change-Id: I5f2763531e88253b4cb1e7843c28107648fc9704
Reviewed-on: https://gerrit.chromium.org/gerrit/61330
Reviewed-by: Richard Barnette <jrbarnette@chromium.org>
Commit-Queue: Simran Basi <sbasi@chromium.org>
Reviewed-by: Simran Basi <sbasi@chromium.org>
Tested-by: Simran Basi <sbasi@chromium.org>
diff --git a/servo/data/servo_v3_r0.xml b/servo/data/servo_v3_r0.xml
index 4f831e7..a071d50 100644
--- a/servo/data/servo_v3_r0.xml
+++ b/servo/data/servo_v3_r0.xml
@@ -598,33 +598,4 @@
     <doc>Cpu uart stream collected while cpu_uart_capture is set to 'on'</doc>
     <params cmd="get" subtype="uart_stream" interface="8" drv="uart"></params>
   </control>
-
-
-  <!-- TODO (sbasi): crbug.com/248685 refactor these signals. -->
-  <control>
-    <name>kbd_en</name>
-    <doc>Enable servo to assert certain keypresses via kbd_m1 and
-    kbd_m2</doc>
-    <params></params>
-  </control>
-    <control>
-    <name>kbd_m1_a0</name>
-    <doc>kbd_m1_a0</doc>
-    <params></params>
-  </control>
-  <control>
-    <name>kbd_m1_a1</name>
-    <doc>kbd_m1_a1</doc>
-    <params></params>
-  </control>
-  <control>
-    <name>kbd_m2_a0</name>
-    <doc>kbd_m2_a0</doc>
-    <params></params>
-  </control>
-  <control>
-    <name>kbd_m2_a1</name>
-    <doc>kbd_m2_a1</doc>
-    <params></params>
-  </control>
 </root>
diff --git a/servo/system_config.py b/servo/system_config.py
index 442ec4b..e54f764 100644
--- a/servo/system_config.py
+++ b/servo/system_config.py
@@ -134,7 +134,7 @@
     4. specific one for a one-off rework done to a system
 
     Special key parameters in config files:
-      clobber_ok: signifies this control may _clobber_ and existing definition
+      clobber_ok: signifies this control may _clobber_ an existing definition
         of the same name.  Note, its value is ignored ( clobber_ok='' )
 
     NOTE, method is recursive when parsing 'include' elements from XML.
@@ -237,13 +237,13 @@
         if 'init' in set_dict:
           self.hwinit.append((name, set_dict['init']))
 
-        # else its a control
-        if clobber_ok:
+        # else it's a control
+        if clobber_ok and name in self.syscfg_dict[tag]:
           self.syscfg_dict[tag][name]['get_params'].update(get_dict)
           self.syscfg_dict[tag][name]['set_params'].update(set_dict)
           continue
 
-        # else its a new control
+        # else it's a new control
         self.syscfg_dict[tag][name] = {'doc':doc, 'get_params':get_dict,
                                        'set_params':set_dict}
         if alias: