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:
parent
b9484019a3
commit
c1adb9087a
1 changed files with 14 additions and 6 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue