| Index: client/site_tests/factory_Keyboard/factory_Keyboard.py
|
| diff --git a/client/site_tests/factory_Keyboard/factory_Keyboard.py b/client/site_tests/factory_Keyboard/factory_Keyboard.py
|
| index 1f15cebb6512fee5f1f5e9c0e84b4eb57b186e4d..ad64fb3e747a08336d9d3165943950ce6d395599 100644
|
| --- a/client/site_tests/factory_Keyboard/factory_Keyboard.py
|
| +++ b/client/site_tests/factory_Keyboard/factory_Keyboard.py
|
| @@ -21,6 +21,7 @@ import logging
|
| import time
|
| import os
|
| import sys
|
| +import utils
|
|
|
| from gtk import gdk
|
|
|
| @@ -128,12 +129,28 @@ class factory_Keyboard(test.test):
|
| version = 1
|
| preserve_srcdir = True
|
|
|
| + def get_layout_from_vpd(self):
|
| + """ vpd should contain "initial_locale"="en-US" or similar. """
|
| + cmd = 'vpd -l | grep initial_locale | cut -f4 -d\'"\''
|
| + layout = utils.system_output(cmd).strip()
|
| + if layout != '':
|
| + return layout
|
| + return None
|
| +
|
| def run_once(self, layout=None):
|
|
|
| factory.log('%s run_once' % self.__class__)
|
|
|
| os.chdir(self.srcdir)
|
|
|
| + # Autodetect from VPD.
|
| + if not layout:
|
| + layout = self.get_layout_from_vpd()
|
| + # Default to United States.
|
| + if not layout:
|
| + layout = 'en-US'
|
| +
|
| + factory.log("Using keyboard layout %s" % layout)
|
| try:
|
| kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout)
|
| image_size = (kbd_image.get_width(), kbd_image.get_height())
|
|
|