Expose a DEVICE.id function to retrieve the id from a built device.

Also make the types of id abstract for CONSOLE and BLOCK on advice
from @samoht, as each implementation can provide backend-specific
ways of building and handling it.