The OS keeps track of which dev belongs to which device.
Users normally figure out which dev got which device by examining the syslogs (dmesg).
You sound like you want to write a driver, or write software using a particular IO channel?
Basically, you have a lot of reading to do.
Start with the udev man page.
Then a book...
... or a tutorial, depending on your level...