How can i detect a device on the users computer, such as a Midi port? I want to be able to tell if the user has a casio keyboard connected to their conputer. Any suggestions?

Thanks,
Nathan Strandberg