diff --git a/lib/db/api.js b/lib/db/api.js index c5fad9da..2ba2d2f1 100644 --- a/lib/db/api.js +++ b/lib/db/api.js @@ -197,6 +197,7 @@ dbapi.saveDeviceIdentity = function(serial, identity) { , sdk: identity.sdk , display: identity.display , phone: identity.phone + , name: identity.name })) } diff --git a/lib/roles/device/plugins/solo.js b/lib/roles/device/plugins/solo.js index a7f57955..2805a86b 100644 --- a/lib/roles/device/plugins/solo.js +++ b/lib/roles/device/plugins/solo.js @@ -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) diff --git a/lib/util/datautil.js b/lib/util/datautil.js index 2d774d91..2a906d5c 100644 --- a/lib/util/datautil.js +++ b/lib/util/datautil.js @@ -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 diff --git a/lib/util/devutil.js b/lib/util/devutil.js index 4d826ac1..18ca88a0 100644 --- a/lib/util/devutil.js +++ b/lib/util/devutil.js @@ -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 } } diff --git a/lib/wire/wire.proto b/lib/wire/wire.proto index 6e1b32b1..ceb2601a 100644 --- a/lib/wire/wire.proto +++ b/lib/wire/wire.proto @@ -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;