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:
parent
f741136aed
commit
760e09290f
5 changed files with 11 additions and 5 deletions
|
@ -197,6 +197,7 @@ dbapi.saveDeviceIdentity = function(serial, identity) {
|
||||||
, sdk: identity.sdk
|
, sdk: identity.sdk
|
||||||
, display: identity.display
|
, display: identity.display
|
||||||
, phone: identity.phone
|
, phone: identity.phone
|
||||||
|
, name: identity.name
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,7 @@ module.exports = syrup.serial()
|
||||||
, identity.model
|
, identity.model
|
||||||
, identity.version
|
, identity.version
|
||||||
, identity.abi
|
, identity.abi
|
||||||
|
, identity.name
|
||||||
, identity.sdk
|
, identity.sdk
|
||||||
, new wire.DeviceDisplayMessage(identity.display)
|
, new wire.DeviceDisplayMessage(identity.display)
|
||||||
, new wire.DevicePhoneMessage(identity.phone)
|
, new wire.DevicePhoneMessage(identity.phone)
|
||||||
|
|
|
@ -14,22 +14,23 @@ var datautil = module.exports = Object.create(null)
|
||||||
|
|
||||||
datautil.applyData = function(device) {
|
datautil.applyData = function(device) {
|
||||||
var model = device.model
|
var model = device.model
|
||||||
|
var name = device.name
|
||||||
|
|
||||||
if (model) {
|
if (model) {
|
||||||
var match = deviceData[model]
|
var match = deviceData.find({model: model, name: name})
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
if (aliases[model]) {
|
if (aliases[model]) {
|
||||||
match = deviceData[aliases[model]]
|
match = deviceData.find({model: aliases[model], name: name})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!match) {
|
if (!match) {
|
||||||
model = model.replace(/ /g, '_')
|
model = model.replace(/ /g, '_')
|
||||||
match = deviceData[model]
|
match = deviceData.find({model: model, name: name})
|
||||||
|
|
||||||
if (!match) {
|
if (!match) {
|
||||||
model = model.replace(/_/g, '')
|
model = model.replace(/_/g, '')
|
||||||
match = deviceData[model]
|
match = deviceData.find({model: model, name: name})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +38,7 @@ datautil.applyData = function(device) {
|
||||||
|
|
||||||
if (match) {
|
if (match) {
|
||||||
device.name = match.name.id
|
device.name = match.name.id
|
||||||
|
device.model = match.name.long
|
||||||
device.releasedAt = match.date
|
device.releasedAt = match.date
|
||||||
device.image = model + '.jpg' // TODO: check for icon/photo file existence
|
device.image = model + '.jpg' // TODO: check for icon/photo file existence
|
||||||
device.cpu = match.cpu
|
device.cpu = match.cpu
|
||||||
|
|
|
@ -133,6 +133,7 @@ devutil.makeIdentity = function(serial, properties) {
|
||||||
, version = properties['ro.build.version.release']
|
, version = properties['ro.build.version.release']
|
||||||
, sdk = properties['ro.build.version.sdk']
|
, sdk = properties['ro.build.version.sdk']
|
||||||
, abi = properties['ro.product.cpu.abi']
|
, abi = properties['ro.product.cpu.abi']
|
||||||
|
, name = properties['ro.product.name']
|
||||||
|
|
||||||
// Remove brand prefix for consistency
|
// Remove brand prefix for consistency
|
||||||
if (model.substr(0, brand.length) === brand) {
|
if (model.substr(0, brand.length) === brand) {
|
||||||
|
@ -146,7 +147,6 @@ devutil.makeIdentity = function(serial, properties) {
|
||||||
|
|
||||||
// Clean up remaining model name
|
// Clean up remaining model name
|
||||||
// model = model.replace(/[_ ]/g, '')
|
// model = model.replace(/[_ ]/g, '')
|
||||||
|
|
||||||
return {
|
return {
|
||||||
serial: serial
|
serial: serial
|
||||||
, platform: 'Android'
|
, platform: 'Android'
|
||||||
|
@ -156,5 +156,6 @@ devutil.makeIdentity = function(serial, properties) {
|
||||||
, version: version
|
, version: version
|
||||||
, abi: abi
|
, abi: abi
|
||||||
, sdk: sdk
|
, sdk: sdk
|
||||||
|
, name: name
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -172,6 +172,7 @@ message DeviceIdentityMessage {
|
||||||
required string model = 5;
|
required string model = 5;
|
||||||
required string version = 6;
|
required string version = 6;
|
||||||
required string abi = 7;
|
required string abi = 7;
|
||||||
|
required string name = 12;
|
||||||
required string sdk = 8;
|
required string sdk = 8;
|
||||||
required DeviceDisplayMessage display = 9;
|
required DeviceDisplayMessage display = 9;
|
||||||
required DevicePhoneMessage phone = 11;
|
required DevicePhoneMessage phone = 11;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue