1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 02:09:32 +02:00

Code adapted to the new interface of stf-device-db.

This commit is contained in:
Valverde Antonio 2014-06-13 11:36:43 +09:00 committed by Simo Kinnunen
parent f741136aed
commit 760e09290f
5 changed files with 11 additions and 5 deletions

View file

@ -197,6 +197,7 @@ dbapi.saveDeviceIdentity = function(serial, identity) {
, sdk: identity.sdk
, display: identity.display
, phone: identity.phone
, name: identity.name
}))
}

View file

@ -27,6 +27,7 @@ module.exports = syrup.serial()
, identity.model
, identity.version
, identity.abi
, identity.name
, identity.sdk
, new wire.DeviceDisplayMessage(identity.display)
, new wire.DevicePhoneMessage(identity.phone)

View file

@ -14,22 +14,23 @@ var datautil = module.exports = Object.create(null)
datautil.applyData = function(device) {
var model = device.model
var name = device.name
if (model) {
var match = deviceData[model]
var match = deviceData.find({model: model, name: name})
if (!match) {
if (aliases[model]) {
match = deviceData[aliases[model]]
match = deviceData.find({model: aliases[model], name: name})
}
else {
if (!match) {
model = model.replace(/ /g, '_')
match = deviceData[model]
match = deviceData.find({model: model, name: name})
if (!match) {
model = model.replace(/_/g, '')
match = deviceData[model]
match = deviceData.find({model: model, name: name})
}
}
}
@ -37,6 +38,7 @@ datautil.applyData = function(device) {
if (match) {
device.name = match.name.id
device.model = match.name.long
device.releasedAt = match.date
device.image = model + '.jpg' // TODO: check for icon/photo file existence
device.cpu = match.cpu

View file

@ -133,6 +133,7 @@ devutil.makeIdentity = function(serial, properties) {
, version = properties['ro.build.version.release']
, sdk = properties['ro.build.version.sdk']
, abi = properties['ro.product.cpu.abi']
, name = properties['ro.product.name']
// Remove brand prefix for consistency
if (model.substr(0, brand.length) === brand) {
@ -146,7 +147,6 @@ devutil.makeIdentity = function(serial, properties) {
// Clean up remaining model name
// model = model.replace(/[_ ]/g, '')
return {
serial: serial
, platform: 'Android'
@ -156,5 +156,6 @@ devutil.makeIdentity = function(serial, properties) {
, version: version
, abi: abi
, sdk: sdk
, name: name
}
}

View file

@ -172,6 +172,7 @@ message DeviceIdentityMessage {
required string model = 5;
required string version = 6;
required string abi = 7;
required string name = 12;
required string sdk = 8;
required DeviceDisplayMessage display = 9;
required DevicePhoneMessage phone = 11;