BUTTERFLY-FACTORY: Add keyboard test for HP.

BUG=none
TEST=manual

Change-Id: I0b3cc5e18c799ebd3b4d1c07e68a949e7a617fe8
Reviewed-on: https://gerrit.chromium.org/gerrit/33289
Reviewed-by: Ricky Liang <jcliang@chromium.org>
Tested-by: Ricky Liang <jcliang@chromium.org>
diff --git a/client/site_tests/factory_Keyboard/factory_Keyboard.py b/client/site_tests/factory_Keyboard/factory_Keyboard.py
index 3556d3b..6a8ab43 100644
--- a/client/site_tests/factory_Keyboard/factory_Keyboard.py
+++ b/client/site_tests/factory_Keyboard/factory_Keyboard.py
@@ -104,10 +104,11 @@
             factory.log('key (0x%x) ignored because not in bindings'
                         % event.keyval)
             return True
-
         self._pressed_keys.add(event.hardware_keycode)
         widget.queue_draw()
-
+        if event.hardware_keycode == 246:
+            self._pressed_keys.add(247)
+            widget.queue_draw()
         # The first keypress starts test countdown.
         if self._deadline is None:
             self._deadline = int(time.time()) + ful.FAIL_TIMEOUT
@@ -121,6 +122,10 @@
         self._pressed_keys.remove(event.hardware_keycode)
         self.successful_keys.add(event.hardware_keycode)
         widget.queue_draw()
+        if event.hardware_keycode == 246:
+            self._pressed_keys.remove(247)
+            self.successful_keys.add(247)
+            widget.queue_draw()
         if not self.calc_missing_string():
             factory.log('completed successfully')
             gtk.main_quit()
@@ -154,11 +159,11 @@
         os.chdir(self.srcdir)
 
         # Autodetect from VPD.
-        if not layout:
-            layout = self.get_layout_from_vpd()
+        #if not layout:
+        #    layout = self.get_layout_from_vpd()
         # Default to United States.
         if not layout:
-            layout = 'en-US'
+            layout = 'en-HP'
 
         factory.log("Using keyboard layout %s" % layout)
         try:
diff --git a/client/site_tests/factory_Keyboard/src/en-HP.bindings b/client/site_tests/factory_Keyboard/src/en-HP.bindings
new file mode 100644
index 0000000..7f74f11
--- /dev/null
+++ b/client/site_tests/factory_Keyboard/src/en-HP.bindings
@@ -0,0 +1,98 @@
+# AUTOMATICALLY GENERATED -- This data structure is automatically
+# # generated by the tool under /src/platform/factory_keyboard_layout
+# # with a corresponding image file. Please refer to png_renderer.py
+# # for the usage information.
+
+# This binding table provides the mapping from keycodes to the physical
+# coordinates of key locations on the image file.
+# The binding table was generated with scan codes. The scan codes are manually
+# changed to keycodes by testing showkey -s and showkey -k. Also note that power
+# button has different scan code from the generated one.
+
+{
+    1 : [13, 16, 46, 30],
+    2 : [66, 54, 46, 46],
+    3 : [122, 54, 46, 46],
+    4 : [175, 54, 46, 46],
+    5 : [228, 54, 46, 46],
+    6 : [281, 54, 46, 46],
+    7 : [335, 54, 46, 46],
+    8 : [388, 54, 46, 46],
+    9 : [440, 54, 46, 46],
+    10 : [496, 54, 46, 46],
+    11 : [547, 54, 46, 46],
+    12 : [601, 54, 46, 46],
+    13 : [655, 54, 46, 46],
+    14 : [707, 54, 100, 46],
+    15 : [13, 107, 70, 46],
+    16 : [95, 107, 46, 46],
+    17 : [148, 107, 46, 46],
+    18 : [201, 107, 46, 46], 
+    19 : [255, 107, 46, 46],
+    20 : [307, 107, 46, 46],
+    21 : [361, 107, 46, 46],
+    22 : [414, 107, 46, 46],
+    23 : [467, 107, 46, 46],
+    24 : [521, 107, 46, 46],
+    25 : [574, 107, 46, 46],
+    26 : [626, 107, 46, 46],
+    27 : [682, 107, 46, 46],
+    28 : [694, 160, 112, 46],
+    29 : [13, 267, 60, 46],
+    30 : [108, 160, 46, 46], 
+    31 : [161, 160, 46, 46],
+    32 : [213, 160, 46, 46],
+    33 : [268, 160, 46, 46],
+    34 : [321, 160, 46, 46],
+    35 : [373, 160, 46, 46],
+    36 : [427, 160, 46, 46],
+    37 : [480, 160, 46, 46],
+    38 : [535, 160, 46, 46],
+    39 : [587, 160, 46, 46],
+    40 : [641, 160, 46, 46],
+    41 : [13, 54, 46, 46],
+    42 : [13, 213, 113, 46],
+    43 : [736, 107, 70, 46],
+    44 : [135, 213, 46, 46],
+    45 : [187, 213, 46, 46],
+    46 : [240, 213, 46, 46],
+    47 : [294, 213, 46, 46],
+    48 : [347, 213, 46, 46],
+    49 : [400, 213, 46, 46],
+    50 : [454, 213, 46, 46],
+    51 : [509, 213, 46, 46],
+    52 : [561, 213, 46, 46],
+    53 : [614, 213, 46, 46],
+    54 : [667, 213, 140, 46],
+    56 : [188, 267, 46, 46],
+    57 : [240, 267, 285, 46],
+    58 : [13, 160, 85, 46],
+    59 : [67, 15, 46, 30],
+    60 : [120, 16, 46, 30],
+    61 : [173, 16, 46, 30],
+    62 : [229, 16, 46, 30],
+    63 : [280, 16, 46, 30],
+    64 : [335, 16, 46, 30], 
+    65 : [388, 16, 46, 30],
+    66 : [440, 16, 46, 30],
+    67 : [496, 16, 46, 30],
+    68 : [547, 16, 46, 30],
+    87 : [601, 16, 46, 30],
+    88 : [655, 16, 46, 30],
+    110 : [762, 16, 46, 30],
+    111 : [813, 16, 46, 30],
+    97 : [641, 267, 60, 46],
+    100 : [534, 267, 46, 46],
+    102 : [814, 54, 46, 46],
+    103 : [761, 267, 46, 23],
+    104 : [814, 107, 46, 46],
+    105 : [708, 267, 46, 46],
+    106 : [814, 267, 46, 46],
+    107 : [814, 213, 46, 46],
+    108 : [761, 289, 46, 23],
+    109 : [814, 160, 46, 46],
+    125 : [135, 267, 46, 46],
+    126 : [587, 267, 46, 46],
+    238 : [709, 16, 46, 30],
+    239 : [79, 267, 46, 46]
+}
diff --git a/client/site_tests/factory_Keyboard/src/en-HP.png b/client/site_tests/factory_Keyboard/src/en-HP.png
new file mode 100644
index 0000000..c9b9467
--- /dev/null
+++ b/client/site_tests/factory_Keyboard/src/en-HP.png
Binary files differ