1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00
OpenSTF/lib/util/devutil.js
2014-01-22 16:34:49 +09:00

33 lines
942 B
JavaScript

module.exports = {
makeIdentity: function(serial, properties) {
var model = properties['ro.product.model']
, brand = properties['ro.product.brand']
, manufacturer = properties['ro.product.manufacturer']
, version = properties['ro.build.version.release']
, sdk = +properties['ro.build.version.sdk']
, abi = properties['ro.product.cpu.abi']
// Remove brand prefix for consistency
if (model.substr(0, brand.length) === brand) {
model = model.substr(brand.length)
}
// Remove manufacturer prefix for consistency
if (model.substr(0, manufacturer.length) === manufacturer) {
model = model.substr(manufacturer.length)
}
// Clean up remaining model name
model = model.replace(/[_ ]/g, '')
return {
platform: 'android'
, serial: serial
, manufacturer: manufacturer
, model: model
, version: version
, sdk: sdk
, abi: abi
}
}
}