user4338: 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.

user13327: 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.

4338: <p>I have a <a href="https://www.pjrc.com/teensy/" rel="nofollow noreferrer">Teensy</a> 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 <strong>host</strong> 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.</p>
 13327: <p>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.</p>

<p>Note that if your goal is to make sure the host is <em>trusted</em>, 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. <a href="https://en.wikipedia.org/wiki/Challenge%E2%80%93response_authentication" rel="nofollow noreferrer">challenge-respose</a>.</p>
