mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Switch to protocol buffers for communication.
This commit is contained in:
parent
f60cf2008b
commit
90e405a341
8 changed files with 354 additions and 36 deletions
33
lib/util/devutil.js
Normal file
33
lib/util/devutil.js
Normal file
|
@ -0,0 +1,33 @@
|
|||
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
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue