Dynamically determine the number of devices

and use that number to allocate the endpoint pointer
array. Resize it down when the number of endpoints has been
created.