mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-21 00:05:15 +02:00
Improve device filtering to ignore weird devices with question mark serials.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user