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..e011d10564c23b7bb58edb2760df73230e05c96e 100644 |
--- a/client/site_tests/factory_Keyboard/factory_Keyboard.py |
+++ b/client/site_tests/factory_Keyboard/factory_Keyboard.py |
@@ -128,12 +128,27 @@ 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\'"\'' |
Hung-Te
2011/03/11 07:28:26
A little concern if some properties in VPD may als
|
+ 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' |
+ |
try: |
kbd_image = cairo.ImageSurface.create_from_png('%s.png' % layout) |
image_size = (kbd_image.get_width(), kbd_image.get_height()) |