1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-05 19:42:01 +02:00

Improve device filtering to ignore weird devices with question mark serials.

This commit is contained in:
Simo Kinnunen 2014-06-19 14:24:46 +09:00
parent b9484019a3
commit c1adb9087a

View file

@ -93,16 +93,24 @@ module.exports = function(options) {
client.trackDevices().then(function(tracker) {
log.info('Tracking devices')
// This can happen when ADB doesn't have a good connection to
// the device
function isWeirdUnusableDevice(device) {
return device.id === '????????????'
}
// Helper for ignoring unwanted devices
function filterDevice(listener) {
if (options.filter) {
return function(device) {
if (options.filter(device)) {
listener(device)
}
return function(device) {
if (isWeirdUnusableDevice(device)) {
log.warn('ADB lists a weird device: "%s"', device.id)
return false
}
if (options.filter && !options.filter(device)) {
return false
}
return listener(device)
}
return listener
}
// To make things easier, we're going to cheat a little, and make all