I have a Teensy board and would like to know if there's a way to get a serial number (or any other kind of ID that is preferably unique) of the host controller that I plug my Teensy into. E.g. can I get any unique identification numbers of my Macbook's USB controller when I plug my Teensy into it? C/C++ code examples for Teensy would be highly appreciated.

  • 1
    There's no such information necessarily provided. You can have custom software on the host collect and offer information, and you may be able to unreliably fingerprint the type/version host operating system by small details of its behavior. – Chris Stratton Dec 19 '14 at 14:49
  • What could I potentially receive about the host controller at all? – JSmyth Dec 19 '14 at 14:56
  • 2
    Without custom code on the host, almost nothing, except seeing how it habitually configures and uses your device. – Chris Stratton Dec 19 '14 at 15:25

Nothing in the USB spec requires the host to provide any sort of identification to connecting devices. The standard way of implementing what you want consists in writing a custom driver which communicates the necessary information to the device. If installing a custom driver is not an option, all you can do is try to detect the OS by observing what it does during the enumeration process. Such identification will not be reliable (enumeration process can change after an OS update) and by no means unique.

Note that if your goal is to make sure the host is trusted, a simple ID will not be enough as it can be easily spoofed. You'll have to implement some sort of authentication scheme, e.g. challenge-respose.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.