Devsel mod.: move populate device array to a function

Will be used for more than filtering