cros_unibuild_convert: add form-factor field

The form-factor field is required by cros_config, make sure it is set
for any device that gets converted to using unibuild.

BUG=b:186608669
TEST=presubmit

Change-Id: I69791d02cbacce77362b50eac8720e6e03fc9728
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2870830
Tested-by: Nikolai Artemiev <nartemiev@google.com>
Commit-Queue: Jack Rosenthal <jrosenth@chromium.org>
Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
diff --git a/contrib/cros_unibuild_convert.py b/contrib/cros_unibuild_convert.py
index 58b26b1..11df2f5 100755
--- a/contrib/cros_unibuild_convert.py
+++ b/contrib/cros_unibuild_convert.py
@@ -467,6 +467,15 @@
   return None
 
 
+def genconf_form_factor(device, _):
+  devicetype = device.lsb_val('DEVICETYPE')
+  if devicetype in ('REFERENCE', 'CHROMEBOOK'):
+    return 'CHROMEBOOK'
+  if devicetype in ('CHROMEBIT', 'CHROMEBASE', 'CHROMEBOX'):
+    return devicetype
+  return None
+
+
 def genconf_has_backlight(device, _):
   devicetype = device.lsb_val('DEVICETYPE')
   return devicetype not in ('CHROMEBIT', 'CHROMEBOX')
@@ -605,6 +614,7 @@
         'signature-id': (M_PRIVATE, genconf_signature_id),
     },
     'hardware-properties': {
+        'form-factor': (M_PUBLIC, genconf_form_factor),
         'has-backlight': (M_PUBLIC, genconf_has_backlight),
         'psu-type': (M_PUBLIC, genconf_psu_type),
     },